VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
marc at kasteris.com Guest
|
Posted: Sun Aug 24, 2008 9:24 pm Post subject: [Freeswitch-users] FreeSwitch dies when calling sys.exit() f |
|
|
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. |
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Mon Aug 25, 2008 9:44 am Post subject: [Freeswitch-users] FreeSwitch dies when calling sys.exit() f |
|
|
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 (marc@kasteris.com)> wrote:
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|