问题描述:

I'm having a problem receiving Messages and i don't know where and what goes wrong.

Right now i received messages from the United States that are shown in the Inbound Twilio Dashboard and are accessible through the API.

e.g.:

<% @client.account.sms.messages.list({ from: "#{@contact.mobile}", }).each do |message| %>

Bur responses from other countries don't show up anywhere.

For Sending and receiving messages i use the format:

+1757*******

Has the format something to do with it ? What am i missing?

From Twilio Doc:

Phone numbers should be formatted with a '+' and country code e.g.,

+16175551212 (E.164 format). For 'to' numbers without a '+', Twilio will use the same country code as the 'from' number. Twilio will also

attempt to handle locally formatted numbers for that country code

(e.g. (415) 555-1212 for US, 07400123456 for GB). If you are sending

to a different country than the 'from' number, you must include a '+'

and the country code to ensure proper delivery.

After some serious Twilio Scanning i found the Answer - Read below

网友答案:

Twilio Evangelist here.

This could be a number of things. So first off, do the incoming messages show in your Message Logs on the Twilio Dashboard?

If they don't show up, then you make sure you have a URL set for number receiving them.

If they do show up, copy one of the numbers as shown in the logs and try this out in your app. It's a little tricky to be specific without more details, but I expect you should use the +<country><number> format as stated. So for US: +1415xxxx..., for the UK +447590xxxx...' and so on.

You could also try running this code:

 <% @client.account.messages.list({to: your_twilio_number}).each do |message| %>

Display all the messages and check for the inbound messages there, then try again once you've double checked your contact.mobile formatting.

Hope this helps.

网友答案:

For everyone with the Same Issue.

When Setting up a Twilio account you receive a US Number, which works a little different from other Countries.

SMS Enabled Phone Numbers: Some are able to send SMS internationally and domestically, but others are only able to send and receive SMS domestically.

For the United States there is no Mobile, only Toll-Free and Local. With that, other carriers (Outside the US) wont even let your sms trough, thinking that the number on the other end is not a Mobile.

Basically, only US Numbers can send an SMS to a US Number, other countries can't.

So i bought a UK Number and everything is working now.

相关阅读:
Top