diff --git a/src/WebRtc/Utils/WebRtcTransfer.php b/src/WebRtc/Utils/WebRtcTransfer.php index afe6229..80537b9 100644 --- a/src/WebRtc/Utils/WebRtcTransfer.php +++ b/src/WebRtc/Utils/WebRtcTransfer.php @@ -10,11 +10,24 @@ namespace BandwidthLib\WebRtc\Utils; class WebRtcTransfer { - public static function generateBxml($deviceToken, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") { - return '' . WebRtcTransfer::generateTransferBxmlVerb($deviceToken, $sipUri) . ''; + public static function generateBxml($deviceToken, $voiceCallId, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") { + /** + * Returns BXML string with WebRTC a device token to perform a SIP transfer + * @param string $deviceToken The device token + * @param array $voiceCallId The Bandwidth Voice Call Id + * @return string $sipUri The SIP URI to transfer the call to + */ + return '' . WebRtcTransfer::generateTransferBxmlVerb($deviceToken, $voiceCallId, $sipUri) . ''; } - public static function generateTransferBxmlVerb($deviceToken, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") { - return '' . $sipUri . ''; + public static function generateTransferBxmlVerb($deviceToken, $voiceCallId, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") { + /** + * Returns the Transfer verb to perform the SIP transfer + * @param string $deviceToken The device token + * @param array $voiceCallId The Bandwidth Voice Call Id + * @return string $sipUri The SIP URI to transfer the call to + */ + $formattedCallId = substr(str_replace("-", "", $voiceCallId), 1); + return '' . $sipUri . ''; } } diff --git a/tests/WebRtcBxmlTest.php b/tests/WebRtcBxmlTest.php index f8cc7ad..64aa7ed 100644 --- a/tests/WebRtcBxmlTest.php +++ b/tests/WebRtcBxmlTest.php @@ -13,14 +13,14 @@ final class WebRtcBxmlTest extends TestCase { public function testGenerateBxml() { - $expected = 'sip:sipx.webrtc.bandwidth.com:5060'; - $actual = BandwidthLib\WebRtc\Utils\WebRtcTransfer::generateBxml('asdf'); + $expected = 'sip:sipx.webrtc.bandwidth.com:5060'; + $actual = BandwidthLib\WebRtc\Utils\WebRtcTransfer::generateBxml('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4'); $this->assertEquals($expected, $actual); } public function testGenerateTransferBxmlVerb() { - $expected = 'sip:sipx.webrtc.bandwidth.com:5060'; - $actual = BandwidthLib\WebRtc\Utils\WebRtcTransfer::generateTransferBxmlVerb('asdf'); + $expected = 'sip:sipx.webrtc.bandwidth.com:5060'; + $actual = BandwidthLib\WebRtc\Utils\WebRtcTransfer::generateTransferBxmlVerb('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4'); $this->assertEquals($expected, $actual); } }