Merged revisions 192454 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Tue, 5 May 2009 18:23:58 +0000 (18:23 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 5 May 2009 18:23:58 +0000 (18:23 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r192454 | file | 2009-05-05 15:22:27 -0300 (Tue, 05 May 2009) | 8 lines

  Fix an incorrect assumption that certain values on the channel will always exist when they may not.

  The CDR code involved with bridges wrongly assumed that the currently executing application and data
  values will always exist. It is possible for this to be false when call forwarding is involved.

  (closes issue #14984)
  Reported by: gincantalupo
........

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

main/features.c

index 5c31162..032e3ec 100644 (file)
@@ -2571,16 +2571,16 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
                        ast_set_flag(chan_cdr, AST_CDR_FLAG_MAIN);
                        ast_cdr_update(chan);
                        bridge_cdr = ast_cdr_dup(chan_cdr);
                        ast_set_flag(chan_cdr, AST_CDR_FLAG_MAIN);
                        ast_cdr_update(chan);
                        bridge_cdr = ast_cdr_dup(chan_cdr);
-                       ast_copy_string(bridge_cdr->lastapp, chan->appl, sizeof(bridge_cdr->lastapp));
-                       ast_copy_string(bridge_cdr->lastdata, chan->data, sizeof(bridge_cdr->lastdata));
+                       ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp));
+                       ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata));
                } else {
                        /* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
                        bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */
                        ast_copy_string(bridge_cdr->channel, chan->name, sizeof(bridge_cdr->channel));
                        ast_copy_string(bridge_cdr->dstchannel, peer->name, sizeof(bridge_cdr->dstchannel));
                        ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid));
                } else {
                        /* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
                        bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */
                        ast_copy_string(bridge_cdr->channel, chan->name, sizeof(bridge_cdr->channel));
                        ast_copy_string(bridge_cdr->dstchannel, peer->name, sizeof(bridge_cdr->dstchannel));
                        ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid));
-                       ast_copy_string(bridge_cdr->lastapp, chan->appl, sizeof(bridge_cdr->lastapp));
-                       ast_copy_string(bridge_cdr->lastdata, chan->data, sizeof(bridge_cdr->lastdata));
+                       ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp));
+                       ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata));
                        ast_cdr_setcid(bridge_cdr, chan);
                        bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NULL;
                        bridge_cdr->amaflags = chan->amaflags ? chan->amaflags :  ast_default_amaflags;
                        ast_cdr_setcid(bridge_cdr, chan);
                        bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NULL;
                        bridge_cdr->amaflags = chan->amaflags ? chan->amaflags :  ast_default_amaflags;