From: Joshua Colp Date: Tue, 5 May 2009 18:22:27 +0000 (+0000) Subject: Fix an incorrect assumption that certain values on the channel will always exist... X-Git-Tag: 1.4.25-rc1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=385e28f532f13fd1fca3a01960b4d44c00b0d282;p=thirdparty%2Fasterisk.git 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/branches/1.4@192454 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_features.c b/res/res_features.c index c6d00e810e..e2f1810a93 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -1728,16 +1728,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_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)); - 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;