Add Calling and Called Subaddress to CDR record
authorAlec L Davis <sivad.a@paradise.net.nz>
Wed, 20 Jan 2010 17:49:30 +0000 (17:49 +0000)
committerAlec L Davis <sivad.a@paradise.net.nz>
Wed, 20 Jan 2010 17:49:30 +0000 (17:49 +0000)
Requires 'callingsubaddr' and 'calledsubaddr' fields in backend cdr.

(closes issue #16600)
Reported by: alecdavis
Patches:
      cdr_subaddr.diff.txt uploaded by alecdavis (license 585)
Tested by: alecdavis

Review: https://reviewboard.asterisk.org/r/460/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241581 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/cdr.c

index 8cac4ed..4bcd9d2 100644 (file)
@@ -865,7 +865,14 @@ static void set_one_cid(struct ast_cdr *cdr, struct ast_channel *c)
        ast_copy_string(cdr->src, S_OR(num, ""), sizeof(cdr->src));
        ast_cdr_setvar(cdr, "dnid", S_OR(c->cid.cid_dnid, ""), 0);
 
+       if (c->cid.subaddress.valid) {
+               ast_cdr_setvar(cdr, "callingsubaddr", S_OR(c->cid.subaddress.str, ""), 0);
+       }
+       if (c->cid.dialed_subaddress.valid) {
+               ast_cdr_setvar(cdr, "calledsubaddr", S_OR(c->cid.dialed_subaddress.str, ""), 0);
+       }
 }
+
 int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *c)
 {
        for (; cdr; cdr = cdr->next) {