Hi Guys, I'm having real problems doing something trivial, and there doesn't seem to be any docs on this issue In js I do this //Disposition = disp; //Create Custom event custom_msg = "call_disposition: " + Disposition + "\n" + "called_number: " + dial_num + "\n" ; e = new Event("custom", "dialer::dialer-result"); e.addBody(custom_msg); e.fire(); And it works In lua I try this --Disposition = disp; --Create Custom event custom_msg = "call_disposition: " .. Disposition .. "\n" .. "called_number: " .. dial_num .."\n" ; local e = freeswitch.Event("custom", "dialer::dialer-result"); e.addBody(custom_msg); e:fire(e); This doesn't work, I get an error : Error in addBody expected 2..2 args, got 1 What are the arguments? It seems to be looking for a pointer for the first one, but there's nothing on the wiki on this. Regards,
local e = freeswitch.Event("custom", "dialer::dialer-result");
e.addBody(custom_msg);
e:fire(e);
The wiki page (http://wiki.freeswitch.org/wiki/Lua#event:fire) shows that you fire thusly: e:fire(); --No "e" in the parens. Can you try it and report back? -MC
I've got it working now thanks I've also added a working example to the Wiki (lua/addBody) which was empty Regards, -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 17 February 2009 23:23 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] AddBody to events in lua
local e =
freeswitch.Event("custom",
"dialer::dialer-result");
e.addBody(custom_msg);
e:fire(e); The wiki page (http://wiki.freeswitch.org/wiki/Lua#event:fire) shows that you fire thusly: e:fire(); --No "e" in the parens.
Can you try it and report back? -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
in lua you call methods with a colon : e:addBody(blah); calling with a . implies you are going to supply the obj too e.addBody(e, blah); On Tue, Feb 17, 2009 at 5:11 PM, Nik Middleton < nik.middleton@noblesolutions.co.uk> wrote:
Hi Guys,
I'm having real problems doing something trivial, and there doesn't seem to be any docs on this issue
In js I do this
//Disposition = disp;
//Create Custom event
custom_msg =
"call_disposition: " + Disposition + "\n" +
"called_number: " + dial_num + "\n" ;
e = new Event("custom", "dialer::dialer-result");
e.addBody(custom_msg);
e.fire();
And it works
In lua I try this
--Disposition = disp;
--Create Custom event
custom_msg = "call_disposition: " .. Disposition .. "\n" ..
"called_number: " .. dial_num .."\n" ;
local e = freeswitch.Event("custom", "dialer::dialer-result");
e.addBody(custom_msg);
e:fire(e);
This doesn't work, I get an error : Error in addBody expected 2..2 args, got 1
What are the arguments? It seems to be looking for a pointer for the first one, but there's nothing on the wiki on this.
Regards,
_______________________________________________ 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
On Tue, Feb 17, 2009 at 3:25 PM, Anthony Minessale <anthony.minessale@gmail.com> wrote:
in lua you call methods with a colon :
e:addBody(blah);
calling with a . implies you are going to supply the obj too
e.addBody(e, blah);
Also, there is an explicit example here: http://wiki.freeswitch.org/wiki/Lua#event:addBody It looks exactly like what you're trying to do. -MC
Err, that's what I just posted :) Regards, -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 17 February 2009 23:30 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] AddBody to events in lua On Tue, Feb 17, 2009 at 3:25 PM, Anthony Minessale <anthony.minessale@gmail.com> wrote:
in lua you call methods with a colon :
e:addBody(blah);
calling with a . implies you are going to supply the obj too
e.addBody(e, blah);
Also, there is an explicit example here: http://wiki.freeswitch.org/wiki/Lua#event:addBody It looks exactly like what you're trying to do. -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
I'll shortly post some docs on the php fs_sock. There's also a couple of bugs in it that I've fixed. I ran 10,000 events, which completed in around 20 seconds, all received and processed flawlessly. A new one on me was arrayshift. To think that I messed around in C for ages with circular buffers, this is so simple. Regards, -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Brian West Sent: 17 February 2009 23:36 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] AddBody to events in lua Good... keep up the good work adding more docs. ;) /b On Feb 17, 2009, at 5:33 PM, Nik Middleton wrote:
Err, that's what I just posted :)
Regards,
_______________________________________________ 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 ran 10,000 events, which completed in around 20 seconds, all received and processed flawlessly. A new one on me was arrayshift. To think that I messed around in C for ages with circular buffers, this is so simple.
Excellent! You're officially deputized to add any Lua examples you create. We can use examples on the wiki and sample scripts in the contrib directory. Nice work. -MC
And you ran this in lua? /b On Feb 17, 2009, at 6:07 PM, Nik Middleton wrote:
I ran 10,000 events, which completed in around 20 seconds, all received and processed flawlessly. A new one on me was arrayshift. To think that I messed around in C for ages with circular buffers, this is so simple.
No, js, I was trying to break the fs_sock.php, though I found the time was dependant on how much I echoed to the screen. I expect lua to be even faster Regards, -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Brian West Sent: 18 February 2009 00:15 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] AddBody to events in lua And you ran this in lua? /b On Feb 17, 2009, at 6:07 PM, Nik Middleton wrote:
I ran 10,000 events, which completed in around 20 seconds, all received and processed flawlessly. A new one on me was arrayshift. To think that I messed around in C for ages with circular buffers, this is so simple.
_______________________________________________ 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
Nik Middleton wrote:
I'll shortly post some docs on the php fs_sock. don't waste your time... There's a php .so for ESL now, and i'll probably be removing the fs_sock from tree sometime very soon... maybe replacing it with some specific api classes... i'm not sure on that part yet.
-Ray
On Tue, Feb 17, 2009 at 3:33 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:
Err, that's what I just posted :)
oops, hehe, that would explain why I thought my browser cache was messing with me. Nice work. Please definitely add to the Lua wiki page as you gain experience. Hopefully your pain will be other Lua users' gain. ;) -MC
participants (5)
-
Anthony Minessale
-
Brian West
-
Michael Collins
-
Nik Middleton
-
Raymond Chandler