diff options
author | Jonathan Rose <jrose@digium.com> | 2013-06-26 20:59:14 +0000 |
---|---|---|
committer | Jonathan Rose <jrose@digium.com> | 2013-06-26 20:59:14 +0000 |
commit | d014ad2261b1a4ffb590edcd7b7b4d6c31a74457 (patch) | |
tree | 05b525a5d1e609e1e30ebc1d9082fd8aebab1c64 /main | |
parent | 609c42c854c8880548571241b893604c02d513d4 (diff) |
func_channel: Read/Write after_bridge_goto option
Allows reading and setting of a channel's after_bridge_goto datastore
(closes issue ASTERISK-21875)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2628/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393005 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/bridging.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/main/bridging.c b/main/bridging.c index a4a1339a3..feefcbee4 100644 --- a/main/bridging.c +++ b/main/bridging.c @@ -3414,6 +3414,47 @@ void ast_after_bridge_goto_discard(struct ast_channel *chan) } } +void ast_after_bridge_goto_read(struct ast_channel *chan, char *buffer, size_t buf_size) +{ + struct ast_datastore *datastore; + struct after_bridge_goto_ds *after_bridge; + char *current_pos = buffer; + size_t remaining_size = buf_size; + + SCOPED_CHANNELLOCK(lock, chan); + + datastore = ast_channel_datastore_find(chan, &after_bridge_goto_info, NULL); + if (!datastore) { + buffer[0] = '\0'; + return; + } + + after_bridge = datastore->data; + + if (after_bridge->parseable_goto) { + snprintf(buffer, buf_size, "%s", after_bridge->parseable_goto); + return; + } + + if (!ast_strlen_zero(after_bridge->context)) { + snprintf(current_pos, remaining_size, "%s,", after_bridge->context); + remaining_size = remaining_size - strlen(current_pos); + current_pos += strlen(current_pos); + } + + if (after_bridge->run_h_exten) { + snprintf(current_pos, remaining_size, "h,"); + remaining_size = remaining_size - strlen(current_pos); + current_pos += strlen(current_pos); + } else if (!ast_strlen_zero(after_bridge->exten)) { + snprintf(current_pos, remaining_size, "%s,", after_bridge->exten); + remaining_size = remaining_size - strlen(current_pos); + current_pos += strlen(current_pos); + } + + snprintf(current_pos, remaining_size, "%d", after_bridge->priority); +} + int ast_after_bridge_goto_setup(struct ast_channel *chan) { struct ast_datastore *datastore; @@ -3479,6 +3520,10 @@ int ast_after_bridge_goto_setup(struct ast_channel *chan) after_bridge->exten, after_bridge->priority + 1); } if (!goto_failed) { + if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) { + ast_channel_priority_set(chan, ast_channel_priority(chan) + 1); + } + ast_debug(1, "Setup after bridge goto location to %s,%s,%d.\n", ast_channel_context(chan), ast_channel_exten(chan), |