[Freeswitch-users] Lua session originate - freeswitch crash
Eric Beard
eric at loopfx.com
Wed Apr 13 16:48:51 MSD 2011
Thanks Anthony,
I will update to latest. I last did a pull about 2 weeks ago, FreeSWITCH Version 1.0.head (git-8c5586b 2011-04-01 14-22-43 -0500).
If I shouldn't be doing this in this script, then what is the recommended way to originate an outbound IVR call?
My current production application uses Microsoft Speech Server to send outbound customer service calls, with a B2BUA I wrote to communicate with terminators. I'm switching my B2BUA out for FreeSwitch, and it's working great. But if possible I'd like to remove MSS from the equation altogether.
Lua looks like a good way to control the call workflow. Should I be using ESL from an external application instead?
Thanks for your time,
-----------------------
Eric Z. Beard, CTO
Loop LLC
w (877) 850-2010 x9249
m (727) 776-2768
eric at loopfx.com
-----Original Message-----
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Anthony Minessale
Sent: Tuesday, April 12, 2011 7:28 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Lua session originate - freeswitch crash
1) You are not running the latest GIT. Your scripts works fine on my
development box.
2) the originate method is deprecated. you can just do
local new_session =
freeswitch.Session("sofia/gateway/affinity/17277762768", session);
3) In either case you should not be doing what you do in this script
because the whole time you are playing the file to new_session the
original session is blocked not reading or writing any audio.
On Tue, Apr 12, 2011 at 3:02 PM, Eric Beard <eric at loopfx.com> wrote:
> Ok, so I got a little further by trial and error, and realized the 4th arg is due to lua function calling syntax. If you use the dot notation on a function declared with a colon, it expects "this" as the first arg.
>
> My current code looks like this:
>
> -- Originate an outbound call
> local new_session = freeswitch.Session();
> new_session:originate(session, "sofia/gateway/affinity/17277762768", 60);
> new_session:waitForAnswer(session);
> prompt = "/home/eric/test1.wav"
> freeswitch.consoleLog("INFO", "About to play prompt file " .. prompt .."\n")
> new_session:streamFile(prompt)
> new_session:hangup()
>
> The scary thing about this code is that it crashed freeSwitch when I ran it.
>
> This is the last thing I saw in the logs:
>
>
> -----------------------
> Eric Z. Beard, CTO
> Loop LLC
> w (877) 850-2010 x9249
> m (727) 776-2768
> eric at loopfx.com
>
>
> -----Original Message-----
> From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Eric Beard
> Sent: Tuesday, April 12, 2011 3:15 PM
> To: FreeSWITCH Users Help
> Subject: Re: [Freeswitch-users] Lua session originate
>
> Thanks Jeff,
>
> When I try NULL I get this:
>
> freeswitch at internal> 2011-04-12 14:49:31.582049 [ERR] mod_lua.cpp:191 Error in originate (arg 2), ex
> pected 'CoreSession *' got 'string'
> stack traceback:
> [C]: in function 'originate'
> /usr/local/freeswitch/scripts/test_originate.lua:3: in main chunk
>
> I've been digging through the source code, and I can't find where 4 args are required. I see this in freeswitch_lua.cpp:
>
> int Session::originate(CoreSession *a_leg_session, char *dest, int timeout)
> {
> int x = CoreSession::originate(a_leg_session, dest, timeout);
>
> if (x) {
> setLUA(L);
> }
>
> return x;
> }
>
> -----------------------
> Eric Z. Beard, CTO
> Loop LLC
> w (877) 850-2010 x9249
> m (727) 776-2768
> eric at loopfx.com
>
>
> -----Original Message-----
> From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Jeff Lenk
> Sent: Tuesday, April 12, 2011 2:42 PM
> To: freeswitch-users at lists.freeswitch.org
> Subject: Re: [Freeswitch-users] Lua session originate
>
> The fourth parameter is the switch_state_handler_table reference and for most
> uses(script language) you should just pass null but I dont use lua so I
> dont know the details on that.
>
> --
> View this message in context: http://freeswitch-users.2379917.n2.nabble.com/Lua-session-originate-tp6266121p6266239.html
> Sent from the freeswitch-users mailing list archive at Nabble.com.
>
> _______________________________________________
> 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
>
> _______________________________________________
> 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
>
> _______________________________________________
> 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
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900
_______________________________________________
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
More information about the FreeSWITCH-users
mailing list