星号:记录将CALLERID(num)更改为CDR

时间:2015-06-03 23:09:40

标签: asterisk cdr

Asterisk通过cdr将呼叫信息记录到数据库中。

如果呼叫通过SIP中继进入,则远程公共电话号码通常随P-Asserted-Identity一起提供。这些信息在CDR计费数据库中正常丢失。

[incoming]
exten => s,1,Set(CALLERID(num)=${SIP_HEADER(P-Asserted-Identity)})
 same => n,Dial(SIP/me)

这会将P-Asserted-Identity设置为下一个Dial的呼叫号码,但在挂断时没有记录到CDR。原始的CALLERID(num)仍然记录为src

1 个答案:

答案 0 :(得分:0)

如果未设置CALLERID(ani),

CDR使用CALLERID(ani)的当前值而不是CDR(src)的原始CALLERID(num)。

[incoming]
exten => s,1,Verbose(Incoming call on line 123)
; try to extract phone number from sip header P-Asserted-Identity
same => n,Set(FON=$["${SIP_HEADER(P-Asserted-Identity)}" : "<sip:([0-9+]+)"])
; This changes clid number wthout affecting cdr's (Just for Dial...)
same => n,ExecIf($[${ISNULL(${FON})}=0]?Set(CALLERID(num)=${FON})) 
; prevent beeing hacked by inject
same => n,Set(CALLERID(num)=${FILTER(+0123456789,${CALLERID(num)})})
; This tells cdr to use the new num for "automatic identified (billing) number" as src-field
same => n,Set(CALLERID(ani)=${CALLERID(num)})
same => n,Dial(SIP/me)

这是因为您必须记录真实的原始分机而不是一般公共服务号码(08000815)以进行内部计费。 在大多数情况下,计费的有趣部分是真正的原始扩展。这就是为什么CDR保存CALLERID(num)的原始值。 在拨出呼叫期间,CALLERID(num)通常会被修改为一般公共号码。在这种情况下,您无法通过cdr确定真正的原始扩展名。