Search code examples
twiliotwilio-apitwilio-php

Changing 'voiceReceiveMode' to fax is not working


Using Twilio, I am trying to buy a Fax number and set its webhooks accordingly.

$number = $twilio->incomingPhoneNumbers
       ->create([
             "voiceReceiveMode" => 'fax', 

             // also tried "VoiceReceiveMode" => 'fax',

             "voiceUrl" => "http://example.com",
             "phoneNumber" => $request->number,
             "voiceMethod" => "POST"
      ]
);

With this code, I am able to purchase the number, set voice method to post also sets the voice url.


I have set the voiceUrl because in the Docs it says:

"At this point, the number's VoiceUrl will now behave as its FaxUrl". as mentioned here

However voiceReveiveMode doesn't change and always stays at "Voice"

Also, if I dd($number), in IncomingPhoneNumberInstance object, under properties, I don't see voiceReceiveMode

IncomingPhoneNumberInstance {#249 ▼
  #_assignedAddOns: null
  #version: V2010 {#244 ▶}
  #context: null
  #properties: array:30 [▼
    "accountSid" => "**"
    "addressSid" => null
    "addressRequirements" => "none"
    "apiVersion" => "2010-04-01"
    "beta" => false
    "capabilities" => array:4 [▶]
    "dateCreated" => DateTime {#250 ▶}
    "dateUpdated" => DateTime {#251 ▶}
    "friendlyName" => "(218) 963-5608"
    "identitySid" => null
    "phoneNumber" => "+12189635608"
    "origin" => "twilio"
    "sid" => "**"
    "smsApplicationSid" => ""
    "smsFallbackMethod" => "POST"
    "smsFallbackUrl" => ""
    "smsMethod" => "POST"
    "smsUrl" => ""
    "statusCallback" => ""
    "statusCallbackMethod" => "POST"
    "trunkSid" => null
    "uri" => "/2010-04-01/Accounts/ACcc7e0c85b66b0414485f08a1e03abdba/IncomingPhoneNumbers/PNe2bd51168e719b86cee6c9c46074e46c.json"
    "voiceApplicationSid" => null
    "voiceCallerIdLookup" => false
    "voiceFallbackMethod" => "POST"
    "voiceFallbackUrl" => null
    "voiceMethod" => "POST"
    "voiceUrl" => "http://example.app"
    "emergencyStatus" => "Inactive"
    "emergencyAddressSid" => null
  ]

Solution

  • Twilio developer evangelist here.

    After speaking with the Fax team at Twilio it turns out that currently you cannot set the VoiceReceiveMode for a phone number at the time of purchase. Technically this is a limitation in the PHP library for allowing you to try to set that parameter (I tried in Ruby and it wasn't possible). However, ultimately it's a bug in the API for not allowing this.

    For now, I recommend that you use another API call to update the number's VoiceReceiveMode once you have bought it and have its SID.

    At the same time we are looking into updating the API to accept this parameter when you make the purchase. I will endeavour to update this answer when we ship that.