diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-29 00:28:10 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-29 00:28:10 +0000 |
commit | 4efbdfc704f10aac8f3a9284ae8e69dddd1ea3b5 (patch) | |
tree | 210d7ee2d2606a92c83abe9cbc972f9cb8ec96e1 /funcs/func_callerid.c | |
parent | 633b7b4f97532d6bcfe9c26a3bb3183118ce7a6e (diff) |
Merged revisions 90145 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r90145 | russell | 2007-11-28 18:20:34 -0600 (Wed, 28 Nov 2007) | 5 lines
This set of changes is to make some callerID handling thread-safe.
The ast_set_callerid() function needed to lock the channel. Also, the handlers
for the CALLERID() dialplan function needed to lock the channel when reading
or writing callerid values directly on the channel structure.
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@90146 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_callerid.c')
-rw-r--r-- | funcs/func_callerid.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c index e53097f3b..9dfe0d8c7 100644 --- a/funcs/func_callerid.c +++ b/funcs/func_callerid.c @@ -72,6 +72,8 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data); } } else { + ast_channel_lock(chan); + if (!strncasecmp("all", data, 3)) { snprintf(buf, len, "\"%s\" <%s>", S_OR(chan->cid.cid_name, ""), @@ -105,6 +107,8 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, } else { ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data); } + + ast_channel_unlock(chan); } return 0; @@ -133,15 +137,17 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, } else ast_set_callerid(chan, NULL, NULL, value); } else if (!strncasecmp("dnid", data, 4)) { - /* do we need to lock chan here? */ + ast_channel_lock(chan); if (chan->cid.cid_dnid) ast_free(chan->cid.cid_dnid); chan->cid.cid_dnid = ast_strdup(value); + ast_channel_unlock(chan); } else if (!strncasecmp("rdnis", data, 5)) { - /* do we need to lock chan here? */ + ast_channel_lock(chan); if (chan->cid.cid_rdnis) ast_free(chan->cid.cid_rdnis); chan->cid.cid_rdnis = ast_strdup(value); + ast_channel_unlock(chan); } else if (!strncasecmp("pres", data, 4)) { int i; char *s, *val; |