Skip to content

Commit db79dd6

Browse files
authored
DX-2285 Add answerCall Attribute to Ring BXML (#41)
* Update Ring Verb Add answerCall attribute to <Ring> and update test * add param comment
1 parent 973d49d commit db79dd6

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

bandwidth/tests/test_bxml.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,13 @@ def test_bridge(self):
334334

335335
def test_ring(self):
336336
ring = Ring(
337-
duration=5
337+
duration=5,
338+
answer_call=False
338339
)
339340

340341
response = Response()
341342
response.add_verb(ring)
342-
expected_bxml = '<?xml version="1.0" encoding="UTF-8"?><Response><Ring duration="5"/></Response>'
343+
expected_bxml = '<?xml version="1.0" encoding="UTF-8"?><Response><Ring duration="5" answerCall="False"/></Response>'
343344
assert (response.to_bxml() == expected_bxml)
344345

345346
def test_start_gather(self):

bandwidth/voice/bxml/verbs/ring.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@
1515

1616
class Ring(AbstractBxmlVerb):
1717

18-
def __init__(self, duration):
18+
def __init__(self, duration=None, answer_call=None):
1919
"""
2020
Initializes the Ring class with the duration parameter
2121
2222
:param float duration: The time in seconds to ring
23+
:param boolean answer_call: Whether or not to accept the incoming call while playing the ring
2324
"""
2425
self.duration = duration
26+
self.answer_call = answer_call
2527

2628
def to_bxml(self):
2729
root = etree.Element(RING_TAG)
2830
if self.duration is not None:
2931
root.set("duration", str(self.duration))
32+
if self.answer_call is not None:
33+
root.set("answerCall", str(self.answer_call))
3034
return etree.tostring(root).decode()

0 commit comments

Comments
 (0)