Every time I try and implement something in Asterisk, it’s like pulling teeth. I don’t know why this is so difficult.
We have a situation we we’d like to override the callerid= value in sip.conf with a new value when calls are placed from this extention through our sip proxy. Calls that do not go through the proxy will keep the original callerid= value set for the extension in sip.conf
So, I figured we’d just set a variable when the context for this user was entered. Simple eh? Then, later on, when the dial command is executed to put the call through the sip proxy, we’d just set the caller id to be the value of the variable. Simple eh? Wrong!
extensions.conf:
[context_user1]
caller_id = 5551212
include => local
[context_user2]
caller_id = 5551213
include => local
[local]
exten => _1X.,1,Set(CALLERID(name)=${caller_id})
exten => _1X.,2,Dial(${EXTEN}@sip_proxy)
Guess what, this doesn’t work. The docs say that you can only set variables in the [global] context, or by using SetVar when matching an extension. Well, before we get to dialling the SIP proxy, we haven’t matched an extension yet, so how the heck do we call SetVar?
Does anyone know how to do this?
And before anyone asks why I want to do this, as I know they will. Lets assume you have a business. They have a main number that when dialled rings both their phones. That’s easy. Got that working. When they dial out to the PSTN, we don’t want their caller id to be displayed. We just want the main number to be displayed. We COULD set both phones to have the same main number’s caller id, which works. HOWEVER, when you try and do things that depend on the caller id of the phone, it breaks things because both phones appear to have the same caller id. Take queues for example. You might want to call AgentCallbacklogin and pass the caller id of the phone to the command.
I just don’t know why this has to be so difficult in Asterisk.
Help appreciated!
Doug