[Freeswitch-users] AddBody to events in lua

Anthony Minessale anthony.minessale at gmail.com
Tue Feb 17 15:25:11 PST 2009


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 at 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 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/

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090217/6e79ecb9/attachment-0001.html 


More information about the Freeswitch-users mailing list