summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2014-09-05 20:11:35 +0000
committerJonathan Rose <jrose@digium.com>2014-09-05 20:11:35 +0000
commitc56aa2d8f6a04dafb82cf35e69f0ea932dc864fd (patch)
tree7d0a54604f33ed35c9c985aed304a009ee273ce1
parent43a35c24079fee2c4f356016821013ce47670610 (diff)
Dial API: Add a dial option to indicate the dialed channel will replace dialer
Adds an option to the dial API that marks an outgoing dial as replacing the dialing channel for the purpose of propagating accountcode. When it is used, AST_CHANNEL_REQUESTOR_REPLACEMENT is used instead of AST_CHANNEL_REQUESTOR_BRIDGE_PEER when setting accountcodes on the involved channels with ast_channel_req_accountcodes. Review: https://reviewboard.asterisk.org/r/3968/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@422684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--include/asterisk/dial.h1
-rw-r--r--main/dial.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/include/asterisk/dial.h b/include/asterisk/dial.h
index b61116f8e..ab9219811 100644
--- a/include/asterisk/dial.h
+++ b/include/asterisk/dial.h
@@ -45,6 +45,7 @@ enum ast_dial_option {
AST_DIAL_OPTION_MUSIC, /*!< Play music on hold instead of ringing to the calling channel */
AST_DIAL_OPTION_DISABLE_CALL_FORWARDING, /*!< Disable call forwarding on channels */
AST_DIAL_OPTION_PREDIAL, /*!< Execute a predial subroutine before dialing */
+ AST_DIAL_OPTION_DIAL_REPLACES_SELF, /*!< The dial operation is a replacement for the requester */
AST_DIAL_OPTION_MAX, /*!< End terminator -- must always remain last */
};
diff --git a/main/dial.c b/main/dial.c
index 04249fd71..a27ac5b59 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -205,6 +205,7 @@ static const struct ast_option_types option_types[] = {
{ AST_DIAL_OPTION_MUSIC, music_enable, music_disable }, /*!< Play music to the caller instead of ringing */
{ AST_DIAL_OPTION_DISABLE_CALL_FORWARDING, NULL, NULL }, /*!< Disable call forwarding on channels */
{ AST_DIAL_OPTION_PREDIAL, predial_enable, predial_disable }, /*!< Execute a subroutine on the outbound channels prior to dialing */
+ { AST_DIAL_OPTION_DIAL_REPLACES_SELF, NULL, NULL }, /*!< The dial operation is a replacement for the requester */
{ AST_DIAL_OPTION_MAX, NULL, NULL }, /*!< Terminator of list */
};
@@ -344,7 +345,11 @@ static int begin_dial_prerun(struct ast_dial_channel *channel, struct ast_channe
ast_connected_line_copy_from_caller(ast_channel_connected(channel->owner), ast_channel_caller(chan));
ast_channel_language_set(channel->owner, ast_channel_language(chan));
- ast_channel_req_accountcodes(channel->owner, chan, AST_CHANNEL_REQUESTOR_BRIDGE_PEER);
+ if (channel->options[AST_DIAL_OPTION_DIAL_REPLACES_SELF]) {
+ ast_channel_req_accountcodes(channel->owner, chan, AST_CHANNEL_REQUESTOR_REPLACEMENT);
+ } else {
+ ast_channel_req_accountcodes(channel->owner, chan, AST_CHANNEL_REQUESTOR_BRIDGE_PEER);
+ }
if (ast_strlen_zero(ast_channel_musicclass(channel->owner)))
ast_channel_musicclass_set(channel->owner, ast_channel_musicclass(chan));