Asterisk: Logging changed CALLERID(num) to CDR -
asterisk logs call info database via cdr.
if call comes in via sip trunk remote public telephone number supplied p-asserted-identity. information normaly gets lost in cdr billing database.
[incoming] exten => s,1,set(callerid(num)=${sip_header(p-asserted-identity)}) same => n,dial(sip/me) this sets p-asserted-identity calling number next dial didn't logged cdr on hangup. still original callerid(num) logged src
cdr uses current value of callerid(ani) instead of original callerid(num) cdr(src) if callerid(ani) not unset.
[incoming] exten => s,1,verbose(incoming call on line 123) ; try extract phone number sip header p-asserted-identity same => n,set(fon=$["${sip_header(p-asserted-identity)}" : "<sip:([0-9+]+)"]) ; changes clid number wthout affecting cdr's (just dial...) same => n,execif($[${isnull(${fon})}=0]?set(callerid(num)=${fon})) ; prevent beeing hacked inject same => n,set(callerid(num)=${filter(+0123456789,${callerid(num)})}) ; tells cdr use new num "automatic identified (billing) number" src-field same => n,set(callerid(ani)=${callerid(num)}) same => n,dial(sip/me) this because have log real originating extension instead of general public service number (08000815) internal billing. in cases interesting part billing real originating extension. thats why cdr saves original value of callerid(num). callerid(num) gets modified general public number during outgoing call. in case couldn't identify real originating extension anymore cdr.
Comments
Post a Comment