[asterisk-commits] murf: branch murf/bug8221-1.4 r48531 - in
/team/murf/bug8221-1.4: main/ res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Dec 16 23:48:02 MST 2006
Author: murf
Date: Sun Dec 17 00:48:02 2006
New Revision: 48531
URL: http://svn.digium.com/view/asterisk?view=rev&rev=48531
Log:
Got a huge number of debug log messages (LOG_NOTICE), and I think I have blind xfers almost workable; Assisted xfers are... rocky. CDR-wise, at least.
Modified:
team/murf/bug8221-1.4/main/cdr.c
team/murf/bug8221-1.4/main/channel.c
team/murf/bug8221-1.4/main/pbx.c
team/murf/bug8221-1.4/res/res_features.c
Modified: team/murf/bug8221-1.4/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221-1.4/main/cdr.c?view=diff&rev=48531&r1=48530&r2=48531
==============================================================================
--- team/murf/bug8221-1.4/main/cdr.c (original)
+++ team/murf/bug8221-1.4/main/cdr.c Sun Dec 17 00:48:02 2006
@@ -502,43 +502,47 @@
to->disposition = from->disposition;
from->disposition = AST_CDR_NOANSWER;
}
- if (!to->lastapp[0] && from->lastapp[0]) {
- strcpy(to->lastapp, from->lastapp);
+ if (ast_strlen_zero(to->lastapp) && !ast_strlen_zero(from->lastapp)) {
+ ast_copy_string(to->lastapp, from->lastapp, sizeof(to->lastapp));
from->lastapp[0] = 0; /* theft */
}
- if (!to->lastdata[0] && from->lastdata[0]) {
- strcpy(to->lastdata, from->lastdata);
+ if (ast_strlen_zero(to->lastdata) && !ast_strlen_zero(from->lastdata)) {
+ ast_copy_string(to->lastdata, from->lastdata, sizeof(to->lastdata));
from->lastdata[0] = 0; /* theft */
}
- if (!to->dcontext[0] && from->dcontext[0]) {
- strcpy(to->dcontext, from->dcontext);
+ if (ast_strlen_zero(to->dcontext) && !ast_strlen_zero(from->dcontext)) {
+ ast_copy_string(to->dcontext, from->dcontext, sizeof(to->dcontext));
from->dcontext[0] = 0; /* theft */
}
- if (!to->dstchannel[0] && from->dstchannel[0]) {
- strcpy(to->dstchannel, from->dstchannel);
+ if (ast_strlen_zero(to->dstchannel) && !ast_strlen_zero(from->dstchannel)) {
+ ast_copy_string(to->dstchannel, from->dstchannel, sizeof(to->dstchannel));
from->dstchannel[0] = 0; /* theft */
}
- if (!to->src[0] && from->src[0]) {
- strcpy(to->src, from->src);
+ if (ast_strlen_zero(to->channel) && !ast_strlen_zero(from->channel)) {
+ ast_copy_string(to->channel, from->channel, sizeof(to->channel));
+ from->channel[0] = 0; /* theft */
+ }
+ if (ast_strlen_zero(to->src) && !ast_strlen_zero(from->src)) {
+ ast_copy_string(to->src, from->src, sizeof(to->src));
from->src[0] = 0; /* theft */
}
- if (!to->dst[0] && from->dst[0]) {
- strcpy(to->dst, from->dst);
+ if (ast_strlen_zero(to->dst) && !ast_strlen_zero(from->dst)) {
+ ast_copy_string(to->dst, from->dst, sizeof(to->dst));
from->dst[0] = 0; /* theft */
}
if (!to->amaflags && from->amaflags) {
to->amaflags = from->amaflags;
from->amaflags = 0; /* theft */
}
- if (!to->accountcode[0] && from->accountcode[0]) {
- strcpy(to->accountcode, from->accountcode);
+ if (ast_strlen_zero(to->accountcode) && !ast_strlen_zero(from->accountcode)) {
+ ast_copy_string(to->accountcode, from->accountcode, sizeof(to->accountcode));
from->accountcode[0] = 0; /* theft */
}
- if (!to->userfield[0] && from->userfield[0]) {
- strcpy(to->userfield, from->userfield);
+ if (ast_strlen_zero(to->userfield) && !ast_strlen_zero(from->userfield)) {
+ ast_copy_string(to->userfield, from->userfield, sizeof(to->userfield));
from->userfield[0] = 0; /* theft */
}
- /* amaflags, flags, varsead, dst, src? */
+ /* flags, varsead, ? */
}
void ast_cdr_start(struct ast_cdr *cdr)
Modified: team/murf/bug8221-1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221-1.4/main/channel.c?view=diff&rev=48531&r1=48530&r2=48531
==============================================================================
--- team/murf/bug8221-1.4/main/channel.c (original)
+++ team/murf/bug8221-1.4/main/channel.c Sun Dec 17 00:48:02 2006
@@ -678,11 +678,6 @@
tmp->timingfd = -1;
#endif
- /* Experiment: under what conditions do we NOT want to track cdrs on channels? */
- tmp->cdr = ast_cdr_alloc();
- ast_cdr_init(tmp->cdr, tmp);
- ast_cdr_start(tmp->cdr);
-
if (needqueue) {
if (pipe(tmp->alertpipe)) {
ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe!\n");
@@ -750,6 +745,11 @@
S_OR(cid_name, "<unknown>"),
tmp->uniqueid);
}
+
+ /* Experiment: under what conditions do we NOT want to track cdrs on channels? */
+ tmp->cdr = ast_cdr_alloc();
+ ast_cdr_init(tmp->cdr, tmp);
+ ast_cdr_start(tmp->cdr);
headp = &tmp->varshead;
AST_LIST_HEAD_INIT_NOLOCK(headp);
@@ -3264,6 +3264,7 @@
struct ast_channel *clone = original->masq;
struct ast_channel_spy_list *spy_list = NULL;
struct ast_channel_spy *spy = NULL;
+ struct ast_cdr *cdr;
int rformat = original->readformat;
int wformat = original->writeformat;
char newn[100];
@@ -3317,6 +3318,13 @@
t = original->tech;
original->tech = clone->tech;
clone->tech = t;
+
+ /* Swap the cdrs */
+ ast_log(LOG_NOTICE,"Actually Masquerading %s(%d)[cdr=%x] into the structure of %s(%d)[cdr=%x]\n",
+ clone->name, clone->_state, (int)clone->cdr, original->name, original->_state, (int)original->cdr);
+ cdr = original->cdr;
+ original->cdr = clone->cdr;
+ clone->cdr = cdr;
t_pvt = original->tech_pvt;
original->tech_pvt = clone->tech_pvt;
Modified: team/murf/bug8221-1.4/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221-1.4/main/pbx.c?view=diff&rev=48531&r1=48530&r2=48531
==============================================================================
--- team/murf/bug8221-1.4/main/pbx.c (original)
+++ team/murf/bug8221-1.4/main/pbx.c Sun Dec 17 00:48:02 2006
@@ -2295,6 +2295,7 @@
/* XXX and now what ? */
free(c->pbx);
}
+ ast_log(LOG_NOTICE, "__ast_pbx_run called with channel %s; amaflags=%d\n", c->name, c->amaflags);
if (!(c->pbx = ast_calloc(1, sizeof(*c->pbx))))
return -1;
if (c->amaflags) {
@@ -2571,7 +2572,7 @@
ast_log(LOG_WARNING, "Asked to start thread on NULL channel?\n");
return AST_PBX_FAILED;
}
-
+ ast_log(LOG_NOTICE, "ast_pbx_start called for channel %s\n", c->name);
if (increase_call_count(c))
return AST_PBX_CALL_LIMIT;
@@ -4517,8 +4518,9 @@
int res = 0;
ast_channel_lock(chan);
-
+
if (chan->pbx) { /* This channel is currently in the PBX */
+ ast_log(LOG_NOTICE,"async_goto: pbx already, chan=%x\n",(int)chan);
ast_explicit_goto(chan, context, exten, priority);
ast_softhangup_nolock(chan, AST_SOFTHANGUP_ASYNCGOTO);
} else {
@@ -4526,6 +4528,11 @@
the PBX, we have to make a new channel, masquerade, and start the PBX
at the new location */
struct ast_channel *tmpchan = ast_channel_alloc(0, chan->_state, 0, 0, "AsyncGoto/%s", chan->name);
+ if (chan->cdr) {
+ tmpchan->cdr = ast_cdr_dup(chan->cdr);
+ ast_log(LOG_NOTICE,"Duplicated CDR to AsyncGoto/%s channel\n", chan->name);
+ }
+ ast_log(LOG_NOTICE,"async_goto, set up new pbx, chan is %s\n", chan->name);
if (!tmpchan)
res = -1;
else {
Modified: team/murf/bug8221-1.4/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8221-1.4/res/res_features.c?view=diff&rev=48531&r1=48530&r2=48531
==============================================================================
--- team/murf/bug8221-1.4/res/res_features.c (original)
+++ team/murf/bug8221-1.4/res/res_features.c Sun Dec 17 00:48:02 2006
@@ -656,7 +656,7 @@
/* Start autoservice on chan while we talk to the originator */
ast_autoservice_start(transferee);
ast_indicate(transferee, AST_CONTROL_HOLD);
-
+ ast_log(LOG_NOTICE,"BLINDTRANSFER from %s to %s\n", transferer->name, transferee->name);
memset(xferto, 0, sizeof(xferto));
/* Transfer */
@@ -675,6 +675,7 @@
return res;
}
if (!strcmp(xferto, ast_parking_ext())) {
+ ast_log(LOG_NOTICE,"BLINDTRANSFER PARK from %s to %s\n", transferer->name, transferee->name);
res = finishup(transferee);
if (res)
res = -1;
@@ -689,9 +690,36 @@
}
/*! \todo XXX Maybe we should have another message here instead of invalid extension XXX */
} else if (ast_exists_extension(transferee, transferer_real_context, xferto, 1, transferer->cid.cid_num)) {
- pbx_builtin_setvar_helper(peer, "BLINDTRANSFER", chan->name);
+ ast_log(LOG_NOTICE,"BLINDTRANSFER NON-PARK from %s to %s\n", transferer->name, transferee->name);
+ pbx_builtin_setvar_helper(peer, "BLINDTRANSFER", transferee->name);
pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", peer->name);
res=finishup(transferee);
+ if (!transferer->cdr) {
+ ast_log(LOG_NOTICE,"****Creating a CDR for %s\n", transferer->name);
+ transferer->cdr=ast_cdr_alloc();
+ ast_cdr_init(transferer->cdr, transferer); /* initilize our channel's cdr */
+ ast_cdr_start(transferer->cdr);
+ }
+ ast_cdr_setdestchan(transferer->cdr, transferee->name);
+ ast_cdr_setapp(transferer->cdr, "BLINDTRANSFER","");
+ if (transferer->cdr)
+ ast_log(LOG_NOTICE,"---transferer.cdr.name=%s, .dstchan=%s, .lastapp=%s, .start=%d, .answer=%d, .end=%d, dispos=%d\n",
+ transferer->cdr->channel,
+ transferer->cdr->dstchannel,
+ transferer->cdr->lastapp,
+ (int)transferer->cdr->start.tv_sec,
+ (int)transferer->cdr->answer.tv_sec,
+ (int)transferer->cdr->end.tv_sec,
+ (int)transferer->cdr->disposition);
+ if (transferee->cdr)
+ ast_log(LOG_NOTICE,"---transferee.cdr.name=%s, .dstchann=%s, .lastapp=%s, .start=%d, .answer=%d, .end=%d, dispos=%d\n",
+ transferee->cdr->channel,
+ transferee->cdr->dstchannel,
+ transferee->cdr->lastapp,
+ (int)transferee->cdr->start.tv_sec,
+ (int)transferee->cdr->answer.tv_sec,
+ (int)transferee->cdr->end.tv_sec,
+ (int)transferee->cdr->disposition);
if (!transferee->pbx) {
/* Doh! Use our handy async_goto functions */
if (option_verbose > 2)
@@ -699,12 +727,16 @@
,transferee->name, xferto, transferer_real_context);
if (ast_async_goto(transferee, transferer_real_context, xferto, 1))
ast_log(LOG_WARNING, "Async goto failed :-(\n");
+ ast_log(LOG_NOTICE,"No pbx for transferee %s\n", transferee->name);
res = -1;
} else {
/* Set the channel's new extension, since it exists, using transferer context */
+ ast_log(LOG_NOTICE, "set_c_e_p to %s/%s/%d for channel %s\n", transferer_real_context, xferto, 0, transferee->name);
set_c_e_p(transferee, transferer_real_context, xferto, 0);
}
+ ast_log(LOG_NOTICE,"About to call check_goto_on_transfer for %s\n", transferer->name);
check_goto_on_transfer(transferer);
+ ast_log(LOG_NOTICE,"Returned from check_goto_on_transfer for %s\n", transferer->name);
return res;
} else {
if (option_verbose > 2)
@@ -714,7 +746,9 @@
finishup(transferee);
return -1;
}
+ ast_log(LOG_NOTICE,"About to call stopstream\n");
ast_stopstream(transferer);
+ ast_log(LOG_NOTICE,"About to call finishup\n");
res = finishup(transferee);
if (res) {
if (option_verbose > 1)
@@ -1421,6 +1455,7 @@
peer->cdr = NULL;
} else if (chan->cdr) {
/* take the cdr from the channel - literally */
+ ast_log(LOG_NOTICE,"_________Bridging call with ONLY CHAN holding a CDR!\n");
ast_cdr_init(bridge_object.cdr,chan);
if (chan->cdr->disposition!=AST_CDR_ANSWERED) {
ast_cdr_end(chan->cdr);
@@ -1438,6 +1473,14 @@
ast_cdr_init(peer->cdr, peer);
} else if (peer->cdr) {
/* take the cdr from the peer - literally */
+ ast_log(LOG_NOTICE,"_________Bridging call with ONLY PEER holding a CDR!\n");
+ ast_log(LOG_NOTICE,"---peer.cdr.name=%s, .dstchan=%s, .lastapp=%s, .start=%d, .answer=%d, .end=%d, .dispos=%d\n", peer->cdr->channel,
+ peer->cdr->dstchannel,
+ peer->cdr->lastapp,
+ (int)peer->cdr->start.tv_sec,
+ (int)peer->cdr->answer.tv_sec,
+ (int)peer->cdr->end.tv_sec,
+ (int)peer->cdr->disposition);
ast_cdr_init(bridge_object.cdr,peer);
if (peer->cdr->disposition != AST_CDR_ANSWERED) {
ast_cdr_end(peer->cdr);
@@ -1464,7 +1507,12 @@
ast_cdr_init(peer->cdr, peer);
ast_cdr_start(peer->cdr); /* now is the time to start */
}
-
+ if (ast_strlen_zero(bridge_object.cdr->dstchannel)) {
+ if (strcmp(bridge_object.cdr->channel, peer->name) != 0)
+ ast_cdr_setdestchan(bridge_object.cdr, peer->name);
+ else
+ ast_cdr_setdestchan(bridge_object.cdr, chan->name);
+ }
for (;;) {
struct ast_channel *other; /* used later */
@@ -1966,6 +2014,14 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel %s connected to parked call %d\n", chan->name, park);
+ pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", peer->name);
+ ast_cdr_setdestchan(chan->cdr, peer->name);
+#ifdef NOT_NECC
+ ast_log(LOG_NOTICE,"Channel name is %s, and the cdr channel name is '%s'\n", chan->name, chan->cdr->channel);
+ if (!ast_strlen_zero(chan->name) && ast_strlen_zero(chan->cdr->channel)) {
+ ast_copy_string(chan->cdr->channel, chan->name, sizeof(chan->cdr->channel));
+ }
+#endif
memset(&config, 0, sizeof(struct ast_bridge_config));
res = ast_bridge_call(chan, peer, &config);
More information about the asterisk-commits
mailing list