Skip to content

Commit

Permalink
SWI-4587 Add transferCallerDisplayName (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrice6713 authored Feb 20, 2024
1 parent 0fd1abc commit 16925c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion bandwidth/models/bxml/verbs/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Transfer(Verb):

def __init__(
self, transfer_to: List[Union[PhoneNumber, SipUri]] = [],
transfer_caller_id: str=None, call_timeout: str=None,
transfer_caller_id: str=None, transfer_caller_display_name: str=None, call_timeout: str=None,
transfer_complete_url: str=None, transfer_complete_method: str=None,
transfer_complete_fallback_url: str=None,
transfer_complete_fallback_method: str=None, username: str=None,
Expand All @@ -29,6 +29,7 @@ def __init__(
Args:
transfer_to (list[PhoneNumber, SipUri], optional): List of recipients to transfer a call to. Defaults to [].
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.
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.
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.
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.
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.
Expand Down Expand Up @@ -63,6 +64,7 @@ def __init__(
"""
self.transfer_to = transfer_to
self.transfer_caller_id = transfer_caller_id
self.transfer_caller_display_name = transfer_caller_display_name
self.call_timeout = call_timeout
self.transfer_complete_url = transfer_complete_url
self.transfer_complete_method = transfer_complete_method
Expand All @@ -84,6 +86,7 @@ def __init__(
def _attributes(self):
return {
"transferCallerId": self.transfer_caller_id,
"transferCallerDisplayName": self.transfer_caller_display_name,
"callTimeout": self.call_timeout,
"transferCompleteUrl": self.transfer_complete_url,
"transferCompleteMethod": self.transfer_complete_method,
Expand Down
5 changes: 3 additions & 2 deletions test/unit/bxml/test_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ def setUp(self):
transfer_to=[self.sip_uri],
call_timeout = "15",
transfer_caller_id = "+19195554321",
transfer_caller_display_name="test",
tag = "test"
)

def test_to_bxml(self):
expected = '<Transfer transferCallerId="+19195554321" callTimeout="15" tag="test"><SipUri uui="test">[email protected]</SipUri></Transfer>'
expected = '<Transfer transferCallerId="+19195554321" transferCallerDisplayName="test" callTimeout="15" tag="test"><SipUri uui="test">[email protected]</SipUri></Transfer>'
assert(expected == self.transfer.to_bxml())

def test_add_verb(self):
expected = '<Transfer transferCallerId="+19195554321" callTimeout="15" tag="test"><SipUri uui="test">[email protected]</SipUri><PhoneNumber tag="test">+19195551234</PhoneNumber></Transfer>'
expected = '<Transfer transferCallerId="+19195554321" transferCallerDisplayName="test" callTimeout="15" tag="test"><SipUri uui="test">[email protected]</SipUri><PhoneNumber tag="test">+19195551234</PhoneNumber></Transfer>'
self.transfer.add_transfer_recipient(self.phone_number)
assert(expected == self.transfer.to_bxml())

0 comments on commit 16925c4

Please sign in to comment.