Skip to content

Commit db2afec

Browse files
authored
DX-2615 Add Call Queueing Support (#87)
* DX-2615 Add Call Queueing support * Bump Version
1 parent e6e3291 commit db2afec

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

bandwidth/tests/test_api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def test_successful_create_and_get_call(self, voice_client):
237237
assert create_response_body.mfrom == BW_NUMBER
238238
assert create_response_body.call_url == "https://voice.bandwidth.com/api/v2/accounts/" + \
239239
BW_ACCOUNT_ID + "/calls/" + create_response_body.call_id
240-
assert dateutil.parser.isoparse(str(create_response_body.start_time)) # assert that str(start_time) is datetime
240+
assert dateutil.parser.isoparse(str(create_response_body.enqueued_time)) # assert that str(enqueued_time) is datetime
241241
assert type(create_response_body.call_timeout) is float
242242
assert type(create_response_body.callback_timeout) is float
243243
assert create_response_body.answer_method == "POST"
@@ -246,7 +246,9 @@ def test_successful_create_and_get_call(self, voice_client):
246246
assert get_response_body.call_id == create_response_body.call_id
247247
assert get_response_body.application_id == BW_VOICE_APPLICATION_ID
248248
assert get_response_body.account_id == BW_ACCOUNT_ID
249-
assert dateutil.parser.isoparse(str(get_response_body.start_time))
249+
if get_response_body.start_time:
250+
assert dateutil.parser.isoparse(str(get_response_body.start_time))
251+
assert dateutil.parser.isoparse(str(get_response_body.enqueued_time))
250252
assert dateutil.parser.isoparse(str(get_response_body.last_update))
251253
if get_response_body.answer_time: # may be null dependent on timing
252254
assert dateutil.parser.isoparse(str(get_response_body.answer_time))
@@ -319,7 +321,7 @@ def test_createCall_with_priority(self, voice_client):
319321
assert create_response_body.mfrom == BW_NUMBER
320322
assert create_response_body.call_url == "https://voice.bandwidth.com/api/v2/accounts/" + \
321323
BW_ACCOUNT_ID + "/calls/" + create_response_body.call_id
322-
assert dateutil.parser.isoparse(str(create_response_body.start_time)) # assert that str(start_time) is datetime
324+
assert dateutil.parser.isoparse(str(create_response_body.enqueued_time)) # assert that str(enqueued_time) is datetime
323325
assert type(create_response_body.call_timeout) is float
324326
assert type(create_response_body.callback_timeout) is float
325327
assert create_response_body.answer_method == "POST"

bandwidth/voice/models/call_state.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class CallState(object):
5858
"identity": 'identity',
5959
"stir_shaken": 'stirShaken',
6060
"start_time": 'startTime',
61+
"enqueued_time": 'enqueuedTime',
6162
"answer_time": 'answerTime',
6263
"end_time": 'endTime',
6364
"disconnect_cause": 'disconnectCause',
@@ -78,6 +79,7 @@ def __init__(self,
7879
identity=None,
7980
stir_shaken=None,
8081
start_time=None,
82+
enqueued_time=None,
8183
answer_time=None,
8284
end_time=None,
8385
disconnect_cause=None,
@@ -98,6 +100,7 @@ def __init__(self,
98100
self.identity = identity
99101
self.stir_shaken = stir_shaken
100102
self.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None
103+
self.enqueued_time = APIHelper.RFC3339DateTime(enqueued_time) if enqueued_time else None
101104
self.answer_time = APIHelper.RFC3339DateTime(answer_time) if answer_time else None
102105
self.end_time = APIHelper.RFC3339DateTime(end_time) if end_time else None
103106
self.disconnect_cause = disconnect_cause
@@ -134,6 +137,7 @@ def from_dictionary(cls,
134137
identity = dictionary.get('identity')
135138
stir_shaken = dictionary.get('stirShaken')
136139
start_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("startTime")).datetime if dictionary.get("startTime") else None
140+
enqueued_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("enqueuedTime")).datetime if dictionary.get("enqueuedTime") else None
137141
answer_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("answerTime")).datetime if dictionary.get("answerTime") else None
138142
end_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("endTime")).datetime if dictionary.get("endTime") else None
139143
disconnect_cause = dictionary.get('disconnectCause')
@@ -153,6 +157,7 @@ def from_dictionary(cls,
153157
identity,
154158
stir_shaken,
155159
start_time,
160+
enqueued_time,
156161
answer_time,
157162
end_time,
158163
disconnect_cause,

bandwidth/voice/models/create_call_response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class CreateCallResponse(object):
2323
to (string): TODO: type description here.
2424
mfrom (string): TODO: type description here.
2525
start_time (datetime): TODO: type description here.
26+
enqueued_time (datetime): TODO
2627
call_url (string): TODO: type description here.
2728
call_timeout (float): TODO: type description here.
2829
callback_timeout (float): TODO: type description here.
@@ -55,6 +56,7 @@ class CreateCallResponse(object):
5556
"answer_method": 'answerMethod',
5657
"disconnect_method": 'disconnectMethod',
5758
"start_time": 'startTime',
59+
"enqueued_time": 'enqueuedTime',
5860
"call_timeout": 'callTimeout',
5961
"callback_timeout": 'callbackTimeout',
6062
"answer_fallback_url": 'answerFallbackUrl',
@@ -80,6 +82,7 @@ def __init__(self,
8082
answer_method=None,
8183
disconnect_method=None,
8284
start_time=None,
85+
enqueued_time=None,
8386
call_timeout=None,
8487
callback_timeout=None,
8588
answer_fallback_url=None,
@@ -100,6 +103,8 @@ def __init__(self,
100103
self.to = to
101104
self.mfrom = mfrom
102105
self.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None
106+
self.enqueued_time = APIHelper.RFC3339DateTime(enqueued_time) if enqueued_time else None,
107+
self.enqueued_time = enqueued_time
103108
self.call_url = call_url
104109
self.call_timeout = call_timeout
105110
self.callback_timeout = callback_timeout
@@ -144,6 +149,7 @@ def from_dictionary(cls,
144149
answer_method = dictionary.get('answerMethod')
145150
disconnect_method = dictionary.get('disconnectMethod')
146151
start_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("startTime")).datetime if dictionary.get("startTime") else None
152+
enqueued_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("enqueuedTime")).datetime if dictionary.get("enqueuedTime") else None
147153
call_timeout = dictionary.get('callTimeout')
148154
callback_timeout = dictionary.get('callbackTimeout')
149155
answer_fallback_url = dictionary.get('answerFallbackUrl')
@@ -167,6 +173,7 @@ def from_dictionary(cls,
167173
answer_method,
168174
disconnect_method,
169175
start_time,
176+
enqueued_time,
170177
call_timeout,
171178
callback_timeout,
172179
answer_fallback_url,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
setup(
1717
name='bandwidth-sdk',
18-
version='13.5.0',
18+
version='13.6.0',
1919
description='Bandwidth\'s set of APIs',
2020
long_description=long_description,
2121
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)