[asterisk-commits] dvossel: trunk r187556 - /trunk/apps/app_dial.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 9 15:40:37 CDT 2009
Author: dvossel
Date: Thu Apr 9 15:40:34 2009
New Revision: 187556
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=187556
Log:
More changes concerning r187426. Revised where locks are placed.
Modified:
trunk/apps/app_dial.c
Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_dial.c?view=diff&rev=187556&r1=187555&r2=187556
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Thu Apr 9 15:40:34 2009
@@ -668,8 +668,13 @@
/* do not call with chan lock held */
static const char *get_cid_name(char *name, int namelen, struct ast_channel *chan)
{
- const char *context = ast_strdupa(S_OR(chan->macrocontext, chan->context));
- const char *exten = ast_strdupa(S_OR(chan->macroexten, chan->exten));
+ const char *context;
+ const char *exten;
+
+ ast_channel_lock(chan);
+ context = ast_strdupa(S_OR(chan->macrocontext, chan->context));
+ exten = ast_strdupa(S_OR(chan->macroexten, chan->exten));
+ ast_channel_unlock(chan);
return ast_get_hint(NULL, 0, name, namelen, chan, context, exten) ? name : "";
}
@@ -781,13 +786,13 @@
ast_party_connected_line_copy(&c->connected, apc);
S_REPLACE(in->cid.cid_rdnis, ast_strdup(c->cid.cid_rdnis));
- ast_channel_unlock(in);
- ast_channel_unlock(c);
ast_channel_update_redirecting(in, apr);
ast_clear_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE);
if (ast_call(c, tmpchan, 0)) {
+ ast_channel_unlock(in);
+ ast_channel_unlock(c);
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
ast_clear_flag64(o, DIAL_STILLGOING);
ast_hangup(original);
@@ -798,7 +803,14 @@
senddialevent(in, c, stuff);
if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
char cidname[AST_MAX_EXTENSION] = "";
- ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
+ const char *tmpexten;
+ tmpexten = ast_strdupa(S_OR(in->macroexten, in->exten));
+ ast_channel_unlock(in);
+ ast_channel_unlock(c);
+ ast_set_callerid(c, tmpexten, get_cid_name(cidname, sizeof(cidname), in), NULL);
+ } else {
+ ast_channel_unlock(in);
+ ast_channel_unlock(c);
}
/* Hangup the original channel now, in case we needed it */
ast_hangup(original);
@@ -1923,11 +1935,11 @@
const char *tmpexten = ast_strdupa(S_OR(chan->macroexten, chan->exten));
senddialevent(chan, tc, numsubst);
ast_verb(3, "Called %s\n", numsubst);
- ast_channel_unlock(chan); /* unlock chan here. should not call get_cid_name with chan locked */
+ ast_channel_unlock(chan);
+ ast_channel_unlock(tc);
if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
ast_set_callerid(tc, tmpexten, get_cid_name(cidname, sizeof(cidname), chan), NULL);
}
- ast_channel_unlock(tc);
}
/* Put them in the list of outgoing thingies... We're ready now.
XXX If we're forcibly removed, these outgoing calls won't get
More information about the asterisk-commits
mailing list