[asterisk-commits] murf: branch murf/CDRfix5 r69552 - in /team/murf/CDRfix5: channels/ main/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 15 11:24:43 CDT 2007
Author: murf
Date: Fri Jun 15 11:24:42 2007
New Revision: 69552
URL: http://svn.digium.com/view/asterisk?view=rev&rev=69552
Log:
ah, that feels better. Got all the way to Scenario 10 before I found a problem with the linked ids. Now I get to play in chan_sip
Modified:
team/murf/CDRfix5/channels/chan_zap.c
team/murf/CDRfix5/main/channel.c
team/murf/CDRfix5/res/res_features.c
Modified: team/murf/CDRfix5/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/CDRfix5/channels/chan_zap.c?view=diff&rev=69552&r1=69551&r2=69552
==============================================================================
--- team/murf/CDRfix5/channels/chan_zap.c (original)
+++ team/murf/CDRfix5/channels/chan_zap.c Fri Jun 15 11:24:42 2007
@@ -4553,8 +4553,12 @@
if (((ast->pbx) || (ast->_state == AST_STATE_UP)) &&
(p->transfertobusy || (ast->_state != AST_STATE_BUSY))) {
int otherindex = SUB_THREEWAY;
+ extern void ast_channel_log(char *title, struct ast_channel *chan);
+ extern void ast_cdr_log(char *title, struct ast_cdr *cdr);
struct ast_channel *other = ast_bridged_channel(p->subs[SUB_THREEWAY].owner);
int way3bridge = 0, cdr3way = 0;
+ const char *firstlink;
+
#ifdef CDR_FIX_NOT_ANYMORE
struct ast_cdr *x2;
#endif
@@ -4573,7 +4577,26 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Other is %s, 3way link=%s, real link=%s\n",
other->name, p->subs[SUB_THREEWAY].owner->linkedid, p->subs[SUB_REAL].owner->linkedid);
- ast_channel_set_linkgroup(p->subs[SUB_THREEWAY].owner, p->subs[SUB_REAL].owner);
+ ast_channel_log("+++++ 3WAY ===== SUB_THREEWAY channel:", p->subs[SUB_THREEWAY].owner);
+ ast_channel_log("+++++ 3WAY ===== SUB_REAL channel:", p->subs[SUB_REAL].owner);
+ ast_channel_log("+++++ 3WAY ===== 'other' channel:", other);
+
+ /* get the youngest linked id and push it around */
+ if (strcmp(other->uniqueid, p->subs[SUB_REAL].owner->uniqueid) < 0)
+ firstlink = other->uniqueid;
+ else
+ firstlink = p->subs[SUB_REAL].owner->uniqueid;
+ if (strcmp(p->subs[SUB_THREEWAY].owner->uniqueid, firstlink) < 0)
+ firstlink = p->subs[SUB_THREEWAY].owner->uniqueid;
+ if (p->subs[SUB_REAL].owner->_bridge && strcmp(p->subs[SUB_REAL].owner->uniqueid, firstlink) < 0)
+ firstlink = p->subs[SUB_REAL].owner->_bridge->uniqueid;
+
+ /* now, copy it around to all the linkedid fields */
+ ast_string_field_set(p->subs[SUB_THREEWAY].owner, linkedid, firstlink);
+ ast_string_field_set(p->subs[SUB_REAL].owner, linkedid, firstlink);
+ ast_string_field_set(other, linkedid, firstlink);
+ if (p->subs[SUB_REAL].owner->_bridge)
+ ast_string_field_set(p->subs[SUB_REAL].owner->_bridge, linkedid, firstlink);
#ifdef CDR_FIX_NOT_ANYMORE
if (other)
ast_verbose(VERBOSE_PREFIX_3 "way3bridge is %d, and bridged to %s\n",
Modified: team/murf/CDRfix5/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/CDRfix5/main/channel.c?view=diff&rev=69552&r1=69551&r2=69552
==============================================================================
--- team/murf/CDRfix5/main/channel.c (original)
+++ team/murf/CDRfix5/main/channel.c Fri Jun 15 11:24:42 2007
@@ -3407,10 +3407,13 @@
} else if (ast_strlen_zero(chan->linkedid) && !ast_strlen_zero(peer->linkedid)) {
ast_string_field_set(chan, linkedid, peer->linkedid);
} else {
- if (strcmp(chan->linkedid,peer->linkedid)!= 0)
- ast_log(LOG_WARNING,"linkid clash between (chan)%s and (peer) %s.\n",
- chan->linkedid, peer->linkedid);
- ast_string_field_set(peer, linkedid, chan->linkedid); /* let the chan take precedence, then */
+ int x = strcmp(chan->linkedid,peer->linkedid);
+ ast_log(LOG_WARNING,"linkid clash between (chan)%s and (peer) %s.\n",
+ chan->linkedid, peer->linkedid); /* smallest wins! */
+ if (x < 0)
+ ast_string_field_set(peer, linkedid, chan->linkedid); /* let the chan take precedence, then */
+ else if (x > 0)
+ ast_string_field_set(chan, linkedid, peer->linkedid); /* let the chan take precedence, then */
}
}
Modified: team/murf/CDRfix5/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/murf/CDRfix5/res/res_features.c?view=diff&rev=69552&r1=69551&r2=69552
==============================================================================
--- team/murf/CDRfix5/res/res_features.c (original)
+++ team/murf/CDRfix5/res/res_features.c Fri Jun 15 11:24:42 2007
@@ -1638,18 +1638,21 @@
void ast_channel_log(char *title, struct ast_channel *chan)
{
- ast_log(LOG_NOTICE, "______ %s ______\n", title);
+ ast_log(LOG_NOTICE, "______ %s (%lx)______\n", title, (unsigned long)chan);
ast_log(LOG_NOTICE, "CHAN: name: %s; appl: %s; data: %s; contxt: %s; exten: %s; pri: %d;\n",
chan->name, chan->appl, chan->data, chan->context, chan->exten, chan->priority);
ast_log(LOG_NOTICE, "CHAN: acctcode: %s; dialcontext: %s; amaflags: %x; maccontxt: %s; macexten: %s; macpri: %d;\n",
chan->accountcode, chan->dialcontext, chan->amaflags, chan->macrocontext, chan->macroexten, chan->macropriority);
ast_log(LOG_NOTICE, "CHAN: masq: %x; masqr: %x; _bridge: %x; uniqueID: %s; linkedID:%s\n",
- (unsigned int)chan->masq, (unsigned int)chan->masqr, (unsigned int)chan->_bridge, chan->uniqueid, chan->linkedid);
+ (unsigned int)chan->masq, (unsigned int)chan->masqr,
+ (unsigned int)chan->_bridge, chan->uniqueid, chan->linkedid);
if (chan->masqr)
ast_log(LOG_NOTICE, "CHAN: masquerading as: %s; cdr: %x;\n",
chan->masqr->name, (unsigned int)chan->masqr->cdr);
-
- ast_log(LOG_NOTICE, "===== done ====\n");
+ if (chan->_bridge)
+ ast_log(LOG_NOTICE, "CHAN: Bridged to %s\n", chan->_bridge->name);
+
+ast_log(LOG_NOTICE, "===== done ====\n");
}
void ast_channel_set_linkgroup(struct ast_channel *chan, struct ast_channel *peer)
@@ -1765,7 +1768,6 @@
}
}
ast_cdr_answer(bridge_cdr);
- ast_copy_string(bridge_cdr->linkedid,chan->linkedid,sizeof(bridge_cdr->linkedid));
}
@@ -1928,6 +1930,9 @@
ast_channel_log("XXXXXXXXXXX Post-bridge CHAN Channel info XXXXXXXXXXX", chan);
ast_channel_log("XXXXXXXXXXX Post-bridge PEER Channel info XXXXXXXXXXX", peer);
+ /* update the linked id field, as xfers, etc, might have changed it */
+ ast_copy_string(bridge_cdr->linkedid,chan->linkedid,sizeof(bridge_cdr->linkedid));
+
ast_cdr_end(bridge_cdr);
#ifdef CDR_FIX_NOT_ANYMORE
More information about the asterisk-commits
mailing list