-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dx 1669 1674 sip uri and tag bxml (#15)
* DX-1674 sip uri * DX-1669 tag * Changed variable name to sip
- Loading branch information
1 parent
c8e1044
commit 1f88cd2
Showing
3 changed files
with
231 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
<?php | ||
/** | ||
* SipUri.php | ||
* | ||
* Implementation of the BXML SipUri tag | ||
* | ||
* * @copyright Bandwidth INC | ||
*/ | ||
|
||
namespace BandwidthLib\Voice\Bxml; | ||
|
||
require_once "Verb.php"; | ||
|
||
class SipUri extends Verb { | ||
|
||
/** | ||
* Constructor for SipUri | ||
* | ||
* @param string $sip The sip uri destination | ||
*/ | ||
public function __construct($sip) { | ||
$this->sip = $sip; | ||
} | ||
|
||
/** | ||
* Sets the username attribute for SipUri | ||
* | ||
* @param string $username The username for http authentication on the audio url | ||
*/ | ||
public function username($username) { | ||
$this->username = $username; | ||
} | ||
|
||
/** | ||
* Sets the password attribute for SipUri | ||
* | ||
* @param string $password The password for http authentication on the audio url | ||
*/ | ||
public function password($password) { | ||
$this->password = $password; | ||
} | ||
|
||
/** | ||
* Sets the transferAnswerUrl attribute for SipUri | ||
* | ||
* @param string $transferAnswerUrl The url to receive the transfer answered callback | ||
*/ | ||
public function transferAnswerUrl($transferAnswerUrl) { | ||
$this->transferAnswerUrl = $transferAnswerUrl; | ||
} | ||
|
||
/** | ||
* Sets the transferAnswerMethod attribute for SipUri | ||
* | ||
* @param string $transferAnswerMethod The http method to send the transfer answered callback | ||
*/ | ||
public function transferAnswerMethod($transferAnswerMethod) { | ||
$this->transferAnswerMethod = $transferAnswerMethod; | ||
} | ||
|
||
/** | ||
* Sets the transferDisconnectUrl attribute for SipUri | ||
* | ||
* @param string $transferDisconnectUrl The url to receive the transfer disconnect callback | ||
*/ | ||
public function transferDisconnectUrl($transferDisconnectUrl) { | ||
$this->transferDisconnectUrl = $transferDisconnectUrl; | ||
} | ||
|
||
/** | ||
* Sets the transferDisconnectMethod attribute for SipUri | ||
* | ||
* @param string $transferDisconnectMethod The http method to send the transfer disconnect callback | ||
*/ | ||
public function transferDisconnectMethod($transferDisconnectMethod) { | ||
$this->transferDisconnectMethod = $transferDisconnectMethod; | ||
} | ||
|
||
/** | ||
* Sets the tag attribute for SipUri | ||
* | ||
* @param string $tag A custom string to be included in callbacks | ||
*/ | ||
public function tag($tag) { | ||
$this->tag = $tag; | ||
} | ||
|
||
/** | ||
* Sets the uui attribute for SipUri | ||
* | ||
* @param string $uui The value of the `User-To-User` header to send within the initial `INVITE` | ||
*/ | ||
public function uui($uui) { | ||
$this->uui = $uui; | ||
} | ||
|
||
/** | ||
* Sets the transferAnswerFallbackUrl attribute for SipUri | ||
* | ||
* @param string $transferAnswerFallbackUrl Fallback URL for transfer answer events | ||
*/ | ||
public function transferAnswerFallbackUrl($transferAnswerFallbackUrl) { | ||
$this->transferAnswerFallbackUrl = $transferAnswerFallbackUrl; | ||
} | ||
|
||
/** | ||
* Sets the transferAnswerFallbackMethod attribute for SipUri | ||
* | ||
* @param string $transferAnswerFallbackMethod HTTP method for fallback events | ||
*/ | ||
public function transferAnswerFallbackMethod($transferAnswerFallbackMethod) { | ||
$this->transferAnswerFallbackMethod = $transferAnswerFallbackMethod; | ||
} | ||
|
||
/** | ||
* Sets the fallbackUsername attribute for SipUri | ||
* | ||
* @param string $fallbackUsername HTTP basic auth username for fallback events | ||
*/ | ||
public function fallbackUsername($fallbackUsername) { | ||
$this->fallbackUsername = $fallbackUsername; | ||
} | ||
|
||
/** | ||
* Sets the fallbackPassword attribute for SipUri | ||
* | ||
* @param string $fallbackPassword HTTP basic auth password for fallback events | ||
*/ | ||
public function fallbackPassword($fallbackPassword) { | ||
$this->fallbackPassword = $fallbackPassword; | ||
} | ||
|
||
public function toBxml($doc) { | ||
$element = $doc->createElement("SipUri", $this->sip); | ||
|
||
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->uui)) { | ||
$element->setAttribute("uui", $this->uui); | ||
} | ||
|
||
if(isset($this->transferAnswerUrl)) { | ||
$element->setAttribute("transferAnswerUrl", $this->transferAnswerUrl); | ||
} | ||
|
||
if(isset($this->transferAnswerMethod)) { | ||
$element->setAttribute("transferAnswerMethod", $this->transferAnswerMethod); | ||
} | ||
|
||
if(isset($this->transferDisconnectUrl)) { | ||
$element->setAttribute("transferDisconnectUrl", $this->transferDisconnectUrl); | ||
} | ||
|
||
if(isset($this->transferDisconnectMethod)) { | ||
$element->setAttribute("transferDisconnectMethod", $this->transferDisconnectMethod); | ||
} | ||
|
||
if(isset($this->transferAnswerFallbackUrl)) { | ||
$element->setAttribute("transferAnswerFallbackUrl", $this->transferAnswerFallbackUrl); | ||
} | ||
|
||
if(isset($this->transferAnswerFallbackMethod)) { | ||
$element->setAttribute("transferAnswerFallbackMethod", $this->transferAnswerFallbackMethod); | ||
} | ||
|
||
if(isset($this->fallbackUsername)) { | ||
$element->setAttribute("fallbackUsername", $this->fallbackUsername); | ||
} | ||
|
||
if(isset($this->fallbackPassword)) { | ||
$element->setAttribute("fallbackPassword", $this->fallbackPassword); | ||
} | ||
|
||
return $element; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Tag.php | ||
* | ||
* Implementation of the BXML Tag verb | ||
* | ||
* * @copyright Bandwidth INC | ||
*/ | ||
|
||
namespace BandwidthLib\Voice\Bxml; | ||
|
||
require_once "Verb.php"; | ||
|
||
class Tag extends Verb { | ||
|
||
/** | ||
* Constructor for Tag | ||
* | ||
* @param string $tag The value to set the call tag to | ||
*/ | ||
public function __construct($tag) { | ||
$this->tag = $tag; | ||
} | ||
|
||
public function toBxml($doc) { | ||
$element = $doc->createElement("Tag", $this->tag); | ||
|
||
return $element; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters