never use while(1) or the system exit call from your script. replace while(1) with while(session.ready()) On Sun, Aug 24, 2008 at 9:21 PM, Marc Orenberg <marc@kasteris.com> wrote:
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.
Here is a simple example:
def hangup_hook(session, what): print("info","Hangup hook for %s!!\n\n" % what) sys.exit()
def handler(session, args): session.answer() session.setHangupHook(hangup_hook) while(1): session.streamFile(PROMPTS_DIR + "ThanksForCalling.wav") 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.
Thanks for your help.
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400