Review Board 1.7.16


CDR: add Dialed Number Identifier field (DNID) field in record

Review Request #455 - Created Jan. 6, 2010 and submitted

Alec Davis
trunk
Reviewers
asterisk-dev
russell
Asterisk
CDR record fields are missing the number the inbound caller dialed, this is important where a corporate has multiple DDI's and want to know how each of them are performing.

We have previously had customize the 'userfield' or the like, in the dialplan with a line as follows:
    exten => s,n,Set(CDR(userfield)=${CALLERID(dnid)})

Now, with the addition of the 'dnid' field in the database (mysql in our case) the 'dnid' field is automatically filled.

cdr collector support:
yes (after user adds required 'dnid' field):
   cdr_adaptive_odbc, cdr_mysql, cdr_pgsql and cdr_tds will automatically fill in field if 'dnid' field exists in database. 
   cdr_custom requires user added field in cdr_custom.conf like ;Master.csv => "${CDR(clid)}",${CDR(dnid)}",

maybe (requires cdr collector supporting code):
   cdr_custom, requires optional user config flag and supporting code, IE. cdr_csv:logdnid=yes.
      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.
added additional mysql field with following systax;
  mysql> alter table cdr ADD (dnid varchar(80) not null);

made inbound test calls, from my cell phone (021xxxx), and restricted number.
The DNID is only 4 digits, as that is what our Telco presents us with.
The 'userfield' is still being customized from the dialplan. My extension is 4866. 8888 was unassigned.

mysql> select calldate,clid,dnid,dst,userfield,dcontext,lastapp,lastdata,duration from cdr where dcontext like "ivr2%" and dnid like "9%";
+---------------------+-------------------------+------+------+-----------------+-----------------------------+---------+---------------+----------+
| calldate            | clid                    | dnid | dst  | userfield       | dcontext                    | lastapp | lastdata      | duration |
+---------------------+-------------------------+------+------+-----------------+-----------------------------+---------+---------------+----------+
| 2010-01-07 20:52:52 | "Alec Davis" <21496xxx> | 9100 | 4866 | 9100-Alec Davis | ivr2-bdt-dialledbyextension | Dial    | DAHDI/g0/4866 |       22 |
| 2010-01-07 20:56:46 |                         | 9100 | 4866 | 9100-Alec Davis | ivr2-bdt-dialledbyextension | Dial    | DAHDI/g0/4866 |       17 |
| 2010-01-07 21:23:44 | "Alec Davis" <21496xxx> | 9888 | 8888 | 9888-           | ivr2-bdt-dialledbyextension | Dial    | DAHDI/g0/8888 |       16 |
| 2010-01-07 21:24:29 | "Alec Davis" <21496xxx> | 9888 | 4866 | 9888-Alec Davis | ivr2-bdt-dialledbyextension | Dial    | DAHDI/g0/4866 |       20 |
+---------------------+-------------------------+------+------+-----------------+-----------------------------+---------+---------------+----------+
4 rows in set (0.01 sec)

Diff revision 2 (Latest)

1 2
1 2

  1. trunk/main/cdr.c: Loading...
trunk/main/cdr.c
Revision 239388 New Change
[20] 860 lines
[+20] [+] static void set_one_cid(struct ast_cdr *cdr, struct ast_channel *c)
861
		ast_copy_string(cdr->clid, num, sizeof(cdr->clid));
861
		ast_copy_string(cdr->clid, num, sizeof(cdr->clid));
862
	} else {				/* nothing known */
862
	} else {				/* nothing known */
863
		cdr->clid[0] = '\0';
863
		cdr->clid[0] = '\0';
864
	}
864
	}
865
	ast_copy_string(cdr->src, S_OR(num, ""), sizeof(cdr->src));
865
	ast_copy_string(cdr->src, S_OR(num, ""), sizeof(cdr->src));

    
   
866
	ast_cdr_setvar(cdr, "dnid", S_OR(c->cid.cid_dnid, ""), 0);
866

    
   
867

   
867
}
868
}
868
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *c)
869
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *c)
869
{
870
{
870
	for (; cdr; cdr = cdr->next) {
871
	for (; cdr; cdr = cdr->next) {
[+20] [20] 762 lines
  1. trunk/main/cdr.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.