0

When buy a new number from twilio and connecting it with sms url to recieve SMS reply from user we do the following:

twilio.object.account.incoming_phone_numbers.create(
  :phone_number => number,
  :sms_url => url
 )

but when change this url we have to go through all numbers and change the SMS url so we create a Twiml app.

Question is: Can we connect phone number when buy it to Twiml app something like:

twilio.object.account.incoming_phone_numbers.create(
  :phone_number => number,
  :twiml_sid => sid  // that what we are trying to achieve
 )

or its only sms_url !

mohamed-ibrahim
  • 10,837
  • 4
  • 39
  • 51

2 Answers2

0

Twilio evangelist here.

You can absolutely do this. Just set the VoiceApplicationSid parameter when creating the new phone number:

$number = $client->account->incoming_phone_numbers->create(array(
  "FriendlyName" => "My Company Line",
  "VoiceApplicationSid" => "APXXXXXXXXXXXXXXXXXXXXXXXXX",
  "PhoneNumber" => "+15105647903"
));

Hope that helps.

Devin Rader
  • 10,260
  • 1
  • 20
  • 32
  • you are correct, i found it and i added an answer for ruby and using sms_application_sid, will accept the answer thought – mohamed-ibrahim Jan 17 '16 at 11:20
  • Hi Devin, can you please check my question here, http://stackoverflow.com/questions/38370533/twiml-app-invoke-aws-lambda-when-user-replies-stop-start-for-twilio-number – Vamsi Challa Jul 14 '16 at 09:41
0

According to Twilio Documentation here:

under Optional Paramters you can find SmsApplicationSid and VoiceApplicationSid setting it to Twiml app SID will use the SMS url or Voice url according to which service you want to handle responce for, following should be working:

twilio.object.account.incoming_phone_numbers.create(
 :phone_number => number,
 :sms_application_sid => sid
)
mohamed-ibrahim
  • 10,837
  • 4
  • 39
  • 51