Skip to content

Commit 9a8f09a

Browse files
DX-2203 Voice, Answering Machine Detection (#29)
* New deploy * Remove DS Store * Version bump to 12 This is breaking due to the change from `pai` to `stirShaken` * Add test for answering machine detection * Remove pause between creating and getting call * Improve test and correct spacing * Add import statement * fix syntax * Improve test coverage * add lxml to requirements.txt * Remove Doc directory * update test to use `mfrom` * Remove perpetually failing test * Update test to accommodate breaking change Testing with a bad statement to fail the test * Correct planned failure * Update __init__.py * remove apimatic tests * Update api_tests.py Co-authored-by: DX-Bandwidth <[email protected]>
1 parent 3e76ff2 commit 9a8f09a

File tree

23 files changed

+863
-237
lines changed

23 files changed

+863
-237
lines changed

.DS_Store

-6 KB
Binary file not shown.

bandwidth/messaging/controllers/api_controller.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def list_media(self,
3131
continuation_token=None):
3232
"""Does a GET request to /users/{accountId}/media.
3333
34-
listMedia
34+
Gets a list of your media files. No query parameters are supported.
3535
3636
Args:
3737
account_id (string): User's account ID
@@ -95,7 +95,7 @@ def get_media(self,
9595
media_id):
9696
"""Does a GET request to /users/{accountId}/media/{mediaId}.
9797
98-
getMedia
98+
Downloads a media file you previously uploaded.
9999
100100
Args:
101101
account_id (string): User's account ID
@@ -156,7 +156,8 @@ def upload_media(self,
156156
cache_control=None):
157157
"""Does a PUT request to /users/{accountId}/media/{mediaId}.
158158
159-
uploadMedia
159+
Uploads a file the normal HTTP way. You may add headers to the request
160+
in order to provide some control to your media-file.
160161
161162
Args:
162163
account_id (string): User's account ID
@@ -231,7 +232,10 @@ def delete_media(self,
231232
media_id):
232233
"""Does a DELETE request to /users/{accountId}/media/{mediaId}.
233234
234-
deleteMedia
235+
Deletes a media file from Bandwidth API server. Make sure you don't
236+
have any application scripts still using the media before you delete.
237+
If you accidentally delete a media file, you can immediately upload a
238+
new file with the same name.
235239
236240
Args:
237241
account_id (string): User's account ID
@@ -295,7 +299,7 @@ def get_messages(self,
295299
limit=None):
296300
"""Does a GET request to /users/{accountId}/messages.
297301
298-
getMessages
302+
Gets a list of messages based on query parameters.
299303
300304
Args:
301305
account_id (string): User's account ID
@@ -392,7 +396,8 @@ def create_message(self,
392396
body):
393397
"""Does a POST request to /users/{accountId}/messages.
394398
395-
createMessage
399+
Endpoint for sending text messages and picture messages using V2
400+
messaging.
396401
397402
Args:
398403
account_id (string): User's account ID

bandwidth/messaging/models/bandwidth_message.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ class BandwidthMessage(object):
2727
Bandwidth. Can be in or out
2828
to (list of string): The phone number recipients of the message
2929
mfrom (string): The phone number the message was sent from
30-
media (list of string): The list of media URLs sent in the message
30+
media (list of string): The list of media URLs sent in the message.
31+
Including a `filename` field in the `Content-Disposition` header
32+
of the media linked with a URL will set the displayed file name.
33+
This is a best practice to ensure that your media has a readable
34+
file name.
3135
text (string): The contents of the message
3236
tag (string): The custom string set by the user
3337
priority (string): The priority specified by the user

bandwidth/multifactorauth/controllers/mfa_controller.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def create_voice_two_factor(self,
3232
body):
3333
"""Does a POST request to /accounts/{accountId}/code/voice.
3434
35-
Allows a user to send a MFA code through a phone call
35+
Multi-Factor authentication with Bandwidth Voice services. Allows for
36+
a user to send an MFA code via a phone call.
3637
3738
Args:
3839
account_id (string): Bandwidth Account ID with Voice service
@@ -92,7 +93,8 @@ def create_messaging_two_factor(self,
9293
body):
9394
"""Does a POST request to /accounts/{accountId}/code/messaging.
9495
95-
Allows a user to send a MFA code through a text message (SMS)
96+
Multi-Factor authentication with Bandwidth Messaging services. Allows
97+
a user to send an MFA code via a text message (SMS).
9698
9799
Args:
98100
account_id (string): Bandwidth Account ID with Messaging service
@@ -152,7 +154,7 @@ def create_verify_two_factor(self,
152154
body):
153155
"""Does a POST request to /accounts/{accountId}/code/verify.
154156
155-
Allows a user to verify an MFA code
157+
Allows a user to verify an MFA code.
156158
157159
Args:
158160
account_id (string): Bandwidth Account ID with Two-Factor enabled

bandwidth/phonenumberlookup/controllers/api_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def create_lookup_request(self,
3030
body):
3131
"""Does a POST request to /accounts/{accountId}/tnlookup.
3232
33-
Create a TN Lookup Order
33+
Create a TN Lookup Order.
3434
3535
Args:
3636
account_id (string): The ID of the Bandwidth account that the user
@@ -292,7 +292,7 @@ def get_lookup_request_status(self,
292292
request_id):
293293
"""Does a GET request to /accounts/{accountId}/tnlookup/{requestId}.
294294
295-
Query an existing TN Lookup Order
295+
Query an existing TN Lookup Order.
296296
297297
Args:
298298
account_id (string): The ID of the Bandwidth account that the user

bandwidth/voice/controllers/api_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def create_call(self,
3535
body):
3636
"""Does a POST request to /api/v2/accounts/{accountId}/calls.
3737
38-
Creates an outbound call.
38+
Creates an outbound phone call.
3939
4040
Args:
4141
account_id (string): TODO: type description here.
@@ -298,7 +298,7 @@ def get_call_recordings(self,
298298
"""Does a GET request to /api/v2/accounts/{accountId}/calls/{callId}/recordings.
299299
300300
Returns a (potentially empty) list of metadata for the recordings that
301-
took place during the specified call
301+
took place during the specified call.
302302
303303
Args:
304304
account_id (string): TODO: type description here.

bandwidth/voice/models/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,24 @@
99
'conference_state',
1010
'conference_member_state',
1111
'conference_recording_metadata',
12+
'machine_detection_request',
1213
'transcribe_recording_request',
1314
'transcription_response',
1415
'transcription_metadata',
1516
'transcript',
17+
'call_callback',
18+
'transcription',
19+
'diversion',
20+
'conference_callback',
1621
'answer_fallback_method_enum',
1722
'answer_method_enum',
1823
'callback_method_enum',
1924
'conference_event_method_enum',
2025
'direction_enum',
2126
'disconnect_method_enum',
27+
'fallback_method_enum',
2228
'file_format_enum',
29+
'mode_enum',
2330
'redirect_fallback_method_enum',
2431
'redirect_method_enum',
2532
'state_enum',
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
bandwidth
5+
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
8+
"""
9+
from bandwidth.voice.models.diversion import Diversion
10+
from bandwidth.voice.models.transcription import Transcription
11+
12+
13+
class CallCallback(object):
14+
15+
"""Implementation of the 'CallCallback' model.
16+
17+
This object represents all possible fields that may be included in
18+
callbacks related to call events, including events that come from BXML
19+
verbs
20+
21+
Attributes:
22+
event_type (string): TODO: type description here.
23+
event_time (string): TODO: type description here.
24+
account_id (string): TODO: type description here.
25+
application_id (string): TODO: type description here.
26+
mfrom (string): TODO: type description here.
27+
to (string): TODO: type description here.
28+
direction (string): TODO: type description here.
29+
call_id (string): TODO: type description here.
30+
call_url (string): TODO: type description here.
31+
start_time (string): TODO: type description here.
32+
answer_time (string): TODO: type description here.
33+
transfer_caller_id (string): TODO: type description here.
34+
transfer_to (string): TODO: type description here.
35+
cause (string): TODO: type description here.
36+
error_message (string): TODO: type description here.
37+
error_id (string): TODO: type description here.
38+
end_time (string): TODO: type description here.
39+
digit (string): TODO: type description here.
40+
parent_call_id (string): TODO: type description here.
41+
recording_id (string): TODO: type description here.
42+
duration (string): TODO: type description here.
43+
file_format (string): TODO: type description here.
44+
media_url (string): TODO: type description here.
45+
tag (string): TODO: type description here.
46+
channels (int): TODO: type description here.
47+
status (string): TODO: type description here.
48+
digits (string): TODO: type description here.
49+
terminating_digit (string): TODO: type description here.
50+
transcription (Transcription): TODO: type description here.
51+
diversion (Diversion): TODO: type description here.
52+
53+
"""
54+
55+
# Create a mapping from Model property names to API property names
56+
_names = {
57+
"event_type": 'eventType',
58+
"event_time": 'eventTime',
59+
"account_id": 'accountId',
60+
"application_id": 'applicationId',
61+
"mfrom": 'from',
62+
"to": 'to',
63+
"direction": 'direction',
64+
"call_id": 'callId',
65+
"call_url": 'callUrl',
66+
"start_time": 'startTime',
67+
"answer_time": 'answerTime',
68+
"transfer_caller_id": 'transferCallerId',
69+
"transfer_to": 'transferTo',
70+
"cause": 'cause',
71+
"error_message": 'errorMessage',
72+
"error_id": 'errorId',
73+
"end_time": 'endTime',
74+
"digit": 'digit',
75+
"parent_call_id": 'parentCallId',
76+
"recording_id": 'recordingId',
77+
"duration": 'duration',
78+
"file_format": 'fileFormat',
79+
"media_url": 'mediaUrl',
80+
"tag": 'tag',
81+
"channels": 'channels',
82+
"status": 'status',
83+
"digits": 'digits',
84+
"terminating_digit": 'terminatingDigit',
85+
"transcription": 'transcription',
86+
"diversion": 'diversion'
87+
}
88+
89+
def __init__(self,
90+
event_type=None,
91+
event_time=None,
92+
account_id=None,
93+
application_id=None,
94+
mfrom=None,
95+
to=None,
96+
direction=None,
97+
call_id=None,
98+
call_url=None,
99+
start_time=None,
100+
answer_time=None,
101+
transfer_caller_id=None,
102+
transfer_to=None,
103+
cause=None,
104+
error_message=None,
105+
error_id=None,
106+
end_time=None,
107+
digit=None,
108+
parent_call_id=None,
109+
recording_id=None,
110+
duration=None,
111+
file_format=None,
112+
media_url=None,
113+
tag=None,
114+
channels=None,
115+
status=None,
116+
digits=None,
117+
terminating_digit=None,
118+
transcription=None,
119+
diversion=None):
120+
"""Constructor for the CallCallback class"""
121+
122+
# Initialize members of the class
123+
self.event_type = event_type
124+
self.event_time = event_time
125+
self.account_id = account_id
126+
self.application_id = application_id
127+
self.mfrom = mfrom
128+
self.to = to
129+
self.direction = direction
130+
self.call_id = call_id
131+
self.call_url = call_url
132+
self.start_time = start_time
133+
self.answer_time = answer_time
134+
self.transfer_caller_id = transfer_caller_id
135+
self.transfer_to = transfer_to
136+
self.cause = cause
137+
self.error_message = error_message
138+
self.error_id = error_id
139+
self.end_time = end_time
140+
self.digit = digit
141+
self.parent_call_id = parent_call_id
142+
self.recording_id = recording_id
143+
self.duration = duration
144+
self.file_format = file_format
145+
self.media_url = media_url
146+
self.tag = tag
147+
self.channels = channels
148+
self.status = status
149+
self.digits = digits
150+
self.terminating_digit = terminating_digit
151+
self.transcription = transcription
152+
self.diversion = diversion
153+
154+
@classmethod
155+
def from_dictionary(cls,
156+
dictionary):
157+
"""Creates an instance of this model from a dictionary
158+
159+
Args:
160+
dictionary (dictionary): A dictionary representation of the object
161+
as obtained from the deserialization of the server's response. The
162+
keys MUST match property names in the API description.
163+
164+
Returns:
165+
object: An instance of this structure class.
166+
167+
"""
168+
if dictionary is None:
169+
return None
170+
171+
# Extract variables from the dictionary
172+
event_type = dictionary.get('eventType')
173+
event_time = dictionary.get('eventTime')
174+
account_id = dictionary.get('accountId')
175+
application_id = dictionary.get('applicationId')
176+
mfrom = dictionary.get('from')
177+
to = dictionary.get('to')
178+
direction = dictionary.get('direction')
179+
call_id = dictionary.get('callId')
180+
call_url = dictionary.get('callUrl')
181+
start_time = dictionary.get('startTime')
182+
answer_time = dictionary.get('answerTime')
183+
transfer_caller_id = dictionary.get('transferCallerId')
184+
transfer_to = dictionary.get('transferTo')
185+
cause = dictionary.get('cause')
186+
error_message = dictionary.get('errorMessage')
187+
error_id = dictionary.get('errorId')
188+
end_time = dictionary.get('endTime')
189+
digit = dictionary.get('digit')
190+
parent_call_id = dictionary.get('parentCallId')
191+
recording_id = dictionary.get('recordingId')
192+
duration = dictionary.get('duration')
193+
file_format = dictionary.get('fileFormat')
194+
media_url = dictionary.get('mediaUrl')
195+
tag = dictionary.get('tag')
196+
channels = dictionary.get('channels')
197+
status = dictionary.get('status')
198+
digits = dictionary.get('digits')
199+
terminating_digit = dictionary.get('terminatingDigit')
200+
transcription = Transcription.from_dictionary(dictionary.get('transcription')) if dictionary.get('transcription') else None
201+
diversion = Diversion.from_dictionary(dictionary.get('diversion')) if dictionary.get('diversion') else None
202+
203+
# Return an object of this model
204+
return cls(event_type,
205+
event_time,
206+
account_id,
207+
application_id,
208+
mfrom,
209+
to,
210+
direction,
211+
call_id,
212+
call_url,
213+
start_time,
214+
answer_time,
215+
transfer_caller_id,
216+
transfer_to,
217+
cause,
218+
error_message,
219+
error_id,
220+
end_time,
221+
digit,
222+
parent_call_id,
223+
recording_id,
224+
duration,
225+
file_format,
226+
media_url,
227+
tag,
228+
channels,
229+
status,
230+
digits,
231+
terminating_digit,
232+
transcription,
233+
diversion)

0 commit comments

Comments
 (0)