[asterisk-commits] rmudgett: branch rmudgett/hangup_handlers r369033 - in /team/rmudgett/hangup_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 15 15:03:17 CDT 2012


Author: rmudgett
Date: Fri Jun 15 15:03:13 2012
New Revision: 369033

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369033
Log:
Move ast_autoservice_chan_hangup_peer to a better home.

Modified:
    team/rmudgett/hangup_handlers/apps/app_dial.c
    team/rmudgett/hangup_handlers/include/asterisk/channel.h
    team/rmudgett/hangup_handlers/main/autoservice.c
    team/rmudgett/hangup_handlers/main/features.c

Modified: team/rmudgett/hangup_handlers/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/hangup_handlers/apps/app_dial.c?view=diff&rev=369033&r1=369032&r2=369033
==============================================================================
--- team/rmudgett/hangup_handlers/apps/app_dial.c (original)
+++ team/rmudgett/hangup_handlers/apps/app_dial.c Fri Jun 15 15:03:13 2012
@@ -1728,28 +1728,6 @@
 	return 0;
 }
 
-/*!
- * \internal
- * \brief Put chan into autoservice while hanging up peer.
- * \since 11.0
- *
- * \param chan Chan to put into autoservice.
- * \param peer Chan to run hangup handlers and hangup.
- *
- * \return Nothing
- */
-static void autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer)
-{
-	if (chan) {
-		ast_autoservice_start(chan);
-	}
-	ast_pbx_hangup_handler_run(peer);
-	ast_hangup(peer);
-	if (chan) {
-		ast_autoservice_stop(chan);
-	}
-}
-
 static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
 	struct ast_flags64 *opts, char **opt_args, struct privacy_args *pa)
 {
@@ -1880,7 +1858,7 @@
 		return 0; /* the good exit path */
 	} else {
 		/* hang up on the callee -- he didn't want to talk anyway! */
-		autoservice_chan_hangup_peer(chan, peer);
+		ast_autoservice_chan_hangup_peer(chan, peer);
 		return -1;
 	}
 }
@@ -2773,7 +2751,7 @@
 				if (active_chan) {
 					struct ast_frame *fr = ast_read(active_chan);
 					if (!fr) {
-						autoservice_chan_hangup_peer(chan, peer);
+						ast_autoservice_chan_hangup_peer(chan, peer);
 						res = -1;
 						goto done;
 					}
@@ -2789,7 +2767,7 @@
 							switch (fr->subclass.integer) {
 								case AST_CONTROL_HANGUP:
 									ast_frfree(fr);
-									autoservice_chan_hangup_peer(chan, peer);
+									ast_autoservice_chan_hangup_peer(chan, peer);
 									res = -1;
 									goto done;
 								default:
@@ -2820,7 +2798,7 @@
 			ast_channel_exten_set(peer, ast_channel_exten(chan));
 			ast_channel_priority_set(peer, ast_channel_priority(chan) + 2);
 			if (ast_pbx_start(peer)) {
-				autoservice_chan_hangup_peer(chan, peer);
+				ast_autoservice_chan_hangup_peer(chan, peer);
 			}
 			hanguptree(&out_chans, NULL, ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE) ? 1 : 0);
 			if (continue_exec)
@@ -3026,7 +3004,7 @@
 			res = ast_channel_make_compatible(chan, peer);
 			if (res < 0) {
 				ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(chan), ast_channel_name(peer));
-				autoservice_chan_hangup_peer(chan, peer);
+				ast_autoservice_chan_hangup_peer(chan, peer);
 				res = -1;
 				goto done;
 			}
@@ -3069,7 +3047,7 @@
 				ast_channel_hangupcause_set(chan, ast_channel_hangupcause(peer));
 			}
 		}
-		autoservice_chan_hangup_peer(chan, peer);
+		ast_autoservice_chan_hangup_peer(chan, peer);
 	}
 out:
 	if (moh) {

Modified: team/rmudgett/hangup_handlers/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/hangup_handlers/include/asterisk/channel.h?view=diff&rev=369033&r1=369032&r2=369033
==============================================================================
--- team/rmudgett/hangup_handlers/include/asterisk/channel.h (original)
+++ team/rmudgett/hangup_handlers/include/asterisk/channel.h Fri Jun 15 15:03:13 2012
@@ -2205,6 +2205,17 @@
  * \retval -1 error, or the channel has been hungup
  */
 int ast_autoservice_stop(struct ast_channel *chan);
+
+/*!
+ * \brief Put chan into autoservice while hanging up peer.
+ * \since 11.0
+ *
+ * \param chan Chan to put into autoservice.
+ * \param peer Chan to run hangup handlers and hangup.
+ *
+ * \return Nothing
+ */
+void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer);
 
 /*!
  * \brief Ignore certain frame types

Modified: team/rmudgett/hangup_handlers/main/autoservice.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/hangup_handlers/main/autoservice.c?view=diff&rev=369033&r1=369032&r2=369033
==============================================================================
--- team/rmudgett/hangup_handlers/main/autoservice.c (original)
+++ team/rmudgett/hangup_handlers/main/autoservice.c Fri Jun 15 15:03:13 2012
@@ -303,6 +303,18 @@
 	return res;
 }
 
+void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer)
+{
+	if (chan) {
+		ast_autoservice_start(chan);
+	}
+	ast_pbx_hangup_handler_run(peer);
+	ast_hangup(peer);
+	if (chan) {
+		ast_autoservice_stop(chan);
+	}
+}
+
 int ast_autoservice_ignore(struct ast_channel *chan, enum ast_frame_type ftype)
 {
 	struct asent *as;

Modified: team/rmudgett/hangup_handlers/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/hangup_handlers/main/features.c?view=diff&rev=369033&r1=369032&r2=369033
==============================================================================
--- team/rmudgett/hangup_handlers/main/features.c (original)
+++ team/rmudgett/hangup_handlers/main/features.c Fri Jun 15 15:03:13 2012
@@ -4634,6 +4634,7 @@
 		save_prio = ast_channel_priority(chan);
 		ast_channel_unlock(chan);
 
+		ast_autoservice_start(peer);
 		if (ast_exists_extension(chan, ast_channel_context(chan), "h", 1,
 			S_COR(ast_channel_caller(chan)->id.number.valid,
 				ast_channel_caller(chan)->id.number.str, NULL))) {
@@ -4650,6 +4651,7 @@
 			/* Indicate hangup handlers were run. */
 			hangup_run = 1;
 		}
+		ast_autoservice_stop(peer);
 
 		ast_channel_lock(chan);
 




More information about the asterisk-commits mailing list