我正在尝试使用 MySQL 设置 CDR 记录。当调用被应答或未被应答时,它会在 dst 字段中写入正确的值,即在 dcontext 字段中调用和拨出的电话号码。
但是当调用被拒绝或电话关闭时,它会在 dst 字段中写入“s”,并在 dcontext 字段中写入 Transmission_voice。在这种情况下,我们希望 Asterisk 也写入电话号码。
当调用被应答或无人应答时,将转到此上下文:
[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");
最佳答案
这是预期的行为。当调用占线时,没有目的地。
如果您想更改此设置,请通过本地/ channel 调用,而不是通过 sip。
关于php - 调用占线时 Asterisk AMI 上的 CDR 目标错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26512639/