我一直通过电子邮件与CallFire开发人员进行交流,非常感谢您的帮助。我对生成的PHP-SDK v2 examples.php示例中的send调用方法有疑问 只是为了澄清我要完成的工作,我需要从一个网站打电话给用户,播放一条消息,然后转移到我将提供的另一个号码。
在搜索API文档后,每个SDK的字传输发生16到18次,但是大多数都被隐藏了,或者与“租赁配置”有关。我发现的另一个示例包含在XML传输指南中:https://answers.callfire.com/hc/en-us/articles/200769678-Transfer。 我知道我可以在PHP API中完成所有操作,但是我需要一些指导。
在PHP示例中,liveMessageSoundid在其json字段中具有3个参数,该整数用于CallFire Web后端,但是具有machineMessage值,它打开了一个蠕虫可以遵循的蠕虫,然后machineMessageSoundId引用了transferMessage。我需要转移呼叫,但是transferNumber的值为string / voice / string。这些字符串之一必须是电话号码,但是SendCall方法示例从未明确显示转接呼叫命令吗?
这是我正在使用的示例,它正在构建json以传输到CallFire。
$request->getOperationConfig()->setBodyParameter("[phoneNumber" : "string",fromNumber" : "string",
"contactId" : integer,attributes" : [ "string" ],
"dialplanXml" : "string",liveMessage" : "string",
"liveMessageSoundId" : integer,machineMessage" : "string",
"machineMessageSoundId" : integer,transferMessage" : "string",
"transferMessageSoundId" : integer,transferDigit" : "string",
"transferNumber" : "string",voice" : "string"
}
]");
这是我到目前为止所拥有的:
<?php
//These will be loaded from our site.
$number = "";
$name = "";
$rep_name = "";
$rep_number = "";
$live_message = "Hello," +$name+ " , Thank you for contacing Texas Home School Coalition, please stand by for a moment while we connect you to your representative. Please have your statement ready regarding this important issue, we also left you a guide to read from on the action page you contacted us from":
$machine_message = "Hello, "+ $name +" , We received a request to give you a call from Texas Home School Coalition regarding an important issue for home schoolers and parents but we need you on the line in order to help you reach your representative.";
public static function main() {
$client = \CallFire\Api\DocumentedClient::createClient("9dccec3d4ebb", "$PASSWORD");
$request = $client->sendCalls();
$request->getOperationConfig()->setHeaderParameters(array("Content-Type" => "application/json"));
$body = '[
{
"defaultVoice" => "MALE1"
"phoneNumber": "test_number",
"fromNumber": "8067444441",
"liveMessage": $live_message,
"machineMessage": $machine_message,
"transferMessage": $transfer_message,
"transferNumber": $rep_number;
}
]';
$request->getOperationConfig()->setBodyParameter($body);
$result = $client->request($request);
$json = json_decode($result->getBody());
}
?>
答案 0 :(得分:0)
正如我在电子邮件中提到的那样-您的代码是正确的,您只需要再添加一个参数transferDigit即可告诉系统何时执行传输。
这些都是可用的参数:
$request->getOperationConfig()->setBodyParameter("[
{
"phoneNumber" : "string",
"contactId" : integer,
"attributes" : [ "string" ],
"dialplanXml" : "string",
"liveMessage" : "string",
"liveMessageSoundId" : integer,
"machineMessage" : "string",
"machineMessageSoundId" : integer,
"transferMessage" : "string",
"transferMessageSoundId" : integer,
"transferDigit" : "string",
"transferNumber" : "string",
"voice" : "string"
}
所以你的身体必须像:
{
"defaultVoice" => "MALE1"
"phoneNumber": "test_number",
"fromNumber": "8067444441",
"liveMessage": $live_message,
"machineMessage": $machine_message,
"transferMessage": $transfer_message,
"transferNumber": $rep_number,
"transferDigit" : "1 or 2 ....";
}
也请重新生成代码示例,我不知道您在哪里找到示例,例如:“ liveMessageSoundId”:integer,machineMessage“。 请查看正确的