星号agi呼叫失败然后接下来

the*_*man 2 asterisk agi

我试图让我的php-agi脚本拨打下一个命令,如果第一个命令忙或者无论如何都失败了.我现在设置它的方式不仅仅是工作,它只是返回繁忙然后死亡,或者如果它工作,它将发送两个拨号命令.这是我得到的:

$agi->exec('DIAL',"SIP/".$target."@".$ip.",30,g");
$agi->exec('DIAL',"SIP/".$target."@".$ip2.",30,g");
Run Code Online (Sandbox Code Playgroud)

对此有任何帮助,非常感谢,提前谢谢!

小智 6

当你打电话给Dial()星号时,设置一个名为DIALSTATUS的通道变量.您可以从AGI中阅读.

来自CLI的"核心显示应用程序拨号"的输出:

${DIALSTATUS}: This is the status of the call
CHANUNAVAIL
CONGESTION
NOANSWER
BUSY
ANSWER
CANCEL
DONTCALL: For the Privacy and Screening Modes. Will be set if the
called party chooses to send the calling party to the 'Go Away' script.
TORTURE: For the Privacy and Screening Modes. Will be set if the
called party chooses to send the calling party to the 'torture' script.
INVALIDARGS
Run Code Online (Sandbox Code Playgroud)

防爆.

    $agi->exec('DIAL',"SIP/".$target."@".$ip.",30,g");
    $dialstatus = $agi->get_variable('DIALSTATUS');
    if ( $dialstatus != 'ANSWERED' ) {
      $agi->exec('DIAL',"SIP/".$target."@".$ip2.",30,g");
    }
Run Code Online (Sandbox Code Playgroud)

所以逻辑只是在没有应答第一个呼叫的情况下进行呼叫.