[Freeswitch-users] More playing with sessions in lua

Anthony Minessale anthony.minessale at gmail.com
Mon Jan 18 11:44:44 PST 2010


as soon as you play please hold there is no longer a chance for signaling
based ringback
you could have used the application ring_ready to send your phone an 180
ringing if you did not play the file
once you played the file you are responsible for sending audio to the
channel, think of it like a gui where the runtime loop takes input and you
must not do anything blocking in that loop and you can't play the file and
do something else at the same time without more threads which is not easy to
do from an embedded script.



On Mon, Jan 18, 2010 at 1:11 PM, Troy Anderson <troy at tlainvestments.com>wrote:

> I think there may be other ways to do this, but if I could understand how
> to do it from lua, I think it would help me understand more about what's
> going on and make the mod_lua even more valuable to me and anyone else
> struggling with this kind of issue.
>
> I am trying to answer a call in lua, exchange a bit of information with the
> caller, then I want to originate a call to another endpoint, and depending
> on what their response to some audio questions is, connect the original
> caller to them, or send the original caller away.  The problem is that I
> want the original caller to her ring tones or music on hold while they're
> waiting.  In addition to the way presented here, I've tried parking the
> caller using uuid_park, but still can't figure out how to play
> music/ringback for them.
>
> session:answer();
> session:sleep(1000);
> session:execute("playback","pleasehold.wav")
>
> local targetEndpoint = "1100 at default" -- or wherever
>
> -- ringback works only AFTER the bridge line, below.  How do I get it to
> start immediately?
> local destSession = freeswitch.Session("{ringback='myringback.wav'}"..
> targetEndpoint)  -- this "originates" a call to targetEndpoint
>
> local digit
> destSession:playAndGetDigits(1,1,3,3000,"#","instructions.wav","[1-3]")
>
> if (digit == "1") then
>        freeswitch.bridge(session,destSession)
> else
>        session:execute("playback","goodbye.wav")
>        session:hangup()
>        destSession:hangup()
> end
>
>
> I appreciate any help on this.
>
> -Troy
>
> _______________________________________________
> 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
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100118/4f5533a0/attachment-0002.html 


More information about the FreeSWITCH-users mailing list