Question

Set Caller ID with PHP and ring-out


I am trying to call a number using "/restapi/v1.0/account/~/extension/~/ring-out" in php

I have the body set up like this

$body = array(

'from' => array(

'phoneNumber' => $fromNumber

),

'to' => array(

'phoneNumber' => $toNumber

),

'callerId' => array(

'phoneNumber' => $CallerIDPhoneNumber

),

'playPrompt' => false


);


If I make the call and have the $fromNumber and the $CallerIDPhoneNumber number as the same number it works fine but I want the $CallerIDPhoneNumber to always be the main office number regardless of where I am calling from. If I change the $CallerIDPhoneNumber to any other number than the $fromNumber number it does not work. any Ideas what I am doing wrong?


4 replies

Userlevel 1

There is nothing wrong with your code. You said it does not work if you change the caller id number. What happens when it does not work? An error? The caller (from number) does not see the correct caller id, or what?

You can make sure the caller id you are using is valid by calling this endpoint and check if the number has the CallerId feature before using it as a callerId.

$response = $platform->get('/account/~/extension/~/phone-number');

foreach ($response->json()->records as $record){
    print_r ("This phone number ".$record->phoneNumber." has the following features: "."
");
    foreach ($record->features as $feature)
        print_r (" => ".$feature."
");
}

The php page will not load/crashes and the call is not placed. The caller ID is valid. Is there a way to see what is making the error. It only happens like I said if the Caller ID number is not the same as the From number.

This works,

$fromNumber ="140xxx01";

$CallerIDPhoneNumber ="140xxx01";

the following occurs

1) call is place 2) the php page loads 3) caller Id on recieving call shows the following number: 140xxx01


and this also works

$fromNumber ="140xxx02";

$CallerIDPhoneNumber ="140xxx02";

1) call is place 2) the php page loads 3) caller Id on recieving call shows the following number: 140xxx02


but this does not

$fromNumber ="140xxx01";

$CallerIDPhoneNumber ="140xxx02";

no call is placed and an error occurs resulting in the php page crashing/not loading:

Userlevel 1

That is weird and I would say that it's not because of PHP code nor the ring-out API. If this happens on your production account, submit a dev support case so someone can have a look at your account. If this is your sandbox account, provide me with the account main company number.

Reply