opensips ACC模块扩展字段

        opensips 的ACC模块提供了类似CDR的功能,可以记录通话详单。但是,模块缺省记录的内容有限。我们可以看一下缺省建立的acc表结构:

name type size default null key extra attributes description
id unsigned int 10 default no primary autoincrement
method string 16 '' no
from_tag string 64 '' no
to_tag string 64 '' no
callid string 64 '' no
sip_code string 3 '' no
sip_reason string 32 '' no
time datetime not specified default no
duration unsigned int 11 0 no
ms_duration unsigned int 11 0 no
setuptime unsigned int 11 0 no
created datetime not specified NULL yes

这在计费应用中往往是不够的,比如,没有主被叫信息。

幸运的是,ACC模块提供了扩展功能。通过acc_extra伪变量,让我们可以记录可能的扩展信息,其信息源可以来自SIP信息,也可以来自其它模拟导入的伪变量。相当方便。

定义语法

        指定扩展信息的实现是通过extra_field 实现的,它通过指定标签名进行赋值。这些信息的标签名,通过acc_extra伪变量定义。没有没有指定tag名,那么其值就会被视为log_value。

        其语法定义格式如下:

  • backend : tag -> log_name (';'tag -> log_name)*

  • backend : tag (';' tag)*

其中backend指定扩展内容输出到何处,可选值有log, db, aaa, evi,其后跟着一个冒号,后面是tag列表。如果有个箭头,箭头前表示脚本中伪变量名,箭头后表示输出终端的字段名。

       扩展字段的内容,在整个呼叫过程中始终可见。具体实例:

modparam("acc", "extra_fields", "log: a -> test_a")
modparam("acc", "extra_fields", "db: a -> test_a")

# for syslog-based accounting, use any text you want to be printed
# if setting $acc_extra(a) you will see "My_a_Field=<value> in logs
# if setting $acc_extra(b) you will see "b=<value> in logs
modparam("acc", "extra_fields", "log: a->My_a_Field; b")

# for mysql-based accounting, use the names of the columns
# $acc_extra(a) = <value>  results in setting col_a with <value> in db
modparam("acc", "extra_fields", "db: a->col_a; col_b")

# for AAA-based accounting, use the names of the AAA AVPs
modparam("acc", "extra_fields","aaa:a->AAA_SRC;b->AAA_DST")

# evi definition example
modparam("acc", "extra_fields","a->2345;b->2346")

 

相关推荐

  1. opensips ACC模块扩展字段

    2024-06-14 16:32:01       11 阅读
  2. 分布式IO模块PLC扩展模拟模块

    2024-06-14 16:32:01       14 阅读
  3. mybatis多字段模糊查询

    2024-06-14 16:32:01       38 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-14 16:32:01       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-14 16:32:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-14 16:32:01       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-14 16:32:01       20 阅读

热门阅读

  1. 【深度学习】【Prompt】使用GPT的一些提示词

    2024-06-14 16:32:01       12 阅读
  2. PHP中的while循环:用法、技巧与最佳实践

    2024-06-14 16:32:01       10 阅读
  3. 一个cache的设计总结

    2024-06-14 16:32:01       7 阅读
  4. Windows 11部署FunASR离线语音识别系统

    2024-06-14 16:32:01       11 阅读
  5. Scikit-learn 基础教程:机器学习的初步指南

    2024-06-14 16:32:01       12 阅读
  6. Python教程:机器学习 - 百分位数(4)

    2024-06-14 16:32:01       10 阅读
  7. 养殖业自动化设备厂家

    2024-06-14 16:32:01       8 阅读
  8. 选择适合您的电商API

    2024-06-14 16:32:01       11 阅读
  9. 从零手写实现 nginx-21-modules 模块

    2024-06-14 16:32:01       9 阅读
  10. 【Tomcat】日志相关设置

    2024-06-14 16:32:01       14 阅读
  11. 七天进阶elasticsearch[Four]

    2024-06-14 16:32:01       9 阅读
  12. rust clap库(命令行解析)

    2024-06-14 16:32:01       10 阅读