[Freeswitch-users] Outbound calls from the CLI in Python Part II

Marc Orenberg marc at kasteris.com
Tue Oct 7 20:44:03 PDT 2008

I figured out I can make an outbound call from the CLI in Python as follows:

        def fsapi(session, stream, env, args):
          session = Session("{ignore_early_media=true}sofia/gateway/" + SIP_CARRIER + "/" + phone_number)

Unfortunately, I need to be able to set the caller id before making the call, and I don't think I can do that when I start dialing the call at the same time that I create the new session.

But if I try to originate the call separately from the creation of the session:

        def fsapi(session, stream, env, args):          session = Session()
          session.setCallerData("caller_id_name", CALLER_NAME)
          session.setCallerData("caller_id_number", CALLER_NUMBER)
          session.execute("originate","{ignore_early_media=true}sofia/gateway/" + SIP_CARRIER + "/" + phone_number)
I run into what I think may be a bug; after creating the session I get errors like:

          setCallerData() session is not initalized
          setCallerData() session is not initalized
          execute() session is not initalized

As far as I know, there is no initialization routine to call.
Any advice would be appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20081007/5bf3141c/attachment-0002.html 

More information about the FreeSWITCH-users mailing list