[asterisk-commits] russell: trunk r77858 - in /trunk: apps/ channels/ main/ pbx/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 1 10:39:55 CDT 2007


Author: russell
Date: Wed Aug  1 10:39:54 2007
New Revision: 77858

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77858
Log:
Convert code that checks the _softhangup member of ast_channel directory to use
the ast_check_hangup() funciton.  This function takes scheduled hangups into
account.
(closes issue #10230, patch by Juggie)

Modified:
    trunk/apps/app_dial.c
    trunk/apps/app_macro.c
    trunk/apps/app_meetme.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_queue.c
    trunk/apps/app_zapras.c
    trunk/channels/chan_local.c
    trunk/channels/chan_vpb.cc
    trunk/main/autoservice.c
    trunk/main/pbx.c
    trunk/pbx/pbx_dundi.c
    trunk/res/res_features.c

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Wed Aug  1 10:39:54 2007
@@ -1789,7 +1789,7 @@
 			ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP);  /* set it back the way it was */
 		}
 		if (res != AST_PBX_NO_HANGUP_PEER) {
-			if (!chan->_softhangup)
+			if (!ast_check_hangup(chan))
 				chan->hangupcause = peer->hangupcause;
 			ast_hangup(peer);
 		}
@@ -1808,7 +1808,7 @@
 	senddialendevent(chan, pa.status);
 	ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
 	
-	if ((ast_test_flag64(peerflags, OPT_GO_ON)) && (!chan->_softhangup) && (res != AST_PBX_KEEPALIVE)) {
+	if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE)) {
 		if (calldurationlimit)
 			chan->whentohangup = 0;
 		res = 0;

Modified: trunk/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_macro.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/apps/app_macro.c (original)
+++ trunk/apps/app_macro.c Wed Aug  1 10:39:54 2007
@@ -385,7 +385,7 @@
 		}
 
 		/* don't stop executing extensions when we're in "h" */
-		if (chan->_softhangup && !inhangup) {
+		if (ast_check_hangup(chan) && !inhangup) {
 			ast_debug(1, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n", chan->exten, chan->macroexten, chan->priority);
 			goto out;
 		}
@@ -434,7 +434,7 @@
   		/* If we're leaving the macro normally, restore original information */
 		chan->priority = oldpriority;
 		ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
-		if (!(chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO)) {
+		if (!(ast_check_hangup(chan) & AST_SOFTHANGUP_ASYNCGOTO)) {
 			/* Copy the extension, so long as we're not in softhangup, where we could be given an asyncgoto */
 			const char *offsets;
 			ast_copy_string(chan->exten, oldexten, sizeof(chan->exten));

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Wed Aug  1 10:39:54 2007
@@ -718,7 +718,7 @@
 	int len;
 	int res = -1;
 
-	if (!chan->_softhangup)
+	if (!ast_check_hangup(chan))
 		res = ast_autoservice_start(chan);
 
 	AST_LIST_LOCK(&confs);

Modified: trunk/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_osplookup.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Wed Aug  1 10:39:54 2007
@@ -1734,7 +1734,7 @@
 	ast_debug(1, "OSPFinish: connect '%ld'\n", connect);
 	ast_debug(1, "OSPFinish: end '%ld'\n", end);
 
-	release = chan->_softhangup ? 0 : 1;
+	release = ast_check_hangup(chan) ? 0 : 1;
 
 	if (osp_finish(outhandle, recorded, cause, start, connect, end, release) <= 0) {
 		ast_debug(1, "OSPFinish: Unable to report usage for outbound call\n");

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Aug  1 10:39:54 2007
@@ -2651,7 +2651,7 @@
 				}
 			}
 			res2 |= ast_autoservice_stop(qe->chan);
-			if (peer->_softhangup) {
+			if (ast_check_hangup(peer)) {
 				/* Agent must have hung up */
 				ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", peer->name);
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "AGENTDUMP", "%s", "");
@@ -2943,7 +2943,7 @@
 				qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
 				(long) (time(NULL) - callstart));
 			send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
-		} else if (qe->chan->_softhangup) {
+		} else if (ast_check_hangup(qe->chan)) {
 			ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
 				(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
 			send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);

Modified: trunk/apps/app_zapras.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_zapras.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/apps/app_zapras.c (original)
+++ trunk/apps/app_zapras.c Wed Aug  1 10:39:54 2007
@@ -161,7 +161,7 @@
 			res = wait4(pid, &status, WNOHANG, NULL);
 			if (!res) {
 				/* Check for hangup */
-				if (chan->_softhangup && !signalled) {
+				if (ast_check_hangup(chan) && !signalled) {
 					ast_debug(1, "Channel '%s' hungup.  Signalling RAS at %d to die...\n", chan->name, pid);
 					kill(pid, SIGTERM);
 					signalled=1;

Modified: trunk/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_local.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Wed Aug  1 10:39:54 2007
@@ -246,9 +246,9 @@
 		   we can't get everything.  Remember, we'll get another
 		   chance in just a little bit */
 		if (!ast_mutex_trylock(&(p->chan->_bridge)->lock)) {
-			if (!p->chan->_bridge->_softhangup) {
+			if (!ast_check_hangup(p->chan->_bridge)) {
 				if (!ast_mutex_trylock(&p->owner->lock)) {
-					if (!p->owner->_softhangup) {
+					if (!ast_check_hangup(p->owner)) {
 						ast_channel_masquerade(p->owner, p->chan->_bridge);
 						ast_set_flag(p, LOCAL_ALREADY_MASQED);
 					}
@@ -265,9 +265,9 @@
 	} else if (!isoutbound && p->owner && p->owner->_bridge && p->chan && AST_LIST_EMPTY(&p->chan->readq)) {
 		/* Masquerade bridged channel into chan */
 		if (!ast_mutex_trylock(&(p->owner->_bridge)->lock)) {
-			if (!p->owner->_bridge->_softhangup) {
+			if (!ast_check_hangup(p->owner->_bridge)) {
 				if (!ast_mutex_trylock(&p->chan->lock)) {
-					if (!p->chan->_softhangup) {
+					if (!ast_check_hangup(p->chan)) {
 						ast_channel_masquerade(p->chan, p->owner->_bridge);
 						ast_set_flag(p, LOCAL_ALREADY_MASQED);
 					}

Modified: trunk/channels/chan_vpb.cc
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_vpb.cc?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/channels/chan_vpb.cc (original)
+++ trunk/channels/chan_vpb.cc Wed Aug  1 10:39:54 2007
@@ -546,11 +546,11 @@
 				*rc = who;
 				ast_debug(1, "%s: vpb_bridge: Got a [%s]\n",p0->dev, f ? "digit" : "hangup");
 /*
-				if ((c0->tech_pvt == pvt0) && (!c0->_softhangup)) {
+				if ((c0->tech_pvt == pvt0) && (!ast_check_hangup(c0))) {
 					if (pr0->set_rtp_peer(c0, NULL, NULL, 0)) 
 						ast_log(LOG_WARNING, "Channel '%s' failed to revert\n", c0->name);
 				}
-				if ((c1->tech_pvt == pvt1) && (!c1->_softhangup)) {
+				if ((c1->tech_pvt == pvt1) && (!ast_check_hangup(c1))) {
 					if (pr1->set_rtp_peer(c1, NULL, NULL, 0)) 
 						ast_log(LOG_WARNING, "Channel '%s' failed to revert back\n", c1->name);
 				}

Modified: trunk/main/autoservice.c
URL: http://svn.digium.com/view/asterisk/trunk/main/autoservice.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/main/autoservice.c (original)
+++ trunk/main/autoservice.c Wed Aug  1 10:39:54 2007
@@ -71,7 +71,7 @@
 
 		AST_RWLIST_RDLOCK(&aslist);
 		AST_RWLIST_TRAVERSE(&aslist, as, list) {
-			if (!as->chan->_softhangup) {
+			if (!ast_check_hangup(as->chan)) {
 				if (x < MAX_AUTOMONS)
 					mons[x++] = as->chan;
 				else
@@ -137,7 +137,7 @@
 		if (as->chan == chan) {
 			AST_RWLIST_REMOVE_CURRENT(&aslist, list);
 			ast_free(as);
-			if (!chan->_softhangup)
+			if (!ast_check_hangup(chan))
 				res = 0;
 			break;
 		}

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Wed Aug  1 10:39:54 2007
@@ -2418,7 +2418,7 @@
 				/* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */
 				c->whentohangup = 0;
 				c->_softhangup &= ~AST_SOFTHANGUP_TIMEOUT;
-			} else if (c->_softhangup) {
+			} else if (ast_check_hangup(c)) {
 				ast_debug(1, "Extension %s, priority %d returned normally even though call was hung up\n",
 					c->exten, c->priority);
 				error = 1;

Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Wed Aug  1 10:39:54 2007
@@ -3484,7 +3484,7 @@
 	struct timeval start;
 	
 	/* Don't do anthing for a hungup channel */
-	if (chan && chan->_softhangup)
+	if (chan && ast_check_hangup(chan))
 		return 0;
 
 	ttlms = DUNDI_FLUFF_TIME + ttl * DUNDI_TTL_TIME;
@@ -3525,7 +3525,7 @@
 				ast_log(LOG_DEBUG, "Waiting for similar request for '%s@%s' for '%s'\n",
 					dr.number,dr.dcontext,dundi_eid_to_str(eid_str, sizeof(eid_str), &pending->root_eid));
 			start = ast_tvnow();
-			while(check_request(pending) && (ast_tvdiff_ms(ast_tvnow(), start) < ttlms) && (!chan || !chan->_softhangup)) {
+			while(check_request(pending) && (ast_tvdiff_ms(ast_tvnow(), start) < ttlms) && (!chan || !ast_check_hangup(chan))) {
 				/* XXX Would be nice to have a way to poll/select here XXX */
 				/* XXX this is a busy wait loop!!! */
 				usleep(1);
@@ -3558,11 +3558,11 @@
 	discover_transactions(&dr);
 	/* Wait for transaction to come back */
 	start = ast_tvnow();
-	while (!AST_LIST_EMPTY(&dr.trans) && (ast_tvdiff_ms(ast_tvnow(), start) < ttlms) && (!chan || !chan->_softhangup)) {
+	while (!AST_LIST_EMPTY(&dr.trans) && (ast_tvdiff_ms(ast_tvnow(), start) < ttlms) && (!chan || !ast_check_hangup(chan))) {
 		ms = 100;
 		ast_waitfor_n_fd(dr.pfds, 1, &ms, NULL);
 	}
-	if (chan && chan->_softhangup && option_debug)
+	if (chan && ast_check_hangup(chan) && option_debug)
 		ast_log(LOG_DEBUG, "Hrm, '%s' hungup before their query for %s@%s finished\n", chan->name, dr.number, dr.dcontext);
 	cancel_request(&dr);
 	unregister_request(&dr);

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?view=diff&rev=77858&r1=77857&r2=77858
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Wed Aug  1 10:39:54 2007
@@ -854,7 +854,7 @@
 		ast_set_flag(&(bconfig.features_caller), AST_FEATURE_DISCONNECT);
 		ast_set_flag(&(bconfig.features_callee), AST_FEATURE_DISCONNECT);
 		res = ast_bridge_call(transferer, newchan, &bconfig);
-		if (newchan->_softhangup || !transferer->_softhangup) {
+		if (ast_check_hangup(newchan) || !ast_check_hangup(transferer)) {
 			ast_hangup(newchan);
 			if (ast_stream_and_wait(transferer, xfersound, ""))
 				ast_log(LOG_WARNING, "Failed to play transfer sound!\n");
@@ -1450,7 +1450,7 @@
 			x = 0;
 			started = ast_tvnow();
 			to = timeout;
-			while (!((transferee && transferee->_softhangup) && (!igncallerstate && ast_check_hangup(caller))) && timeout && (chan->_state != AST_STATE_UP)) {
+			while (!((transferee && ast_check_hangup(transferee)) && (!igncallerstate && ast_check_hangup(caller))) && timeout && (chan->_state != AST_STATE_UP)) {
 				struct ast_frame *f = NULL;
 
 				monitor_chans[0] = caller;
@@ -1504,7 +1504,7 @@
 					f = ast_read(caller);
 					if (f == NULL) { /*doh! where'd he go?*/
 						if (!igncallerstate) {
-							if (caller->_softhangup && !chan->_softhangup) {
+							if (ast_check_hangup(caller) && !ast_check_hangup(chan)) {
 								/* make this a blind transfer */
 								ready = 1;
 								break;




More information about the asterisk-commits mailing list