Bridges¶
list_bridges¶
-
Client.
list_bridges
(size=None, **kwargs)¶ Get a list of bridges
Parameters: size (int) – Used for pagination to indicate the size of each page requested for querying a list of items. If no value is specified the default value is 25. (Maximum value 1000) Return type: types.GeneratorType Returns: list of bridges Example: List bridges 1000 at a time:
bridges = api.list_bridges(size=1000) for bridge in bridges: print(bridge["id"]) ## brg-6mv7pi22i ## brg-3emq7olua ## brg-bbufdc7yq ## brg-dvpvd7cuy ## brg-5ws2buzmq
create_bridge¶
-
Client.
create_bridge
(call_ids=None, bridge_audio=None, **kwargs)¶ Create a bridge
Parameters: - bridge_audio (bool) – Enable/Disable two way audio path (default = true)
- call_ids (str) – The first of the call ids in the bridge. If either of the call ids is not provided the bridge is logically created and it can be used to place calls later.
Return type: str
Returns: id of created bridge
Example: Create bridge with 2 calls and audio:
bridge_id = api.create_bridge(call_ids = ['callId1', 'callId2'], bridge_audio = True) print(bridge_id) # brg-123
get_bridge¶
-
Client.
get_bridge
(bridge_id)¶ Gets information about a bridge
Parameters: bridge_id (str) – id of a bridge Return type: dict Returns: bridge information Example: Fetch single bridge by ID:
my_bridge = api.get_bridge('brg-bridgeId') print(my_bridge) ## { 'bridge_audio': True, ## 'calls' : 'https://api.catapult.inetwork.com/v1/users/u-123/bridges/brg-bridgeId/calls', ## 'created_time': '2017-01-26T01:15:09Z', ## 'id' : 'brg-bridgeId', ## 'state' : 'created'} print(my_bridge["state"]) ## created
update_bridge¶
-
Client.
update_bridge
(bridge_id, call_ids=None, bridge_audio=None, **kwargs)¶ Update a bridge
Parameters: - bridge_id (str) – id of a bridge
- bridge_audio (bool) – Enable/Disable two way audio path (default = true)
- call_ids (str) – The first of the call ids in the bridge. If either of the call ids is not provided the bridge is logically created and it can be used to place calls later.
Example: stop bridging audio:
my_bridge = api.get_bridge('brg-bridgeId') print(my_bridge["bridge_audio"]) ## True api.update_bridge(my_bridge['id'], call_ids = ['callId1', 'callId2'], bridge_audio = False) my_bridge = api.get_bridge(my_bridge['id']) print(my_bridge["bridge_audio"]) ## False
list_bridge_calls¶
-
Client.
list_bridge_calls
(bridge_id)¶ Get a list of calls of a bridge
Parameters: bridge_id (str) – id of a bridge Return type: types.GeneratorType Returns: list of calls Example: Fetch all calls that were in a bridge:
call_list = api.get_bridge_calls('bridgeId') print(list(call_list)) ## [ ## { ## "active_time" : "2013-05-22T19:49:39Z", ## "direction" : "out", ## "from" : "{fromNumber}", ## "id" : "{callId1}", ## "bridge_id" : "{bridgeId}", ## "start_time" : "2013-05-22T19:49:35Z", ## "state" : "active", ## "to" : "{toNumber1}", ## "recording_enabled": false, ## "events" : "https://api.catapult.inetwork.com/v1/users/{userId}/calls/{callId1}/events", ## "bridge" : "https://api.catapult.inetwork.com/v1/users/{userId}/bridges/{bridgeId}" ## }, ## { ## "active_time" : "2013-05-22T19:50:16Z", ## "direction" : "out", ## "from" : "{fromNumber}", ## "id" : "{callId2}", ## "bridge_id" : "{bridgeId}", ## "start_time" : "2013-05-22T19:50:16Z", ## "state" : "active", ## "to" : "{toNumber2}", ## "recording_enabled": false, ## "events" : "https://api.catapult.inetwork.com/v1/users/{userId}/calls/{callId2}/events", ## "bridge" : "https://api.catapult.inetwork.com/v1/users/{userId}/bridges/{bridgeId}" ## } ## ]
play_audio_to_bridge¶
-
Client.
play_audio_to_bridge
(bridge_id, file_url=None, sentence=None, gender=None, locale=None, voice=None, loop_enabled=None, **kwargs)¶ Play audio to a bridge
Parameters: - bridge_id (str) – id of a bridge
- file_url (str) – The location of an audio file to play (WAV and MP3 supported).
- sentence (str) – The sentence to speak.
- gender (str) – The gender of the voice used to synthesize the sentence.
- locale (str) – The locale used to get the accent of the voice used to synthesize the sentence.
- voice (str) – The voice to speak the sentence.
- loop_enabled (bool) – When value is true, the audio will keep playing in a loop.
Examples: Play either file for speak sentence:
api.play_audio_to_bridge('bridgeId', file_url='http://host/path/file.mp3') api.play_audio_to_bridge('bridgeId', sentence='Press 0 to complete call', gender='female') # or with extension methods api.play_audio_file_to_bridge('bridgeId', 'http://host/path/file.mp3') api.speak_sentence_to_bridge('bridgeId', 'Hello')