Want to play music on hold while executing a time consuming operation in Lua
I am implementing an IVR using Lua in Freeswitch. In my Lua script I use curl to a web service. Sometimes the response takes a long time to come back. During that time period I would like to play music on hold. I have searched the freeswitch discussion archives a lot. There seem to be many suggested ways to implement music on hold from a Lua script but the answers are not very clear / not really applicable to my use case. I don't know what method I should use and which one is recommended. *Method 1:* Transfer the call to 9664 (music on hold extension). However the implementation for this solution for this does not seem to be available in Lua. For example: How would I transfer the call back? *Method 2:* Using bgapi uuid_park park the call and using uuid_broadcast play an audio file. Again what do I do to unpark the call..? Thanks, Sidharth [P.S. This is a repost, I apologize but I never got any responses on my previous email. Need help! :-) ] -- Sidharth Kshatriya www.sidk.info
Sidharth, Generally, if noone answers, it means noone has an interesting answer or noone had the time yet to answer. It's quite like when you ask a girl out. If she doesn't answer, it's unlikely harassing her will improve the situation ... most of the times :) You can also try to go on irc #freeswitch. And also, you can read the wiki. David Ponzone Direction Technique email: david.ponzone@ipeva.fr tel: 01 74 03 18 97 gsm: 06 66 98 76 34 Service Client IPeva tel: 0811 46 26 26 www.ipeva.fr - www.ipeva-studio.com Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération. IPeva décline toute responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce message, merci de le détruire immédiatement et d'avertir l'expéditeur. Le 16/06/2011 à 06:53, Sidharth Kshatriya a écrit :
I am implementing an IVR using Lua in Freeswitch. In my Lua script I use curl to a web service. Sometimes the response takes a long time to come back. During that time period I would like to play music on hold.
I have searched the freeswitch discussion archives a lot. There seem to be many suggested ways to implement music on hold from a Lua script but the answers are not very clear / not really applicable to my use case. I don't know what method I should use and which one is recommended.
Method 1: Transfer the call to 9664 (music on hold extension). However the implementation for this solution for this does not seem to be available in Lua. For example: How would I transfer the call back? Method 2: Using bgapi uuid_park park the call and using uuid_broadcast play an audio file. Again what do I do to unpark the call..?
Thanks,
Sidharth [P.S. This is a repost, I apologize but I never got any responses on my previous email. Need help! :-) ]
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
This is true. Although I've never formally asked a girl out, I have posted a lame question and waited for days until someone responded. Then we have a few messages back and forth. Maybe Sidharth has a point because now I'm married and have lost the interest to ask anyone out, if I had it in the first place. Mehma === On 6/16/11 3:41 AM, David Ponzone wrote:
Generally, if noone answers, it means noone has an interesting answer or noone had the time yet to answer. It's quite like when you ask a girl out. If she doesn't answer, it's unlikely harassing her will improve the situation ... most of the times :)
Le 16/06/2011 à 06:53, Sidharth Kshatriya a écrit :
[P.S. This is a repost, I apologize but I never got any responses on my previous email. Need help! :-) ]
Actually, I am looking into ways to accomplish these. They are somewhat related to some recipes I am doing for the FS Cookbook. Please stand by. FYI, I am looking at an ESL-based solution, not a dialplan script. Thus far I have not found a viable way to do async stuff like this from a dp script and I'm thinking ESL is the way to go. I will report back in a bit. -MC On Wed, Jun 15, 2011 at 9:53 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com
wrote:
I am implementing an IVR using Lua in Freeswitch. In my Lua script I use curl to a web service. Sometimes the response takes a long time to come back. During that time period I would like to play music on hold.
I have searched the freeswitch discussion archives a lot. There seem to be many suggested ways to implement music on hold from a Lua script but the answers are not very clear / not really applicable to my use case. I don't know what method I should use and which one is recommended.
*Method 1:* Transfer the call to 9664 (music on hold extension). However the implementation for this solution for this does not seem to be available in Lua. For example: How would I transfer the call back? *Method 2:* Using bgapi uuid_park park the call and using uuid_broadcast play an audio file. Again what do I do to unpark the call..?
Thanks,
Sidharth [P.S. This is a repost, I apologize but I never got any responses on my previous email. Need help! :-) ]
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thanks Michael. This is quite a mainstream requirement :-) ! Not everyone uses ESL. Is there no way we can "hack" this in Lua? Will await your research, Sidharth On Thu, Jun 16, 2011 at 11:51 PM, Michael Collins <msc@freeswitch.org>wrote:
Actually, I am looking into ways to accomplish these. They are somewhat related to some recipes I am doing for the FS Cookbook. Please stand by. FYI, I am looking at an ESL-based solution, not a dialplan script. Thus far I have not found a viable way to do async stuff like this from a dp script and I'm thinking ESL is the way to go. I will report back in a bit.
-MC
On Wed, Jun 15, 2011 at 9:53 PM, Sidharth Kshatriya < sid.kshatriya@gmail.com> wrote:
I am implementing an IVR using Lua in Freeswitch. In my Lua script I use curl to a web service. Sometimes the response takes a long time to come back. During that time period I would like to play music on hold.
I have searched the freeswitch discussion archives a lot. There seem to be many suggested ways to implement music on hold from a Lua script but the answers are not very clear / not really applicable to my use case. I don't know what method I should use and which one is recommended.
*Method 1:* Transfer the call to 9664 (music on hold extension). However the implementation for this solution for this does not seem to be available in Lua. For example: How would I transfer the call back? *Method 2:* Using bgapi uuid_park park the call and using uuid_broadcast play an audio file. Again what do I do to unpark the call..?
Thanks,
Sidharth [P.S. This is a repost, I apologize but I never got any responses on my previous email. Need help! :-) ]
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Sidharth Kshatriya www.sidk.info
In this case, it turns out you are asking the girl to defy physics for you. The session is executing the script code in the same thread that needs to play the audio. You cannot magically do 2 things at once in the same thread so.... using ASYNC (esl) is your only choice apart from using C and threads or launching the lua script in another thread with luarun with the channel uuid as an arg so it can feed it to the constructor and send commands to it remotely which is a pretty big mess..... On Thu, Jun 16, 2011 at 4:56 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:
Thanks Michael. This is quite a mainstream requirement :-) ! Not everyone uses ESL. Is there no way we can "hack" this in Lua?
Will await your research,
Sidharth
On Thu, Jun 16, 2011 at 11:51 PM, Michael Collins <msc@freeswitch.org> wrote:
Actually, I am looking into ways to accomplish these. They are somewhat related to some recipes I am doing for the FS Cookbook. Please stand by. FYI, I am looking at an ESL-based solution, not a dialplan script. Thus far I have not found a viable way to do async stuff like this from a dp script and I'm thinking ESL is the way to go. I will report back in a bit. -MC
On Wed, Jun 15, 2011 at 9:53 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:
I am implementing an IVR using Lua in Freeswitch. In my Lua script I use curl to a web service. Sometimes the response takes a long time to come back. During that time period I would like to play music on hold.
I have searched the freeswitch discussion archives a lot. There seem to be many suggested ways to implement music on hold from a Lua script but the answers are not very clear / not really applicable to my use case. I don't know what method I should use and which one is recommended.
Method 1: Transfer the call to 9664 (music on hold extension). However the implementation for this solution for this does not seem to be available in Lua. For example: How would I transfer the call back? Method 2: Using bgapi uuid_park park the call and using uuid_broadcast play an audio file. Again what do I do to unpark the call..?
Thanks,
Sidharth [P.S. This is a repost, I apologize but I never got any responses on my previous email. Need help! :-) ]
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ Join us at ClueCon 2011, Aug 9-11, Chicago http://www.cluecon.com 877-7-4ACLUE
FreeSWITCH-users mailing list FreeSWITCH-users@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@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900
nice metaphore Anth ;) ----- Original Message ----- From: "Anthony Minessale" <anthony.minessale@gmail.com> To: "FreeSWITCH Users Help" <freeswitch-users@lists.freeswitch.org> Sent: Friday, June 17, 2011 1:30 PM Subject: Re: [Freeswitch-users] Want to play music on hold while executing a time consuming operation in Lua
In this case, it turns out you are asking the girl to defy physics for you.
The session is executing the script code in the same thread that needs to play the audio. You cannot magically do 2 things at once in the same thread so.... using ASYNC (esl) is your only choice apart from using C and threads or launching the lua script in another thread with luarun with the channel uuid as an arg so it can feed it to the constructor and send commands to it remotely which is a pretty big mess.....
On Thu, Jun 16, 2011 at 4:56 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:
Thanks Michael. This is quite a mainstream requirement :-) ! Not everyone uses ESL. Is there no way we can "hack" this in Lua?
Will await your research,
Sidharth
On Thu, Jun 16, 2011 at 11:51 PM, Michael Collins <msc@freeswitch.org> wrote:
Actually, I am looking into ways to accomplish these. They are somewhat related to some recipes I am doing for the FS Cookbook. Please stand by. FYI, I am looking at an ESL-based solution, not a dialplan script. Thus far I have not found a viable way to do async stuff like this from a dp script and I'm thinking ESL is the way to go. I will report back in a bit. -MC
On Wed, Jun 15, 2011 at 9:53 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:
I am implementing an IVR using Lua in Freeswitch. In my Lua script I use curl to a web service. Sometimes the response takes a long time to come back. During that time period I would like to play music on hold.
I have searched the freeswitch discussion archives a lot. There seem to be many suggested ways to implement music on hold from a Lua script but the answers are not very clear / not really applicable to my use case. I don't know what method I should use and which one is recommended.
Method 1: Transfer the call to 9664 (music on hold extension). However the implementation for this solution for this does not seem to be available in Lua. For example: How would I transfer the call back? Method 2: Using bgapi uuid_park park the call and using uuid_broadcast play an audio file. Again what do I do to unpark the call..?
Thanks,
Sidharth [P.S. This is a repost, I apologize but I never got any responses on my previous email. Need help! :-) ]
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ Join us at ClueCon 2011, Aug 9-11, Chicago http://www.cluecon.com 877-7-4ACLUE
FreeSWITCH-users mailing list FreeSWITCH-users@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@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900
_______________________________________________ Join us at ClueCon 2011, Aug 9-11, Chicago http://www.cluecon.com 877-7-4ACLUE
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Tony, Thanks for the explanation. This was indeed my concern with trying to do it from a dp script. Sid, I'm afraid you'll need to use ESL or find a girl who is not bound by the laws of physics... :) -MC On Fri, Jun 17, 2011 at 10:30 AM, Anthony Minessale < anthony.minessale@gmail.com> wrote:
In this case, it turns out you are asking the girl to defy physics for you.
The session is executing the script code in the same thread that needs to play the audio. You cannot magically do 2 things at once in the same thread so.... using ASYNC (esl) is your only choice apart from using C and threads or launching the lua script in another thread with luarun with the channel uuid as an arg so it can feed it to the constructor and send commands to it remotely which is a pretty big mess.....
On Thu, Jun 16, 2011 at 4:56 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:
Thanks Michael. This is quite a mainstream requirement :-) ! Not everyone uses ESL. Is there no way we can "hack" this in Lua?
Will await your research,
Sidharth
On Thu, Jun 16, 2011 at 11:51 PM, Michael Collins <msc@freeswitch.org> wrote:
Actually, I am looking into ways to accomplish these. They are somewhat related to some recipes I am doing for the FS Cookbook. Please stand by. FYI, I am looking at an ESL-based solution, not a dialplan script. Thus
far
I have not found a viable way to do async stuff like this from a dp script and I'm thinking ESL is the way to go. I will report back in a bit. -MC
On Wed, Jun 15, 2011 at 9:53 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:
I am implementing an IVR using Lua in Freeswitch. In my Lua script I
use
curl to a web service. Sometimes the response takes a long time to come back. During that time period I would like to play music on hold.
I have searched the freeswitch discussion archives a lot. There seem to be many suggested ways to implement music on hold from a Lua script but the answers are not very clear / not really applicable to my use case. I don't know what method I should use and which one is recommended.
Method 1: Transfer the call to 9664 (music on hold extension). However the implementation for this solution for this does not seem to be available in Lua. For example: How would I transfer the call back? Method 2: Using bgapi uuid_park park the call and using uuid_broadcast play an audio file. Again what do I do to unpark the call..?
Thanks,
Sidharth [P.S. This is a repost, I apologize but I never got any responses on my previous email. Need help! :-) ]
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Sidharth Kshatriya www.sidk.info
_______________________________________________ Join us at ClueCon 2011, Aug 9-11, Chicago http://www.cluecon.com 877-7-4ACLUE
FreeSWITCH-users mailing list FreeSWITCH-users@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@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900
_______________________________________________ Join us at ClueCon 2011, Aug 9-11, Chicago http://www.cluecon.com 877-7-4ACLUE
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (6)
-
Anthony Minessale
-
David Ponzone
-
Madovsky
-
Mehma Sarja
-
Michael Collins
-
Sidharth Kshatriya