无论如何都要从Twilio发送短信,以便从号码包含一个扩展名?

时间:2014-06-07 11:58:04

标签: php twilio

无论如何都要从Twilio发送短信,以便从号码包含扩展名吗?

这样的事情:

<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "...";
$token = "...";
$client = new Services_Twilio($sid, $token);
$client->account->messages->sendMessage(
    "+441337944066+123#", // From
    "+441234567891", // To
    "Hello world" // Body
);

此时尝试此操作会产生此错误消息:

 Fatal error: Uncaught exception 'Services_Twilio_RestException' with message 'The 'From' number +441337944066+123# is not a valid phone number or shortcode.'

2 个答案:

答案 0 :(得分:1)

据我了解,您需要发送FROM值为有效Twillio号码的邮件。由于包装器/帮助器正在使用REST API,因此它仍应受这些限制的约束。请参阅此处的相关文档:http://www.twilio.com/docs/api/rest/sending-messages

所以,除非你从Twillio那里购买了这个号码并且它有一个扩展名,不幸的是,我不相信这是可能的。

答案 1 :(得分:1)

Twilio支持。

很遗憾,我们在发送邮件时不支持扩展程序。

但是,如果您希望拨打语音通话分机,可以使用SendDigits参数:

https://www.twilio.com/docs/api/rest/making-calls

汤姆