sending custom events from event_socket, channel_variable_changed event?
Hello *, while trying to figure out how to send custom events from mod_socket with "sendmsg" (like a telnet connection or something) i only found how to do that from within javascript (with e.fire() and stuff). So... first of all, how's the correct syntax to do that from the event_socket? the wiki states --- sendmsg <uuid> Send a message to the call of given uuid (call-command execute or hangup), see examples below. --- Is there a secret syntax i missed how to send "CUSTOM" events? I tried to work-around that by setting a channel-variable and then calling the info-app. That way, a channel_execute event is fired and shows up in my event_socket-app. If there's a prettier way... please ignore the following up to the <snipp> mark :) so it looked to me that i can only send "command" messages and looking at the sources i found that mod_socket will hard-wire the event-name to "SWITCH_EVENT_COMMAND" (in read_packet() in ./mod/event_handlers/mod_event_socket/mod_event_socket.c). If i understand correctly how e.g.. the mod_spidermonkey-bindings enqueue events, the event-name is taken from the user and can therefor be "CUSTOM" (looks like it's being looked up in the switch_event_types_t-enum). --- if (switch_name_event(ename, &etype) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown event %s\n", ename); *rval = BOOLEAN_TO_JSVAL(JS_FALSE); return JS_TRUE; } if (etype == SWITCH_EVENT_CUSTOM) { [...] if (switch_event_create_subclass(&event, etype, subclass_name) != SWITCH_STATUS_SUCCESS) { --- If it's currently not possible, do you think this could be useful, too? I thought a bit about the syntax and came up with this idea to not break compatibility, but feel free to change that, you know it better :) if you want to send an event that's not COMMAND, use "event-name: CUSTOM" as the first line after the "sendmsg [uuid]" and change the event-name (if that's possible) of the event already created by read_packet() or reconstruct the event or ... <snipp> Just another idea..... that could become handy is if there would be an event "CHANNEL_VAR_CHANGED", fired/enqueued by setvar(), setvar_multi() and friends. But as i write this i admit that one will be overwhelmed by the setvar massacre for example bridge() would do to set "disposition"-variables... Just a thought. Cheers Beni.
I think we can't do it just because nobody needed it. I added a patch to r14874 to allow you to add a "unique-id" header to the sendevent command that should allow you to address and event right to a particular session rather than fire the event. On Tue, Sep 15, 2009 at 12:08 PM, Benedikt Fraunhofer < fraunhofer.lists.freeswitch-001@traced.net> wrote:
Hello *,
while trying to figure out how to send custom events from mod_socket with "sendmsg" (like a telnet connection or something) i only found how to do that from within javascript (with e.fire() and stuff).
So... first of all, how's the correct syntax to do that from the event_socket? the wiki states --- sendmsg <uuid>
Send a message to the call of given uuid (call-command execute or hangup), see examples below. ---
Is there a secret syntax i missed how to send "CUSTOM" events?
I tried to work-around that by setting a channel-variable and then calling the info-app. That way, a channel_execute event is fired and shows up in my event_socket-app. If there's a prettier way... please ignore the following up to the <snipp> mark :)
so it looked to me that i can only send "command" messages and looking at the sources i found that mod_socket will hard-wire the event-name to "SWITCH_EVENT_COMMAND" (in read_packet() in ./mod/event_handlers/mod_event_socket/mod_event_socket.c). If i understand correctly how e.g.. the mod_spidermonkey-bindings enqueue events, the event-name is taken from the user and can therefor be "CUSTOM" (looks like it's being looked up in the switch_event_types_t-enum). --- if (switch_name_event(ename, &etype) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown event %s\n", ename); *rval = BOOLEAN_TO_JSVAL(JS_FALSE); return JS_TRUE; }
if (etype == SWITCH_EVENT_CUSTOM) { [...] if (switch_event_create_subclass(&event, etype, subclass_name) != SWITCH_STATUS_SUCCESS) {
---
If it's currently not possible, do you think this could be useful, too? I thought a bit about the syntax and came up with this idea to not break compatibility, but feel free to change that, you know it better :) if you want to send an event that's not COMMAND, use "event-name: CUSTOM" as the first line after the "sendmsg [uuid]" and change the event-name (if that's possible) of the event already created by read_packet() or reconstruct the event or ...
<snipp>
Just another idea..... that could become handy is if there would be an event "CHANNEL_VAR_CHANGED", fired/enqueued by setvar(), setvar_multi() and friends. But as i write this i admit that one will be overwhelmed by the setvar massacre for example bridge() would do to set "disposition"-variables... Just a thought.
Cheers Beni.
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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
Hi Anthony, 2009/9/15 Anthony Minessale <anthony.minessale@gmail.com>:
I added a patch to r14874 to allow you to add a "unique-id" header to the sendevent command that should allow you to address and event right to a particular session rather than fire the event.
thx! While riding the train back from work i thought i could've missed that what i wanted to achieve was possible with sendevent instead of sendmsg but your reply made me calm down :) I won't be able to give it a try until this Friday, but I'll report back if this is the "new" way to send CUSTOM events from mod_event to mod_event and pay the wiki tax, accordingly :) Thx again! Beni.
participants (2)
-
Anthony Minessale
-
Benedikt Fraunhofer