ocsnetworks
ocsnetworks

Reputation: 13

Retrieving Numbers with Specific Capabilities

$numbers = $client->availablePhoneNumbers('US')->local->read(array(
"Capabilities" => "fax", 
"areaCode" => $areacode
));

$number = $client->incomingPhoneNumbers->create(array(
"phoneNumber" => $numbers[0]->phoneNumber,
"friendlyName" => "SpecialName",
"VoiceUrl" => "myurlcode",
"VoiceMethod" => "POST"
));


$twilionumber = $number->phoneNumber;

When I use the php code above to purchase a number, it is successful.
However, the twilio capabilities is not being recognized.
I need to be able to get only numbers available for Twilio Fax.

Based on Twilio's api documentation it should be working? Twilio Rest API Documentation

Is there something I am missing?

Upvotes: 1

Views: 105

Answers (1)

Alex Baban
Alex Baban

Reputation: 11742

I'm not sure where you found the "Capabilities" thing

"Capabilities" => "fax", 
"areaCode" => $areacode

but I suggest you try instead:

"faxEnabled" => "true", 
"areaCode" => $areacode

It's mentioned here: https://www.twilio.com/docs/api/fax/receive#phone-number-setup

If you don't have a fax-capable number, you'll need to purchase one. You can either use the Available Phone Numbers REST API resource (query with FaxEnabled=true) ,or Console Phone Numbers Search (check the box to search for numbers with the Fax capability) to do so.


Also, for more insights you can read the source code of the helper library:

https://github.com/twilio/twilio-php/blob/master/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalOptions.php

Upvotes: 1

Related Questions