<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><DIV>When I use the Python function sys.exit() in the hangup callback function, it immediately causes the FreeSwitch application to stop running. But I need to somehow stop the Python script from running in this situation.</DIV>
<DIV> </DIV>
<DIV>Here is a simple example:</DIV>
<DIV> </DIV>
<DIV><FONT color=#0000bf>     def hangup_hook(session, what):<BR>       print("info","Hangup hook for  %s!!\n\n" % what)<BR>       sys.exit()</FONT></DIV>
<DIV><FONT color=#0000bf>     </FONT></DIV>
<DIV><FONT color=#0000bf>     def handler(session, args):<BR>       session.answer()<BR>       session.setHangupHook(hangup_hook)<BR>       while(1):<BR>         session.streamFile(PROMPTS_DIR + "ThanksForCalling.wav")<BR></FONT></DIV>
<DIV>The above script simply plays "Thanks for calling" over and over. If I hang-up, FreeSwitch dies. If I remove the sys.exit(), it will return from hangup_hook and continue trying to play the prompt forever.</DIV>
<DIV> </DIV>
<DIV>Thanks for your help.</DIV>
<DIV> </DIV>
<DIV> </DIV></div></body></html>