Twilio调用不更新到URL,但不会引发任何错误

Twilio调用不更新到URL,但不会引发任何错误

问题描述:

我有一个系统内置的浏览器到浏览器调用。Twilio调用不更新到URL,但不会引发任何错误

当来电使用接受,他们可以沟通没有任何问题!为twilio的万岁。

所以现在我们有两个人 - 谁接到电话(我们称它们为接收器)和谁进行呼叫的人的人(我们姑且称之为拨号)

然后接收器有一个按钮的左所谓的地方保留。单击此按钮时,它会将接收器重定向到的循环消息。您有一个保留的呼叫,并将拨号器重定向到队列 - 他们会听到一些时髦的音乐。

如果再次点击,接收方将拨打队列并获取主叫方。这个工作完美,他们可以再次沟通。

但是,如果我把拨号程序放回到它的队列中,但是当我通过修改呼叫更新方法检索它并将它重定向到与更新呼叫之前相同的部分。

这不会引发错误。这几乎就像twilio甚至没有尝试将呼叫重定向到URL一样,因为日志不会返回任何内容。由于没有错误,我的应用程序认为一切正常。

这是会出现这种情况的原因吗?有没有限制或什么?

要清楚这是第一次运作 - 完美。只是不是下一次,只是在检索电话。

这是Call实例上的update命令的问题。

进出口使用Laravel我的框架

这里是我的routes.php文件

// Hold music and Client Message 
Route::post('voice/queue/music', ['uses' => 'API\[email protected]']); 
Route::post('voice/queue/client-message', ['uses' => 'API\[email protected]']); 

// Routes containing Twiml XML 
Route::post('voice/inbound/enqueue-call', ['uses' => 'API\Voice\[email protected]']); 
Route::post('voice/inbound/dequeue-call', ['uses' => 'API\Voice\[email protected]']); 

// Place Outbound Call on Hold 
Route::post('inbound/enqueue', ['uses' => 'API\Voice\[email protected]']); 
Route::post('inbound/dequeue', ['uses' => 'API\Voice\[email protected]']); 

这里是我的InboundCallHoldController.php

class InboundCallHoldController extends Controller 
{ 

public function placeInboundCallOnHold(Request $request){ 
    $CallSid = $request['CallSid'] !== null ? $request['CallSid'] : null; 
    $response = new Twiml(); 
    $queue = 'call-hold:'.$CallSid; 

    Log::info("---> Inbound Call | placeInboundCallOnHold --> Enqueuing Caller ".$CallSid." to ".$queue); 

    $response->enqueue($queue, ['waitUrl' => env("API_URL").'/api/voice/queue/music']); 
    return response($response)->header('Content-Type', 'text/xml'); 
} 

public function dialHeldInboundCall(Request $request){ 
    $callSid = $request['ParentCallSid'] !== null ? $request['ParentCallSid'] : null; 
    $response = new Twiml(); 
    $dial = $response->dial(); 

    $queueName = 'call-hold:'.$callSid; 

    Log::info("---> Inbound Call | dialHeldInboundCall --> Dialing a queue to get a caller ".$queueName); 

    $dial->queue($queueName); 
    $response->redirect(env('API_URL')."/api/voice/queue/client-message"); 
    return response($response)->header('Content-Type', 'text/xml'); 
} 

public function getInboundCallOnHold(Request $request){ 
    $callSid = $request['CallSid'] !== null ? $request['CallSid'] : null; 

    $account = Account::where("twilio_sid", "TWILIO_ACCOUNT_SID")->first(); 
    $client = new Client($account->twilio_sid, $account->twilio_auth_token); 

    Log::info("---> Inbound Call | getInboundCallOnHold --> Updating Live call and redirecting Caller ".$callSid . " to Queue"); 
    $call = $client->calls($callSid)->fetch(); 

    $client->calls($call->sid)->update([ 
     "url" => env('API_URL')."/api/voice/inbound/dequeue-call", 
     "method" => "POST" 
    ]); 

    Log::info("---> Inbound Call | getInboundCallOnHold --> ".$callSid . " status is now ".$call->status); 

    return response([ 
     "status" => "fetched-inbound-call", 
     "success" => true 
    ], 200); 

} 

public function holdInboundCall(Request $request){ 
    $callSid = $request['CallSid'] !== null ? $request['CallSid'] : null; 

    $account = Account::where("twilio_sid", "TWILIO_ACCOUNT_SID")->first(); 
    $client = new Client($account->twilio_sid, $account->twilio_auth_token); 


    Log::info("---> Inbound Call | Hold Initiated"); 

    $call = $client->calls($callSid)->fetch(); 
    $parentCall = $client->calls($call->parentCallSid)->fetch(); 

     if($parentCall->status === "in-progress" and $call->status == "in-progress"){ 
      // find the child - this is the receiver - Play the hold music 

      Log::info("---> Inbound Call | holdInboundCall --> Redirect Receiver ".$call->sid . " to wait message"); 

      $call->update([ 
       "url" => env('API_URL')."/api/voice/queue/client-message", 
       "method" => "POST" 
      ]); 
      // find the parent - this is the inbound caller - Add them to a queue 
      Log::info("---> Inbound Call | holdInboundCall --> Redirect Inbound Caller ".$parentCall->sid . " to queue"); 
      $parentCall->update([ 
       "url" => env('API_URL')."/api/voice/inbound/enqueue-call", 
       "method" => "POST" 
      ]); 

      return response([ 
       "status" => "on-hold-inbound", 
       "success" => true 
      ], 200); 
    } 


    return response()->json(["call_hold_failed" => ["A call not be placed on hold until it has been answered"]], 422); 
} 

} 

这里就是更新后不发生第二次。

$client->calls($call->sid)->update([ 
    "url" => env('API_URL')."/api/voice/inbound/dequeue-call", 
    "method" => "POST" 
]); 

这很奇怪,因为这是失败前的过程;在保持

  1. 地方调用 - >成功
  2. 拨号队列,并从队列中取得来电 - >成功
  3. 置于保持通话 - >成功
  4. 拨号队列并从队列中获取来电 - >失败

正如我所说没有错误引发。

我调用这些用javascript调用以下网址

// Place Outbound Call on Hold 
Route::post('inbound/enqueue', ['uses' => 'API\Voice\[email protected]']); 
Route::post('inbound/dequeue', ['uses' => 'API\Voice\[email protected]']); 

这里是日志的输出;

[2017-09-04 13:42:47] local.INFO: ---> Inbound Call | Hold Initiated 
[2017-09-04 13:42:47] local.INFO: ---> Inbound Call | holdInboundCall --> Redirect Receiver CA784af9a0419cde8dc3ab2379ad93e5b2 to wait message 
[2017-09-04 13:42:48] local.INFO: ---> Inbound Call | holdInboundCall --> Redirect Inbound Caller CA3c31e8169647a7d90455058ce7bfa70f to queue 
[2017-09-04 13:42:49] local.INFO: ---> Inbound Call | placeInboundCallOnHold --> Enqueuing Caller CA3c31e8169647a7d90455058ce7bfa70f to call-hold:CA3c31e8169647a7d90455058ce7bfa70f 
[2017-09-04 13:43:09] local.INFO: ---> Inbound Call | getInboundCallOnHold --> Updating Live call and redirecting Caller CA784af9a0419cde8dc3ab2379ad93e5b2 to Queue 
[2017-09-04 13:43:10] local.INFO: ---> Inbound Call | getInboundCallOnHold --> CA784af9a0419cde8dc3ab2379ad93e5b2 status is now in-progress 
[2017-09-04 13:43:10] local.INFO: ---> Inbound Call | dialHeldInboundCall --> Dialing a queue to get a caller call-hold:CA3c31e8169647a7d90455058ce7bfa70f 
[2017-09-04 13:43:10] local.INFO: ---> Inbound Call | dialHeldInboundCall --> Call Sid is CA3c31e8169647a7d90455058ce7bfa70f 
[2017-09-04 13:43:36] local.INFO: ---> Inbound Call | Hold Initiated 
[2017-09-04 13:43:37] local.INFO: ---> Inbound Call | holdInboundCall --> Redirect Receiver CA784af9a0419cde8dc3ab2379ad93e5b2 to wait message 
[2017-09-04 13:43:43] local.INFO: ---> Inbound Call | holdInboundCall --> Redirect Inbound Caller CA3c31e8169647a7d90455058ce7bfa70f to queue 
[2017-09-04 13:43:44] local.INFO: ---> Inbound Call | placeInboundCallOnHold --> Enqueuing Caller CA3c31e8169647a7d90455058ce7bfa70f to call-hold:CA3c31e8169647a7d90455058ce7bfa70f 
[2017-09-04 13:44:06] local.INFO: ---> Inbound Call | getInboundCallOnHold --> Updating Live call and redirecting Caller CA784af9a0419cde8dc3ab2379ad93e5b2 to Queue 
[2017-09-04 13:44:07] local.INFO: ---> Inbound Call | getInboundCallOnHold --> CA784af9a0419cde8dc3ab2379ad93e5b2 status is now in-progress 
+0

您是否检查客户端日志? twilio上的任何已知错误?没有代码,我认为我们不可能帮助最可能的问题。 – Lucas

+0

调试器中没有内部错误。这就像一个鬼!它说执行更新命令(我认为它不会引发任何错误),但实际上不会重定向该呼叫。 – YayoUK

+0

我会发布一些代码,当我回到我的办公桌 – YayoUK

由于OnHoldStatus通过PHP设置,它看起来并不像你这样

难道PHP的全局或其他服务器端(在多用户的高级使用的情况下,会话跟踪)的任何代码序列化,刚刚退出前添加代码以清除PHP

或者可以说是另一种方式是你的服务器上的PHP变量:变量当您退出保留状态条件IE没有得到清除。它们已经被设置为旧的最后一个状态。

+0

我正在使用laravel--正在处理会话跟踪 – YayoUK