I am using the Asterisk AMI to make 2 external calls using the same sip trunk, the problem is that in the first call the callerID didn’t was fixed, show a different number that I don’t know what is from.
For the second call the callerID it’s correct and it’s showing how I need.
I tried many things to correct that, last option how can say in the bold and italic line I made the Set of the variable CALLERID(num) but it’s didn’t work.
Contexts:
[clickoutcontext]
exten => _X.,1,NoOp(“Click In Context”)
> exten => _X.,n,Set(CALLERID(number)=1148369238)
exten => _X.,n,SIPAddHeader(Call-Info: sip:170.x.x.x;answer-after=0)
exten => _X.,n,Dial(${OUT_2}/${EXTEN})[clickincontext]
exten => _X.,1,NoOp(“Click Out Context”)
exten => _X.,n,SIPRemoveHeader(Call-Info)
exten => _X.,n,MixMonitor(/var/spool/asterisk/monitor/${varName}“.gsm”,b}
exten => _X.,n,Dial(${OUT_2}/${EXTEN})
The variable ${OUT_2} = my sip trunk that correspond “SIP/1010” and have a callerID already defined. The question is why in the second call send the callerId and in the first didn’t send.
This is the AMI settings:
$strChannel = 'local/'.$_REQUEST['telefone']."@clickoutcontext";
fputs($oSocket, "Action: login\r\n");
fputs($oSocket, "Events: off\r\n");
fputs($oSocket, "Username: $strUser\r\n");
fputs($oSocket, "Secret: $strSecret\r\n\r\n");
fputs($oSocket, "Action: originate\r\n");
fputs($oSocket, "Channel: $strChannel\r\n");
fputs($oSocket, "WaitTime: $strWaitTime\r\n");
fputs($oSocket, "CallerId: $strCallerId\r\n");
fputs($oSocket, "Exten: $customerNumber\r\n");
fputs($oSocket, "Context: $strContext\r\n");
fputs($oSocket, "Variable: varName=$filename\r\n");
fputs($oSocket, "Priority: $strPriority\r\n\r\n");
fputs($oSocket, "Action: Logoff\r\n\r\n");
I use the Local context to it work well with external number.
Asterisk version 11.25.3