EvoluxBR/greenswitch

Generate a call with specific audio

rodrigomartins806 opened this issue · 4 comments

Hello, I need to generate a call via code and when the person answers I will play an audio, would this be possible with this library?

Hi @rodrigomartins806 , yes it's possible. Something like:

fs = greenswitch.InboundESL(host='127.0.0.1', port=8021, password='ClueCon')
fs.connect()
r = fs.send('api originate sofia/gateway/mygw/123456789 &playback(mysound.wav)')
print(r.data)

@italorossi , one last question, is the library I have to import the one installed by freeswitch itself or do I have to install it from somewhere else?

You only need Python and greenswitch, once you have Python installed you can pip install greenswitch and try the example code.

One last query, I put together the code below, I saw that the library call is ok, however when I run the code I get the following return: -ERR NORMAL_TEMPORARY_FAILURE, I'm trying to make a call to an internal extension and when it answers it should play the audio, I'm logged in to the extension but nothing happens, do I have to enter any more parameters when it is an internal call?

import greenswitch


fs = greenswitch.InboundESL(host='127.0.0.1', port=8021, password='ClueCon')
fs.connect()
r = fs.send('api originate sofia/internal/200@server1.mtic.dev  &playback(testeaudio.wav)')
print(r.data)