Conferences¶
create_conference¶
-
Client.
create_conference
(from_, callback_url=None, callback_timeout=None, callback_http_method=None, fallback_url=None, tag=None, **kwargs)¶ Create a conference
Parameters: - from_ (str) – The phone number that will host the conference (required)
- callback_url (str) – The full server URL where the conference events related to the Conference will be sent
- callback_timeout (str) – Determine how long should the platform wait for callbackUrl’s response before timing out in milliseconds.
- callback_http_method (str) – Determine if the callback event should be sent via HTTP GET or HTTP POST. Values are “GET” or “POST” (if not set the default is POST).
- fallback_url (str) – The full server URL used to send the callback event if the request to callbackUrl fails or timesout
- tag (str) – A string that will be included in the callback events of the conference.
Return type: str
Returns: id of created conference
Example: create simple conference:
conference_id = api.create_conference('+12018994444') print(conference_id) ## conf-ixaagbn5wcyskisiy
Example: create conference with extra parameters:
conference_id = api.create_conference(from_ = "+12018994444", callback_url = "http://google.com", callback_timeout= 2000, fallback_url = "http://yahoo.com") print(conference_id) ## conf-ixaagbn5wcyskisiy my_conf = api.get_conference(conference_id) print(my_conf) ## { 'active_members' : 0, ## 'callback_http_method': 'post', ## 'callback_timeout' : 2000, ## 'callback_url' : 'http://google.com', ## 'created_time' : '2017-01-26T01:58:59Z', ## 'fallback_url' : 'http://yahoo.com', ## 'from' : '+12018994444', ## 'hold' : False, ## 'id' : 'conf-ixaagbn5wcyskisiy', ## 'mute' : False, ## 'state' : 'created'}
get_conference¶
-
Client.
get_conference
(conference_id)¶ Get information about a conference
Parameters: conference_id (str) – id of a conference Return type: dict Returns: conference information Example: Create then fetch conference:
conference_id = api.create_conference(from_ = "+12018994444", callback_url = "http://google.com", callback_timeout= 2000, fallback_url = "http://yahoo.com") print(conference_id) ## conf-ixaagbn5wcyskisiy my_conf = api.get_conference(conference_id) print(my_conf) ## { 'active_members' : 0, ## 'callback_http_method': 'post', ## 'callback_timeout' : 2000, ## 'callback_url' : 'http://google.com', ## 'created_time' : '2017-01-26T01:58:59Z', ## 'fallback_url' : 'http://yahoo.com', ## 'from' : '+12018994444', ## 'hold' : False, ## 'id' : 'conf-ixaagbn5wcyskisiy', ## 'mute' : False, ## 'state' : 'created'}
update_conference¶
-
Client.
update_conference
(conference_id, state=None, mute=None, hold=None, callback_url=None, callback_timeout=None, callback_http_method=None, fallback_url=None, tag=None, **kwargs)¶ Update a conference
Parameters: - conference_id (str) – id of a conference
- state (str) – Conference state. Possible state values are: “completed” to terminate the conference.
- mute (str) – If “true”, all member can’t speak in the conference. If “false”, all members can speak in the conference
- hold (str) – If “true”, all member can’t hear or speak in the conference. If “false”, all members can hear and speak in the conference
- callback_url (str) – The full server URL where the conference events related to the conference will be sent
- callback_timeout (str) – Determine how long should the platform wait for callbackUrl’s response before timing out in milliseconds.
- callback_http_method (str) – Determine if the callback event should be sent via HTTP GET or HTTP POST. Values are “GET” or “POST” (if not set the default is POST).
- fallback_url (str) – The full server URL used to send the callback event if the request to callbackUrl fails.
- tag (str) – A string that will be included in the callback events of the conference.
Example: End conference:
api.update_conference('conferenceId', state='completed')
play_audio_to_conference¶
-
Client.
play_audio_to_conference
(conference_id, file_url=None, sentence=None, gender=None, locale=None, voice=None, loop_enabled=None, **kwargs)¶ Play audio to a conference
Parameters: - conference_id (str) – id of a conference
- 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 (str) – When value is true, the audio will keep playing in a loop.
Example: Play audio file to conference:
api.play_audio_to_conference('conferenceId', file_url='http://host/path/file.mp3')
Example: Speak Sentence to conference:
api.play_audio_to_conference('conferenceId', sentence='Press 0 to complete call', gender='female')
Example: Use Extensions methods:
# or with extension methods api.play_audio_file_to_conference('conferenceId', 'http://host/path/file.mp3') api.speak_sentence_to_conference('conferenceId', 'Hello')
list_conference_members¶
-
Client.
list_conference_members
(conference_id)¶ Get a list of members of a conference
Parameters: conference_id (str) – id of a conference Return type: types.GeneratorType Returns: list of recordings Example: Fetch and list conference members:
my_conf_id = api.create_conference(from_='+19192223333') print(my_conf) # conf-confId my_call_id = api.create_call(from_='+19192223333', to='+19192223334', conference_id= 'conf-confId') print(my_call_id) # c-callId my_conf_member_id = api.create_conference_member(my_conf_id, call_id=my_call_id) print(my_conf_member_id) # member-memberId my_conference_members = list_conference_members(my_conf_id) print(list(my_conference_members)) ## [ ## { ## 'added_time' :'2017-01-30T22:01:11Z', ## 'call' :'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId', ## 'hold' :False, ## 'id' :'member-memberId', ## 'join_tone' :False, ## 'leaving_tone':False, ## 'mute' :False, ## 'removed_time':'2017-01-30T22:01:21Z', ## 'state' :'completed' ## } ## ]
create_conference_member¶
-
Client.
create_conference_member
(conference_id, call_id=None, join_tone=None, leaving_tone=None, mute=None, hold=None, **kwargs)¶ Create a conference member for a conference
Parameters: - conference_id (str) – id of a conference
- call_id (str) – The callId must refer to an active call that was created using this conferenceId (required)
- join_tone (bool) – If “true”, will play a tone when the member joins the conference. If “false”, no tone is played when the member joins the conference.
- leaving_tone (bool) – If “true”, will play a tone when the member leaves the conference. If “false”, no tone is played when the member leaves the conference.
- mute (bool) – If “true”, member can’t speak in the conference. If “false”, this members can speak in the conference (unless set at the conference level).
- hold (bool) – If “true”, member can’t hear or speak in the conference. If “false”, member can hear and speak in the conference (unless set at the conference level).
Return type: str
Returns: id of create of conference member
Example: Create Conference and add member:
my_conf_id = api.create_conference(from_='+19192223333') print(my_conf) # conf-confId my_call_id = api.create_call(from_='+19192223333', to='+19192223334', conference_id= 'conf-confId') print(my_call_id) # c-callId my_conf_member_id = api.create_conference_member(my_conf_id, call_id=my_call_id, join_tone=True) print(my_conf_member_id) # member-memberId my_conf_member = api.get_conference_member(my_conf_id, my_member_id) print(my_conf_member) ## { ## 'added_time': '2017-01-30T22:01:11Z', ## 'call' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId', ## 'hold' : False, ## 'id' : 'member-memberId', ## 'join_tone' : False, ## 'leaving_tone' : False, ## 'mute' : False, ## 'removed_time' : '2017-01-30T22:01:21Z', ## 'state' : 'completed' ## }
get_conference_member¶
-
Client.
get_conference_member
(conference_id, member_id)¶ Get a conference member
Parameters: - conference_id (str) – id of a conference
- member_id (str) – id of a member
Return type: dict
Returns: data of conference member
Example: Create Conference and add member:
my_conf_id = api.create_conference(from_='+19192223333') print(my_conf) # conf-confId my_call_id = api.create_call(from_='+19192223333', to='+19192223334', conference_id= 'conf-confId') print(my_call_id) # c-callId my_conf_member_id = api.create_conference_member(my_conf_id, call_id=my_call_id, join_tone=True) print(my_conf_member_id) # member-memberId my_conf_member = api.get_conference_member(my_conf_id, my_member_id) print(my_conf_member) ## { ## 'added_time': '2017-01-30T22:01:11Z', ## 'call' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId', ## 'hold' : False, ## 'id' : 'member-memberId', ## 'join_tone' : True, ## 'leaving_tone' : False, ## 'mute' : False, ## 'removed_time' : '2017-01-30T22:01:21Z', ## 'state' : 'active' ## }
update_conference_member¶
-
Client.
update_conference_member
(conference_id, member_id, join_tone=None, leaving_tone=None, mute=None, hold=None, **kwargs)¶ Update a conference member
Parameters: - conference_id (str) – id of a conference
- member_id (str) – id of a conference member
- join_tone (bool) – If “true”, will play a tone when the member joins the conference. If “false”, no tone is played when the member joins the conference.
- leaving_tone (bool) – If “true”, will play a tone when the member leaves the conference. If “false”, no tone is played when the member leaves the conference.
- mute (bool) – If “true”, member can’t speak in the conference. If “false”, this members can speak in the conference (unless set at the conference level).
- hold (bool) – If “true”, member can’t hear or speak in the conference. If “false”, member can hear and speak in the conference (unless set at the conference level).
Example: update conference member:
my_conf_id = api.create_conference(from_='+19192223333') print(my_conf) # conf-confId my_call_id = api.create_call(from_='+19192223333', to='+19192223334', conference_id= 'conf-confId') print(my_call_id) # c-callId my_conf_member_id = api.create_conference_member(my_conf_id, call_id=my_call_id, join_tone=True) print(my_conf_member_id) # member-memberId my_conf_member = api.get_conference_member(my_conf_id, my_member_id) print(my_conf_member) ## { ## 'added_time': '2017-01-30T22:01:11Z', ## 'call' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId', ## 'hold' : False, ## 'id' : 'member-memberId', ## 'join_tone' : True, ## 'leaving_tone' : False, ## 'mute' : False, ## 'removed_time' : '2017-01-30T22:01:21Z', ## 'state' : 'active' ## } api.update_conference_member(my_conf_id, my_member_id, mute=True, hold=True) my_conf = api.get_conference_member(my_member_id) ## { ## 'added_time': '2017-01-30T22:01:11Z', ## 'call' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId', ## 'hold' : True, ## 'id' : 'member-memberId', ## 'join_tone' : True, ## 'leaving_tone' : False, ## 'mute' : True, ## 'removed_time' : '2017-01-30T22:01:21Z', ## 'state' : 'active' ## }
play_audio_to_conference_member¶
-
Client.
play_audio_to_conference_member
(conference_id, member_id, file_url=None, sentence=None, gender=None, locale=None, voice=None, loop_enabled=None, **kwargs)¶ Play audio to a conference member
Parameters: - conference_id (str) – id of a conference
- member_id (str) – id of a conference member
- 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 (str) – When value is true, the audio will keep playing in a loop.
Example: Play audio to specific conference member:
api.play_audio_to_conference_member('conferenceId', 'memberId', file_url='http://host/path/file.mp3') api.play_audio_to_conference_member('conferenceId', 'memberId', sentence='Press 0 to complete call', gender='female') # or with extension methods api.play_audio_file_to_conference_member('conferenceId', 'memberId', 'http://host/path/file.mp3') api.speak_sentence_to_conference_member('conferenceId', 'memberId', 'Hello')
speak_sentence_to_conference_member¶
-
Client.
speak_sentence_to_conference_member
(conference_id, member_id, sentence, gender='female', voice='susan', locale='en_US', tag=None)¶ Speak sentence to a conference member
Parameters: - conference_id (str) – id of a conference
- member_id (str) – id of a conference member
- sentence (str) – sentence to say
- gender (str) – gender of voice
- voice (str) – voice name
- locale (str) – locale name
- tag (str) – A string that will be included in the callback events of the call.
Example: Speak sentence to specific conference member:
api.speak_sentence_to_conference_member('conferenceId', 'memberId', 'Hello')
play_audio_file_to_conference_member¶
-
Client.
play_audio_file_to_conference_member
(conference_id, member_id, file_url, tag=None)¶ Play audio file to a conference member
Parameters: - conference_id (str) – id of a conference
- member_id (str) – id of a conference member
- file_url (str) – URL to remote file to play
- tag (str) – A string that will be included in the callback events of the call.
Example: Play an audio file to specific member:
api.play_audio_file_to_conference_member('conferenceId', 'memberId', 'http://host/path/file.mp3')
remove_conference_member¶
-
Client.
remove_conference_member
(conference_id, member_id)¶ Remove a conference member
Parameters: - conference_id (str) – id of a conference
- member_id (str) – id of a conference member
Example: Remove Member from Conference:
my_conf = api.get_conference('conferenceId') my_conf_members = list(api.list_conference_members(my_conf['id'])) print(my_conf_members) ## [{ 'added_time' : '2017-01-30T23:17:11Z', ## 'call' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId', ## 'hold' : False, ## 'id' : 'member-memberId', ## 'join_tone' : False, ## 'leaving_tone': False, ## 'mute' : False, ## 'state' : 'active'}, ## { 'added_time' : '2017-01-30T23:17:14Z', ## 'call' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId2', ## 'hold' : False, ## 'id' : 'member-memberId2', ## 'join_tone' : False, ## 'leaving_tone': False, ## 'mute' : False, ## 'state' : 'active'}] api.remove_conference_member(my_conf['id'], my_conf_members[1]['id']) my_conf_members = list(api.list_conference_members(my_conf['id'])) print(my_conf_members) ## [{ 'added_time' : '2017-01-30T23:17:11Z', ## 'call' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId', ## 'hold' : False, ## 'id' : 'member-memberId', ## 'join_tone' : False, ## 'leaving_tone': False, ## 'mute' : False, ## 'state' : 'active'}, ## { 'added_time' : '2017-01-30T23:17:14Z', ## 'call' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/calls/c-callId2', ## 'hold' : False, ## 'id' : 'member-memberId2', ## 'join_tone' : False, ## 'leaving_tone': False, ## 'mute' : False, ## 'state' : 'completed'}]
hold_conference_member¶
-
Client.
hold_conference_member
(conference_id, member_id, hold)¶ Hold or unhold a conference member
Parameters: - conference_id (str) – id of a conference
- member_id (str) – id of a conference member
- hold (bool) – hold (if true) or unhold (if false) a member
Example: Put specific conference member on hold:
api.hold_conference_member('conferenceId', 'memberId', True)
mute_conference_member¶
-
Client.
mute_conference_member
(conference_id, member_id, mute)¶ Mute or unmute a conference member
Parameters: - conference_id (str) – id of a conference
- member_id (str) – id of a conference member
- mute (bool) – mute (if true) or unmute (if false) a member
Example: Mute specific conference member:
api.mute_conference_member('conferenceId', 'memberId', True)
terminate_conference¶
-
Client.
terminate_conference
(conference_id)¶ Terminate of current conference
Parameters: conference_id (str) – id of a conference Example: End the Conference:
api.terminate_conference('conferenceId')
hold_conference¶
-
Client.
hold_conference
(conference_id, hold)¶ Hold or unhold a conference
Parameters: - conference_id (str) – id of a conference
- hold (bool) – hold (if true) or unhold (if false) a conference
Example: Put entire confernce on hold, where no one can hear:
api.hold_conference('conferenceId', True)
mute_conference¶
-
Client.
mute_conference
(conference_id, mute)¶ Mute or unmute a conference
Parameters: - conference_id (str) – id of a conference
- mute (bool) – mute (if true) or unmute (if false) a conference
Example: Mute the entire Conference, where no one can speak:
api.mute_conference('conferenceId', True)