I run a python script that keeps on running until user presses * in while loop and it works fine with *.

def handler(session, args):
        session.answer()
        digits=session.read(1, 1, "http://localhost/dtmf/dtmf.wav", 300, "#")
        session.execute("curl","http://127.0.0.1/info.php post lang=%s" %digits)
        cur=session.getVariable("curl_response_data")
        rec='';
        if (digits!='0'):
                while True:
                        session.execute("curl","http://127.0.0.1/info2.php post currentshout=%s" %rec)
                        rec=session.getVariable("curl_response_data")
                        ex=session.read(1, 1, "http://localhost/reciters//%s.mp3" %rec, 1, "#")
                        if (ex=='*'):
                                break
                        ex=session.read(1, 1, "http://localhost/languages/%s/%s.mp3" %(cur,rec), 1, "#")
                        if (ex=='*'):
                                 break

But in while loop ig user hangup call(channel hangup) i keep getting this error.

"channel is hangup and curl does not have zombie exec flag."

how can i terminate session on channel hangup.?

Any help in this regard would be appreciated.

Thanks