AMI Originate call with 2 different callerid

I am using AMI via a php page to originate calls to my cell phone, and I am finding the same caller ID is being used for both legs of the call, this is bad.

Is there a way to call my exten, and send the recipients CID to me, then call the recipient, and send them some other static CID.

I have set my channel to receive the call as:

local/15555551212@from-internal

I think the channel is where I need to manipulate the CID, then set a different static CID in the “CallerID” variable below.

$strName  = $_POST['txtname'];
$strExten = $_POST['txtphonenumber'];
$callNumber = $strExten;
#specify the caller id for the call
$strCallerId = "Web-".$strName . " <$callNumber>";
{
$oSocket = fsockopen($strHost, 5038, $errnum, $errdesc) or die("Connection to host failed");
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: $strExten\r\n");
fputs($oSocket, "Context: $strContext\r\n"); 
fputs($oSocket, "Priority: 1\r\n\r\n");
fputs($oSocket, "Action: Logoff\r\n\r\n");
sleep(3);
fclose($oSocket);

If the recipient is a cell phone, the cell phone thinks it is getting a call from itself and prompts for the voicemail login - this is bad.

I can set the callerID to be some other static number (cannot be my own since it is also a cell), but I need it to display that static number to the caller, and show me the “strExten” variable as CallerID.

Scenario

You set the caller id to be showed for the channel using CallerId parameter then for the other party
Use function Set(CALLERID(num)=${CIDVALUE}) on the context saved on the variable $strContext before initiate the call

1 Like