呼叫繁忙时,Asterisk AMI上的CDR dst错误

时间:2014-10-22 16:41:07

标签: php mysql odbc asterisk ami

我正在尝试使用MySQL设置CDR记录。当应答呼叫或未应答呼叫时,它会在dst字段上写入正确的值,即在dcontext字段中调用和拨出的电话号码。

但是当电话被拒绝或电话关闭时,它会在dst字段中写入“s”,在dcontext字段中写入transmit_voice。在这种情况下,我们希望星号也能写出电话号码。

当接听电话或没有接听电话时:

[outgoing]

exten =>_X., 1,Answer()
same=>n, Set(j=0) 
same=>n, Set(message=message)
same => n,While($[${j} < ${I}])
same => n,Playback(${${message}${j}})
same => n,Set(j=$[${j} + 1])
same => n,EndWhile
same=>n,Set(CDR(target)=${EXTEN})
same => n,Hangup()

当电话被拒绝或电话关闭时,请转到此上下文:

[transmit_voice]
exten => _X!,1,NoOp


#include extensions_custom.conf

以下是PHP代码段:

fputs($this->socket,"Action: originate\r\n");
fputs($this->socket,"Channel: SIP/".$this->strTrunkName."/".$phone."\r\n");
fputs($this->socket,"Variable: canal= SIP/".$this->strTrunkName."/".$phone."\r\n");
fputs($this->socket,"Timeout: ".$this->strWaitTime."\r\n");
fputs($this->socket,"Callerid: ".$this->strCallerId."\r\n");
fputs($this->socket,"Exten: ".$phone."\r\n");
fputs($this->socket,"Context: outgoing\r\n");
while ($audio < count($this->arrAudioPath))
{
  fputs($this->socket,"Variable: message".$audio."=".$this->arrAudioPath[$audio]."\r\n");
  $audio++;
}  
fputs($this->socket,"Variable: I=".$audio."\r\n");
fputs($this->socket,"Async: yes\r\n");
fputs($this->socket,"Priority: 1\r\n\r\n");

1 个答案:

答案 0 :(得分:1)

这是预期的行为。当电话忙时,没有dst。

如果您想要更改,请通过本地/频道拨打,而不是通过sip。