chamlingd
chamlingd

Reputation: 85

how can i check the capabilities of incoming phone numbers using REST API?

I want to check the capabilities of incoming phone numbers.

foreach ($client->account->incoming_phone_numbers as $number) {
    echo $number->phone_number;
    echo $number->capabilities;
}

but it didn't work.

Upvotes: 1

Views: 134

Answers (1)

rickyrobinett
rickyrobinett

Reputation: 1244

Ricky from Twilio here.

Since the capabilities are stored in an object you can echo them. But you can see them using print_r:

  foreach ($client->account->incoming_phone_numbers as $number) {
    echo $number->phone_number;
    print_r($number->capabilities);
  }

If you want to check for a specific capability (for example: mms) you could do something like this:

  foreach ($client->account->incoming_phone_numbers as $number) {
    echo $number->phone_number;
    if($number->capabilities->mms) {
      echo " has mms capability.";
    } else {
      echo " does not have mms capability";
    }
  }

Let me know if that helps or if I can help with anything else.

Upvotes: 2

Related Questions