From 62f13c39520618ce65e733757e7dd4ac40eb764e Mon Sep 17 00:00:00 2001 From: Audrey Copeland Date: Fri, 23 Jul 2021 15:51:36 -0400 Subject: [PATCH] Add documentation and fix tests --- src/WebRtc/Utils/WebRtcTransfer.php | 12 ++++++++++++ tests/WebRtcBxmlTest.php | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/WebRtc/Utils/WebRtcTransfer.php b/src/WebRtc/Utils/WebRtcTransfer.php index 272272d..6b1a0c9 100644 --- a/src/WebRtc/Utils/WebRtcTransfer.php +++ b/src/WebRtc/Utils/WebRtcTransfer.php @@ -11,10 +11,22 @@ class WebRtcTransfer { 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, $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); } }