[Freeswitch-users] mod_avmd

Bernard Fluixa fluixab at bellsouth.net
Tue Jul 24 02:38:16 MSD 2012


Hello,

I can start mod_avmd and it detects voicemail beep when calling my cellphone. However, when I pickup the phone and press a key to use IVR, I would like to stop mod_avmd. I copied the input callback example from FreeSWITCH Wiki. My issue is that my input handler is never triggered, neither when I key a DTMF nor when beep is detected. 

1) My handler is: 
function onInput(s, type, obj)
    if (type == "dtmf") then								
        avmd_result = 1;
		if ( debug_mode > 0 ) then 
			print("onInput - Human detected");	
		end
        return "break";
    end
    if (type == "event" ) then							
        avmd_result = 2;
		if ( debug_mode > 0 ) then 
			print("onInput - Voicemail detected");	
		end
        avmd_result = 2;
        return "break";
    end
end

2) To start mod_avmd, play file and collect digits:
		session:setInputCallback("onInput");
		session:execute("avmd","start");

		digits = session:playAndGetDigits(…….);

3) To stop mod_avmd:
		session:execute("avmd","stop");

4) Output when keying DTMF (*3 in this case). Input handler does not kick off upon DTMF: 
EXECUTE sofia/external/+19543307528 avmd(start)
012-07-23 18:13:28.025981 [INFO] mod_avmd.c:538 <<< AVMD v=0.073060 f=0.900987 1147.172790Hz sma=0.090099 sqa=0.081178 >>>
... 
012-07-23 18:13:30.492866 [INFO] mod_avmd.c:538 <<< AVMD v=0.052551 f=0.764130 972.920758Hz sma=0.076413 sqa=0.058389 >>>
2012-07-23 18:13:30.586854 [DEBUG] switch_rtp.c:3795 RTP RECV DTMF *:800
2012-07-23 18:13:30.605660 [INFO] mod_avmd.c:538 <<< AVMD v=0.067196 f=0.864073 1100.171521Hz sma=0.086407 sqa=0.074662 >>>
…
2012-07-23 18:13:30.998715 [INFO] mod_avmd.c:538 <<< AVMD v=0.030803 f=0.585023 744.874518Hz sma=0.058502 sqa=0.034225 >>>
2012-07-23 18:13:31.085676 [DEBUG] switch_rtp.c:3795 RTP RECV DTMF 3:640
...
012-07-23 18:13:36.645609 [INFO] mod_avmd.c:538 <<< AVMD v=0.030380 f=0.580996 739.747695Hz sma=0.058100 sqa=0.033756 >>>

5) Output when beep is detected - Mod_avmd stops output after beep detection but input handler does not kick off
2012-07-23 18:04:04.992856 [INFO] mod_avmd.c:538 <<< AVMD v=0.000048 f=0.812668 1034.721179Hz sma=0.811125 sqa=0.657971 >>>
2012-07-23 18:04:04.992856 [INFO] mod_avmd.c:561 <<< AVMD - Beep Detected >>>

What am I missing?

Thank you

Bernard




On Jul 23, 2012, at 2:16 PM, Bernard Fluixa wrote:

> OK. I'm clear now. Thanks again.
> On Jul 23, 2012, at 1:17 PM, Michael Collins wrote:
> 
>> Precisely. 
>> -MC
>> 
>> On Mon, Jul 23, 2012 at 9:59 AM, Bernard Fluixa <fluixab at bellsouth.net> wrote:
>> Michael,
>> 
>> Thank you or your response. So it is my responsibility to do whatever needs to be done while mod_avmd attempts to detect a beep and to manually stop it after a beep as been detected or after a certain timeout. Correct?
>> 
>> Bernard
>> 
>>   
>> 
>> 
>> On Jul 23, 2012, at 11:59 AM, Michael Collins wrote:
>> 
>>> Bernard,
>>> 
>>> Keep in mind that avmd is non-blocking, that is, it won't cause your dialplan or script to pause while it is attempting to detect the beep. Your dialplan will keep doing what it normally does, and if avmd detects a beep then it will throw an event which you catch and handle in your onInput function.
>>> 
>>> -MC
>>> 
>>> On Mon, Jul 23, 2012 at 6:47 AM, BF <bfmtl at hotmail.com> wrote:
>>> Hello,
>>> 
>>> I'm trying to use it from a Lua script. My understanding is that mod_avmd detects beep from voicemail systems and is CPU intensive, please correct me if I'm wrong.
>>> 
>>> The Lua example at FreeSWITCH Wiki is
>>> local human_detected = false;
>>> local voicemail_detected = false;
>>> 
>>> function onInput(session, type, obj)
>>>     if type == "dtmf" and obj['digit'] == '1' and human_detected == false then
>>>         human_detected = true;
>>>         return "break";
>>>     end
>>> 
>>>     if type == "event" and voicemail_detected == false then
>>>         voicemail_detected = true;
>>>         return "break";
>>>     end
>>> end
>>> 
>>> session:setInputCallback("onInput");
>>> session:execute("avmd","start");
>>> In order to implement this example, the script must wait for the beep to be detected or not to process the case accordingly. What is no beep is detected? How can I prevent called party to hear only silence while potential beep detection is being executed?
>>> 
>>> Thank you
>>> 
>>> Bernard
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>> 
>>> 
>>> 
>>> 
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>> 
>>> Join Us At ClueCon - Aug 7-9, 2012
>>> 
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>> 
>>> 
>>> 
>>> -- 
>>> Michael S Collins
>>> Twitter: @mercutioviz
>>> http://www.FreeSWITCH.org
>>> http://www.ClueCon.com
>>> http://www.OSTAG.org
>>> 
>>> 
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>> 
>>> 
>>> 
>>> 
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>> 
>>> Join Us At ClueCon - Aug 7-9, 2012
>>> 
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>> 
>> 
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>> 
>> 
>> 
>> 
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>> 
>> Join Us At ClueCon - Aug 7-9, 2012
>> 
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>> 
>> 
>> 
>> 
>> -- 
>> Michael S Collins
>> Twitter: @mercutioviz
>> http://www.FreeSWITCH.org
>> http://www.ClueCon.com
>> http://www.OSTAG.org
>> 
>> 
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>> 
>> 
>> 
>> 
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>> 
>> Join Us At ClueCon - Aug 7-9, 2012
>> 
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> Join Us At ClueCon - Aug 7-9, 2012
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120723/9bbb37a0/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list