|
10 | 10 | namespace BandwidthLib\WebRtc\Utils;
|
11 | 11 |
|
12 | 12 | class WebRtcTransfer {
|
13 |
| - public static function generateBxml($deviceToken, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") { |
14 |
| - return '<?xml version="1.0" encoding="UTF-8"?><Response>' . WebRtcTransfer::generateTransferBxmlVerb($deviceToken, $sipUri) . '</Response>'; |
| 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 | + */ |
| 20 | + return '<?xml version="1.0" encoding="UTF-8"?><Response>' . WebRtcTransfer::generateTransferBxmlVerb($deviceToken, $voiceCallId, $sipUri) . '</Response>'; |
15 | 21 | }
|
16 | 22 |
|
17 |
| - public static function generateTransferBxmlVerb($deviceToken, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") { |
18 |
| - return '<Transfer><SipUri uui="' . $deviceToken . ';encoding=jwt">' . $sipUri . '</SipUri></Transfer>'; |
| 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 | + */ |
| 30 | + $formattedCallId = substr(str_replace("-", "", $voiceCallId), 1); |
| 31 | + return '<Transfer><SipUri uui="' . $formattedCallId . ';encoding=base64,' . $deviceToken . ';encoding=jwt">' . $sipUri . '</SipUri></Transfer>'; |
19 | 32 | }
|
20 | 33 | }
|
0 commit comments