如何使用 Twilio 处理 Phone 数字的差异?

How to deal with differences in Phone Numbers using Twilio?

工具

Django - Twilio WSP API

上下文

我发消息到我自己的号码 +54 9 (1234) 123456

但是当我回复时,Twilio 收到来自 +54 (1234) 123456 的消息

问题

如果我在数据库中保存“+54 9 (1234) 123456”并收到来自“+54 (1234) 123456”的验证,我无法找到要验证的匹配项。

这是一个有趣的问题!我不得不去研究一下阿根廷的数字,看看这里发生了什么。

According to Wikipedia:

To send an SMS text message to an Argentine cell phone from another country, the 9 used internationally when dialing the number for a voice call (and the 15 used for calls within Argentina) is omitted. For example, if the mobile number in Argentina is (11) 15 1234–5678, a voice call from abroad would be dialled as +54 9 11 1234 5678, but a text message would require +54 11 1234 5678, with +54 9 11 1234 5678 usually being invalid. If a text message is received from Argentina, the reply can be sent to the number displayed as the sender. Not all mobile providers in Argentina have SMS agreements with every carrier in the world, so it may not be possible to send an international SMS.

似乎当 Twilio 收到来自阿根廷号码的消息时,它不需要 9。您最好在数据库中以两种形式(有和没有 9)存储数字,这样您可以用它来发送和接收消息。

我没有真正的阿根廷手机号码来测试,但您可能会发现 Twilio Lookup API 可以帮助您格式化号码。