From 53a5f2284963bd60a912f332d379c6c7fc3e06f3 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 29 Nov 2007 00:28:10 +0000 Subject: 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: https://origsvn.digium.com/svn/asterisk/trunk@90146 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/channel.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main') diff --git a/main/channel.c b/main/channel.c index 0dd937c1e..219485939 100644 --- a/main/channel.c +++ b/main/channel.c @@ -3758,6 +3758,8 @@ int ast_do_masquerade(struct ast_channel *original) void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani) { + ast_channel_lock(chan); + if (cid_num) { if (chan->cid.cid_num) ast_free(chan->cid.cid_num); @@ -3788,6 +3790,8 @@ void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char chan->cid.cid_pres, ast_describe_caller_presentation(chan->cid.cid_pres) ); + + ast_channel_unlock(chan); } int ast_setstate(struct ast_channel *chan, enum ast_channel_state state) -- cgit v1.2.3