登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

baikgd的博客

技术是工具,生活是目的,更好的生活是目标!

 
 
 

日志

 
 

Asterisk CDR的CSV格式的应用  

2009-10-15 23:54:56|  分类: linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

如今有了图形界面,一般都用数据库方式存储Asterisk的CDR(Call Detail Record)记录.其中最常用的就是Mysql了.由于License的关系,Asterisk CDR对Mysql的支持是放在add-ones中的.但在trixbox和Elastix中,都启用了cdr_mysql.但这并不是asteriskCDR的全部.

  在一个项目中,客户不愿意放弃他们现有的计费系统(支持串口或文件获取数据),而且也找不到计费系统的开发商来支持.这个时候,Asterisk的默认CDR方式就派上用场了.

  Asterisk的cdr_csv.so模块将CDR数据保存在/var/log/asterisk/cdr_csv/目录下的Master.csv文件中(看到csv,联想到什么?--对了,就是excel支持的一种以逗号分隔数据域的文本格式,可以直接导入到excel中的)

  Master.csv字段(数据域)顺序是
"${CDR(clid)}","${CDR(src)}","${CDR(dst)}","${CDR(dcontext)}","${CDR(channel)}","${CDR(dstchannel)}","${CDR(lastapp)}","${CDR(lastdata)}","${CDR(start)}","${CDR(answer)}","${CDR(end)}","${CDR(duration)}","${CDR(billsec)}","${CDR(disposition)}","${CDR(amaflags)}","${CDR(accountcode)}","${CDR(uniqueid)}","${CDR(userfield)}"

各个字段的定义如下
${CDR(clid)} = callerid for the call (with the name)

${CDR(src)} = callerid number for the call

${CDR(dst)} = destination extension

${CDR(dcontext)} = Destination context

${CDR(channel)} = Src channel

${CDR(dstchannel)} = Destination channel if appropriate

${CDR(lastapp)} = this is the last application in the dialplan used, on an outgoing call this will be DIAL.

${CDR(lastdata)} = these are the parameters given to the last application used in the dialplan

${CDR(start)} = time of the start of the call

${CDR(answer)} = time when the call was answered

${CDR(end)} = time when the call got hung up

${CDR(duration)} = duration of the call

${CDR(billsec)} = duration of the actual call (without the ringing)

${CDR(disposition)} = status of the call (ANSWERED, BUSY, NO ANSWER)

${CDR(amaflags)} = flag for the type of CDR (can be set in a.o. sip.conf)
  default: Sets the system default.
  omit: Do not record calls.
  billing: Mark the entry for billing
  documentation: Mark the entry for documentation.

${CDR(accountcode)} = the accountcode as set for this channel with for example SetAccountcode in the dialplan (Extensions.conf) or in the channel configuration file (e.g. per user in sip.conf, iax.conf and per channel in zaptel.conf)

${CDR(uniqueid)} = a unique id for this call

${CDR(userfield)} = a userfield set by the dialplan command SetCDRUserfield

  由此我们可以根据这些字段的定义将Master.csv文件转化为计费软件需要的内容
实际上,Asterisk CDR也考虑到这点,在/etc/asterisk/目录下有个cdr_custom.conf文件可以让你从这些字段中自定义需要的内容,这样我们获得CDR记录的目录变为/var/log/asterisk/cdr_cusotm
  呵呵,再拓展一下,可以将Asterisk的csv格式的文件重定向到串口,呵呵 这样就更省事了

  评论这张
 
阅读(729)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018