[Freeswitch-dev] DTMF events

Michael Collins msc at freeswitch.org
Wed Jan 21 13:19:05 PST 2009


Rob,

I've been able to duplicate this behavior on my Mac with r11333. It
seems to work with Lua but not with Javascript. I am going to discuss
it with the devs and possibly open a jira issue. In the meantime would
you be willing to try it with Lua, even just for testing? This worked
for me:
<lua script>
-- Test sending custom events in Lua
local event = freeswitch.Event("custom");
event:addHeader("Sample Custom Event", "no");
event:fire();
</lua script>
I saved the above as /usr/local/freeswitch/scripts/event1.lua

I then opened two terminal windows, one to freeswitch CLI and the
other a telnet into the event socket
On the event socket I logged in and listened for custom events:
 telnet localhost 8021 <enter>
 auth ClueCon <enter><enter>
 events plain custom <enter><enter>

On FS CLI I typed:
 lua event1.lua <press enter>

On the event socket I immediately see this:
Sample Custom Event: no
Event-Name: CUSTOM
Core-UUID: 2c04a36e-5a23-4b14-b0a5-34fe9fd9f1bc
FreeSWITCH-Hostname: michael-collinss-macbook-pro.local
FreeSWITCH-IPv4: 192.168.1.5
FreeSWITCH-IPv6: %3A%3A1
Event-Date-Local: 2009-01-21%2013%3A14%3A35
Event-Date-GMT: Wed,%2021%20Jan%202009%2021%3A14%3A35%20GMT
Event-Date-Timestamp: 1232572475813346
Event-Calling-File: switch_cpp.cpp
Event-Calling-Function: fire
Event-Calling-Line-Number: 295

However, when I do the same kind of thing with js it doesn't work:
<js script>
// Sample event sent from JavaScript
console_log("INFO","Starting event1.js sample event sender...\n");
    var msg = "Hello, welcome to the FreeSWITCH demo application
please enter some text into the chat box";
    e = new Event("custom", "message");
    e.addBody(msg);
    e.fire();
</js script>

I saved the above as /usr/local/freeswitch/scripts/event1.js
I run it from the FS CLI:
 jsrun event1.js <enter>
And I see my console message pop up but I don't see anything on the event socket
However, if I do this at the event socket:
 events plain all <enter><enter>

And then do jsrun event1.js from FS CLI then I do see my event on the
event socket like this:
Content-Length: 559
Content-Type: text/event-plain

Event-Subclass: message
Event-Name: CUSTOM
Core-UUID: 2c04a36e-5a23-4b14-b0a5-34fe9fd9f1bc
FreeSWITCH-Hostname: michael-collinss-macbook-pro.local
FreeSWITCH-IPv4: 192.168.1.5
FreeSWITCH-IPv6: %3A%3A1
Event-Date-Local: 2009-01-21%2013%3A07%3A48
Event-Date-GMT: Wed,%2021%20Jan%202009%2021%3A07%3A48%20GMT
Event-Date-Timestamp: 1232572068370864
Event-Calling-File: mod_spidermonkey.c
Event-Calling-Function: event_fire
Event-Calling-Line-Number: 671
Content-Length: 90

Hello, welcome to the FreeSWITCH demo application please enter some
text into the chat box

So, there's definitely something going on, we just need to find out
what for sure. I'll be in touch.
-MC (mercutioviz)
On Wed, Jan 21, 2009 at 7:53 AM, Rob Charlton
<rob.charlton at savageminds.com> wrote:
> Yes, and yes. I see the DTMF events arriving when I make an incoming call.
>
> I put a breakpoint on switch_channel_dequeue_dtmf() which gets hit when
> I type digits after:
>
> - I originate a call to a sip extension
> - I receive a call from a sip extension
> - I receive a call from our sip trunk (from PSTN)
>
> The breakpoint doesn't get hit when I type digits after:
>
> - I originate a call via our sip trunk (to the PSTN)
>
> As regards this:
>  > In the latter case, I am still able to pick up DTMF digits if I use
>  > javascript session.collectInput() - so it appears as if the DTMF tones
>  > are being recognised by Freeswitch, but no events sent.
> I must have been dreaming - that isn't the case at all -
> session.collectInput doesn't get any digits at all.
>
> We use the same SIP trunk with asterisk and that _does_ pick up DTMF
> tones for outbound PSTN calls.
>
> Thanks
>
> Rob
>
>
> Anthony Minessale wrote:
>> Did you try enabling all events and making a single call to make sure
>> you are subscribed to the right event?
>>
>>
>> On Wed, Jan 21, 2009 at 6:38 AM, Rob Charlton
>> <rob.charlton at savageminds.com <mailto:rob.charlton at savageminds.com>>
>> wrote:
>>
>>     Hi,
>>
>>     I'm using mod_event_socket to listen for DTMF events. I have Nokia
>>     handsets registered as SIP clients over Wifi, as well as a SIP trunk
>>     providing incoming PSTN calls to a range of DDIs and outgoing PSTN
>>     calls.
>>
>>     If I make an incoming (PSTN or SIP) call and answer it, I always see
>>     DTMF events via mod_event_socket.
>>     If I make an outgoing call direct to a handset using SIP then I
>>     see DTMF
>>     events - e.g. originate user/1000 &park()
>>     If I make an outgoing call via PSTN then I don't see DTMF events e.g.
>>     originate sofia/gateway/mygateway/myphonenumber &park() or
>>     &javascript(myscript.js);
>>
>>     In the latter case, I am still able to pick up DTMF digits if I use
>>     javascript session.collectInput() - so it appears as if the DTMF tones
>>     are being recognised by Freeswitch, but no events sent.
>>
>>     What am I doing wrong?
>>
>>     Cheers
>>
>>     Rob
>>
>>     --
>>     Rob Charlton
>>     Savage Minds Ltd
>>
>
>
> _______________________________________________
> Freeswitch-dev mailing list
> Freeswitch-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>



More information about the Freeswitch-dev mailing list