|
| 1 | +""" |
| 2 | +startGather.py |
| 3 | +
|
| 4 | +Representation of Bandwidth's startGather BXML verb |
| 5 | +
|
| 6 | +@copyright Bandwidth INC |
| 7 | +""" |
| 8 | + |
| 9 | +from lxml import etree |
| 10 | + |
| 11 | +from .base_verb import AbstractBxmlVerb |
| 12 | + |
| 13 | +START_GATHER_TAG = "StartGather" |
| 14 | + |
| 15 | + |
| 16 | +class StartGather(AbstractBxmlVerb): |
| 17 | + |
| 18 | + def __init__(self, dtmfUrl=None, dtmfMethod=None, username=None, password=None, tag=None): |
| 19 | + """ |
| 20 | + Initializes the Gather class with the following parameters |
| 21 | +
|
| 22 | + :param str dtmfUrl: The url to receive the dtmf event |
| 23 | + :param str dtmfMethod: The HTTP method used to send the gather dtmfUrl event |
| 24 | + :param str username: The username for callback http authentication |
| 25 | + :param str password: The password for callback http authentication |
| 26 | + :param str tag: |
| 27 | + """ |
| 28 | + |
| 29 | + self.dtmfUrl = dtmfUrl |
| 30 | + self.dtmfMethod = dtmfMethod |
| 31 | + self.username = username |
| 32 | + self.password = password |
| 33 | + self.tag = tag |
| 34 | + |
| 35 | + def to_bxml(self): |
| 36 | + root = etree.Element(START_GATHER_TAG) |
| 37 | + if self.dtmfUrl is not None: |
| 38 | + root.set("dtmfUrl", self.dtmfUrl) |
| 39 | + if self.dtmfMethod is not None: |
| 40 | + root.set("dtmfMethod", self.dtmfMethod) |
| 41 | + if self.username is not None: |
| 42 | + root.set("username", self.username) |
| 43 | + if self.password is not None: |
| 44 | + root.set("password", self.password) |
| 45 | + if self.tag is not None: |
| 46 | + root.set("tag", self.tag) |
| 47 | + return etree.tostring(root).decode() |
0 commit comments