[Freeswitch-users] FreeSWITCH crashes when bridging two calls in python script

Michael Jerris mike at jerris.com
Fri Aug 14 20:17:44 PDT 2009


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090814/6a53d968/attachment-0002.html 


More information about the FreeSWITCH-users mailing list