<div dir="ltr">Hi,<div><br></div><div>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><br></div><div>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><br></div><div>Code is as follows;</div><div><b><br></b></div><div><b>XML file that starts python script when the person answers the cal</b>l:</div><div><div><br></div><div><extension name="record_topic"></div><div>        <condition field="destination_number" expression="^4449"> </div><div>        <action application="set" data="execute_on_answer=python <b>python.sangoshthi_IVR_handler</b>"/></div><div><br></div><div>         <action application="sleep" data="30000"/></div><div>        </condition></div><div></extension></div></div><div><br></div><div><b>Python Script handler:</b></div><div><br></div><div><div>def handler(session, args):</div><div>   </div><div>    session.setHangupHook(hangup_hook)</div><div>    session.setInputCallback(input_callback)</div><div><br></div><div>    print('session object value is ', str(session))</div><div><br></div></div><div><div>    callerid =  session.getVariable('caller_id_number')</div><div>    call_uuid = session.getVariable('uuid')</div><div><br></div><div>    phone_number = callerid[len(callerid)-10:]</div><div><br></div><div>     initial_greeting(session, phone_number, call_uuid)</div></div><div><br></div><div><br></div><div><div>def hangup_hook(session, what, args=''):<br></div></div><div><div>    """</div><div>    Must be explicitly set up with session.setHangupHook(hangup_hook).</div><div><br></div><div>    `session` is a session object.</div><div>    `what` is "hangup" or "transfer".</div><div>    `args` is populated if you pass extra args to session.setInputCallback().</div><div><br></div><div>    """</div><div>    print('PERSON HANGED UPPPPP...........')</div><div>    freeswitch.consoleLog("INFO", "hangup hook for '%s'\n" % what)</div><div><br></div></div><div>-- <br><div class="gmail_signature"><div dir="ltr">Regards,<div>Deepika</div><div><a href="https://deepikay.wixsite.com/deepika" target="_blank">https://deepikay.wixsite.com/deepika</a><br></div></div></div>
</div></div>