summaryrefslogtreecommitdiff
path: root/main/manager_channels.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-08-11 18:32:37 +0000
committerMark Michelson <mmichelson@digium.com>2014-08-11 18:32:37 +0000
commitef70c08dc7e074bee599c01a6850499ce8889ed6 (patch)
tree69db30c50c43cf49ffa3eccbcfa00cd868a678e8 /main/manager_channels.c
parent1b500d2fa1eb4b158a663e2f20bf2ffa3523a707 (diff)
Improve call forwarding reporting, especially with regards to ARI.
This patch addresses a few issues: 1) The order of Dial events have been changed when performing a call forward. The order has now been altered to 1) Dial begins dialing channel A. 2) When A forwards the call to B, we issue the dial end event to channel A, indicating the dial is being canceled due to a forward to B. 3) When the call to channel B occurs, we then issue a new dial begin to channel B. 2) Call forwards are now reported on the calling channel, not the peer channel. 3) AMI DialEnd events have been altered to display the extension the call is being forwarded to when relevant. 4) You can now get the values of channel variables for channels that are not currently in the Stasis application. This brings the retrieval of channel variables more in line with the rest of channel read operations since they may be performed on channels not in Stasis. ASTERISK-24134 #close Reported by Matt Jordan ASTERISK-24138 #close Reported by Matt Jordan Patches: forward-shenanigans.diff uploaded by Matt Jordan (License #6283) Review: https://reviewboard.asterisk.org/r/3899 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@420794 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/manager_channels.c')
-rw-r--r--main/manager_channels.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/manager_channels.c b/main/manager_channels.c
index 9a15353f2..127084161 100644
--- a/main/manager_channels.c
+++ b/main/manager_channels.c
@@ -185,6 +185,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
</enum>
</enumlist>
</parameter>
+ <parameter name="Forward" required="false">
+ <para>If the call was forwarded, where the call was
+ forwarded to.</para>
+ </parameter>
</syntax>
<see-also>
<ref type="application">Dial</ref>
@@ -986,6 +990,7 @@ static void channel_dial_cb(void *data, struct stasis_subscription *sub,
struct ast_multi_channel_blob *obj = stasis_message_data(message);
const char *dialstatus;
const char *dialstring;
+ const char *forward;
struct ast_channel_snapshot *caller;
struct ast_channel_snapshot *peer;
RAII_VAR(struct ast_str *, caller_event_string, NULL, ast_free);
@@ -1007,6 +1012,7 @@ static void channel_dial_cb(void *data, struct stasis_subscription *sub,
dialstatus = ast_json_string_get(ast_json_object_get(ast_multi_channel_blob_get_json(obj), "dialstatus"));
dialstring = ast_json_string_get(ast_json_object_get(ast_multi_channel_blob_get_json(obj), "dialstring"));
+ forward = ast_json_string_get(ast_json_object_get(ast_multi_channel_blob_get_json(obj), "forward"));
if (ast_strlen_zero(dialstatus)) {
manager_event(EVENT_FLAG_CALL, "DialBegin",
"%s"
@@ -1016,12 +1022,16 @@ static void channel_dial_cb(void *data, struct stasis_subscription *sub,
ast_str_buffer(peer_event_string),
S_OR(dialstring, "unknown"));
} else {
+ int forwarded = !ast_strlen_zero(forward);
+
manager_event(EVENT_FLAG_CALL, "DialEnd",
"%s"
"%s"
+ "%s%s%s"
"DialStatus: %s\r\n",
caller_event_string ? ast_str_buffer(caller_event_string) : "",
ast_str_buffer(peer_event_string),
+ forwarded ? "Forward: " : "", S_OR(forward, ""), forwarded ? "\r\n" : "",
S_OR(dialstatus, "unknown"));
}