Skip to content

Commit 037cb55

Browse files
committed
Add Connect and Endpoint BXML verbs to the SDK
1 parent e969f88 commit 037cb55

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

bandwidth/models/bxml/verbs/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from .bridge import Bridge
22
from .conference import Conference
3+
from .connect import Connect
34
from .custom_param import CustomParam
5+
from .endpoint import Endpoint
46
from .forward import Forward
57
from .gather import Gather
68
from .hangup import Hangup
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""
2+
connect.py
3+
4+
Bandwidth's Connect BXML verb
5+
6+
@copyright Bandwidth INC
7+
"""
8+
from typing import Union
9+
10+
from ..nestable_verb import NestableVerb
11+
from ..verbs.endpoint import Endpoint
12+
13+
14+
class Connect(NestableVerb):
15+
16+
def __init__(
17+
self, destination: Union[Endpoint, None] = None,
18+
event_callback_url: str = None
19+
):
20+
"""Initialize a <Connect> verb
21+
22+
Args:
23+
destination (Endpoint, optional): The endpoint destination to connect to. Defaults to None.
24+
event_callback_url (str, optional): URL to send events to for this Connect verb. Defaults to None.
25+
"""
26+
self.destination = destination
27+
self.event_callback_url = event_callback_url
28+
29+
nested_verbs = []
30+
if destination is not None:
31+
nested_verbs.append(destination)
32+
33+
super().__init__(
34+
tag="Connect",
35+
nested_verbs=nested_verbs
36+
)
37+
38+
@property
39+
def _attributes(self):
40+
return {
41+
"eventCallbackUrl": self.event_callback_url
42+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
endpoint.py
3+
4+
Bandwidth's Endpoint BXML verb (used within Connect)
5+
6+
@copyright Bandwidth INC
7+
"""
8+
from ..verb import Verb
9+
10+
11+
class Endpoint(Verb):
12+
13+
def __init__(self, endpoint_id: str):
14+
"""Initialize an <Endpoint> verb
15+
16+
Args:
17+
endpoint_id (str): The ID of the endpoint to connect to.
18+
"""
19+
self.endpoint_id = endpoint_id
20+
super().__init__(
21+
tag="Endpoint",
22+
content=endpoint_id
23+
)
24+
25+
@property
26+
def _attributes(self):
27+
return None

0 commit comments

Comments
 (0)