Hi Guys, I'm trying to get VMD running in js, does anyone have an example of how it's called? If I try session:execute("vmd"); I get an error Regards
I'm trying to get VMD running in js, does anyone have an example of how it's called? http://wiki.freeswitch.org/wiki/Mod_vmd
You need to use the event socket because that is the way VMD is designed. If called from the dialplan it will set a channel variable but that isn't of much use in a real-time application. Using it as an API (or bgapi) will yield an event when VMD is detected. This makes sense because you don't know when (or even if) VMD will be detected, so using the event system is the best choice. -MC
That makes sense, though could it not have a call back mechanism similar to DTMF detect? I'm still not sure how I could use it even in an event socket. I plan to call my js IVR script using a socket, but that has the originate call in it which is nice and simple, but I'm unsure how I could abort it (js IVR. The functionality I'm looking for is really simple. I simply don't want to leave a voicemail message. So VMD looks just the ticket. Regards -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 12 February 2009 20:00 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] js and VMD
I'm trying to get VMD running in js, does anyone have an example of how it's called? http://wiki.freeswitch.org/wiki/Mod_vmd
You need to use the event socket because that is the way VMD is designed. If called from the dialplan it will set a channel variable but that isn't of much use in a real-time application. Using it as an API (or bgapi) will yield an event when VMD is detected. This makes sense because you don't know when (or even if) VMD will be detected, so using the event system is the best choice. -MC _______________________________________________ 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
On Thu, Feb 12, 2009 at 12:49 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:
That makes sense, though could it not have a call back mechanism similar to DTMF detect?
It probably could but the mod's author was using it exclusively from event socket. I personally added the channel variable code for the sake of testing. I'm sure this could be added but it's beyond my skills presently. I would recommend opening up a JIRA and requesting this functionality as an improvement. Perhaps the author, Eric Des Courtis, could add it or perhaps another skilled programmer could add this functionality. In the grand scheme of things it probably isn't that difficult and with a little time even I could figure it out.
I'm still not sure how I could use it even in an event socket. I plan to call my js IVR script using a socket, but that has the originate call in it which is nice and simple, but I'm unsure how I could abort it (js IVR.
As a proof of concept you could have your script loop and check the value of ${vmd_status} every 1000ms or so, and if it ever has the value "TRUE" then you know VMD was positive and you could hangup and do whatever other cleanup is necessary. That solution would be a temp fix even though it wouldn't actually scale very well. How are you handling answered calls now? Do you just start playing a message? I'm wondering how this would work even if there was a callback. Would you mind doing a pastebin of your script? I'd like to see the big picture. -MC
The functionality I'm looking for is really simple. I simply don't want to leave a voicemail message. So VMD looks just the ticket.
Regards
Just been chatting to Ken Rice, his view (and he may be mistaken) is that it should fire the call back event in much the same way as DTMF does, however, it's not working. I used to develop with C/C++ for about 10 years, but that was 12 years ago. Very rusty. However, I'm going to look at the start_dtmf code and try to replicate the functionality in mod_vmd. Regarding your suggestion, that wouldn't really work as I'm streaming a file. However, if memory serves me well, there is a timer function in C that you can set to run that can call a function. There is a function in js called setTimeout(time_func, 500) but sadly it's not available in spidermonkey. BTW this function would resolve a bounty on call duration timeouts Regards -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins Sent: 12 February 2009 21:45 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] js and VMD On Thu, Feb 12, 2009 at 12:49 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:
That makes sense, though could it not have a call back mechanism similar to DTMF detect?
It probably could but the mod's author was using it exclusively from event socket. I personally added the channel variable code for the sake of testing. I'm sure this could be added but it's beyond my skills presently. I would recommend opening up a JIRA and requesting this functionality as an improvement. Perhaps the author, Eric Des Courtis, could add it or perhaps another skilled programmer could add this functionality. In the grand scheme of things it probably isn't that difficult and with a little time even I could figure it out.
I'm still not sure how I could use it even in an event socket. I plan to call my js IVR script using a socket, but that has the originate call in it which is nice and simple, but I'm unsure how I could abort it (js IVR.
As a proof of concept you could have your script loop and check the value of ${vmd_status} every 1000ms or so, and if it ever has the value "TRUE" then you know VMD was positive and you could hangup and do whatever other cleanup is necessary. That solution would be a temp fix even though it wouldn't actually scale very well. How are you handling answered calls now? Do you just start playing a message? I'm wondering how this would work even if there was a callback. Would you mind doing a pastebin of your script? I'd like to see the big picture. -MC
The functionality I'm looking for is really simple. I simply don't
want
to leave a voicemail message. So VMD looks just the ticket.
Regards
_______________________________________________ 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
On Thu, Feb 12, 2009 at 2:26 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:
Just been chatting to Ken Rice, his view (and he may be mistaken) is that it should fire the call back event in much the same way as DTMF does, however, it's not working. I used to develop with C/C++ for about 10 years, but that was 12 years ago. Very rusty. However, I'm going to look at the start_dtmf code and try to replicate the functionality in mod_vmd.
That would be awesome. I think once you get into the code you'll realize that it isn't like walking through a warzone or tapdancing in a minefield like some other codebases. :) The code is really well-ordered so you can frequently copy and paste from other files and functions and create new functionality. Feel free to get in there and start mixing it up! It's kinda fun.
Regarding your suggestion, that wouldn't really work as I'm streaming a file. However, if memory serves me well, there is a timer function in C that you can set to run that can call a function. There is a function in js called setTimeout(time_func, 500) but sadly it's not available in spidermonkey. BTW this function would resolve a bounty on call duration timeouts
Understood. The other thing you could do, at least to test the events for VMD, is to create a little daemon kind of program that sits there and listens for VMD hits and have it uuid_kill those channels for you. Crude, to be sure, but it would definitely let you confirm that the system is working. -MC
participants (2)
-
Michael Collins
-
Nik Middleton