[asterisk-commits] russell: branch russell/chan_refcount r82360 - /team/russell/chan_refcount/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 13 18:30:10 CDT 2007
Author: russell
Date: Thu Sep 13 18:30:10 2007
New Revision: 82360
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82360
Log:
convert a few more places that look up a channel
Modified:
team/russell/chan_refcount/main/manager.c
team/russell/chan_refcount/main/pbx.c
Modified: team/russell/chan_refcount/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/manager.c?view=diff&rev=82360&r1=82359&r2=82360
==============================================================================
--- team/russell/chan_refcount/main/manager.c (original)
+++ team/russell/chan_refcount/main/manager.c Thu Sep 13 18:30:10 2007
@@ -1530,20 +1530,25 @@
static int action_hangup(struct mansession *s, const struct message *m)
{
- struct ast_channel *c = NULL;
+ struct ast_channel *chan = NULL;
const char *name = astman_get_header(m, "Channel");
+
if (ast_strlen_zero(name)) {
astman_send_error(s, m, "No channel specified");
return 0;
}
- c = ast_get_channel_by_name_locked(name);
- if (!c) {
+
+ if (!(chan = ast_channel_get_by_name(name))) {
astman_send_error(s, m, "No such channel");
return 0;
}
- ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
- ast_channel_unlock(c);
+
+ ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT);
+
+ ast_channel_unref(chan);
+
astman_send_ack(s, m, "Channel Hungup");
+
return 0;
}
Modified: team/russell/chan_refcount/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/pbx.c?view=diff&rev=82360&r1=82359&r2=82360
==============================================================================
--- team/russell/chan_refcount/main/pbx.c (original)
+++ team/russell/chan_refcount/main/pbx.c Thu Sep 13 18:30:10 2007
@@ -4631,11 +4631,11 @@
struct ast_channel *chan;
int res = -1;
- chan = ast_get_channel_by_name_locked(channame);
- if (chan) {
+ if ((chan = ast_channel_get_by_name(channame))) {
res = ast_async_goto(chan, context, exten, priority);
- ast_channel_unlock(chan);
- }
+ ast_channel_unref(chan);
+ }
+
return res;
}
@@ -5901,14 +5901,16 @@
name = strsep(&value,"=");
channel = strsep(&value,",");
if (channel && value && name) { /*! \todo XXX should do !ast_strlen_zero(..) of the args ? */
- struct ast_channel *chan2 = ast_get_channel_by_name_locked(channel);
+ struct ast_channel *chan2 = ast_channel_get_by_name(channel);
if (chan2) {
char *s = alloca(strlen(value) + 4);
if (s) {
sprintf(s, "${%s}", value);
+ ast_channel_lock(chan2);
pbx_substitute_variables_helper(chan2, s, tmp, sizeof(tmp) - 1);
+ ast_channel_unlock(chan2);
}
- ast_channel_unlock(chan2);
+ ast_channel_unref(chan2);
}
pbx_builtin_setvar_helper(chan, name, tmp);
}
More information about the asterisk-commits
mailing list