Skip to content

Commit 7835aaa

Browse files
Merge branch 'DX-2897' into DX-2895
2 parents 1051f72 + 4b44c49 commit 7835aaa

24 files changed

+521
-14
lines changed

bandwidth/model/bxml/verbs/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@
77
from .phone_number import PhoneNumber
88
from .play_audio import PlayAudio
99
from .record import Record
10+
from .ring import Ring
11+
from .send_dtmf import SendDtmf
1012
from .sip_uri import SipUri
1113
from .speak_sentence import SpeakSentence
14+
from .start_gather import StartGather
1215
from .start_recording import StartRecording
16+
from .start_stream import StartStream
17+
from .stop_gather import StopGather
18+
from .stop_stream import StopStream
1319
from .stop_recording import StopRecording
20+
from .stream_param import StreamParam
1421
from .tag import Tag
1522
from .transfer import Transfer

bandwidth/model/bxml/verbs/forward.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class Forward(TerminalVerb):
1212

1313
def __init__(
14-
self, to: str=None, from_: str=None,
14+
self, to: str=None, _from: str=None,
1515
call_timeout: str=None, diversion_treatment: str=None,
1616
diversion_reason: str=None, uui: str=None
1717
):
@@ -47,18 +47,19 @@ def __init__(
4747
This value, including the encoding specifier, may not exceed 256 characters.
4848
"""
4949
self.to = to
50-
self.from_ = from_
50+
self._from = _from
5151
self.call_timeout = call_timeout
5252
self.diversion_treatment = diversion_treatment
5353
self.diversion_reason = diversion_reason
5454
self.uui = uui
5555

56-
super().__init__(tag="Forward", content=None)
56+
super().__init__(tag="Forward")
57+
5758
@property
5859
def _attributes(self):
5960
return {
6061
"to": self.to,
61-
"from_": self.from_,
62+
"_from": self._from,
6263
"callTimeout": self.call_timeout,
6364
"diversionTreatment": self.diversion_treatment,
6465
"diversionReason": self.diversion_reason,

bandwidth/model/bxml/verbs/gather.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def __init__(
6565
self.audio_verbs = audio_verbs
6666
super().__init__(
6767
tag="Gather",
68-
content=None,
6968
nested_verbs=self.audio_verbs)
7069

7170
@property

bandwidth/model/bxml/verbs/hangup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ def __init__(self):
1616
Args:
1717
None
1818
"""
19-
super().__init__(tag="Hangup", content=None)
19+
super().__init__(tag="Hangup")

bandwidth/model/bxml/verbs/pause.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
pause.py
3+
34
Bandwidth's Pause BXML verb
5+
46
@copyright Bandwidth INC
57
"""
68
from ..terminal_verb import TerminalVerb
@@ -12,7 +14,8 @@ def __init__(self, duration:str=None):
1214
"""
1315
self.duration = duration
1416

15-
super().__init__(tag="Pause", content=None)
17+
super().__init__(tag="Pause")
18+
1619
@property
1720
def _attributes(self):
1821
return {

bandwidth/model/bxml/verbs/pause_recording.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ class PauseRecording(TerminalVerb):
1313
def __init__(self):
1414
"""Initialize a <PauseRecording> verb
1515
"""
16-
super().__init__(tag="PauseRecording", content=None)
16+
super().__init__(tag="PauseRecording")

bandwidth/model/bxml/verbs/ring.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
ring.py
3+
4+
Bandwidth's Ring BXML verb
5+
6+
@copyright Bandwidth INC
7+
"""
8+
from ..terminal_verb import TerminalVerb
9+
10+
11+
class Ring(TerminalVerb):
12+
13+
def __init__(
14+
self, duration: str = None,
15+
answer_call: str = None,
16+
):
17+
"""Initialize a <Ring> verb
18+
19+
Args:
20+
duration (str, optional): How many seconds to play ringing on the call. Default value is 5. Range: decimal values between 0.1 - 86400.
21+
answer_call (str, optional): A boolean indicating whether or not to answer the call when Ring is executed on an unanswered incoming call. Default value is 'true'.
22+
"""
23+
self.duration = duration
24+
self.answer_call = answer_call
25+
super().__init__(tag="Ring")
26+
27+
@property
28+
def _attributes(self):
29+
return {
30+
"duration": self.duration,
31+
"answerCall": self.answer_call,
32+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
send_dtmf.py
3+
4+
Bandwidth's SendDtmf BXML verb
5+
6+
@copyright Bandwidth INC
7+
"""
8+
from ..terminal_verb import TerminalVerb
9+
10+
11+
class SendDtmf(TerminalVerb):
12+
13+
def __init__(
14+
self, digits: str,
15+
tone_duration: str=None,
16+
tone_interval: str=None,
17+
):
18+
"""Initialize a <SendDtmf> verb
19+
20+
Args:
21+
digits (str): String containing the DTMF characters to be sent in a call. Allows a maximum of 50 characters. The digits will be sent one-by-one with a marginal delay.
22+
tone_duration (str, optional): The length (in milliseconds) of each DTMF tone. Default value is 200. Range: decimal values between 50 - 5000.
23+
tone_interval (str, optional): The duration of silence (in milliseconds) following each DTMF tone. Default value is 400. Range: decimal values between 50 - 5000.
24+
"""
25+
self.digits = digits
26+
self.tone_duration = tone_duration
27+
self.tone_interval = tone_interval
28+
super().__init__(
29+
tag="SendDtmf",
30+
content=self.digits
31+
)
32+
33+
@property
34+
def _attributes(self):
35+
return {
36+
"toneDuration": self.tone_duration,
37+
"toneInterval": self.tone_interval
38+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""
2+
start_gather.py
3+
4+
Bandwidth's StartGather BXML verb
5+
6+
@copyright Bandwidth INC
7+
"""
8+
from ..terminal_verb import TerminalVerb
9+
10+
11+
class StartGather(TerminalVerb):
12+
13+
def __init__(
14+
self, dtmf_url: str, dtmf_method: str=None, username: str=None,
15+
password: str=None, tag: str=None,
16+
):
17+
"""Initialize a <StartGather> verb
18+
19+
Args:
20+
dtmf_url (str): URL to send the DTMF event to. May be a relative URL..
21+
dtmf_method (str, optional): The HTTP method to use for the request to dtmfUrl. GET or POST. Default value is POST. Defaults to None.
22+
username (str, optional): The username to send in the HTTP request to dtmfUrl. Defaults to None.
23+
password (str, optional): The password to send in the HTTP request to dtmfUrl. Defaults to None.
24+
tag (str, optional): A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None.
25+
"""
26+
self.dtmf_url = dtmf_url
27+
self.dtmf_method = dtmf_method
28+
self.username = username
29+
self.password = password
30+
self.tag = tag
31+
super().__init__(
32+
tag="StartGather"
33+
)
34+
35+
@property
36+
def _attributes(self):
37+
return {
38+
"dtmfUrl": self.dtmf_url,
39+
"dtmfMethod": self.dtmf_method,
40+
"username": self.username,
41+
"password": self.password,
42+
"tag": self.tag
43+
}

bandwidth/model/bxml/verbs/start_recording.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(
4343
self.tag = tag
4444
self.file_format = file_format
4545
self.multi_channel = multi_channel
46-
super().__init__(tag="StartRecording", content=None)
46+
super().__init__(tag="StartRecording")
4747

4848
@property
4949
def _attributes(self):

0 commit comments

Comments
 (0)