FreeSWITCH crashes when bridging two calls in python script
Hello, I'm trying to play a prompt to the B-leg of a bridged call in Python. I place the call to the B-leg, play the prompt, and then bridge it with the A-Leg, but then FreeSWITCH crashes when the call is completed. Here's the code I'm using: def bridge_call_with_prompt(session,carrier,caller_id,phonenum,promptfile,recordfile): try: sessiondata = "{ignore_early_media=true,origination_caller_id_number=" + str(caller_id) + "}sofia/gateway/" + carrier + "/" + phonenum new_session = Session(sessiondata) if (not new_session.ready()): return(False) if (recordfile <> ""): new_session.streamFile(promptfile) new_session.execute("set","call_timeout=60") new_session.execute("set","continue_on_fail=true") new_session.execute("set","hangup_after_bridge=false") new_session.execute("set", "ringback=%(2000,4000,440.0,480.0)") if (not new_session.ready()): return(False) if (not session.ready()): return(False) bridge(session,new_session) new_session.hangup() except: report_exception() return(False) return(True) Does anybody know how I can stop it from crashing, and/or another way to go about this? If I simply do: session.execute("bridge","sofia/gateway/" + carrier + "/" + phonenum) it won't cause FreeSWITCH to crash, but then I can't play my prompt. Thanks, Marc
Please open a bug on jira.freeswitch.org mike On Aug 14, 2009, at 6:27 PM, Marc Orenberg wrote:
Hello,
I'm trying to play a prompt to the B-leg of a bridged call in Python. I place the call to the B-leg, play the prompt, and then bridge it with the A-Leg, but then FreeSWITCH crashes when the call is completed.
Here's the code I'm using:
def bridge_call_with_prompt (session,carrier,caller_id,phonenum,promptfile,recordfile): try: sessiondata = "{ignore_early_media=true,origination_caller_id_number=" + str(caller_id) + "}sofia/gateway/" + carrier + "/" + phonenum new_session = Session(sessiondata) if (not new_session.ready()): return(False) if (recordfile <> ""): new_session.streamFile(promptfile) new_session.execute("set","call_timeout=60") new_session.execute("set","continue_on_fail=true") new_session.execute("set","hangup_after_bridge=false") new_session.execute("set", "ringback=%(2000,4000,440.0,480.0)") if (not new_session.ready()): return(False) if (not session.ready()): return(False) bridge(session,new_session) new_session.hangup() except: report_exception() return(False) return(True)
Does anybody know how I can stop it from crashing, and/or another way to go about this? If I simply do:
session.execute("bridge","sofia/gateway/" + carrier + "/" + phonenum)
it won't cause FreeSWITCH to crash, but then I can't play my prompt.
Thanks, Marc
Hi, Can you provide us with a backtrace of the crash? you can open a bug report on http://jira.freeswitch.org/ Also, if you want to play a prompt file and wait for a dtmf to accept the call, there are variables called group_confirm_file and group_confirm_key that will make the core take care of that for you. Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca On 14-Aug-09, at 6:27 PM, Marc Orenberg wrote:
Hello,
I'm trying to play a prompt to the B-leg of a bridged call in Python. I place the call to the B-leg, play the prompt, and then bridge it with the A-Leg, but then FreeSWITCH crashes when the call is completed.
Here's the code I'm using:
def bridge_call_with_prompt (session,carrier,caller_id,phonenum,promptfile,recordfile): try: sessiondata = "{ignore_early_media=true,origination_caller_id_number=" + str(caller_id) + "}sofia/gateway/" + carrier + "/" + phonenum new_session = Session(sessiondata) if (not new_session.ready()): return(False) if (recordfile <> ""): new_session.streamFile(promptfile) new_session.execute("set","call_timeout=60") new_session.execute("set","continue_on_fail=true") new_session.execute("set","hangup_after_bridge=false") new_session.execute("set", "ringback=%(2000,4000,440.0,480.0)") if (not new_session.ready()): return(False) if (not session.ready()): return(False) bridge(session,new_session) new_session.hangup() except: report_exception() return(False) return(True)
Does anybody know how I can stop it from crashing, and/or another way to go about this? If I simply do:
session.execute("bridge","sofia/gateway/" + carrier + "/" + phonenum)
it won't cause FreeSWITCH to crash, but then I can't play my prompt.
Thanks, Marc
_______________________________________________ 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
participants (3)
-
Marc Orenberg
-
Mathieu Rene
-
Michael Jerris