VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
nik.middleton at noble... Guest
|
Posted: Wed Feb 18, 2009 2:31 pm Post subject: [Freeswitch-users] Originate and bridge with lua |
|
|
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);
} |
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Wed Feb 18, 2009 2:44 pm Post subject: [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:
Quote: | 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
|
_______________________________________________
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 |
|
Back to top |
|
|
nik.middleton at noble... Guest
|
Posted: Wed Feb 18, 2009 2:55 pm Post subject: [Freeswitch-users] Originate and bridge with lua |
|
|
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:
Quote: | Hi Guys,
It's not clear from the docs how I can originate a call from within an
| lua
Quote: | script
This what works in js,
Question. How do I instantiate a new session, do I use the execute to
| dial,
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
Quote: | 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
_______________________________________________
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 |
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Wed Feb 18, 2009 4:10 pm Post subject: [Freeswitch-users] Originate and bridge with lua |
|
|
On Wed, Feb 18, 2009 at 11:53 AM, Nik Middleton
<nik.middleton@noblesolutions.co.uk> wrote:
Quote: | 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 |
|
Back to top |
|
|
nik.middleton at noble... Guest
|
Posted: Wed Feb 18, 2009 4:31 pm Post subject: [Freeswitch-users] Originate and bridge with lua |
|
|
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:
Quote: | 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
Quote: | 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
_______________________________________________
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 |
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Wed Feb 18, 2009 4:47 pm Post subject: [Freeswitch-users] Originate and bridge with lua |
|
|
Quote: | 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 |
|
Back to top |
|
|
nik.middleton at noble... Guest
|
Posted: Wed Feb 18, 2009 4:57 pm Post subject: [Freeswitch-users] Originate and bridge with lua |
|
|
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
Quote: | Everything is working perfectly, except the bridge to another number.
Because of the nature of the beast the bridge needs to dial an
| external
Quote: | 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 |
|
Back to top |
|
|
brian at freeswitch.org Guest
|
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Wed Feb 18, 2009 5:07 pm Post subject: [Freeswitch-users] Originate and bridge with lua |
|
|
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 (nik.middleton@noblesolutions.co.uk)> wrote:
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Wed Feb 18, 2009 6:45 pm Post subject: [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 (anthony.minessale@gmail.com)> wrote:
Quote: | 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 (nik.middleton@noblesolutions.co.uk)> wrote:
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
|
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
nik.middleton at noble... Guest
|
Posted: Wed Feb 18, 2009 7:00 pm Post subject: [Freeswitch-users] Originate and bridge with lua |
|
|
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 (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 (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 (freeswitch-users-bounces@lists.freeswitch.org)
[mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of
Michael Collins
Sent: 18 February 2009 21:43
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)
Subject: Re: [Freeswitch-users] Originate and bridge with lua
Quote: | Everything is working perfectly, except the bridge to another number.
Because of the nature of the beast the bridge needs to dial an
| external
Quote: | 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 (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 (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|