[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 02:34:42 CST 2010


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

(Updated 2010-01-18 02:34:41.864137)


Review request for Asterisk Developers, Tilghman Lesher and rmudgett.


Changes
-------

Report on testing results.
Discovery of possible unrelated bug, CDR records not yet filled in??


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 239623 

Diff: https://reviewboard.asterisk.org/r/460/diff


Testing (updated)
-------

tested with trunk, with Jtec 5551234:1234 calling Asterisk 8699:8690, but cdr requires a forced update before record is updated.

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,Set(CALLERID(name)=Test)
exten => h,n,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 not yet set. Later after the 'set(CALLERID(name)=Test") they are then set????

[Jan 18 20:38:04] WARNING[1748]: cdr.c:867 set_one_cid: dnid='<unknown>'  <***
[Jan 18 20:38:04] WARNING[1748]: cdr.c:870 set_one_cid: callingsubaddr='<unknown>' <***
[Jan 18 20:38:04] WARNING[1748]: cdr.c:874 set_one_cid: calledsubaddr='<unknown>'  <***
    -- Executing [8699 at incoming:1] NoOp("DAHDI/i1/45551234:1234-8", "NAME= NUM='45551234' SUBADDR='1234' DNID='8699' DNIDSUBADDR='8690' RDNIS=''") in new stack
    -- Executing [8699 at incoming:2] Answer("DAHDI/i1/45551234:1234-8", "") in new stack
    -- Accepting call from '45551234' to '8699' on channel 0/14, span 1
    -- Executing [8699 at incoming:3] VoiceMailMain("DAHDI/i1/45551234:1234-8", "") in new stack
    -- <DAHDI/i1/45551234:1234-8> Playing 'vm-login.slin' (language 'en')
    -- Channel 0/14, span 1 got hangup request, cause 16
[Jan 18 20:38:07] WARNING[1783]: app_voicemail.c:9210 vm_authenticate: Couldn't read username
    -- Executing [h at incoming:1] Set("DAHDI/i1/45551234:1234-8", "CALLERID(name)=Test") in new stack
[Jan 18 20:38:07] WARNING[1783]: cdr.c:867 set_one_cid: dnid='8699'   <***
[Jan 18 20:38:07] WARNING[1783]: cdr.c:870 set_one_cid: callingsubaddr='1234'  <***
[Jan 18 20:38:07] WARNING[1783]: cdr.c:874 set_one_cid: calledsubaddr='8690'   <***
    -- Executing [h at incoming:2] Verbose("DAHDI/i1/45551234:1234-8", "0,NAME=Test NUM='45551234' SUBADDR='1234' DNID='8699' DNIDSUBADDR='8690' RDNIS=''") in new stack
NAME=Test NUM='45551234' SUBADDR='1234' DNID='8699' DNIDSUBADDR='8690' RDNIS=''
    -- Hungup 'DAHDI/i1/45551234:1234-8'


mysql table entry after above call:

mysql> select calldate,clid,src,callingsubaddr,dnid,calledsubaddr,dst,lastapp,duration from cdr where clid like "%Test%";
+---------------------+-------------------+----------+----------------+------+---------------+------+---------------+----------+
| calldate            | clid              | src      | callingsubaddr | dnid | calledsubaddr | dst  | lastapp       | duration |
+---------------------+-------------------+----------+----------------+------+---------------+------+---------------+----------+
| 2010-01-18 20:38:04 | "Test" <45551234> | 45551234 | 1234           | 8699 | 8690          | 8699 | VoiceMailMain |        3 |
+---------------------+-------------------+----------+----------------+------+---------------+------+---------------+----------+
1 row in set (0.00 sec)


Thanks,

Alec




More information about the asterisk-dev mailing list