Hi Guys, It's not clear from the docs how I can originate a call from within an lua script This what works in js, Question. How do I instantiate a new session, do I use the execute to dial, and same for bridge? Regards, if (!first_session.ready()) var new_session = new Session(tdial-string); if (!first_session.ready()) { disp_call(DROP) exit(); new_session.answer(); if (new_session.ready()) { bridge(first_session, new_session); }
Nik, What are you building? I'm wondering if this is the correct approach for your application. You might be better off using the even socket and controlling your calls from a central point. -MC On Wed, Feb 18, 2009 at 11:26 AM, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:
Hi Guys,
It's not clear from the docs how I can originate a call from within an lua script
This what works in js,
Question. How do I instantiate a new session, do I use the execute to dial, and same for bridge?
Regards,
if (!first_session.ready())
var new_session = new Session(tdial-string);
if (!first_session.ready()) {
disp_call(DROP)
exit();
new_session.answer();
if (new_session.ready()) {
bridge(first_session, new_session);
}
_______________________________________________ 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
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, -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 18 February 2009 19:41 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Originate and bridge with lua Nik, What are you building? I'm wondering if this is the correct approach for your application. You might be better off using the even socket and controlling your calls from a central point. -MC On Wed, Feb 18, 2009 at 11:26 AM, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:
Hi Guys,
It's not clear from the docs how I can originate a call from within an lua script
This what works in js,
Question. How do I instantiate a new session, do I use the execute to dial, and same for bridge?
Regards,
if (!first_session.ready())
var new_session = new Session(tdial-string);
if (!first_session.ready()) {
disp_call(DROP)
exit();
new_session.answer();
if (new_session.ready()) {
bridge(first_session, new_session);
}
_______________________________________________ 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
_______________________________________________ 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
On Wed, Feb 18, 2009 at 11:53 AM, Nik Middleton <nik.middleton@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@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
Hi Michael, Yes that's exactly what it boils down to, an outbound ivr. Everything is working perfectly, except the bridge to another number. Because of the nature of the beast the bridge needs to dial an external number (ie sofia/gateway/Mygateway/num) What I'm getting is: attempt to perform arithmetic on global 'sofia' (a nil value) regards -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 18 February 2009 21:09 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Originate and bridge with lua On Wed, Feb 18, 2009 at 11:53 AM, Nik Middleton <nik.middleton@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@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 _______________________________________________ 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
Everything is working perfectly, except the bridge to another number. Because of the nature of the beast the bridge needs to dial an external number (ie sofia/gateway/Mygateway/num) What I'm getting is:
attempt to perform arithmetic on global 'sofia' (a nil value)
Can you pastebin your Lua script? -MC
Sorted now thanks, it needed to be in the format session:execute("bridge", "{params}sofia/gateway/Mygateway/number"); key change was '"' Now I've converted my js script to lua going to run some tests tomorrow. I sincerely hope it'll handle more than the 10 calls js would break at. Here's my current setup External prog generates bgapi calls via socket and calls originate with name of lua script also passed. Lua does IVR and then bridges where required. It also fires back an event to show result of call. Astererisk happily does around 200 calls, I'm hoping FS will do better or I've just been wasting my time. Is there a more efficient way of doing this? Regards, -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 18 February 2009 21:43 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Originate and bridge with lua
Everything is working perfectly, except the bridge to another number. Because of the nature of the beast the bridge needs to dial an external number (ie sofia/gateway/Mygateway/num) What I'm getting is:
attempt to perform arithmetic on global 'sofia' (a nil value)
Can you pastebin your Lua script? -MC _______________________________________________ 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
You want to make it even more efficient? when they press 1, session:execute("transfer", "<number>"); Then, put an extension in your dialplan to match <number> and do the bridge. Then you can exit the script and only run the script when you need it. Your problem with js was the same issue, you should have been doing something similar there too. BTW, If you make another comparison to asterisk comment, I will never answer another email from you again I don't have time for that crap. On Wed, Feb 18, 2009 at 3:56 PM, Nik Middleton < nik.middleton@noblesolutions.co.uk> wrote:
Sorted now thanks, it needed to be in the format
session:execute("bridge", "{params}sofia/gateway/Mygateway/number");
key change was '"'
Now I've converted my js script to lua going to run some tests tomorrow.
I sincerely hope it'll handle more than the 10 calls js would break at.
Here's my current setup
External prog generates bgapi calls via socket and calls originate with name of lua script also passed.
Lua does IVR and then bridges where required. It also fires back an event to show result of call.
Astererisk happily does around 200 calls, I'm hoping FS will do better or I've just been wasting my time. Is there a more efficient way of doing this?
Regards,
-----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 18 February 2009 21:43 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Originate and bridge with lua
Everything is working perfectly, except the bridge to another number. Because of the nature of the beast the bridge needs to dial an external number (ie sofia/gateway/Mygateway/num) What I'm getting is:
attempt to perform arithmetic on global 'sofia' (a nil value)
Can you pastebin your Lua script? -MC
_______________________________________________ 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
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
i replied to your last private message and it was returned as undeliverable. overzealous spam server? Can you add my account to your whitelist? On Wed, Feb 18, 2009 at 4:06 PM, Anthony Minessale < anthony.minessale@gmail.com> wrote:
You want to make it even more efficient? when they press 1, session:execute("transfer", "<number>");
Then, put an extension in your dialplan to match <number> and do the bridge. Then you can exit the script and only run the script when you need it.
Your problem with js was the same issue, you should have been doing something similar there too.
BTW, If you make another comparison to asterisk comment, I will never answer another email from you again I don't have time for that crap.
On Wed, Feb 18, 2009 at 3:56 PM, Nik Middleton < nik.middleton@noblesolutions.co.uk> wrote:
Sorted now thanks, it needed to be in the format
session:execute("bridge", "{params}sofia/gateway/Mygateway/number");
key change was '"'
Now I've converted my js script to lua going to run some tests tomorrow.
I sincerely hope it'll handle more than the 10 calls js would break at.
Here's my current setup
External prog generates bgapi calls via socket and calls originate with name of lua script also passed.
Lua does IVR and then bridges where required. It also fires back an event to show result of call.
Astererisk happily does around 200 calls, I'm hoping FS will do better or I've just been wasting my time. Is there a more efficient way of doing this?
Regards,
-----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 18 February 2009 21:43 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Originate and bridge with lua
Everything is working perfectly, except the bridge to another number. Because of the nature of the beast the bridge needs to dial an external number (ie sofia/gateway/Mygateway/num) What I'm getting is:
attempt to perform arithmetic on global 'sofia' (a nil value)
Can you pastebin your Lua script? -MC
_______________________________________________ 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
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Done Seems it had a spam score of 2 for some reason Regards, ________________________________ From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Anthony Minessale Sent: 18 February 2009 23:39 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Originate and bridge with lua i replied to your last private message and it was returned as undeliverable. overzealous spam server? Can you add my account to your whitelist? On Wed, Feb 18, 2009 at 4:06 PM, Anthony Minessale <anthony.minessale@gmail.com> wrote: You want to make it even more efficient? when they press 1, session:execute("transfer", "<number>"); Then, put an extension in your dialplan to match <number> and do the bridge. Then you can exit the script and only run the script when you need it. Your problem with js was the same issue, you should have been doing something similar there too. BTW, If you make another comparison to asterisk comment, I will never answer another email from you again I don't have time for that crap. On Wed, Feb 18, 2009 at 3:56 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote: Sorted now thanks, it needed to be in the format session:execute("bridge", "{params}sofia/gateway/Mygateway/number"); key change was '"' Now I've converted my js script to lua going to run some tests tomorrow. I sincerely hope it'll handle more than the 10 calls js would break at. Here's my current setup External prog generates bgapi calls via socket and calls originate with name of lua script also passed. Lua does IVR and then bridges where required. It also fires back an event to show result of call. Astererisk happily does around 200 calls, I'm hoping FS will do better or I've just been wasting my time. Is there a more efficient way of doing this? Regards, -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 18 February 2009 21:43 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Originate and bridge with lua
Everything is working perfectly, except the bridge to another number. Because of the nature of the beast the bridge needs to dial an external number (ie sofia/gateway/Mygateway/num) What I'm getting is:
attempt to perform arithmetic on global 'sofia' (a nil value)
Can you pastebin your Lua script? -MC _______________________________________________ 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 -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
participants (4)
-
Anthony Minessale
-
Brian West
-
Michael Collins
-
Nik Middleton