<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 14, 2017, at 6:01 AM, Deepika Yadav <<a href="mailto:deepikay@iiitd.ac.in" class="">deepikay@iiitd.ac.in</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">I have implemented a functionality where when a person with his mobile phone number calls a specific number (that of SIM inserted in our GOIP hardware), the incoming is hanged and that person is called back.</div><div class=""><br class=""></div><div class="">After the IVR menu starts playing and if in between caller hangs up, hangup_event is not detected and the registered hangup_hook does not get called.</div><div class=""><br class=""></div><div class="">Code is as follows;</div><div class=""><b class=""><br class=""></b></div><div class=""><b class="">XML file that starts python script when the person answers the cal</b>l:</div><div class=""><div class=""><br class=""></div><div class=""><extension name="record_topic"></div><div class=""> <condition field="destination_number" expression="^4449"> </div><div class=""> <action application="set" data="execute_on_answer=python <b class="">python.sangoshthi_IVR_handler</b>"/></div><div class=""><br class=""></div><div class=""> <action application="sleep" data="30000"/></div><div class=""> </condition></div><div class=""></extension></div></div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>This part is really strange. If you want to execute that python script when the call answers after originating to the endpoint, just make the python the only thing in dial plan, and use ignore_early_media on the originate. It won’t hit the dial plan until answer. As for the rest of your question, it seems like you are saying you don’t get the hanguphook when the python script isn’t running?</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><b class="">Python Script handler:</b></div><div class=""><br class=""></div><div class=""><div class="">def handler(session, args):</div><div class=""> </div><div class=""> session.setHangupHook(hangup_hook)</div><div class=""> session.setInputCallback(input_callback)</div><div class=""><br class=""></div><div class=""> print('session object value is ', str(session))</div><div class=""><br class=""></div></div><div class=""><div class=""> callerid = session.getVariable('caller_id_number')</div><div class=""> call_uuid = session.getVariable('uuid')</div><div class=""><br class=""></div><div class=""> phone_number = callerid[len(callerid)-10:]</div><div class=""><br class=""></div><div class=""> initial_greeting(session, phone_number, call_uuid)</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">def hangup_hook(session, what, args=''):<br class=""></div></div><div class=""><div class=""> """</div><div class=""> Must be explicitly set up with session.setHangupHook(hangup_hook).</div><div class=""><br class=""></div><div class=""> `session` is a session object.</div><div class=""> `what` is "hangup" or "transfer".</div><div class=""> `args` is populated if you pass extra args to session.setInputCallback().</div><div class=""><br class=""></div><div class=""> """</div><div class=""> print('PERSON HANGED UPPPPP...........')</div><div class=""> freeswitch.consoleLog("INFO", "hangup hook for '%s'\n" % what)</div><div class=""><br class=""></div></div><div class="">-- <br class=""><div class="gmail_signature"><div dir="ltr" class="">Regards,<div class="">Deepika</div><div class=""><a href="https://deepikay.wixsite.com/deepika" target="_blank" class="">https://deepikay.wixsite.com/deepika</a><br class=""></div></div></div>
</div></div>
_________________________________________________________________________<br class="">Professional FreeSWITCH Consulting Services:<br class=""><a href="mailto:consulting@freeswitch.org" class="">consulting@freeswitch.org</a><br class="">http://www.freeswitchsolutions.com<br class=""><br class="">Official FreeSWITCH Sites<br class="">http://www.freeswitch.org<br class="">http://confluence.freeswitch.org<br class="">http://www.cluecon.com<br class=""><br class="">FreeSWITCH-users mailing list<br class="">FreeSWITCH-users@lists.freeswitch.org<br class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br class="">UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br class="">http://www.freeswitch.org</div></blockquote></div><br class=""></body></html>