diff options
author | Richard Mudgett <rmudgett@digium.com> | 2012-05-10 21:29:41 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2012-05-10 21:29:41 +0000 |
commit | 4ea636c7768bca2e2decb96f1b08bfdd9f32bca9 (patch) | |
tree | 3abc3aa14879d0e0f6d80218499a4f6b86f4d5ff /main/channel.c | |
parent | dd81b047dbf15a501b81354db505daf50703a1a0 (diff) |
Run predial routine on local;2 channel where you would expect.
Before this patch, the predial routine executes on the ;1 channel of a
local channel pair. Executing predial on the ;1 channel of a local
channel pair is of limited utility. Any channel variables set by the
predial routine executing on the ;1 channel will not be available when the
local channel executes dialplan on the ;2 channel.
* Create ast_pre_call() and an associated pre_call() technology callback
to handle running the predial routine. If a channel technology does not
provide the callback, the predial routine is simply run on the channel.
Review: https://reviewboard.asterisk.org/r/1903/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c index 3d8e22302..c00ffb536 100644 --- a/main/channel.c +++ b/main/channel.c @@ -5671,6 +5671,23 @@ struct ast_channel *ast_request(const char *type, struct ast_format_cap *request return NULL; } +int ast_pre_call(struct ast_channel *chan, const char *sub_args) +{ + int (*pre_call)(struct ast_channel *chan, const char *sub_args); + + ast_channel_lock(chan); + pre_call = ast_channel_tech(chan)->pre_call; + if (pre_call) { + int res; + + res = pre_call(chan, sub_args); + ast_channel_unlock(chan); + return res; + } + ast_channel_unlock(chan); + return ast_app_exec_sub(NULL, chan, sub_args); +} + int ast_call(struct ast_channel *chan, const char *addr, int timeout) { /* Place an outgoing call, but don't wait any longer than timeout ms before returning. |