Skip to content

Commit 9028fbb

Browse files
committed
EDGE-630 Strip the hyphens from the callId and add documentation
1 parent 7fea2c9 commit 9028fbb

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

bandwidth/webrtc/utils/transfer_util.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@
99
def generate_transfer_bxml(device_token: str, voice_call_id: str, sip_uri: str ='sip:sipx.webrtc.bandwidth.com:5060'):
1010
"""
1111
Returns BXML string with WebRTC a device token to perform a SIP transfer
12+
:param device_token: The device token
13+
:param voice_call_id: The voice call id, used for debugging
14+
:param sip_uri: The uri of the sipx, if not specified it will take the default value
1215
"""
1316
return '<?xml version="1.0" encoding="UTF-8"?><Response>' + generate_transfer_bxml_verb(device_token, voice_call_id, sip_uri) + '</Response>'
1417

1518
def generate_transfer_bxml_verb(device_token: str, voice_call_id: str, sip_uri: str ='sip:sipx.webrtc.bandwidth.com:5060'):
1619
"""
1720
Returns the Transfer verb to perform the SIP transfer
21+
:param device_token: The device token
22+
:param voice_call_id: The voice call id, used for debugging
23+
:param sip_uri: The uri of the sipx, if not specified it will take the default value
1824
"""
19-
return f'''<Transfer><SipUri uui="{voice_call_id};encoding=base64,{device_token};encoding=jwt">{sip_uri}</SipUri></Transfer>'''
25+
return f'''<Transfer><SipUri uui="{"".join(voice_call_id.split("-")[1::])};encoding=base64,{device_token};encoding=jwt">{sip_uri}</SipUri></Transfer>'''

tests/integration/webrtc_bxml_tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class WebRtcBxmlTests(unittest.TestCase):
1515
Class for the WebRtc BXML tests
1616
"""
1717
def test_generate_transfer_bxml(self):
18-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer><SipUri uui="asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer></Response>'
19-
actual = generate_transfer_bxml('asdf')
18+
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>'
19+
actual = generate_transfer_bxml('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4')
2020
self.assertEqual(actual, expected)
2121

2222
def test_generate_transfer_bxml_verb(self):
23-
expected = '<Transfer><SipUri uui="asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer>'
24-
actual = generate_transfer_bxml_verb('asdf')
23+
expected = '<Transfer><SipUri uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer>'
24+
actual = generate_transfer_bxml_verb('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4')
2525
self.assertEqual(actual, expected)
2626

2727

0 commit comments

Comments
 (0)