[asterisk-commits] russell: branch russell/chan_refcount r82306 - /team/russell/chan_refcount/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 12 18:25:12 CDT 2007


Author: russell
Date: Wed Sep 12 18:25:12 2007
New Revision: 82306

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82306
Log:
add changes to move res_agi to the new functions

Modified:
    team/russell/chan_refcount/res/res_agi.c

Modified: team/russell/chan_refcount/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/res/res_agi.c?view=diff&rev=82306&r1=82305&r2=82306
==============================================================================
--- team/russell/chan_refcount/res/res_agi.c (original)
+++ team/russell/chan_refcount/res/res_agi.c Wed Sep 12 18:25:12 2007
@@ -1075,12 +1075,12 @@
 		return RESULT_SUCCESS;
 	} else if (argc == 2) {
 		/* one argument: look for info on the specified channel */
-		c = ast_get_channel_by_name_locked(argv[1]);
+		c = ast_channel_get_by_name(argv[1]);
 		if (c) {
 			/* we have a matching channel */
-			ast_softhangup(c,AST_SOFTHANGUP_EXPLICIT);
+			ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
 			ast_agi_fdprintf(agi->fd, "200 result=1\n");
-			ast_channel_unlock(c);
+			ast_channel_unref(c);
 			return RESULT_SUCCESS;
 		}
 		/* if we get this far no channel name matched the argument given */
@@ -1143,10 +1143,10 @@
 		return RESULT_SUCCESS;
 	} else if (argc == 3) {
 		/* one argument: look for info on the specified channel */
-		c = ast_get_channel_by_name_locked(argv[2]);
+		c = ast_channel_get_by_name(argv[2]);
 		if (c) {
 			ast_agi_fdprintf(agi->fd, "200 result=%d\n", c->_state);
-			ast_channel_unlock(c);
+			ast_channel_unref(c);
 			return RESULT_SUCCESS;
 		}
 		/* if we get this far no channel name matched the argument given */
@@ -1197,18 +1197,22 @@
 	if ((argc != 4) && (argc != 5))
 		return RESULT_SHOWUSAGE;
 	if (argc == 5) {
-		chan2 = ast_get_channel_by_name_locked(argv[4]);
+		chan2 = ast_channel_get_by_name(argv[4]);
 	} else {
 		chan2 = chan;
 	}
 	if (chan2) {
+		ast_channel_lock(chan2);
 		pbx_substitute_variables_helper(chan2, argv[3], tmp, sizeof(tmp) - 1);
+		ast_channel_unlock(chan2);
 		ast_agi_fdprintf(agi->fd, "200 result=1 (%s)\n", tmp);
 	} else {
 		ast_agi_fdprintf(agi->fd, "200 result=0\n");
 	}
+
 	if (chan2 && (chan2 != chan))
-		ast_channel_unlock(chan2);
+		ast_channel_unref(chan2);
+
 	return RESULT_SUCCESS;
 }
 




More information about the asterisk-commits mailing list