[asterisk-dev] [Code Review] CDR: Add Calling and Called Subaddress fields to CDR record

rmudgett at digium.com rmudgett at digium.com
Wed Jan 20 10:06:11 CST 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/460/#review1381
-----------------------------------------------------------

Ship it!


I don't have anything more to add to this.

- rmudgett


On 2010-01-20 03:08:12, Alec Davis wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/460/
> -----------------------------------------------------------
> 
> (Updated 2010-01-20 03:08:12)
> 
> 
> Review request for Asterisk Developers, Tilghman Lesher and rmudgett.
> 
> 
> 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
> -----
> 
>   trunk/main/cdr.c 241416 
> 
> 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 additional debug lines in 'set_one_cid' it can be seen from the console output that callingsubaddr and calledsubaddr are set correctly.
> 
> 'ast_cdr_init' is called when the channel and cdr are created, but channel variables 'callingsubaddr' and 'calledsubaddr' havn't yet been set.
> 'ast_cdr_update' is called early in __ast_pbx_run, where the channel variables as mentioned above have now been set, thus the cdr variables are now correctly created and visible during a call with 'core show channel DAHDI/xxxxx', and are recorded in the backend cdr database.
> 
> console output:
> [Jan 20 21:34:44] WARNING[14394]: cdr.c:897 ast_cdr_init: ALEC
> [Jan 20 21:34:44] WARNING[14394]: cdr.c:870 set_one_cid: callingsubaddr='<unknown>'
> [Jan 20 21:34:44] WARNING[14394]: cdr.c:874 set_one_cid: calledsubaddr='<unknown>'
> [Jan 20 21:34:44] WARNING[14398]: cdr.c:1087 ast_cdr_update: ALEC
> [Jan 20 21:34:44] WARNING[14398]: cdr.c:870 set_one_cid: callingsubaddr='1234'
> [Jan 20 21:34:44] WARNING[14398]: cdr.c:874 set_one_cid: calledsubaddr='8690'
>     -- Executing [8699 at incoming:1] NoOp("DAHDI/i1/45551234:1234-1", "NAME= NUM='45551234' SUBADDR='1234' DNID='8699' DNIDSUBADDR='8690' RDNIS=''") in new stack
>     -- Executing [8699 at incoming:2] Answer("DAHDI/i1/45551234:1234-1", "") in new stack
>     -- Accepting call from '45551234' to '8699' on channel 0/1, span 1
>     -- Executing [8699 at incoming:3] VoiceMailMain("DAHDI/i1/45551234:1234-1", "") in new stack
>     -- <DAHDI/i1/45551234:1234-1> Playing 'vm-login.slin' (language 'en')
>     -- Channel 0/1, span 1 got hangup request, cause 16
> [Jan 20 21:34:55] WARNING[14398]: app_voicemail.c:9210 vm_authenticate: Couldn't read username
>     -- Executing [h at incoming:1] Verbose("DAHDI/i1/45551234:1234-1", "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-1'
> 
> 
> mysql table entry after above call:
> 
> mysql> select calldate,clid,src,callingsubaddr,dnid,calledsubaddr,dst,lastapp,duration from cdr where calldate > "2010-01-20" ;
> +---------------------+----------+----------+----------------+------+---------------+------+---------------+----------+
> | calldate            | clid     | src      | callingsubaddr | dnid | calledsubaddr | dst  | lastapp       | duration |
> +---------------------+----------+----------+----------------+------+---------------+------+---------------+----------+
> | 2010-01-20 21:34:44 | 45551234 | 45551234 | 1234           | 8699 | 8690          | 8699 | VoiceMailMain |       11 |
> +---------------------+----------+----------+----------------+------+---------------+------+---------------+----------+
> 1 row in set (0.00 sec)
> 
> 
> Thanks,
> 
> Alec
> 
>




More information about the asterisk-dev mailing list