summaryrefslogtreecommitdiff
path: root/main/manager_channels.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2016-05-09 15:00:56 -0500
committerMark Michelson <mmichelson@digium.com>2016-05-31 11:43:24 -0500
commit205a31f86c4ceec4966492363fb9ac674c990235 (patch)
tree425d8f23f52900292cd7aad1e1f7f75bdd5a55d3 /main/manager_channels.c
parent88d997913faabe81f8b9e7bdaa56742be0d669b9 (diff)
Expand the scope of Dial Events
Dial events up to this point have come in two flavors * A Dial event with no status to indicate that dialing has begun * A Dial event with a status to indicate that dialing has ended With this change, Dial events have been expanded to also give intermediate events, such as "RINGING", "PROCEEDING", and "PROGRESS". This is especially useful for ARI dialing, as it gives the application writer the opportunity to place a channel into an early bridge when early media is detected. AMI handles these in-progress dial events by sending a new event called "DialState" that simply indicates that dial state has changed but has not ended. ARI never distinguished between DialBegin and DialEnd, so no change was made to the event itself. Another change here relates to dial forwards. A forward-related event was previously only sent when a channel was successfully able to forward a call to a new channel. With this set of changes, if forwarding is blocked, we send a Dial event with a forwarding destination but no forwarding channel, since we were prevented from creating one. This is again useful for ARI since application writers can now handle call forward attempts from within their own application. ASTERISK-25925 #close Reported by Mark Michelson Change-Id: I42cbec7730d84640a434d143a0d172a740995543
Diffstat (limited to 'main/manager_channels.c')
-rw-r--r--main/manager_channels.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/main/manager_channels.c b/main/manager_channels.c
index c395708cc..ec1f807dc 100644
--- a/main/manager_channels.c
+++ b/main/manager_channels.c
@@ -142,6 +142,33 @@ ASTERISK_REGISTER_FILE()
</see-also>
</managerEventInstance>
</managerEvent>
+ <managerEvent language="en_US" name="DialState">
+ <managerEventInstance class="EVENT_FLAG_CALL">
+ <synopsis>Raised when dial status has changed.</synopsis>
+ <syntax>
+ <channel_snapshot/>
+ <channel_snapshot prefix="Dest"/>
+ <parameter name="DialStatus">
+ <para> The new state of the outbound dial attempt.</para>
+ <enumlist>
+ <enum name="RINGING">
+ <para>The outbound channel is ringing.</para>
+ </enum>
+ <enum name="PROCEEDING">
+ <para>The call to the outbound channel is proceeding.</para>
+ </enum>
+ <enum name="PROGRESS">
+ <para>Progress has been received on the outbound channel.</para>
+ </enum>
+ </enumlist>
+ </parameter>
+ <parameter name="Forward" required="false">
+ <para>If the call was forwarded, where the call was
+ forwarded to.</para>
+ </parameter>
+ </syntax>
+ </managerEventInstance>
+ </managerEvent>
<managerEvent language="en_US" name="DialEnd">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised when a dial action has completed.</synopsis>
@@ -1034,6 +1061,13 @@ static void channel_monitor_stop_cb(void *data, struct stasis_subscription *sub,
publish_basic_channel_event("MonitorStop", EVENT_FLAG_CALL, payload->snapshot);
}
+static int dial_status_end(const char *dialstatus)
+{
+ return (strcmp(dialstatus, "RINGING") &&
+ strcmp(dialstatus, "PROCEEDING") &&
+ strcmp(dialstatus, "PROGRESS"));
+}
+
/*!
* \brief Callback processing messages for channel dialing
*/
@@ -1077,7 +1111,7 @@ static void channel_dial_cb(void *data, struct stasis_subscription *sub,
} else {
int forwarded = !ast_strlen_zero(forward);
- manager_event(EVENT_FLAG_CALL, "DialEnd",
+ manager_event(EVENT_FLAG_CALL, dial_status_end(dialstatus) ? "DialEnd" : "DialState",
"%s"
"%s"
"%s%s%s"