8000 - add support for Conference noun · kevindias/twilio-python@79cdec8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 79cdec8

Browse files
author
phy
committed
- add support for Conference noun
1 parent 2ce43ff commit 79cdec8

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

twilio.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
OTHER DEALINGS IN THE SOFTWARE.
2424
"""
2525

26-
__VERSION__ = "2.0.0"
26+
__VERSION__ = "2.0.1"
2727

2828
import urllib, urllib2, base64, hmac
2929
from hashlib import sha1
@@ -322,12 +322,36 @@ def __init__(self, action=None, method=None, numDigits=None, timeout=None,
322322
class Number(Verb):
323323
"""Specify phone number in a nested Dial element.
324324
325+
number: phone number to dial
325326
sendDigits: key to press after connecting to the number
326327
"""
327328
def __init__(self, number, sendDigits=None, **kwargs):
328329
Verb.__init__(self, sendDigits=sendDigits, **kwargs)
329330
self.body = number
330331

332+
class Conference(Verb):
333+
"""Specify conference in a nested Dial element.
334+
335+
name: friendly name of conference
336+
muted: keep this participant muted (bool)
337+
beep: play a beep when this participant enters/leaves (bool)
338+
startConferenceOnEnter: start conf when this participants joins (bool)
339+
endConferenceOnExit: end conf when this participants leaves (bool)
340+
waitUrl: TwiML url that executes before conference starts
341+
waitMethod: HTTP method for waitUrl GET/POST
342+
"""
343+
GET = 'GET'
344+
POST = 'POST'
345+
346+
def __init__(self, name, muted=None, beep=None,
347+
startConferenceOnEnter=None, endConferenceOnExit=None, waitUrl=None,
348+
waitMethod=None, **kwargs):
349+
Verb.__init__(self, muted=muted, beep=beep, **kwargs)
350+
if waitMethod and (waitMethod != self.GET and waitMethod != self.POST):
351+
raise TwilioException( \
352+
"Invalid waitMethod parameter, must be GET or POST")
353+
self.body = name
354+
331355
class Dial(Verb):
332356
"""Dial another phone number and connect it to this call
333357
@@ -339,7 +363,7 @@ class Dial(Verb):
339363

340364
def __init__(self, number=None, action=None, method=None, **kwargs):
341365
Verb.__init__(self, action=action, method=method, **kwargs)
342-
self.nestables = ['Number']
366+
self.nestables = ['Number', 'Conference']
343367
if number and len(number.split(',')) > 1:
344368
for n in number.split(','):
345369
self.append(Number(n.strip()))

0 commit comments

Comments
 (0)
0