if the first one works but just calls the parties in reverse, just swap them On Monday, May 9, 2016, Gabriel Bustos <gabriel@pinaculo.com.br> wrote:
Hello,
I'm trying to implement a callback (for specific numbers) in my project.
What I need to do is hangup the incoming call and return to that number. What I tried is this:
<action application="set" data="api_hangup_hook=originate user/${redirect_to} &bridge(gsmopen/ANY/${number})"/>
Actually this works (sort of), it originates a call in softphone and when I answer the softphone the call to destination number is made.
BUT what I need is to call to destination number and bridge to softphone when the call is answered. And here is where I'm having problems.
My last attempt was calling a lua script who fires a custom event, like this:
<action application="set" data="api_hangup_hook=${lua(websip/teste.lua ${caller_id_number})}"/>
teste.lua: function fireEvent() local event = freeswitch.Event("CUSTOM", "Gateway::Callback") event:addHeader("My-Header", "test") event:addBody("EventTest") session:sendEvent(event) --event:fire(); end fireEvent()
Ok, the event is fired as I can see in CLI but I think the event hook doesn't work.
This is the line from lua.conf: <hook envent="CUSTOM" subclass="Gateway::Callback" script="testecallback.lua"/>
Can you help me telling me if I'm the right path or if there's a better way to do that?
Thanks in advance.