[asterisk-dev] [Code Review] CDR: Add Calling and Called Subaddress fields to CDR record
Alec Davis
sivad.a at paradise.net.nz
Mon Jan 18 06:11:52 CST 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/460/
-----------------------------------------------------------
(Updated 2010-01-18 06:11:52.569528)
Review request for Asterisk Developers, Tilghman Lesher and rmudgett.
Changes
-------
found issue with CDR not being updated.
sig_pri required ast_cdr_update after all channel variables had been collected and set.
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 240765
trunk/main/cdr.c 240765
Diff: https://reviewboard.asterisk.org/r/460/diff
Testing (updated)
-------
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