【问题标题】:Exotel call working for "From" user not for "To" user?Exotel 通话适用于“发件人”用户而不适用于“收件人”用户?
【发布时间】:2020-06-26 11:59:05
【问题描述】:
<?php 
#Link to developer portal  for connect to agent https://developer.exotel.com/api/#call-agent
$post_data = array(
'From'     => "from_number",
'To'       => "to_number",
'Url'      => "http://my.exotel.com/Exotel/exoml/start_voice/0000000000",
'CallerId' => "000",
'CallType' => "trans" 
); 
$api_key     = "api_key"; 
$api_token   = "api_token"; 
$exotel_sid  = "sid";
#Replace <subdomain> with the region of your account
#<subdomain> of Singapore cluster is @api.exotel.com
#<subdomain> of Mumbai cluster is @api.in.exotel.com 
$url = "https://" . $api_key .  ":"  . $api_token . "@api.exotel.com/v1/Accounts/" .     $exotel_sid . "/Calls/connect"; 
$ch  = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
$http_result = curl_exec($ch);
curl_close($ch);
echo "<pre>";
print "Response = ".print_r($http_result);
?>

嗨, 这是我通过 exotel 服务器连接两部手机的 curl 代码。我接到“发件人”号码的电话。接听电话后,它说号码设置不正确并要求使用应用集市。但是我在应用集市中关联了我的号码,尽管我收到了这张便条。谁能帮帮我,我哪里错了?

【问题讨论】:

  • 您可以尝试将您的外接电话作为来电显示吗?
  • 我添加了图片,请看一下,在那个图片中我使用第二张作为我的来电显示
  • 嗨,我认为您在这里混淆了两件事。如果您尝试连接两个号码,则需要提供 From、To 和 CallerId。如果您尝试将号码连接到流,则必须提供 Url INSTEAD of To 号码。从屏幕截图中,我们无法确定流程是否配置正确。如果您可以分享 API 的响应,那就太好了。附注:hello@exotel.com 将是解决您的问题的最佳论坛。

标签: curl exotel-api


【解决方案1】:

当您在一个请求中同时提供 To 和 URL 两个参数时,会出现此错误消息(它表示数字设置不正确)。 在您的情况下,您正在尝试将客户连接到流呼叫。请评论To

<?php 
#Link to developer portal  for connecting to agent https://developer.exotel.com/api/#call-agent
$api_key     = "api_key"; 
$api_token   = "api_token"; 
$exotel_sid  = "sid";
$flow_id = "flow_id"; //FlowId will be available in the app bazaar page. Eg: 261787.
$post_data = array(
'From'     => "from_number",
'Url'      => "http://my.exotel.com/".$exotel_sid."/exoml/start_voice/".$flow_id, 
'CallerId' => "044-481-37003",
'CallType' => "trans" 
); 
#Replace <subdomain> with the region of your account
#<subdomain> of Singapore cluster is @api.exotel.com
#<subdomain> of Mumbai cluster is @api.in.exotel.com 
$url = "https://" . $api_key .  ":"  . $api_token . "@api.exotel.com/v1/Accounts/" .     $exotel_sid . "/Calls/connect"; 
$ch  = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
$http_result = curl_exec($ch);
curl_close($ch);
echo "<pre>";
print "Response = ".print_r($http_result);
?>

试试这个代码。

【讨论】:

    【解决方案2】:

    如果您想在两个号码之间拨打电话,您只需要在帖子数据中传递FromToCallerId(无需传递URL,因为它是为了将客户连接到呼叫流程)并确保将 CallerId 作为 04448137003 传递,即数字中没有 -

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-18
      • 2014-12-30
      • 1970-01-01
      • 1970-01-01
      • 2012-12-02
      • 1970-01-01
      相关资源
      最近更新 更多