[asterisk-commits] murf: branch murf/bug11210 r99084 - /team/murf/bug11210/channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 18 15:41:21 CST 2008
Author: murf
Date: Fri Jan 18 15:41:21 2008
New Revision: 99084
URL: http://svn.digium.com/view/asterisk?view=rev&rev=99084
Log:
Another checkpoint. I *think* I have all the state changes taken care of. the "find" code is in place. I will feel better if I knew my assumptions about key uniqueness for the findcall tables were true. I will put some code to check this into the works...
Modified:
team/murf/bug11210/channels/chan_iax2.c
Modified: team/murf/bug11210/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_iax2.c?view=diff&rev=99084&r1=99083&r2=99084
==============================================================================
--- team/murf/bug11210/channels/chan_iax2.c (original)
+++ team/murf/bug11210/channels/chan_iax2.c Fri Jan 18 15:41:21 2008
@@ -1625,9 +1625,14 @@
for (x=TRUNK_CALL_START;x<IAX_MAX_CALLS - 1; x++) {
ast_mutex_lock(&iaxsl[x]);
if (!iaxs[x] && ((now.tv_sec - lastused[x].tv_sec) > MIN_REUSE_TIME)) {
+ /* remove this entry from findcall2 */
+ ao2_t_unlink(findcall2, iaxs[callno], "moving a pvt to the trunked pvt range");
iaxs[x] = iaxs[callno];
iaxs[x]->callno = x;
iaxs[callno] = NULL;
+ /* put it back in in the new spot */
+ ao2_t_link(findcall2, iaxs[x], "moved to new pvt callno in trunk range");
+
/* Update the two timers that should have been started */
iaxs[x]->pingid = iax2_sched_replace(iaxs[x]->pingid, sched,
ping_time * 1000, send_ping, (void *)(long)x);
@@ -2321,6 +2326,13 @@
retry:
pvt = iaxs[callno];
+ ao2_t_unlink(findcall1,pvt,"destroy this pvt");
+ ao2_t_unlink(findcall2,pvt,"destroy this pvt");
+ if (pvt->transferring)
+ ao2_t_unlink(findcall3,pvt,"destroy this pvt");
+ if (pvt->transferring == TRANSFER_MEDIAPASS)
+ ao2_t_unlink(findcall4,pvt,"destroy this pvt");
+
lastused[callno] = ast_tvnow();
owner = pvt ? pvt->owner : NULL;
@@ -6422,6 +6434,9 @@
ast_log(LOG_WARNING, "Invalid transfer request\n");
return -1;
}
+ if (old1 == TRANSFER_MEDIAPASS)
+ ao2_t_unlink(findcall4,pvt,"pvt leaving MEDIAPASS state. remove from findcall4");
+
pvt->transfercallno = newcall;
memcpy(&pvt->transfer, &new, sizeof(pvt->transfer));
inet_aton(newip, &pvt->transfer.sin_addr);
@@ -8230,6 +8245,7 @@
}
}
if (f.frametype == AST_FRAME_IAX) {
+ int old1;
if (iaxs[fr->callno]->initid > -1) {
/* Don't auto congest anymore since we've gotten something usefulb ack */
ast_sched_del(sched, iaxs[fr->callno]->initid);
@@ -8304,6 +8320,9 @@
break;
case IAX_COMMAND_TXACC:
if (iaxs[fr->callno]->transferring == TRANSFER_BEGIN) {
+ old1 = iaxs[fr->callno]->transferring;
+ if (old1 == TRANSFER_MEDIAPASS)
+ ao2_t_unlink(findcall4, iaxs[fr->callno], "pvt passing out of MEDIAPASS state, removing from findcall4");
/* Ack the packet with the given timestamp */
AST_LIST_LOCK(&frame_queue);
AST_LIST_TRAVERSE(&frame_queue, cur, list) {
@@ -8316,6 +8335,8 @@
iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->callno);
send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREADY, 0, ied1.buf, ied1.pos, -1);
iaxs[fr->callno]->transferring = TRANSFER_READY;
+ if (!old1)
+ ao2_t_link(findcall3, iaxs[fr->callno], "pvt set transferring; add to findcall3");
}
break;
case IAX_COMMAND_NEW:
@@ -9103,6 +9124,11 @@
}
break;
case IAX_COMMAND_TXREJ:
+ old1 = iaxs[fr->callno]->transferring;
+ if (old1 == TRANSFER_MEDIAPASS)
+ ao2_t_unlink(findcall4, iaxs[fr->callno], "pvt passing out of MEDIAPASS state to state 0, removing from findcall4");
+ if (old1)
+ ao2_t_unlink(findcall3, iaxs[fr->callno], "pvt passing to state 0, removing from findcall3");
iaxs[fr->callno]->transferring = 0;
ast_verb(3, "Channel '%s' unable to transfer\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>");
memset(&iaxs[fr->callno]->transfer, 0, sizeof(iaxs[fr->callno]->transfer));
@@ -9125,13 +9151,19 @@
if ((iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_READY) ||
(iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_MREADY)) {
/* They're both ready, now release them. */
+ int old2 = iaxs[iaxs[fr->callno]->bridgecallno]->transferring;
if (iaxs[fr->callno]->transferring == TRANSFER_MREADY) {
ast_verb(3, "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>",
iaxs[iaxs[fr->callno]->bridgecallno]->owner ? iaxs[iaxs[fr->callno]->bridgecallno]->owner->name : "<Unknown>");
+ if (old2 == TRANSFER_MEDIAPASS)
+ ao2_t_unlink(findcall4,iaxs[iaxs[fr->callno]->bridgecallno],"Passing out of MEDIAPASS; remove from findcall4");
iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_MEDIA; /* no action required in findcall3/4 */
iaxs[fr->callno]->transferring = TRANSFER_MEDIA;
-
+
+ if (!old2)
+ ao2_t_link(findcall3, iaxs[iaxs[fr->callno]->bridgecallno], "transferring now set; adding to findcall3.");
+
memset(&ied0, 0, sizeof(ied0));
memset(&ied1, 0, sizeof(ied1));
iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr->callno]->bridgecallno]->peercallno);
@@ -9169,7 +9201,6 @@
send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos, -1);
send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos, -1);
}
-
}
}
}
More information about the asterisk-commits
mailing list