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 11
11
12
12
class WebRtcTransfer {
13
13
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
+ */
14
20
return '<?xml version="1.0" encoding="UTF-8"?><Response> ' . WebRtcTransfer::generateTransferBxmlVerb ($ deviceToken , $ voiceCallId , $ sipUri ) . '</Response> ' ;
15
21
}
16
22
17
23
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
+ */
18
30
$ formattedCallId = substr (str_replace ("- " , "" , $ voiceCallId ), 1 );
19
31
return '<Transfer><SipUri uui=" ' . $ formattedCallId . ';encoding=base64 ' . $ deviceToken . ';encoding=jwt"> ' . $ sipUri . '</SipUri></Transfer> ' ;
20
32
}
Original file line number Diff line number Diff line change 13
13
final class WebRtcBxmlTest extends TestCase
14
14
{
15
15
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 ' );
18
18
$ this ->assertEquals ($ expected , $ actual );
19
19
}
20
20
21
21
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 ' );
24
24
$ this ->assertEquals ($ expected , $ actual );
25
25
}
26
26
}
You can’t perform that action at this time.
0 commit comments