Skip to content

Commit 16925c4

Browse files
authored
SWI-4587 Add transferCallerDisplayName (#184)
1 parent 0fd1abc commit 16925c4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

bandwidth/models/bxml/verbs/transfer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Transfer(Verb):
1616

1717
def __init__(
1818
self, transfer_to: List[Union[PhoneNumber, SipUri]] = [],
19-
transfer_caller_id: str=None, call_timeout: str=None,
19+
transfer_caller_id: str=None, transfer_caller_display_name: str=None, call_timeout: str=None,
2020
transfer_complete_url: str=None, transfer_complete_method: str=None,
2121
transfer_complete_fallback_url: str=None,
2222
transfer_complete_fallback_method: str=None, username: str=None,
@@ -29,6 +29,7 @@ def __init__(
2929
Args:
3030
transfer_to (list[PhoneNumber, SipUri], optional): List of recipients to transfer a call to. Defaults to [].
3131
transfer_caller_id (str, optional): The caller ID to use when the call is transferred, if different. Must be in E.164 format (e.g. +15555555555) or be one of the following strings Restricted, Anonymous, Private, or Unavailable. Leave as default to pass along the number of the remote party. Defaults to None.
32+
transfer_caller_display_name (str, optional): The caller display name to use when the call is transferred. May not exceed 256 characters nor contain control characters such as new lines.
3233
call_timeout (str, optional):The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Range: decimal values between 1 - 300. Default value is 30 seconds. Defaults to None.
3334
transfer_complete_url (str, optional): URL to send the Transfer Complete event to and request new BXML. Optional but recommended. See below for further details. May be a relative URL. Defaults to None.
3435
transfer_complete_method (str, optional): The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST. Defaults to None.
@@ -63,6 +64,7 @@ def __init__(
6364
"""
6465
self.transfer_to = transfer_to
6566
self.transfer_caller_id = transfer_caller_id
67+
self.transfer_caller_display_name = transfer_caller_display_name
6668
self.call_timeout = call_timeout
6769
self.transfer_complete_url = transfer_complete_url
6870
self.transfer_complete_method = transfer_complete_method
@@ -84,6 +86,7 @@ def __init__(
8486
def _attributes(self):
8587
return {
8688
"transferCallerId": self.transfer_caller_id,
89+
"transferCallerDisplayName": self.transfer_caller_display_name,
8790
"callTimeout": self.call_timeout,
8891
"transferCompleteUrl": self.transfer_complete_url,
8992
"transferCompleteMethod": self.transfer_complete_method,

test/unit/bxml/test_transfer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ def setUp(self):
2727
transfer_to=[self.sip_uri],
2828
call_timeout = "15",
2929
transfer_caller_id = "+19195554321",
30+
transfer_caller_display_name="test",
3031
tag = "test"
3132
)
3233

3334
def test_to_bxml(self):
34-
expected = '<Transfer transferCallerId="+19195554321" callTimeout="15" tag="test"><SipUri uui="test">sip@bw.com</SipUri></Transfer>'
35+
expected = '<Transfer transferCallerId="+19195554321" transferCallerDisplayName="test" callTimeout="15" tag="test"><SipUri uui="test">sip@bw.com</SipUri></Transfer>'
3536
assert(expected == self.transfer.to_bxml())
3637

3738
def test_add_verb(self):
38-
expected = '<Transfer transferCallerId="+19195554321" callTimeout="15" tag="test"><SipUri uui="test">sip@bw.com</SipUri><PhoneNumber tag="test">+19195551234</PhoneNumber></Transfer>'
39+
expected = '<Transfer transferCallerId="+19195554321" transferCallerDisplayName="test" callTimeout="15" tag="test"><SipUri uui="test">sip@bw.com</SipUri><PhoneNumber tag="test">+19195551234</PhoneNumber></Transfer>'
3940
self.transfer.add_transfer_recipient(self.phone_number)
4041
assert(expected == self.transfer.to_bxml())

0 commit comments

Comments
 (0)