[asterisk-dev] [Code Review] CDR: Add Calling and Called Subaddress fields to CDR record
Alec Davis
sivad.a at paradise.net.nz
Tue Jan 19 02:54:35 CST 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/460/
-----------------------------------------------------------
(Updated 2010-01-19 02:54:35.220212)
Review request for Asterisk Developers, Tilghman Lesher and rmudgett.
Changes
-------
These latest changes allow CDR variable visibility during a call.
Addressing Richards concern
removed both ast_cdr_update from sig_pri.c.
added ast_cdr_update to beginning of __ast_pbx_run to update CDR variables collected since ast_channel was created.
tested using 'dnid' patch on most branches, from review https://reviewboard.asterisk.org/r/455/
1.4, 1.6.1, 1.6.2 and trunk, in all cases during a call before the change to __ast_pbx_run, executing 'core show channel DAHDI/xx-1' did not have the 'dnid' variable. After the additional patch of __ast_pbx_run 'dnid' variable is available, and was written to database.
proposal:
add __ast_pbx_run:ast_cdr_update() to 1.4, 1.6.0, 1.6.1, 1.6.2 and trunk.
add callingsubaddr and calledsubaddr to trunk.
Summary
-------
Trunk now supports ISDN subaddress, as disussed on asterisk-dev list - better to add fields than to try manipulating existing fields.
Only records the received string, not the 'User Specified flag' or the Odd/Even flag.
I used the following syntax to add additional mysql fields
mysql> alter table cdr ADD (callingsubaddr varchar(80) not null);
mysql> alter table cdr ADD (calledsubaddr varchar(80) not null);
I need to check whether 'not null' is required, as in many cases the caller wont have subaddress info.
cdr backend collector support:
yes (after user adds required 'callingsubaddr' and 'calledsubaddr' fields):
cdr_adaptive_odbc, cdr_mysql, cdr_pgsql and cdr_tds will automatically fill in field if like name field exists in database.
cdr_custom requires user added field in cdr_custom.conf like ;Master.csv => "${CDR(clid)}",${CDR(callingsubaddr)}", etc
maybe (requires cdr collector supporting code):
cdr_custom, requires optional user config flag and supporting code, IE. cdr_csv:logcallingsubaddr=yes etc.
Has been suggested to ignore cdr_custom, as users interested in 'dnid' wouldn't seriously be using cdr_custom.
cdr_radius, requires optional user config flag and supporting code.
Tilghman considered cdr_radius 'adaptive support', but it has no real method for querying what was supported on the backend.
This addresses bug 16600.
https://issues.asterisk.org/view.php?id=16600
Diffs (updated)
-----
trunk/channels/sig_pri.c 241226
trunk/main/cdr.c 241226
trunk/main/pbx.c 241226
Diff: https://reviewboard.asterisk.org/r/460/diff
Testing
-------
tested with trunk, with Jtec 5551234:1234 calling Asterisk 8699:8690.
dialplan code:
;Voicemail
exten => 8699,1,NoOp(NAME=${CALLERID(name)} NUM='${CALLERID(num)}' SUBADDR='${CALLERID(subaddr)}' DNID='${CALLERID(dnid)}' DNIDSUBADDR='${CALLERID(dnid-subaddr)}' RDNIS
='${CALLERID(rdnis)}')
exten => 8699,n,Answer()
exten => 8699,n,VoicemailMain
exten => h,1,Verbose(0,NAME=${CALLERID(name)} NUM='${CALLERID(num)}' SUBADDR='${CALLERID(subaddr)}' DNID='${CALLERID(dnid)}' DNIDSUBADDR='${CALLERID(dnid-subaddr)}' RDN
IS='${CALLERID(rdnis)}')
console output:
With debug lines in 'set_one_cid' it can be seen from the console output that callingsubaddr and calledsubaddr are now set correctly, this required the ast_cdr_update in sig_pri.c
console output: after ast_cdr_update change in sig_pri, also forced update in dialplan removed.
[Jan 19 00:50:08] WARNING[23332]: cdr.c:868 set_one_cid: dnid='<unknown>'
[Jan 19 00:50:08] WARNING[23332]: cdr.c:871 set_one_cid: callingsubaddr='<unknown>'
[Jan 19 00:50:08] WARNING[23332]: cdr.c:875 set_one_cid: calledsubaddr='<unknown>'
-- Executing [8699 at incoming:1] NoOp("DAHDI/i1/45551234:1234-3", "NAME= NUM='45551234' SUBADDR='1234' DNID='8699' DNIDSUBADDR='8690' RDNIS=''") in new stack
-- Executing [8699 at incoming:2] Answer("DAHDI/i1/455551234:1234-3", "") in new stack
-- Accepting call from '45551234' to '8699' on channel 0/8, span 1
[Jan 19 00:50:08] WARNING[23332]: cdr.c:868 set_one_cid: dnid='8699'
[Jan 19 00:50:08] WARNING[23332]: cdr.c:871 set_one_cid: callingsubaddr='1234'
[Jan 19 00:50:08] WARNING[23332]: cdr.c:875 set_one_cid: calledsubaddr='8690'
-- Executing [8699 at incoming:3] VoiceMailMain("DAHDI/i1/45551234:1234-3", "") in new stack
-- <DAHDI/i1/45551234:1234-3> Playing 'vm-login.slin' (language 'en')
-- Channel 0/8, span 1 got hangup request, cause 16
[Jan 19 00:50:11] WARNING[23349]: app_voicemail.c:9210 vm_authenticate: Couldn't read username
-- Executing [h at incoming:1] Verbose("DAHDI/i1/45551234:1234-3", "0,NAME= NUM='45551234' SUBADDR='1234' DNID='8699' DNIDSUBADDR='8690' RDNIS=''") in new stack
NAME= NUM='45551234' SUBADDR='1234' DNID='8699' DNIDSUBADDR='8690' RDNIS=''
-- Hungup 'DAHDI/i1/45551234:1234-3'
mysql table entry after above call:
mysql> select calldate,clid,src,callingsubaddr,dnid,calledsubaddr,dst,lastapp,duration from cdr where calldate > "2010-01-19 00:57" ;
+---------------------+----------+----------+----------------+------+---------------+------+---------------+----------+
| calldate | clid | src | callingsubaddr | dnid | calledsubaddr | dst | lastapp | duration |
+---------------------+----------+----------+----------------+------+---------------+------+---------------+----------+
| 2010-01-19 00:57:28 | 45551234 | 45551234 | 1234 | 8699 | 8690 | 8699 | VoiceMailMain | 3 |
+---------------------+----------+----------+----------------+------+---------------+------+---------------+----------+
1 row in set (0.01 sec)
Thanks,
Alec
More information about the asterisk-dev
mailing list