Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

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

[Freeswitch-users] firing custom event in Lua


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





PostPosted: Sun Aug 24, 2008 8:54 am    Post subject: [Freeswitch-users] firing custom event in Lua Reply with quote

Hi,

I tried to fire custom event with the following example:

e = freeswitch.Event("message");
e:add_body("mymsg","abcd")
session:sendEvent(e)

But I am getting this error from freeswitch console:

2008-08-25 05:49:33 [ERR] mod_lua.cpp:176 lua_parse_and_execute() ...r/local/freeswitch/scripts/script.lua:61: attempt to call method 'add_body' (a nil value)
stack traceback:
...r/local/freeswitch/scripts/script.lua:61: in main chunk


Does anyone know what is wrong with my script?

Thanks,
JB
Back to top
brian at freeswitch.org
Guest





PostPosted: Sun Aug 24, 2008 11:26 am    Post subject: [Freeswitch-users] firing custom event in Lua Reply with quote

Try e:addBody
/b

On Aug 24, 2008, at 8:51 AM, Juan Backson wrote:

Quote:
e:add_body("mymsg","abcd")

Brian West
sip:brian@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
juanbackson at gmail.com
Guest





PostPosted: Mon Aug 25, 2008 1:59 am    Post subject: [Freeswitch-users] firing custom event in Lua Reply with quote

Hi Brian,

If I try
e = freeswitch.Event("message");
e:addBody("thisisatestevent","abcd")
session:sendEvent(e)

2008-08-25 23:09:30 [ERR] mod_lua.cpp:176 lua_parse_and_execute() Error in addBody expected 2..2 args, got 3
stack traceback:
[C]: in function 'addBody'


If I try

e = freeswitch.Event("message");
e:addBody("thisisatestevent")
session:sendEvent(e)

It went through, but I can't pick up any message with the name or type "message"


Thanks for your help.

JB



On Mon, Aug 25, 2008 at 12:23 AM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote:
Try e:addBody
/b

On Aug 24, 2008, at 8:51 AM, Juan Backson wrote:

Quote:
e:add_body("mymsg","abcd")


Brian West
sip:brian@freeswitch.org ([email]sip%3Abrian@freeswitch.org[/email])




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





PostPosted: Mon Aug 25, 2008 9:42 am    Post subject: [Freeswitch-users] firing custom event in Lua Reply with quote

if you want to fire the event use

e:fire() Wink

session:sendEvent(e) will queue the event to the session which is not what you seem to want.


On Mon, Aug 25, 2008 at 1:57 AM, Juan Backson <juanbackson@gmail.com (juanbackson@gmail.com)> wrote:
Quote:
Hi Brian,

If I try
e = freeswitch.Event("message");
e:addBody("thisisatestevent","abcd")
session:sendEvent(e)

2008-08-25 23:09:30 [ERR] mod_lua.cpp:176 lua_parse_and_execute() Error in addBody expected 2..2 args, got 3
stack traceback:
[C]: in function 'addBody'


If I try

e = freeswitch.Event("message");
e:addBody("thisisatestevent")
session:sendEvent(e)

It went through, but I can't pick up any message with the name or type "message"


Thanks for your help.

JB




On Mon, Aug 25, 2008 at 12:23 AM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote:
Try e:addBody
/b

On Aug 24, 2008, at 8:51 AM, Juan Backson wrote:

Quote:
e:add_body("mymsg","abcd")


Brian West
sip:brian@freeswitch.org ([email]sip%3Abrian@freeswitch.org[/email])




_______________________________________________
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
Back to top
juanbackson at gmail.com
Guest





PostPosted: Wed Aug 27, 2008 4:49 am    Post subject: [Freeswitch-users] firing custom event in Lua Reply with quote

Hi Anthony,

Thanks for your help. I can now send out custom message, but I am still not able to specify the content I want, such as Event_Type etc.

I tried the following, but still it does not work:

e = freeswitch.Event("message");
e:addBody("Event-Name=TestEvent")
e:fire();

Is it possible to specify the Event-Name and Event-Type in lua?

Thanks,
JB

On Mon, Aug 25, 2008 at 10:39 PM, Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)> wrote:
Quote:
if you want to fire the event use

e:fire() Wink

session:sendEvent(e) will queue the event to the session which is not what you seem to want.



On Mon, Aug 25, 2008 at 1:57 AM, Juan Backson <juanbackson@gmail.com (juanbackson@gmail.com)> wrote:
Quote:
Hi Brian,

If I try
e = freeswitch.Event("message");
e:addBody("thisisatestevent","abcd")
session:sendEvent(e)

2008-08-25 23:09:30 [ERR] mod_lua.cpp:176 lua_parse_and_execute() Error in addBody expected 2..2 args, got 3
stack traceback:
[C]: in function 'addBody'


If I try

e = freeswitch.Event("message");
e:addBody("thisisatestevent")
session:sendEvent(e)

It went through, but I can't pick up any message with the name or type "message"


Thanks for your help.

JB




On Mon, Aug 25, 2008 at 12:23 AM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote:
Try e:addBody
/b

On Aug 24, 2008, at 8:51 AM, Juan Backson wrote:

Quote:
e:add_body("mymsg","abcd")


Brian West
sip:brian@freeswitch.org ([email]sip%3Abrian@freeswitch.org[/email])




_______________________________________________
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


_______________________________________________
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

Back to top
brian at freeswitch.org
Guest





PostPosted: Wed Aug 27, 2008 8:45 am    Post subject: [Freeswitch-users] firing custom event in Lua Reply with quote

local event = freeswitch.Event("message_waiting"); -- <-- This is the event NAME
event:addHeader("MWI-Messages-Waiting", "no");
event:addHeader("MWI-Message-Account", "[url=sip:1000@10.0.1.100]sip:1000@10.0.1.100[/url]");
event:fire();


/b






On Aug 27, 2008, at 4:48 AM, Juan Backson wrote:
Quote:
Hi Anthony,

Thanks for your help. I can now send out custom message, but I am still not able to specify the content I want, such as Event_Type etc.

I tried the following, but still it does not work:

e = freeswitch.Event("message");
e:addBody("Event-Name=TestEvent")
e:fire();

Is it possible to specify the Event-Name and Event-Type in lua?

Thanks,
JB

On Mon, Aug 25, 2008 at 10:39 PM, Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)> wrote:
Quote:
if you want to fire the event use

e:fire() Wink

session:sendEvent(e) will queue the event to the session which is not what you seem to want.



On Mon, Aug 25, 2008 at 1:57 AM, Juan Backson <juanbackson@gmail.com (juanbackson@gmail.com)> wrote:
Quote:
Hi Brian,

If I try
e = freeswitch.Event("message");
e:addBody("thisisatestevent","abcd")
session:sendEvent(e)

2008-08-25 23:09:30 [ERR] mod_lua.cpp:176 lua_parse_and_execute() Error in addBody expected 2..2 args, got 3
stack traceback:
[C]: in function 'addBody'


If I try

e = freeswitch.Event("message");
e:addBody("thisisatestevent")
session:sendEvent(e)

It went through, but I can't pick up any message with the name or type "message"


Thanks for your help.

JB




On Mon, Aug 25, 2008 at 12:23 AM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote:
Try e:addBody
/b

On Aug 24, 2008, at 8:51 AM, Juan Backson wrote:

Quote:
e:add_body("mymsg","abcd")


Brian West
sip:brian@freeswitch.org ([email]sip%3Abrian@freeswitch.org[/email])




_______________________________________________
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


_______________________________________________
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


Brian West
[url=sip:brian@freeswitch.org]sip:brian@freeswitch.org[/url]
Back to top
anthony.minessale at g...
Guest





PostPosted: Wed Aug 27, 2008 9:42 am    Post subject: [Freeswitch-users] firing custom event in Lua Reply with quote

also,

local event = freeswitch.Event("custom", "my::event");

event:addHeader("My-Header", "test");
event:fire();


On Wed, Aug 27, 2008 at 8:41 AM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote:
local event = freeswitch.Event("message_waiting"); -- <-- This is the event NAME
event:addHeader("MWI-Messages-Waiting", "no");
event:addHeader("MWI-Message-Account", "sip:1000@10.0.1.100");
event:fire();


/b







On Aug 27, 2008, at 4:48 AM, Juan Backson wrote:

Quote:
Hi Anthony,

Thanks for your help. I can now send out custom message, but I am still not able to specify the content I want, such as Event_Type etc.

I tried the following, but still it does not work:

e = freeswitch.Event("message");
e:addBody("Event-Name=TestEvent")
e:fire();

Is it possible to specify the Event-Name and Event-Type in lua?

Thanks,
JB

On Mon, Aug 25, 2008 at 10:39 PM, Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)> wrote:
Quote:
if you want to fire the event use

e:fire() Wink

session:sendEvent(e) will queue the event to the session which is not what you seem to want.



On Mon, Aug 25, 2008 at 1:57 AM, Juan Backson <juanbackson@gmail.com (juanbackson@gmail.com)> wrote:
Quote:
Hi Brian,

If I try
e = freeswitch.Event("message");
e:addBody("thisisatestevent","abcd")
session:sendEvent(e)

2008-08-25 23:09:30 [ERR] mod_lua.cpp:176 lua_parse_and_execute() Error in addBody expected 2..2 args, got 3
stack traceback:
[C]: in function 'addBody'


If I try

e = freeswitch.Event("message");
e:addBody("thisisatestevent")
session:sendEvent(e)

It went through, but I can't pick up any message with the name or type "message"


Thanks for your help.

JB




On Mon, Aug 25, 2008 at 12:23 AM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote:
Try e:addBody
/b

On Aug 24, 2008, at 8:51 AM, Juan Backson wrote:

Quote:
e:add_body("mymsg","abcd")


Brian West
sip:brian@freeswitch.org ([email]sip%3Abrian@freeswitch.org[/email])




_______________________________________________
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


_______________________________________________
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


Brian West
sip:brian@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
Back to top
brian at freeswitch.org
Guest





PostPosted: Wed Aug 27, 2008 9:56 am    Post subject: [Freeswitch-users] firing custom event in Lua Reply with quote

Let me wiki this one. If its not already up on the wiki.

On Aug 27, 2008, at 9:39 AM, Anthony Minessale wrote:

Quote:
local event = freeswitch.Event("custom", "my::event");

Brian West
sip:brian@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
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