[Freeswitch-users] Running a session asynchronously from a Lua script

Adam Wilt wiltingtree at gmail.com
Thu Feb 4 19:49:36 PST 2010


Brian,

Thanks for the reply.
The problem is I don't want the two parties to speak to each other. I want
one party to wait on hold while the system interacts with the other party.
Then the system will hang-up on the second party and start interacting with
the first party again.

Thanks,
Adam


On Thu, Feb 4, 2010 at 10:23 PM, Brian West <brian at freeswitch.org> wrote:

> I wouldn't do it like that...
>
> I would let FreeSWITCH do what its good at and stop trying to create and
> manage sessions manually.
>
> -- You can optionally answer but you need to set transfer_ringback instead
> of ringback.
> session:setVariable("ringback", "local_stream://moh");
>
>
> session:setVariable("ignore_early_media", "true");
>
>
> session:execute("bridge","user/1007");
>
> Which can also be expressed in pure XML as such:
>
> <extension name="1234">
>   <condition field="destination_number" expression="^1234$">
>
>
>     <action application="set" data="ringback=local_stream://moh"/>
>     <action application="set" data="ignore_early_media=true"/>
>     <action application="bridge" data="user/1007"/>
>   </condition>
> </extension>
>
> There is really no need to do this with Lua.  The XML dialplan can do some
> VERY complex things once you wrap your head around it.
>
> In addition I would recommend you get the latest 1.0.5 build
> http://files-sync.freeswitch.org/windows_installer/  Its tagged as 1.0.4
> and shouldn't be.
>
> /b
>
>
>
> On Feb 4, 2010, at 8:48 PM, Adam Wilt wrote:
>
> Hi all,
>
> I want to park an inbound call and play hold music while I simultaneously
> place another outbound call.
> But the hold music doesn't play while the lua script is placing the second
> call. When the lua script ends, the hold music finally starts.
> Here's my example code:
>
> #!/usr/local/bin/lua
>
> session:answer()
> api = freeswitch.API()
> api:executeString("bgapi uuid_park " .. tostring(session.uuid))
> api:executeString("bgapi uuid_broadcast " .. tostring(session.uuid)  .. "
> /freeswitch/sounds/music/8000/danza-espanola-op-37-h-142-xii-arabesca.wav")
> local new_session =
> freeswitch.Session("sofia/gateway/myprovider/15555555555")
>
>
> So it seems like the script is blocking the original session, despite the
> fact that I'm using bgapi.  I'd really appreciate if somebody could help me
> with this.
>
> By the way, I'm using FreeSWITCH 1.0.4 in Windows.
>
> Thanks,
> Adam
>
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100204/22e157d3/attachment-0002.html 


More information about the FreeSWITCH-users mailing list