News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Set Caller ID with PHP and ring-out
Tags: call handling
Jun 7, 2023 at 4:05pm   •   3 replies  •  0 likes
Robert Goth

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?

3 Answers
answered on Jun 8, 2023 at 12:10pm  

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:


 0
on Jun 8, 2023 at 1:16pm   •  0 likes

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.

answered on Jun 8, 2023 at 11:49am  

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.


 0
answered on Jun 8, 2023 at 7:41am  

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: "."\n");
    foreach ($record->features as $feature)
        print_r (" => ".$feature."\n");
}

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us