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

Commit 3ee6122

Browse files
committed
Structure Changes and additional tags added
1 parent f1d4e0c commit 3ee6122

32 files changed

Lines changed: 897 additions & 220 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
composer.lock
22
*~
33
vendor/
4+
.DS_Store

Mobtexting/DialPlan/BasicAttribute.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

Mobtexting/DialPlan/ComplexAttribute.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

Mobtexting/DialPlan/DialPlan.php

Lines changed: 0 additions & 98 deletions
This file was deleted.

Mobtexting/DialPlan/Voice/Answer.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

Mobtexting/DialPlan/Voice/Dial.php

Whitespace-only changes.

Mobtexting/DialPlan/Voice/Hangup.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

Mobtexting/DialPlan/Voice/Play.php

Whitespace-only changes.

Mobtexting/DialPlan/Voice/Script.php

Whitespace-only changes.

README.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,170 @@
11
# mobtexting-php
2+
23
PHP sdk for mobtexting
4+
5+
## Installation
6+
7+
You can install **mobtexting-php** via composer or by downloading the source.
8+
9+
#### Via Composer:
10+
11+
**mobtexting-php** is available on Packagist as the
12+
[`mobtexting/voice-sdk`](http://packagist.org/packages/mobtexting/voice-sdk) package.
13+
14+
## Quickstart
15+
16+
### Generating JSON
17+
18+
To control phone calls, your application needs to output [JSON] response. Use `Mobtexting\Voice` to easily create such responses.
19+
20+
```php
21+
<?php
22+
$response = new Mobtexting\Voice();
23+
$response->answer();
24+
$response->say('Hello');
25+
$response->play('https://domain.com/cowbell.mp3');
26+
print $response;
27+
```
28+
29+
That will output JSON that looks like this:
30+
31+
```json
32+
[
33+
{
34+
"Answer": {
35+
"delay": 0
36+
}
37+
},
38+
{
39+
"SayText": {
40+
"language": "EN",
41+
"engine": "polly",
42+
"message": "Hello"
43+
}
44+
},
45+
{
46+
"Play": {
47+
"type": "mp3",
48+
"path": "https://domain.com/cowbell.mp3"
49+
}
50+
}
51+
]
52+
```
53+
54+
# Commands
55+
56+
```shell
57+
- answer
58+
- delay
59+
- conference
60+
- email
61+
- filter
62+
- hangup
63+
- play
64+
- record
65+
- repeat
66+
- say
67+
- sayDateTime
68+
- sayNumber
69+
- sayPin
70+
- url
71+
```
72+
73+
### Answer
74+
75+
The `Answer` tag answers the call. One call answers billing will get started.
76+
You can't nest any other tags inside this `Answer` Tag
77+
78+
_Attributes_
79+
80+
`Answer` tag allows following attributes.
81+
82+
* `delay` no of seconds delay the call before answer.
83+
84+
### Delay
85+
86+
The `Delay` tag will allow you to wait the call before going to next tag.
87+
88+
_Attributes_
89+
90+
`Delay` tag allows the following attributes.
91+
92+
* `seconds` no of seconds to delay
93+
94+
### `Say` tag
95+
96+
# Nested tags
97+
98+
Some times we have to nest the tags within other tag.
99+
100+
Following tags allow nested tags
101+
102+
```
103+
- menu
104+
- url
105+
- filter
106+
```
107+
108+
### Example of filter tag with nested tags
109+
110+
```php
111+
$response = new Mobtexting\Voice();
112+
$response->answer();
113+
$response->say('Hello');
114+
115+
$filter = $response->filter([10]);
116+
$filter->onFail('hangup');
117+
$url = $filter->onPass('Url')->setUrl('google.com');
118+
$url->onResponse('*', 'hangup');
119+
$url->onResponse('x', 'hangup');
120+
121+
echo $response;
122+
```
123+
124+
### Response
125+
126+
```json
127+
[
128+
{
129+
"Answer": {
130+
"delay": 0
131+
}
132+
},
133+
{
134+
"SayText": {
135+
"language": "EN",
136+
"engine": "polly",
137+
"message": "Hello"
138+
}
139+
},
140+
{
141+
"Filter": {
142+
"onpass": {
143+
"Url": {
144+
"method": "get",
145+
"url": "google.com",
146+
"response": {
147+
"*": {
148+
"Hangup": {
149+
"reason": 16
150+
}
151+
},
152+
"x": {
153+
"Hangup": {
154+
"reason": 16
155+
}
156+
}
157+
}
158+
}
159+
},
160+
"onfail": {
161+
"Hangup": {
162+
"reason": 16
163+
}
164+
},
165+
"type": "frequency",
166+
"unit": [10]
167+
}
168+
}
169+
]
170+
```

0 commit comments

Comments
 (0)