Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] AddBody to events in lua


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
msc at freeswitch.org
Guest





PostPosted: Tue Feb 17, 2009 6:24 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

Quote:
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
Back to top
anthony.minessale at g...
Guest





PostPosted: Tue Feb 17, 2009 6:26 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

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 (nik.middleton@noblesolutions.co.uk)> wrote:
Quote:

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 (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
Back to top
msc at freeswitch.org
Guest





PostPosted: Tue Feb 17, 2009 6:30 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

On Tue, Feb 17, 2009 at 3:25 PM, Anthony Minessale
<anthony.minessale@gmail.com> wrote:
Quote:
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
Back to top
nik.middleton at noble...
Guest





PostPosted: Tue Feb 17, 2009 6:31 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

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

Quote:
local e =
freeswitch.Event("custom",
Quote:
"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

_______________________________________________
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





PostPosted: Tue Feb 17, 2009 6:34 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

Err, that's what I just posted Smile

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:
Quote:
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

_______________________________________________
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





PostPosted: Tue Feb 17, 2009 6:38 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

Good... keep up the good work adding more docs. Wink

/b

On Feb 17, 2009, at 5:33 PM, Nik Middleton wrote:

Quote:
Err, that's what I just posted Smile

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
Back to top
msc at freeswitch.org
Guest





PostPosted: Tue Feb 17, 2009 6:40 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

On Tue, Feb 17, 2009 at 3:33 PM, Nik Middleton
<nik.middleton@noblesolutions.co.uk> wrote:
Quote:
Err, that's what I just posted Smile

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. Wink

-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





PostPosted: Tue Feb 17, 2009 7:10 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

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. Wink

/b

On Feb 17, 2009, at 5:33 PM, Nik Middleton wrote:

Quote:
Err, that's what I just posted Smile

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

_______________________________________________
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





PostPosted: Tue Feb 17, 2009 7:15 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

Quote:
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

_______________________________________________
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





PostPosted: Tue Feb 17, 2009 7:15 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

And you ran this in lua?

/b

On Feb 17, 2009, at 6:07 PM, Nik Middleton wrote:

Quote:

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
Back to top
nik.middleton at noble...
Guest





PostPosted: Tue Feb 17, 2009 7:22 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

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:

Quote:

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

_______________________________________________
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
intralanman at freeswi...
Guest





PostPosted: Tue Feb 17, 2009 9:42 pm    Post subject: [Freeswitch-users] AddBody to events in lua Reply with quote

Nik Middleton wrote:
Quote:
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

_______________________________________________
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
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

VoiceMeUp - Corporate & Wholesale VoIP Services