[Freeswitch-users] Dynamic return call (callback)

Gabriel Bustos gabriel at pinaculo.com.br
Mon May 9 22:04:31 MSD 2016


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160509/b98ff86d/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list