Skip to content

Commit

Permalink
DX-2100 webrtc bxml transfer method (#30)
Browse files Browse the repository at this point in the history
* DX-2100 webrtc bxml transfer method

* fixed method call
  • Loading branch information
jmulford-bw authored Jul 22, 2021
1 parent fcfa931 commit 191de97
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/WebRtc/Utils/WebRtcTransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

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

public static function generateTransferBxmlVerb($deviceToken, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") {
return '<Transfer><SipUri uui="' . $deviceToken . ';encoding=jwt">' . $sipUri . '</SipUri></Transfer>';
}
}
26 changes: 26 additions & 0 deletions tests/WebRtcBxmlTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* WebRtcBxmlTest.php
*
* A simple php integration test class for WebRtc BXML
*
* @copyright Bandwidth INC
*/

use PHPUnit\Framework\TestCase;

final class WebRtcBxmlTest extends TestCase
{
public function testGenerateBxml() {
$expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer><SipUri uui="asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer></Response>';
$actual = BandwidthLib\WebRtc\Utils\WebRtcTransfer::generateBxml('asdf');
$this->assertEquals($expected, $actual);
}

public function testGenerateTransferBxmlVerb() {
$expected = '<Transfer><SipUri uui="asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer>';
$actual = BandwidthLib\WebRtc\Utils\WebRtcTransfer::generateTransferBxmlVerb('asdf');
$this->assertEquals($expected, $actual);
}
}

0 comments on commit 191de97

Please sign in to comment.