Outbound calls from the CLI in Python Part II
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! Thanks, Marc
Thats why you set origination_caller_id_number inside the {} along side the ingore_early_media=true You shouldn't use setCallerData and in fact that shouldn't be exposed because it'll wreck havoc with billing if you don't know what you're doing. /b On Oct 7, 2008, at 10:44 PM, Marc Orenberg wrote:
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.
participants (2)
-
Brian West
-
Marc Orenberg