EvoluxBR / greenswitch

Battle proven FreeSWITCH Event Socket Protocol client implementation with Gevent
Other
126 stars 50 forks source link

Generate a call with specific audio #87

Closed rodrigomartins806 closed 1 year ago

rodrigomartins806 commented 1 year ago

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?

italorossi commented 1 year ago

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)
rodrigomartins806 commented 1 year ago

@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?

italorossi commented 1 year ago

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

rodrigomartins806 commented 1 year ago

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)