[Freeswitch-users] Originate and bridge with lua

Michael Collins msc at freeswitch.org
Wed Feb 18 13:09:26 PST 2009


On Wed, Feb 18, 2009 at 11:53 AM, Nik Middleton
<nik.middleton at noblesolutions.co.uk> wrote:
> I'm trying to build an emergency broadcasting solution.
>
> So I place a call, and have ivr in the lua script.  But I also want to
> give them the option of speaking to someone.
>
> If they hit the option to speak to someone, while I can fire an event to
> originate a call, I'm not sure how I could bridge the 2 call legs.
>
> Regards,

So really, it's just an outbound IVR, no? Just for a specific purpose.

I would recommend using the event socket and bgapi originate commands
from a central program/script/controller thingy. Generate the calls
and then drop them into a dialplan or script that controls them. I
like to use the dialpan but it really does not matter. Using a script
lets you make changes without doing a reloadxml command.

In any case, your originate commands could be something like this:

bgapi originate
{myvar='myval',myvar2='myval2'}sofia/gateway/mygateway/user at domain
5555

Have extension 5555 do the gruntwork of confirming that you actually
had a successful call, got a human on the line, etc. It can also
handle failures that are not handled by the originate itself. (Depends
on whether or not you ignore early media.) In any case, you've got a
single dp entry that handles the mundane call handling. Then, if there
is a human on the line, you can do something like this:

<action application="lua" data="ivr_start.lua ${myval} ${myval2}"/>

Now you can write a plain Lua script that only has to handle the
delivery of the message. You can handle a DTMF event and the callback
function could use session:execute("bridge","agent") to connect the
called party with your agent.

Hope that helps.
-MC



More information about the Freeswitch-users mailing list