[Freeswitch-users] Issues with using avmd from python script

raj singh rajictdialer at gmail.com
Fri Jul 26 22:52:02 MSD 2013


I have changed my email , not sure if you got my last email so sending
again, thanks for your help


On Fri, Jul 26, 2013 at 11:48 AM, Rajput R Singh <srraghu45 at gmail.com>wrote:

>
>
> Begin forwarded message:
>
> *From: *Michael Collins <msc at freeswitch.org>
> *Subject: **Re: [Freeswitch-users] Issues with using avmd from python
> script*
> *Date: *July 25, 2013 12:14:49 PM PDT
> *To: *FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
> *Reply-To: *FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
>
> I copied the logs to http://pastebin.freeswitch.org/21239 so that I could
> see them more easily. It looks to me like you're just hanging up the call
> after you detect the beep. If you want to do something else I would just
> add whatever dialplan apps you want to run.
>
> -MC
>
>
> On Thu, Jul 25, 2013 at 10:56 AM, Raghu <srraghu45 at gmail.com> wrote:
>
>> I have pasted the console debug logs here <http://pastebin.com/anN768su> ,
>> please review it
>>
>> Thanks
>>
>>
>> On Thu, Jul 25, 2013 at 9:06 AM, Michael Collins <msc at freeswitch.org>wrote:
>>
>>> Get a complete console debug log of the call and put onto pastebin so
>>> that the gang here can review what's happening.
>>> -MC
>>>
>>>
>>> On Wed, Jul 24, 2013 at 11:01 PM, Raghu <srraghu45 at gmail.com> wrote:
>>>
>>>> Thanks MC, i made the change and avmd was able to detect beep on few
>>>> occasions everything else remaining same. Also, i wasnt able to send the
>>>> message to voicemail, i tried with invoking sleep of 3secs
>>>>
>>>> ----------------------------------------
>>>> from freeswitch import *
>>>>
>>>> # WARNING: known bugs with hangup hooks, use with extreme caution
>>>> def hangup_hook(session, what):
>>>>
>>>>     consoleLog("info","hangup hook for RAJ  %s!!\n\n" % what)
>>>>     return
>>>>
>>>> def input_callback(session, what, obj):
>>>>
>>>>     if (what == "dtmf"):
>>>>         consoleLog("info", what + " from callback " + obj.digit + "\n")
>>>>         return
>>>>     elif (what == "event" and session.getVariable('avmd_detect') ==
>>>> "TRUE"):
>>>>         consoleLog("info", "Voicemail Detected\n")
>>>>
>>>>
>>>>     return "TRUE"
>>>>
>>>> def handler(session, args):
>>>>
>>>>     session.answer()
>>>>     callback = session.setInputCallback("input_callback")
>>>>     session.execute("avmd", "start")
>>>>     consoleLog("info", "AVMD start\n")
>>>>     session.execute("sleep", "16000")
>>>>     consoleLog("info", "AVMD status %s\n" %
>>>> session.getVariable('avmd_detect'))
>>>>     if session.getVariable('avmd_detect'):
>>>>          session.execute("sleep", "3000")
>>>>          consoleLog("info", "Beep Detected\n")
>>>>          session.execute("speak", "flite|kal|'Hi this is '")
>>>>          session.execute("avmd", "stop")
>>>>     session.execute("speak", "flite|kal|'Hi this is '")
>>>>     consoleLog("info","callback returned for  %s!!\n\n" % callback)
>>>>     session.execute("avmd", "stop")
>>>>     consoleLog("info", "AVMD stop\n")
>>>>     session.setHangupHook(hangup_hook)
>>>>
>>>>
>>>>     session.hangup() #hangup the call
>>>> -----------------------------------------------------------------
>>>>
>>>> Please suggest
>>>>
>>>> Thanks
>>>>
>>>>
>>>> On Wed, Jul 24, 2013 at 4:08 PM, Michael Collins <msc at freeswitch.org>wrote:
>>>>
>>>>> Hi Raghu,
>>>>>
>>>>> I would put the setInputCallback before the sleep, that way if the
>>>>> avmd is detected while you're sleeping then it should work.
>>>>>
>>>>> -MC
>>>>>
>>>>>
>>>>> On Wed, Jul 24, 2013 at 1:30 PM, Raghu <srraghu45 at gmail.com> wrote:
>>>>>
>>>>>>  I am new to freeswitch. I am trying to send a message to voicemail
>>>>>> using avmd for voicemail detection, here is the code which i am using with
>>>>>> originate command:
>>>>>>
>>>>>> from freeswitch import *
>>>>>>
>>>>>> # WARNING: known bugs with hangup hooks, use with extreme caution
>>>>>> def hangup_hook(session, what):
>>>>>>
>>>>>>     consoleLog("info","hangup hook   %s!!\n\n" % what)
>>>>>>     return
>>>>>>
>>>>>> def input_callback(session, what, obj):
>>>>>>
>>>>>>     if (what == "dtmf"):
>>>>>>         consoleLog("info", what + " from callback " + obj.digit +
>>>>>> "\n")
>>>>>>         return
>>>>>>     elif (what == "event" and session.getVariable('avmd_detect') ==
>>>>>> "TRUE"):
>>>>>>         consoleLog("info", "Voicemail Detected\n")
>>>>>>     return "true"
>>>>>>
>>>>>> def handler(session, args):
>>>>>>
>>>>>>     session.answer()
>>>>>>     session.execute("avmd", "start")
>>>>>>     session.execute("sleep", "25000")
>>>>>>     callback = session.setInputCallback(input_callback)
>>>>>>     consoleLog("info","callback returned %s!!\n\n" % callback)
>>>>>>     while session.getVariable('avmd_detect'):
>>>>>>          session.execute("speak", "flite|kal|'Hi how are you'")
>>>>>>
>>>>>>     session.execute("avmd", "stop")
>>>>>>     session.setHangupHook(hangup_hook)
>>>>>>     session.hangup() #hangup the call
>>>>>>
>>>>>>
>>>>>> I can see avmd getting started but it does detect any beep. Is there
>>>>>> a simpler way to check if avmd is working without using 'originate'?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> _________________________________________________________________________
>>>>>> 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
>>>>>>
>>>>>> 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.freeswitch.org/>
>>>>> http://www.ClueCon.com <http://www.cluecon.com/>
>>>>> http://www.OSTAG.org <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
>>>>>
>>>>> 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
>>>>
>>>> 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.freeswitch.org/>
>>> http://www.ClueCon.com <http://www.cluecon.com/>
>>> http://www.OSTAG.org <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
>>>
>>> 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
>>
>> 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.freeswitch.org/>
> http://www.ClueCon.com <http://www.cluecon.com/>
> http://www.OSTAG.org <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
>
> 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/20130726/0b949526/attachment-0001.html 


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