File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1111
1212class WebRtcTransfer {
1313 public static function generateBxml ($ deviceToken , $ voiceCallId , $ sipUri = "sip:sipx.webrtc.bandwidth.com:5060 " ) {
14+ /**
15+ * Returns BXML string with WebRTC a device token to perform a SIP transfer
16+ * @param string $deviceToken The device token
17+ * @param array $voiceCallId The Bandwidth Voice Call Id
18+ * @return string $sipUri The SIP URI to transfer the call to
19+ */
1420 return '<?xml version="1.0" encoding="UTF-8"?><Response> ' . WebRtcTransfer::generateTransferBxmlVerb ($ deviceToken , $ voiceCallId , $ sipUri ) . '</Response> ' ;
1521 }
1622
1723 public static function generateTransferBxmlVerb ($ deviceToken , $ voiceCallId , $ sipUri = "sip:sipx.webrtc.bandwidth.com:5060 " ) {
24+ /**
25+ * Returns the Transfer verb to perform the SIP transfer
26+ * @param string $deviceToken The device token
27+ * @param array $voiceCallId The Bandwidth Voice Call Id
28+ * @return string $sipUri The SIP URI to transfer the call to
29+ */
1830 $ formattedCallId = substr (str_replace ("- " , "" , $ voiceCallId ), 1 );
1931 return '<Transfer><SipUri uui=" ' . $ formattedCallId . ';encoding=base64 ' . $ deviceToken . ';encoding=jwt"> ' . $ sipUri . '</SipUri></Transfer> ' ;
2032 }
Original file line number Diff line number Diff line change 1313final class WebRtcBxmlTest extends TestCase
1414{
1515 public function testGenerateBxml () {
16- $ expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer><SipUri uui="asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer></Response> ' ;
17- $ actual = BandwidthLib \WebRtc \Utils \WebRtcTransfer::generateBxml ('asdf ' );
16+ $ expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer><SipUri uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64, asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer></Response> ' ;
17+ $ actual = BandwidthLib \WebRtc \Utils \WebRtcTransfer::generateBxml ('asdf ' , ' c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4 ' );
1818 $ this ->assertEquals ($ expected , $ actual );
1919 }
2020
2121 public function testGenerateTransferBxmlVerb () {
22- $ expected = '<Transfer><SipUri uui="asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer> ' ;
23- $ actual = BandwidthLib \WebRtc \Utils \WebRtcTransfer::generateTransferBxmlVerb ('asdf ' );
22+ $ expected = '<Transfer><SipUri uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64, asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer> ' ;
23+ $ actual = BandwidthLib \WebRtc \Utils \WebRtcTransfer::generateTransferBxmlVerb ('asdf ' , ' c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4 ' );
2424 $ this ->assertEquals ($ expected , $ actual );
2525 }
2626}
You can’t perform that action at this time.
0 commit comments