Skip to content

Commit

Permalink
Fix media download encoding (#14)
Browse files Browse the repository at this point in the history
* Deploy

* fixed media download url encoding

* updated user agent version

Co-authored-by: DX-Bandwidth <[email protected]>
  • Loading branch information
jmulford-bw and DX-Bandwidth authored Dec 2, 2020
1 parent 7b57cb2 commit c8e1044
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 38 deletions.
66 changes: 31 additions & 35 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
{
"name": "bandwidth/sdk",
"type": "library",
"description": "Bandwidth's set of APIs",
"keywords": [
"bandwidth",
"API",
"SDK"
],
"homepage": "https://github.com/bandwidth/php-sdk",
"license": "MIT",
"authors": [
{
"name": "APIMatic SDK Generator",
"email": "[email protected]",
"homepage": "https://apimatic.io",
"role": "API Tool"
"name": "bandwidth/sdk",
"type": "library",
"description": "Bandwidth's set of APIs",
"keywords": ["bandwidth","API","SDK"],
"homepage": "https://apimatic.io",
"license": "MIT",
"authors": [
{
"name": "APIMatic SDK Generator",
"email": "[email protected]",
"homepage": "https://apimatic.io",
"role": "API Tool"
}
],
"require": {
"ext-SimpleXML": "*",
"php": ">=5.4.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"mashape/unirest-php": "~3.0.1",
"apimatic/jsonmapper": "~1.3.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.7",
"phan/phan": "^1.2"
},
"autoload": {
"psr-4": {
"BandwidthLib\\": "src/"
}
}
],
"require": {
"ext-SimpleXML": "*",
"php": ">=5.4.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"mashape/unirest-php": "~3.0.1",
"apimatic/jsonmapper": "~1.3.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.7",
"phan/phan": "^1.2"
},
"autoload": {
"psr-4": {
"BandwidthLib\\": "src/"
}
}
}
2 changes: 1 addition & 1 deletion src/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BaseController
* User-agent to be sent with API calls
* @var string
*/
const USER_AGENT = 'php-sdk-refs/tags/php2.11.1';
const USER_AGENT = 'php-sdk-refs/tags/phpold2.13.3';

/**
* HttpCallBack instance associated with this controller
Expand Down
3 changes: 2 additions & 1 deletion src/Messaging/Controllers/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public function getMedia(
$_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array (
'userId' => $userId,
'mediaId' => $mediaId,
));
), false
);

//validate and preprocess url
$_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder);
Expand Down
88 changes: 88 additions & 0 deletions src/Voice/Bxml/StartGather.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
/**
* StartGather.php
*
* Implementation of the BXML StartGather tag
*
* * @copyright Bandwidth INC
*/

namespace BandwidthLib\Voice\Bxml;

require_once "Verb.php";
require_once "SpeakSentence.php";
require_once "PlayAudio.php";

class StartGather extends Verb {

/**
* Sets the username attribute for StartGather
*
* @param string $username The username for http authentication for the gather callback
*/
public function username($username) {
$this->username = $username;
}

/**
* Sets the password attribute for StartGather
*
* @param string $password The password for http authentication for the gather callback
*/
public function password($password) {
$this->password = $password;
}

/**
* Sets the dtmfUrl attribute for StartGather
*
* @param string $dtmfUrl The url to receive the dtmf callback
*/
public function dtmfUrl($dtmfUrl) {
$this->dtmfUrl = $dtmfUrl;
}

/**
* Sets the dtmfMethod attribute for StartGather
*
* @param string $dtmfMethod The http method to send the dtmf callback
*/
public function dtmfMethod($dtmfMethod) {
$this->dtmfMethod = $dtmfMethod;
}

/**
* Sets the tag attribute for StartGather
*
* @param string $tag A custom string to be included in callbacks
*/
public function tag($tag) {
$this->tag = $tag;
}

public function toBxml($doc) {
$element = $doc->createElement("StartGather");

if(isset($this->username)) {
$element->setAttribute("username", $this->username);
}

if(isset($this->password)) {
$element->setAttribute("password", $this->password);
}

if(isset($this->tag)) {
$element->setAttribute("tag", $this->tag);
}

if(isset($this->dtmfUrl)) {
$element->setAttribute("dtmfUrl", $this->dtmfUrl);
}

if(isset($this->dtmfMethod)) {
$element->setAttribute("dtmfMethod", $this->dtmfMethod);
}

return $element;
}
}
20 changes: 20 additions & 0 deletions src/Voice/Bxml/StopGather.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* StopGather.php
*
* Implementation of the BXML StopGather verb
*
* * @copyright Bandwidth INC
*/

namespace BandwidthLib\Voice\Bxml;

require_once "Verb.php";

class StopGather extends Verb {

public function toBxml($doc) {
$element = $doc->createElement("StopGather");
return $element;
}
}
2 changes: 1 addition & 1 deletion src/WebRtc/Utils/WebRtcTransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

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

0 comments on commit c8e1044

Please sign in to comment.