3
3
"""
4
4
5
5
import xml .etree .ElementTree as ET
6
- from six import u
7
-
6
+ from six import iteritems
8
7
9
8
class TwimlException (Exception ):
10
9
pass
@@ -390,7 +389,7 @@ class Dial(Verb):
390
389
"""
391
390
GET = 'GET'
392
391
POST = 'POST'
393
- nestables = ['Number' , 'Conference' , 'Client' , 'Queue' ]
392
+ nestables = ['Number' , 'Conference' , 'Client' , 'Queue' , 'Sip' ]
394
393
395
394
def __init__ (self , number = None , ** kwargs ):
396
395
super (Dial , self ).__init__ (** kwargs )
@@ -412,6 +411,9 @@ def conference(self, name, **kwargs):
412
411
def queue (self , name , ** kwargs ):
413
412
return self .append (Queue (name , ** kwargs ))
414
413
414
+ def sip (self , sip_address = None , ** kwargs ):
415
+ return self .append (Sip (sip_address , ** kwargs ))
416
+
415
417
def addNumber (self , * args , ** kwargs ):
416
418
return self .number (* args , ** kwargs )
417
419
@@ -472,3 +474,31 @@ class Record(Verb):
472
474
"""
473
475
GET = 'GET'
474
476
POST = 'POST'
477
+
478
+
479 + class Sip (Verb ):
480
+ """Dial out to a SIP endpoint
481
+
482
+ :param url: call screening URL none
483
+ :param method: call screening method POST
484
+ :param username: Username for SIP authentication
485
+ :param password: Password for SIP authentication
486
+ """
487
+ nestables = ['Headers' , 'Uri' ]
488
+
489
+ def __init__ (self , sip_address = None , ** kwargs ):
490
+ super (Sip , self ).__init__ (** kwargs )
491
+ if sip_address :
492
+ self .body = sip_address
493
+
494
+ def uri (self , uri , ** kwargs ):
495
+ return self .append (Uri (uri , ** kwargs ))
496
+
497
+
498
+ class Uri (Verb ):
499
+ """A uniform resource indentifier"""
500
+ def __init__ (self , uri , ** kwargs ):
501
+ super (Uri , self ).__init__ (** kwargs )
502
+ self .body = uri
503
+
504
+
0 commit comments