使用带有 cdr_adaptive_odbc 的客户 CDR 的 Asterisk 不工作
Asterisk using Customer CDRs with cdr_adaptive_odbc is not working
我在 Asterisk 14.6.1 中遇到一个问题,即使用 ODBC 将我的自定义 CDR 字段填充到 MySQL 数据库,基本上我正在使用 Dial 同时进行出站呼叫,我需要在 CDR 中知道哪个phone居然接了电话,所以我用的是宏
所以这是我的简单 extensions.conf
exten => 12345,1,Dial(PJSIP/071XXXXXXXX@EP&PJSIP/072XXXXXXXX@EP,180,M(test),r)
还有我的宏:
[macro-test]
exten => s,1,Verbose(Call Answered from ${CALLERID(num)} to ${DIALEDPEERNUMBER})
exten => s,2,Set(CDR(outboundddi)=${DIALEDPEERNUMBER})
exten => s,3,Set(CDR(userfield)=${DIALEDPEERNUMBER})
所以这一切工作正常,电话响铃,正在接听和宏 运行!
Asterisk 的输出:
PJSIP/PrimaryEP-00000001 answered PJSIP/EP-00000000
– Executing [s@macro-test:1] Verbose(“PJSIP/EP-00000001”, “Call Answered from 12345 to 071XXXXXXXX@EP”) in new stack
Call Answered from 12345 to 071XXXXXXXX@EP
– Executing [s@macro-test:2] Set(“PJSIP/EP-00000001”, “CDR(outboundddi)= 071XXXXXXXX@EP”) in new stack
– Executing [s@macro-test:3] Set(“PJSIP/EP-00000001”, “CDR(userfield)= 071XXXXXXXX@EP”) in new stack
所以我知道这一切都有效。 Set(CDR(userfield)=${DIALEDPEERNUMBER}) 工作正常,Set(CDR(outboundddi)=${DIALEDPEERNUMBER}) 没有,它似乎被忽略了,我没有收到错误。因此,该值会填充到数据库的用户字段中,但不会填充到数据库的 outboundddi 字段中。
我认为它被忽略了,因为 cdr_odbc 和 cdr_adaptive_odbc 都在后端注册了 - 但如果我没有加载 cdr_odbc.so 那么我就不会在 ODBC 中记录任何 CDR数据库,如果我取出 cdr_odbc.conf 中的配置,那么我在 ODBC 数据库中什么也得不到。
这里有一些更详细的信息:
cdr 显示状态
呼叫详细记录 (CDR) 设置
Logging: Enabled
Mode: Simple
Log unanswered calls: Yes
Log congestion: Yes
Registered Backends
cdr-custom
cdr_manager (suspended)
radius
Adaptive ODBC
ODBC
res_config_sqlite
odbc 显示
ODBC DSN 设置
Name: asterisk
DSN: Asterisk
Number of active connections: 1 (out of 1)
模块重新加载cdr_adaptive_odbc.so
Module ‘cdr_adaptive_odbc.so’ reloaded successfully.
– Reloading module ‘cdr_adaptive_odbc.so’ (Adaptive ODBC CDR backend)
== Parsing ‘/etc/asterisk/cdr_adaptive_odbc.conf’: Found
– Found adaptive CDR table cdrs@asterisk.
> Found calldate column with type 93 with len 19, octetlen 19, and numlen (0,10)
> Found clid column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found src column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found dst column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found dcontext column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found channel column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found dstchannel column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found lastapp column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found lastdata column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found duration column with type 4 with len 10, octetlen 10, and numlen (0,10)
> Found billsec column with type 4 with len 10, octetlen 10, and numlen (0,10)
> Found disposition column with type 12 with len 45, octetlen 45, and numlen (0,0)
> Found amaflags column with type 4 with len 10, octetlen 10, and numlen (0,10)
> Found accountcode column with type 12 with len 20, octetlen 20, and numlen (0,0)
> Found userfield column with type 12 with len 255, octetlen 255, and numlen (0,0)
> Found uniqueid column with type 12 with len 32, octetlen 32, and numlen (0,0)
> Found linkedid column with type 12 with len 32, octetlen 32, and numlen (0,0)
> Found sequence column with type 12 with len 32, octetlen 32, and numlen (0,0)
> Found peeraccount column with type 12 with len 32, octetlen 32, and numlen (0,0)
> Found outboundddi column with type 12 with len 50, octetlen 50, and numlen (0,0)
cdr_adaptive_cdr.conf
[adaptive_connection]
connection=asterisk
table=cdrs
usegmtime=yes
cdr_odbc.conf
[global]
dsn=asterisk
loguniqueid=yes
dispositionstring=yes
table=cdrs ;“cdr” is default table name
usegmtime=yes ; set to “yes” to log in GMT
hrtime=yes ;Enables microsecond accuracy with the billsec and duration fields
newcdrcolumns=yes ; Enable logging of post-1.8 CDR columns (peeraccount, linkedid, sequence)
我想我可以忘记它并使用正在工作的用户字段,但我宁愿将它存储在自定义 CDR 字段中并且我想知道什么对我自己的理智来说是不正确的,所以如果任何人都可以指出我配置不正确的地方,我将不胜感激。
谢谢
大卫
您在 cdr_adaptive_odbc.conf
中添加了别名行
alias start => calldate
不,它不扫描 table 本身。
我在 Asterisk 14.6.1 中遇到一个问题,即使用 ODBC 将我的自定义 CDR 字段填充到 MySQL 数据库,基本上我正在使用 Dial 同时进行出站呼叫,我需要在 CDR 中知道哪个phone居然接了电话,所以我用的是宏
所以这是我的简单 extensions.conf
exten => 12345,1,Dial(PJSIP/071XXXXXXXX@EP&PJSIP/072XXXXXXXX@EP,180,M(test),r)
还有我的宏:
[macro-test]
exten => s,1,Verbose(Call Answered from ${CALLERID(num)} to ${DIALEDPEERNUMBER})
exten => s,2,Set(CDR(outboundddi)=${DIALEDPEERNUMBER})
exten => s,3,Set(CDR(userfield)=${DIALEDPEERNUMBER})
所以这一切工作正常,电话响铃,正在接听和宏 运行!
Asterisk 的输出:
PJSIP/PrimaryEP-00000001 answered PJSIP/EP-00000000
– Executing [s@macro-test:1] Verbose(“PJSIP/EP-00000001”, “Call Answered from 12345 to 071XXXXXXXX@EP”) in new stack
Call Answered from 12345 to 071XXXXXXXX@EP
– Executing [s@macro-test:2] Set(“PJSIP/EP-00000001”, “CDR(outboundddi)= 071XXXXXXXX@EP”) in new stack
– Executing [s@macro-test:3] Set(“PJSIP/EP-00000001”, “CDR(userfield)= 071XXXXXXXX@EP”) in new stack
所以我知道这一切都有效。 Set(CDR(userfield)=${DIALEDPEERNUMBER}) 工作正常,Set(CDR(outboundddi)=${DIALEDPEERNUMBER}) 没有,它似乎被忽略了,我没有收到错误。因此,该值会填充到数据库的用户字段中,但不会填充到数据库的 outboundddi 字段中。
我认为它被忽略了,因为 cdr_odbc 和 cdr_adaptive_odbc 都在后端注册了 - 但如果我没有加载 cdr_odbc.so 那么我就不会在 ODBC 中记录任何 CDR数据库,如果我取出 cdr_odbc.conf 中的配置,那么我在 ODBC 数据库中什么也得不到。
这里有一些更详细的信息:
cdr 显示状态 呼叫详细记录 (CDR) 设置
Logging: Enabled
Mode: Simple
Log unanswered calls: Yes
Log congestion: Yes
Registered Backends
cdr-custom
cdr_manager (suspended)
radius
Adaptive ODBC
ODBC
res_config_sqlite
odbc 显示 ODBC DSN 设置
Name: asterisk
DSN: Asterisk
Number of active connections: 1 (out of 1)
模块重新加载cdr_adaptive_odbc.so
Module ‘cdr_adaptive_odbc.so’ reloaded successfully.
– Reloading module ‘cdr_adaptive_odbc.so’ (Adaptive ODBC CDR backend)
== Parsing ‘/etc/asterisk/cdr_adaptive_odbc.conf’: Found
– Found adaptive CDR table cdrs@asterisk.
> Found calldate column with type 93 with len 19, octetlen 19, and numlen (0,10)
> Found clid column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found src column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found dst column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found dcontext column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found channel column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found dstchannel column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found lastapp column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found lastdata column with type 12 with len 80, octetlen 80, and numlen (0,0)
> Found duration column with type 4 with len 10, octetlen 10, and numlen (0,10)
> Found billsec column with type 4 with len 10, octetlen 10, and numlen (0,10)
> Found disposition column with type 12 with len 45, octetlen 45, and numlen (0,0)
> Found amaflags column with type 4 with len 10, octetlen 10, and numlen (0,10)
> Found accountcode column with type 12 with len 20, octetlen 20, and numlen (0,0)
> Found userfield column with type 12 with len 255, octetlen 255, and numlen (0,0)
> Found uniqueid column with type 12 with len 32, octetlen 32, and numlen (0,0)
> Found linkedid column with type 12 with len 32, octetlen 32, and numlen (0,0)
> Found sequence column with type 12 with len 32, octetlen 32, and numlen (0,0)
> Found peeraccount column with type 12 with len 32, octetlen 32, and numlen (0,0)
> Found outboundddi column with type 12 with len 50, octetlen 50, and numlen (0,0)
cdr_adaptive_cdr.conf
[adaptive_connection]
connection=asterisk
table=cdrs
usegmtime=yes
cdr_odbc.conf
[global]
dsn=asterisk
loguniqueid=yes
dispositionstring=yes
table=cdrs ;“cdr” is default table name
usegmtime=yes ; set to “yes” to log in GMT
hrtime=yes ;Enables microsecond accuracy with the billsec and duration fields
newcdrcolumns=yes ; Enable logging of post-1.8 CDR columns (peeraccount, linkedid, sequence)
我想我可以忘记它并使用正在工作的用户字段,但我宁愿将它存储在自定义 CDR 字段中并且我想知道什么对我自己的理智来说是不正确的,所以如果任何人都可以指出我配置不正确的地方,我将不胜感激。
谢谢
大卫
您在 cdr_adaptive_odbc.conf
中添加了别名行alias start => calldate
不,它不扫描 table 本身。