<html><body bgcolor="#FFFFFF"><div>Anthm,</div><div>I will add the substance of this to the wiki. </div><div><br></div><div>-MC<br><br>Sent from my iPhone</div><div><br>On Jan 21, 2009, at 2:09 PM, Anthony Minessale <<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><br>lua:<br><br>local event = freeswitch.Event("custom");<br><br>js:<br>e = new Event("custom", "message");<br><br><br>in js you specify a subclass which means you would need to subscribe to it <br>
events plain custom message<br><br>really just <br>events plain custom is not a good idea because all the real events have a subclass <br>once the custom keyword is seen in the event command each name after that is assumed<br>
to be a custom event name.<br><br>For subclass we use the naming convention mod::event_name <br>so a better test would be:<br><br>e = new Event("custom", "my_js::test");<br>
<br>there is no point to specify a subclass unless the event type is custom.<br><br><br>e = new Event("message");<br>
<br>would be a better example because you can easily subscribe to the "message" event.<br><br><br><br><br><br><div class="gmail_quote">On Wed, Jan 21, 2009 at 3:43 PM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org"><a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a></a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Stephen,<br>
<br>
I've been able to duplicate this behavior on my Mac with r11333. It<br>
seems to work with Lua but not with Javascript. I am going to discuss<br>
it with the devs and possibly open a jira issue. In the meantime would<br>
you be willing to try it with Lua, even just for testing? This worked<br>
for me:<br>
<lua script><br>
-- Test sending custom events in Lua<br>
local event = freeswitch.Event("custom");<br>
event:addHeader("Sample Custom Event", "no");<br>
event:fire();<br>
</lua script><br>
I saved the above as /usr/local/freeswitch/scripts/event1.lua<br>
<br>
I then opened two terminal windows, one to freeswitch CLI and the<br>
other a telnet into the event socket<br>
On the event socket I logged in and listened for custom events:<br>
telnet localhost 8021 <enter><br>
auth ClueCon <enter><enter><br>
events plain custom <enter><enter><br>
<br>
On FS CLI I typed:<br>
lua event1.lua <press enter><br>
<br>
On the event socket I immediately see this:<br>
Sample Custom Event: no<br>
Event-Name: CUSTOM<br>
Core-UUID: 2c04a36e-5a23-4b14-b0a5-34fe9fd9f1bc<br>
FreeSWITCH-Hostname: michael-collinss-macbook-pro.local<br>
FreeSWITCH-IPv4: 192.168.1.5<br>
FreeSWITCH-IPv6: %3A%3A1<br>
Event-Date-Local: 2009-01-21%2013%3A14%3A35<br>
Event-Date-GMT: Wed,%2021%20Jan%202009%2021%3A14%3A35%20GMT<br>
Event-Date-Timestamp: 1232572475813346<br>
Event-Calling-File: switch_cpp.cpp<br>
Event-Calling-Function: fire<br>
Event-Calling-Line-Number: 295<br>
<br>
However, when I do the same kind of thing with js it doesn't work:<br>
<js script><br>
// Sample event sent from JavaScript<br>
console_log("INFO","Starting event1.js sample event sender...\n");<br>
var msg = "Hello, welcome to the FreeSWITCH demo application<br>
please enter some text into the chat box";<br>
e = new Event("custom", "message");<br>
e.addBody(msg);<br>
e.fire();<br>
</js script><br>
<br>
I saved the above as /usr/local/freeswitch/scripts/event1.js<br>
I run it from the FS CLI:<br>
jsrun event1.js <enter><br>
And I see my console message pop up but I don't see anything on the event socket<br>
However, if I do this at the event socket:<br>
events plain all <enter><enter><br>
<br>
And then do jsrun event1.js from FS CLI then I do see my event on the<br>
event socket like this:<br>
Content-Length: 559<br>
Content-Type: text/event-plain<br>
<br>
Event-Subclass: message<br>
Event-Name: CUSTOM<br>
Core-UUID: 2c04a36e-5a23-4b14-b0a5-34fe9fd9f1bc<br>
FreeSWITCH-Hostname: michael-collinss-macbook-pro.local<br>
FreeSWITCH-IPv4: 192.168.1.5<br>
FreeSWITCH-IPv6: %3A%3A1<br>
Event-Date-Local: 2009-01-21%2013%3A07%3A48<br>
Event-Date-GMT: Wed,%2021%20Jan%202009%2021%3A07%3A48%20GMT<br>
Event-Date-Timestamp: 1232572068370864<br>
Event-Calling-File: mod_spidermonkey.c<br>
Event-Calling-Function: event_fire<br>
Event-Calling-Line-Number: 671<br>
Content-Length: 90<br>
<br>
Hello, welcome to the FreeSWITCH demo application please enter some<br>
text into the chat box<br>
<br>
So, there's definitely something going on, we just need to find out<br>
what for sure. I'll be in touch.<br>
-MC (mercutioviz)<br>
<div><div></div><div class="Wj3C7c"><br>
On Wed, Jan 21, 2009 at 12:00 PM, Michael Collins <<a href="mailto:msc@freeswitch.org"><a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a></a>> wrote:<br>
> thanks we'll have a look. Also, please use <a href="http://pastebin.freeswitch.org" target="_blank">pastebin.freeswitch.org</a> in<br>
> the future because it makes it easier for us to find things. :)<br>
> -MC<br>
><br>
> On Wed, Jan 21, 2009 at 8:53 AM, Stephen Crosby <<a href="mailto:stevecrozz@gmail.com"><a href="mailto:stevecrozz@gmail.com">stevecrozz@gmail.com</a></a>> wrote:<br>
>> Today I was able to see the event on the listener by subscribing to<br>
>> all events. But I'd like to only subscribe to a subset if possible. I<br>
>> thought that it would pop up when subscribing to CUSTOM events. I've<br>
>> put it all together very neatly here:<br>
>> <a href="http://pastebin.com/m6f8f7b43" target="_blank"><a href="http://pastebin.com/m6f8f7b43">http://pastebin.com/m6f8f7b43</a></a><br>
>><br>
>> --Stephen<br>
>><br>
>> On Wed, Jan 21, 2009 at 6:03 AM, Michael Collins <<a href="mailto:msc@freeswitch.org"><a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a></a>> wrote:<br>
>>> can you create a pastebin with the two scripts in question? We'll take<br>
>>> a look and see if we can figure out what's going on.<br>
>>> Thanks,<br>
>>> MC<br>
>>><br>
>>> On Tue, Jan 20, 2009 at 11:04 PM, Stephen Crosby <<a href="mailto:stevecrozz@gmail.com"><a href="mailto:stevecrozz@gmail.com">stevecrozz@gmail.com</a></a>> wrote:<br>
>>>> I noticed the wiki has an example of sending a custom event from<br>
>>>> javascript: <a href="http://wiki.freeswitch.org/wiki/Javascript_Event" target="_blank"><a href="http://wiki.freeswitch.org/wiki/Javascript_Event">http://wiki.freeswitch.org/wiki/Javascript_Event</a></a> , but I<br>
>>>> can't make it work. It doesn't fail or cause an error. But I never see<br>
>>>> an event on my listener script. Can someone confirm that this example<br>
>>>> does in fact work? or provide me with one that does?<br>
>>>><br>
>>>> --Stephen<br>
>>>><br>
>>>> _______________________________________________<br>
>>>> Freeswitch-users mailing list<br>
>>>> <a href="mailto:Freeswitch-users@lists.freeswitch.org"><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></a><br>
>>>> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></a><br>
>>>> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a><br>
>>>> <a href="http://www.freeswitch.org" target="_blank"><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></a><br>
>>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Freeswitch-users mailing list<br>
>>> <a href="mailto:Freeswitch-users@lists.freeswitch.org"><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></a><br>
>>> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></a><br>
>>> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a><br>
>>> <a href="http://www.freeswitch.org" target="_blank"><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></a><br>
>>><br>
>><br>
>> _______________________________________________<br>
>> Freeswitch-users mailing list<br>
>> <a href="mailto:Freeswitch-users@lists.freeswitch.org"><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></a><br>
>> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></a><br>
>> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a><br>
>> <a href="http://www.freeswitch.org" target="_blank"><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></a><br>
>><br>
><br>
<br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org"><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a><br>
<a href="http://www.freeswitch.org" target="_blank"><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/"><a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a></a><br>ClueCon <a href="http://www.cluecon.com/"><a href="http://www.cluecon.com/">http://www.cluecon.com/</a></a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:<a href="mailto:anthony_minessale@hotmail.com">anthony_minessale@hotmail.com</a></a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a></a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:<a href="mailto:888@conference.freeswitch.org">888@conference.freeswitch.org</a></a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:<a href="mailto:guest@conference.freeswitch.org">guest@conference.freeswitch.org</a>/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:<a href="mailto:conf+888@conference.freeswitch.org">conf+888@conference.freeswitch.org</a></a><br>pstn:213-799-1400<br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Freeswitch-users mailing list</span><br><span><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></span><br><span><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></span><br><span>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a></span><br><span><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></span><br></div></blockquote></body></html>