Skip to content
This repository was archived by the owner on Nov 26, 2020. It is now read-only.

Commit 9bfbda4

Browse files
committed
Merge branch 'master' of https://github.com/rajesh6115/voice-php
2 parents eb3f7ae + 65eea09 commit 9bfbda4

4 files changed

Lines changed: 34 additions & 8 deletions

File tree

example/dial.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
require(__DIR__.'/../vendor/autoload.php');
3+
4+
$response = new Mobtexting\Voice();
5+
$response->answer();
6+
$dial = $response->dial("+91720414xxxx", "+91803007xxxx"); // customer number, DID number
7+
$dial->onNoAnswer("dial", array("+9172xxxx", "+9180xxxx")); // customer number, DID number
8+
9+
10+
//print_r($response->toArray());
11+
12+
echo $response;

src/Voice/Tag/Dial.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ public function __construct($to, $from = null)
1717
parent::__construct("Dial", $attrib);
1818
}
1919

20-
public function onAnswer($tag, $attribs = [])
20+
public function onAnswer($tag, $attribs = [], $isSequential = false)
2121
{
2222
$new_tag = $this->append($tag, $attribs);
2323
$this->setAttribute('onanswer', array($new_tag), false);
2424
return $new_tag;
2525
}
2626

27-
public function onNoAnswer($tag, $attribs = [])
27+
public function onNoAnswer($tag, $attribs = [], $isSequential = false)
2828
{
2929
$new_tag = $this->append($tag, $attribs);
3030
$this->setAttribute('onnoanswer', array($new_tag), false);

src/Voice/Tag/Filter.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,28 @@ public function __construct($data = null, $type = 'frequency')
3030
parent::__construct("Filter", ['type' => $type, $unit => $data]);
3131
}
3232

33-
public function onFail($tag, $attribs = [])
33+
public function onFail($tag, $attribs = [], $isSequential = false)
3434
{
35-
return $this->setAttribute('onfail', $this->append($tag, $attribs), true);
35+
$newTag = $this->append($tag, $attribs);
36+
if($isSequential){
37+
$this->attributes['onfail'] = array_merge($this->attributes['onfail'], array($newTag) );
38+
}else {
39+
$this->setAttribute('onfail', array($newTag), true);
40+
}
41+
42+
return $newTag;
3643
}
3744

38-
public function onPass($tag, $attribs = [])
45+
public function onPass($tag, $attribs = [], $isSequential = false)
3946
{
40-
return $this->setAttribute('onpass', $this->append($tag, $attribs), true);
47+
$newTag = $this->append($tag, $attribs);
48+
if($isSequential){
49+
$this->attributes['onpass'] = array_merge($this->attributes['onpass'], array($newTag) );
50+
}else {
51+
$this->setAttribute('onpass', array($newTag), true);
52+
}
53+
54+
return $newTag;
4155
}
4256

4357
public function getDefaultAttributes()

src/Voice/Tag/Menu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct($prompt = null, $attribs = [])
2626
parent::__construct("Menu", $attribs);
2727
}
2828

29-
public function onFail($verb, $attribs = [])
29+
public function onFail($verb, $attribs = [], $isSequential = false)
3030
{
3131
$new_tag = $this->append($verb, $attribs);
3232
$this->setAttribute('onfail', array($new_tag), false);
@@ -40,7 +40,7 @@ public function onKeyPress($key, $verb, $attribs = [])
4040
return $new_tag;
4141
}
4242

43-
public function onTimeout($verb, $attribs = [])
43+
public function onTimeout($verb, $attribs = [], $isSequential = false)
4444
{
4545
$new_tag = $this->append($verb, $attribs);
4646
$this->setAttribute('timeout', array($new_tag), false);

0 commit comments

Comments
 (0)