diff options
author | Joshua Colp <jcolp@digium.com> | 2013-11-01 12:33:09 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2013-11-01 12:33:09 +0000 |
commit | 4053f36a71fcb0d8354a9023c9514d51c0011892 (patch) | |
tree | 94cf956eeb286f6e378328b15f8ef12daa7310bd /res/ari | |
parent | d17a780333fc007fdfcd75282a9c4ee032894f2c (diff) |
res_ari_channels: Fix a deadlock when originating multiple channels close to eachother.
If a Stasis application is specified an implicit subscription is done on the originated
channel. This was previously done with the channel lock held which is dangerous as the
underlying code locks the container and iterates items. This change releases the lock
on the originated channel before subscribing occurs.
(closes issue ASTERISK-22768)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2979/
........
Merged revisions 402346 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402347 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari')
-rw-r--r-- | res/ari/resource_channels.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c index a00b29532..10d190534 100644 --- a/res/ari/resource_channels.c +++ b/res/ari/resource_channels.c @@ -642,6 +642,9 @@ void ast_ari_originate(struct ast_variable *headers, return; } + snapshot = ast_channel_snapshot_create(chan); + ast_channel_unlock(chan); + if (!ast_strlen_zero(args->app)) { /* channel: + channel ID + null terminator */ char uri[9 + strlen(ast_channel_uniqueid(chan))]; @@ -651,10 +654,7 @@ void ast_ari_originate(struct ast_variable *headers, stasis_app_subscribe(args->app, uris, 1, NULL); } - snapshot = ast_channel_snapshot_create(chan); ast_ari_response_ok(response, ast_channel_snapshot_to_json(snapshot)); - - ast_channel_unlock(chan); ast_channel_unref(chan); } |