Skip to content

Commit c8e1044

Browse files
Fix media download encoding (#14)
* Deploy * fixed media download url encoding * updated user agent version Co-authored-by: DX-Bandwidth <[email protected]>
1 parent 7b57cb2 commit c8e1044

File tree

6 files changed

+143
-38
lines changed

6 files changed

+143
-38
lines changed

composer.json

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
11
{
2-
"name": "bandwidth/sdk",
3-
"type": "library",
4-
"description": "Bandwidth's set of APIs",
5-
"keywords": [
6-
"bandwidth",
7-
"API",
8-
"SDK"
9-
],
10-
"homepage": "https://github.com/bandwidth/php-sdk",
11-
"license": "MIT",
12-
"authors": [
13-
{
14-
"name": "APIMatic SDK Generator",
15-
"email": "[email protected]",
16-
"homepage": "https://apimatic.io",
17-
"role": "API Tool"
2+
"name": "bandwidth/sdk",
3+
"type": "library",
4+
"description": "Bandwidth's set of APIs",
5+
"keywords": ["bandwidth","API","SDK"],
6+
"homepage": "https://apimatic.io",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "APIMatic SDK Generator",
11+
"email": "[email protected]",
12+
"homepage": "https://apimatic.io",
13+
"role": "API Tool"
14+
}
15+
],
16+
"require": {
17+
"ext-SimpleXML": "*",
18+
"php": ">=5.4.0",
19+
"ext-curl": "*",
20+
"ext-json": "*",
21+
"ext-mbstring": "*",
22+
"mashape/unirest-php": "~3.0.1",
23+
"apimatic/jsonmapper": "~1.3.0"
24+
},
25+
"require-dev": {
26+
"squizlabs/php_codesniffer": "^2.7",
27+
"phan/phan": "^1.2"
28+
},
29+
"autoload": {
30+
"psr-4": {
31+
"BandwidthLib\\": "src/"
32+
}
1833
}
19-
],
20-
"require": {
21-
"ext-SimpleXML": "*",
22-
"php": ">=5.4.0",
23-
"ext-curl": "*",
24-
"ext-json": "*",
25-
"ext-mbstring": "*",
26-
"mashape/unirest-php": "~3.0.1",
27-
"apimatic/jsonmapper": "~1.3.0"
28-
},
29-
"require-dev": {
30-
"squizlabs/php_codesniffer": "^2.7",
31-
"phan/phan": "^1.2"
32-
},
33-
"autoload": {
34-
"psr-4": {
35-
"BandwidthLib\\": "src/"
36-
}
37-
}
3834
}

src/Controllers/BaseController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BaseController
2222
* User-agent to be sent with API calls
2323
* @var string
2424
*/
25-
const USER_AGENT = 'php-sdk-refs/tags/php2.11.1';
25+
const USER_AGENT = 'php-sdk-refs/tags/phpold2.13.3';
2626

2727
/**
2828
* HttpCallBack instance associated with this controller

src/Messaging/Controllers/APIController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ public function getMedia(
139139
$_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array (
140140
'userId' => $userId,
141141
'mediaId' => $mediaId,
142-
));
142+
), false
143+
);
143144

144145
//validate and preprocess url
145146
$_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder);

src/Voice/Bxml/StartGather.php

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* StartGather.php
4+
*
5+
* Implementation of the BXML StartGather tag
6+
*
7+
* * @copyright Bandwidth INC
8+
*/
9+
10+
namespace BandwidthLib\Voice\Bxml;
11+
12+
require_once "Verb.php";
13+
require_once "SpeakSentence.php";
14+
require_once "PlayAudio.php";
15+
16+
class StartGather extends Verb {
17+
18+
/**
19+
* Sets the username attribute for StartGather
20+
*
21+
* @param string $username The username for http authentication for the gather callback
22+
*/
23+
public function username($username) {
24+
$this->username = $username;
25+
}
26+
27+
/**
28+
* Sets the password attribute for StartGather
29+
*
30+
* @param string $password The password for http authentication for the gather callback
31+
*/
32+
public function password($password) {
33+
$this->password = $password;
34+
}
35+
36+
/**
37+
* Sets the dtmfUrl attribute for StartGather
38+
*
39+
* @param string $dtmfUrl The url to receive the dtmf callback
40+
*/
41+
public function dtmfUrl($dtmfUrl) {
42+
$this->dtmfUrl = $dtmfUrl;
43+
}
44+
45+
/**
46+
* Sets the dtmfMethod attribute for StartGather
47+
*
48+
* @param string $dtmfMethod The http method to send the dtmf callback
49+
*/
50+
public function dtmfMethod($dtmfMethod) {
51+
$this->dtmfMethod = $dtmfMethod;
52+
}
53+
54+
/**
55+
* Sets the tag attribute for StartGather
56+
*
57+
* @param string $tag A custom string to be included in callbacks
58+
*/
59+
public function tag($tag) {
60+
$this->tag = $tag;
61+
}
62+
63+
public function toBxml($doc) {
64+
$element = $doc->createElement("StartGather");
65+
66+
if(isset($this->username)) {
67+
$element->setAttribute("username", $this->username);
68+
}
69+
70+
if(isset($this->password)) {
71+
$element->setAttribute("password", $this->password);
72+
}
73+
74+
if(isset($this->tag)) {
75+
$element->setAttribute("tag", $this->tag);
76+
}
77+
78+
if(isset($this->dtmfUrl)) {
79+
$element->setAttribute("dtmfUrl", $this->dtmfUrl);
80+
}
81+
82+
if(isset($this->dtmfMethod)) {
83+
$element->setAttribute("dtmfMethod", $this->dtmfMethod);
84+
}
85+
86+
return $element;
87+
}
88+
}

src/Voice/Bxml/StopGather.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* StopGather.php
4+
*
5+
* Implementation of the BXML StopGather verb
6+
*
7+
* * @copyright Bandwidth INC
8+
*/
9+
10+
namespace BandwidthLib\Voice\Bxml;
11+
12+
require_once "Verb.php";
13+
14+
class StopGather extends Verb {
15+
16+
public function toBxml($doc) {
17+
$element = $doc->createElement("StopGather");
18+
return $element;
19+
}
20+
}

src/WebRtc/Utils/WebRtcTransfer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
class WebRtcTransfer {
1313
public static function generateBxml($deviceToken, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") {
14-
return '<?xml version="1.0" encoding="UTF-8"?><Transfer><SipUri uui="' . $deviceToken . ';encoding=jwt">' . $sipUri . '</SipUri></Transfer>';
14+
return '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer><SipUri uui="' . $deviceToken . ';encoding=jwt">' . $sipUri . '</SipUri></Transfer></Response>';
1515
}
1616
}

0 commit comments

Comments
 (0)