Reputation: 471
I am converting an application I created in C# that uses Google text-to-speech (gTTS) to play a message over a PA system. The telephone system is migrating to a cloud based Cisco WebEx architecture. I am trying to use the WebEx API to accomplish this task, but I am unable to figure out how to do so. What I need to do is place a call to an extension and when the recipient (in this case the PA system) picks up, to play the sound and then hangup. Is this even possible using solely WebEx API endpoints?
I have attempted to use https://webexapis.com/v1/telephony/calls/actions/playsound/invoke, but it appears that this may not even exist and the documentation I found on it is incorrect. Here is some sample Python code I tried with this endpoint outside of my C# application.
def play_wav_to_extension(extension, wav_file_url):
url = f"{WEBEX_BASE_URL}/telephony/calls/actions/playsound/invoke"
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json"
}
payload = {
"extension": extension,
"soundUrl": wav_file_url
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
I have also attempted to do https://webexapis.com/v1/telephony/calls/dial to place a call and attach a playbackUrl as part of the data being passed through the API, but also no success. Here is some sample Python code I tried outside of my application.
def initiate_call(destination, audio_url):
url = f"{base_url}/telephony/calls/dial"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
data = {
"destination": destination,
"mediaType": "AUDIO",
"playbackUrl": audio_url
}
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
call_id = response.json().get("callId")
print(f"Call initiated. Call ID: {call_id}")
return call_id
Any help on how I might be able to do this would be greatly appreciated. If there is no way to use solely WebEx APIs to accomplish this but there are third party alternatives such as Twilio, I am open to suggestions.
Upvotes: -1
Views: 50
Reputation: 471
After working with Cisco WebEx Tech Support, it was deemed that being able to inject audio into a call in this manner using this or any APIs is not possible.
Upvotes: 0