manager_channels: Fix throwing of HangupHandler manager events
[asterisk/asterisk.git] / main / manager_channels.c
index f6dc46c..646bbd7 100644 (file)
@@ -28,8 +28,6 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
 #include "asterisk/callerid.h"
 #include "asterisk/channel.h"
 #include "asterisk/manager.h"
@@ -44,6 +42,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <syntax>
                                <channel_snapshot/>
                        </syntax>
+                       <see-also>
+                               <ref type="managerEvent">Newstate</ref>
+                               <ref type="managerEvent">Hangup</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="Newstate">
@@ -52,6 +54,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <syntax>
                                <channel_snapshot/>
                        </syntax>
+                       <see-also>
+                               <ref type="managerEvent">Newchannel</ref>
+                               <ref type="managerEvent">Hangup</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="Hangup">
@@ -66,6 +72,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                        <para>A description of why the channel was hung up.</para>
                                </parameter>
                        </syntax>
+                       <see-also>
+                               <ref type="managerEvent">Newchannel</ref>
+                               <ref type="managerEvent">SoftHangupRequest</ref>
+                               <ref type="managerEvent">HangupRequest</ref>
+                               <ref type="managerEvent">Newstate</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="HangupRequest">
@@ -75,6 +87,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                <channel_snapshot/>
                                <xi:include xpointer="xpointer(/docs/managerEvent[@name='Hangup']/managerEventInstance/syntax/parameter[@name='Cause'])" />
                        </syntax>
+                       <see-also>
+                               <ref type="managerEvent">SoftHangupRequest</ref>
+                               <ref type="managerEvent">Hangup</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="SoftHangupRequest">
@@ -84,6 +100,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                <channel_snapshot/>
                                <xi:include xpointer="xpointer(/docs/managerEvent[@name='Hangup']/managerEventInstance/syntax/parameter[@name='Cause'])" />
                        </syntax>
+                       <see-also>
+                               <ref type="managerEvent">HangupRequest</ref>
+                               <ref type="managerEvent">Hangup</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="NewExten">
@@ -114,6 +134,20 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                        <para>A description of the Caller ID presentation.</para>
                                </parameter>
                        </syntax>
+                       <see-also>
+                               <ref type="function">CALLERID</ref>
+                       </see-also>
+               </managerEventInstance>
+       </managerEvent>
+       <managerEvent language="en_US" name="NewConnectedLine">
+               <managerEventInstance class="EVENT_FLAG_CALL">
+                       <synopsis>Raised when a channel's connected line information is changed.</synopsis>
+                       <syntax>
+                               <channel_snapshot/>
+                       </syntax>
+                       <see-also>
+                               <ref type="function">CONNECTEDLINE</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="NewAccountCode">
@@ -125,6 +159,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                        <para>The channel's previous account code</para>
                                </parameter>
                        </syntax>
+                       <see-also>
+                               <ref type="function">CHANNEL</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="DialBegin">
@@ -139,9 +176,39 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        </syntax>
                        <see-also>
                                <ref type="application">Dial</ref>
+                               <ref type="application">Originate</ref>
+                               <ref type="manager">Originate</ref>
+                               <ref type="managerEvent">DialEnd</ref>
                        </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>
@@ -192,6 +259,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        </syntax>
                        <see-also>
                                <ref type="application">Dial</ref>
+                               <ref type="application">Originate</ref>
+                               <ref type="manager">Originate</ref>
+                               <ref type="managerEvent">DialBegin</ref>
                        </see-also>
                </managerEventInstance>
        </managerEvent>
@@ -204,6 +274,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                        <para>The suggested MusicClass, if provided.</para>
                                </parameter>
                        </syntax>
+                       <see-also>
+                               <ref type="managerEvent">Unhold</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="Unhold">
@@ -212,6 +285,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <syntax>
                                <channel_snapshot/>
                        </syntax>
+                       <see-also>
+                               <ref type="managerEvent">Hold</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="ChanSpyStart">
@@ -222,7 +298,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                <channel_snapshot prefix="Spyee"/>
                        </syntax>
                        <see-also>
-                               <ref type="application">ChanSpyStop</ref>
+                               <ref type="managerEvent">ChanSpyStop</ref>
+                               <ref type="application">ChanSpy</ref>
                        </see-also>
                </managerEventInstance>
        </managerEvent>
@@ -234,7 +311,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                <channel_snapshot prefix="Spyee"/>
                        </syntax>
                        <see-also>
-                               <ref type="application">ChanSpyStart</ref>
+                               <ref type="managerEvent">ChanSpyStart</ref>
+                               <ref type="application">ChanSpy</ref>
                        </see-also>
                </managerEventInstance>
        </managerEvent>
@@ -247,6 +325,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                        <para>Hangup handler parameter string passed to the Gosub application.</para>
                                </parameter>
                        </syntax>
+                       <see-also>
+                               <ref type="function">CHANNEL</ref>
+                       </see-also>
                </managerEventInstance>
        </managerEvent>
        <managerEvent language="en_US" name="HangupHandlerPop">
@@ -353,6 +434,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        </syntax>
                        <see-also>
                                <ref type="managerEvent">MusicOnHoldStop</ref>
+                               <ref type="application">StartMusicOnHold</ref>
                                <ref type="application">MusicOnHold</ref>
                        </see-also>
                </managerEventInstance>
@@ -406,18 +488,23 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
                const struct ast_channel_snapshot *snapshot,
                const char *prefix)
 {
-       struct ast_str *out = ast_str_create(1024);
-       int res = 0;
+       struct ast_str *out;
+       char *caller_name;
+       char *connected_name;
+       int res;
 
-       if (!out) {
+       if (snapshot->base->tech_properties & AST_CHAN_TP_INTERNAL) {
                return NULL;
        }
 
-       if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {
-               ast_free(out);
+       out = ast_str_create(1024);
+       if (!out) {
                return NULL;
        }
 
+       caller_name = ast_escape_c_alloc(snapshot->caller->name);
+       connected_name = ast_escape_c_alloc(snapshot->connected->name);
+
        res = ast_str_set(&out, 0,
                "%sChannel: %s\r\n"
                "%sChannelState: %u\r\n"
@@ -431,20 +518,25 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
                "%sContext: %s\r\n"
                "%sExten: %s\r\n"
                "%sPriority: %d\r\n"
-               "%sUniqueid: %s\r\n",
-               prefix, snapshot->name,
+               "%sUniqueid: %s\r\n"
+               "%sLinkedid: %s\r\n",
+               prefix, snapshot->base->name,
                prefix, snapshot->state,
                prefix, ast_state2str(snapshot->state),
-               prefix, S_OR(snapshot->caller_number, "<unknown>"),
-               prefix, S_OR(snapshot->caller_name, "<unknown>"),
-               prefix, S_OR(snapshot->connected_number, "<unknown>"),
-               prefix, S_OR(snapshot->connected_name, "<unknown>"),
-               prefix, snapshot->language,
-               prefix, snapshot->accountcode,
-               prefix, snapshot->context,
-               prefix, snapshot->exten,
-               prefix, snapshot->priority,
-               prefix, snapshot->uniqueid);
+               prefix, S_OR(snapshot->caller->number, "<unknown>"),
+               prefix, S_OR(caller_name, "<unknown>"),
+               prefix, S_OR(snapshot->connected->number, "<unknown>"),
+               prefix, S_OR(connected_name, "<unknown>"),
+               prefix, snapshot->base->language,
+               prefix, snapshot->base->accountcode,
+               prefix, snapshot->dialplan->context,
+               prefix, snapshot->dialplan->exten,
+               prefix, snapshot->dialplan->priority,
+               prefix, snapshot->base->uniqueid,
+               prefix, snapshot->peer->linkedid);
+
+       ast_free(caller_name);
+       ast_free(connected_name);
 
        if (!res) {
                ast_free(out);
@@ -453,10 +545,13 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
 
        if (snapshot->manager_vars) {
                struct ast_var_t *var;
+               char *val;
                AST_LIST_TRAVERSE(snapshot->manager_vars, var, entries) {
+                       val = ast_escape_c_alloc(var->value);
                        ast_str_append(&out, 0, "%sChanVariable: %s=%s\r\n",
                                       prefix,
-                                      var->name, var->value);
+                                      var->name, S_OR(val, ""));
+                       ast_free(val);
                }
        }
 
@@ -481,11 +576,6 @@ static struct ast_manager_event_blob *channel_state_change(
 {
        int is_hungup, was_hungup;
 
-       if (!new_snapshot) {
-               /* Ignore cache clearing events; we'll see the hangup first */
-               return NULL;
-       }
-
        /* The Newchannel, Newstate and Hangup events are closely related, in
         * in that they are mutually exclusive, basically different flavors
         * of a new channel state event.
@@ -504,8 +594,8 @@ static struct ast_manager_event_blob *channel_state_change(
                        EVENT_FLAG_CALL, "Hangup",
                        "Cause: %d\r\n"
                        "Cause-txt: %s\r\n",
-                       new_snapshot->hangupcause,
-                       ast_cause2str(new_snapshot->hangupcause));
+                       new_snapshot->hangup->cause,
+                       ast_cause2str(new_snapshot->hangup->cause));
        }
 
        if (old_snapshot->state != new_snapshot->state) {
@@ -521,13 +611,8 @@ static struct ast_manager_event_blob *channel_newexten(
        struct ast_channel_snapshot *old_snapshot,
        struct ast_channel_snapshot *new_snapshot)
 {
-       /* No Newexten event on cache clear */
-       if (!new_snapshot) {
-               return NULL;
-       }
-
        /* Empty application is not valid for a Newexten event */
-       if (ast_strlen_zero(new_snapshot->appl)) {
+       if (ast_strlen_zero(new_snapshot->dialplan->appl)) {
                return NULL;
        }
 
@@ -543,21 +628,24 @@ static struct ast_manager_event_blob *channel_newexten(
 
        /* DEPRECATED: Extension field deprecated in 12; remove in 14 */
        return ast_manager_event_blob_create(
-               EVENT_FLAG_CALL, "Newexten",
+               EVENT_FLAG_DIALPLAN, "Newexten",
                "Extension: %s\r\n"
                "Application: %s\r\n"
                "AppData: %s\r\n",
-               new_snapshot->exten,
-               new_snapshot->appl,
-               new_snapshot->data);
+               new_snapshot->dialplan->exten,
+               new_snapshot->dialplan->appl,
+               new_snapshot->dialplan->data);
 }
 
 static struct ast_manager_event_blob *channel_new_callerid(
        struct ast_channel_snapshot *old_snapshot,
        struct ast_channel_snapshot *new_snapshot)
 {
-       /* No NewCallerid event on cache clear or first event */
-       if (!old_snapshot || !new_snapshot) {
+       struct ast_manager_event_blob *res;
+       char *callerid;
+
+       /* No NewCallerid event on first channel snapshot */
+       if (!old_snapshot) {
                return NULL;
        }
 
@@ -565,19 +653,27 @@ static struct ast_manager_event_blob *channel_new_callerid(
                return NULL;
        }
 
-       return ast_manager_event_blob_create(
+       if (!(callerid = ast_escape_c_alloc(
+                     ast_describe_caller_presentation(new_snapshot->caller->pres)))) {
+               return NULL;
+       }
+
+       res = ast_manager_event_blob_create(
                EVENT_FLAG_CALL, "NewCallerid",
                "CID-CallingPres: %d (%s)\r\n",
-               new_snapshot->caller_pres,
-               ast_describe_caller_presentation(new_snapshot->caller_pres));
+               new_snapshot->caller->pres,
+               callerid);
+
+       ast_free(callerid);
+       return res;
 }
 
 static struct ast_manager_event_blob *channel_new_connected_line(
        struct ast_channel_snapshot *old_snapshot,
        struct ast_channel_snapshot *new_snapshot)
 {
-       /* No NewConnectedLine event on cache clear or first event */
-       if (!old_snapshot || !new_snapshot) {
+       /* No NewConnectedLine event on first channel snapshot */
+       if (!old_snapshot) {
                return NULL;
        }
 
@@ -593,17 +689,17 @@ static struct ast_manager_event_blob *channel_new_accountcode(
        struct ast_channel_snapshot *old_snapshot,
        struct ast_channel_snapshot *new_snapshot)
 {
-       if (!old_snapshot || !new_snapshot) {
+       if (!old_snapshot) {
                return NULL;
        }
 
-       if (!strcmp(old_snapshot->accountcode, new_snapshot->accountcode)) {
+       if (!strcmp(old_snapshot->base->accountcode, new_snapshot->base->accountcode)) {
                return NULL;
        }
 
        return ast_manager_event_blob_create(
                EVENT_FLAG_CALL, "NewAccountCode",
-               "OldAccountCode: %s\r\n", old_snapshot->accountcode);
+               "OldAccountCode: %s\r\n", old_snapshot->base->accountcode);
 }
 
 channel_snapshot_monitor channel_monitors[] = {
@@ -618,21 +714,14 @@ static void channel_snapshot_update(void *data, struct stasis_subscription *sub,
                                    struct stasis_message *message)
 {
        RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
-       struct stasis_cache_update *update;
-       struct ast_channel_snapshot *old_snapshot;
-       struct ast_channel_snapshot *new_snapshot;
+       struct ast_channel_snapshot_update *update;
        size_t i;
 
        update = stasis_message_data(message);
 
-       ast_assert(ast_channel_snapshot_type() == update->type);
-
-       old_snapshot = stasis_message_data(update->old_snapshot);
-       new_snapshot = stasis_message_data(update->new_snapshot);
-
        for (i = 0; i < ARRAY_LEN(channel_monitors); ++i) {
                RAII_VAR(struct ast_manager_event_blob *, ev, NULL, ao2_cleanup);
-               ev = channel_monitors[i](old_snapshot, new_snapshot);
+               ev = channel_monitors[i](update->old_snapshot, update->new_snapshot);
 
                if (!ev) {
                        continue;
@@ -641,7 +730,7 @@ static void channel_snapshot_update(void *data, struct stasis_subscription *sub,
                /* If we haven't already, build the channel event string */
                if (!channel_event_string) {
                        channel_event_string =
-                               ast_manager_build_channel_state_string(new_snapshot);
+                               ast_manager_build_channel_state_string(update->new_snapshot);
                        if (!channel_event_string) {
                                return;
                        }
@@ -672,28 +761,33 @@ static void channel_hangup_request_cb(void *data,
        struct stasis_message *message)
 {
        struct ast_channel_blob *obj = stasis_message_data(message);
-       RAII_VAR(struct ast_str *, extra, NULL, ast_free);
-       RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
+       struct ast_str *extra;
+       struct ast_str *channel_event_string;
        struct ast_json *cause;
        int is_soft;
        char *manager_event = "HangupRequest";
 
+       if (!obj->snapshot) {
+               /* No snapshot?  Likely an earlier allocation failure creating it. */
+               return;
+       }
+
        extra = ast_str_create(20);
        if (!extra) {
                return;
        }
 
        channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
-
        if (!channel_event_string) {
+               ast_free(extra);
                return;
        }
 
        cause = ast_json_object_get(obj->blob, "cause");
        if (cause) {
                ast_str_append(&extra, 0,
-                              "Cause: %jd\r\n",
-                              ast_json_integer_get(cause));
+                       "Cause: %jd\r\n",
+                       ast_json_integer_get(cause));
        }
 
        is_soft = ast_json_is_true(ast_json_object_get(obj->blob, "soft"));
@@ -702,9 +796,12 @@ static void channel_hangup_request_cb(void *data,
        }
 
        manager_event(EVENT_FLAG_CALL, manager_event,
-                     "%s%s",
-                     ast_str_buffer(channel_event_string),
-                     ast_str_buffer(extra));
+               "%s%s",
+               ast_str_buffer(channel_event_string),
+               ast_str_buffer(extra));
+
+       ast_free(channel_event_string);
+       ast_free(extra);
 }
 
 static void channel_chanspy_stop_cb(void *data, struct stasis_subscription *sub,
@@ -796,6 +893,9 @@ static void channel_dtmf_begin_cb(void *data, struct stasis_subscription *sub,
                                                </enumlist>
                                        </parameter>
                                </syntax>
+                               <see-also>
+                                       <ref type="managerEvent">DTMFEnd</ref>
+                               </see-also>
                </managerEventInstance>
        ***/
        manager_event(EVENT_FLAG_DTMF, "DTMFBegin",
@@ -842,6 +942,9 @@ static void channel_dtmf_end_cb(void *data, struct stasis_subscription *sub,
                                                </enumlist>
                                        </parameter>
                                </syntax>
+                               <see-also>
+                                       <ref type="managerEvent">DTMFBegin</ref>
+                               </see-also>
                </managerEventInstance>
        ***/
        manager_event(EVENT_FLAG_DTMF, "DTMFEnd",
@@ -868,11 +971,11 @@ static void channel_hangup_handler_cb(void *data, struct stasis_subscription *su
                return;
        }
 
-       if (!strcmp(action, "type")) {
+       if (!strcmp(action, "run")) {
                event = "HangupHandlerRun";
-       } else if (!strcmp(action, "type")) {
+       } else if (!strcmp(action, "pop")) {
                event = "HangupHandlerPop";
-       } else if (!strcmp(action, "type")) {
+       } else if (!strcmp(action, "push")) {
                event = "HangupHandlerPush";
        } else {
                return;
@@ -1001,6 +1104,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
  */
@@ -1044,7 +1154,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"
@@ -1061,20 +1171,22 @@ static void channel_hold_cb(void *data, struct stasis_subscription *sub,
        struct stasis_message *message)
 {
        struct ast_channel_blob *obj = stasis_message_data(message);
-       const char *musicclass;
-       RAII_VAR(struct ast_str *, musicclass_string, NULL, ast_free);
-       RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
+       struct ast_str *musicclass_string = ast_str_create(32);
+       struct ast_str *channel_event_string;
 
-       if (!(musicclass_string = ast_str_create(32))) {
+       if (!musicclass_string) {
                return;
        }
 
        channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
        if (!channel_event_string) {
+               ast_free(musicclass_string);
                return;
        }
 
        if (obj->blob) {
+               const char *musicclass;
+
                musicclass = ast_json_string_get(ast_json_object_get(obj->blob, "musicclass"));
 
                if (!ast_strlen_zero(musicclass)) {
@@ -1087,13 +1199,16 @@ static void channel_hold_cb(void *data, struct stasis_subscription *sub,
                "%s",
                ast_str_buffer(channel_event_string),
                ast_str_buffer(musicclass_string));
+
+       ast_free(musicclass_string);
+       ast_free(channel_event_string);
 }
 
 static void channel_unhold_cb(void *data, struct stasis_subscription *sub,
        struct stasis_message *message)
 {
        struct ast_channel_blob *obj = stasis_message_data(message);
-       RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
+       struct ast_str *channel_event_string;
 
        channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
        if (!channel_event_string) {
@@ -1103,6 +1218,8 @@ static void channel_unhold_cb(void *data, struct stasis_subscription *sub,
        manager_event(EVENT_FLAG_CALL, "Unhold",
                "%s",
                ast_str_buffer(channel_event_string));
+
+       ast_free(channel_event_string);
 }
 
 static void manager_channels_shutdown(void)
@@ -1126,7 +1243,7 @@ int manager_channels_init(void)
        if (!message_router) {
                return -1;
        }
-       channel_topic = ast_channel_topic_all_cached();
+       channel_topic = ast_channel_topic_all();
        if (!channel_topic) {
                return -1;
        }
@@ -1138,7 +1255,7 @@ int manager_channels_init(void)
 
        ast_register_cleanup(manager_channels_shutdown);
 
-       ret |= stasis_message_router_add_cache_update(message_router,
+       ret |= stasis_message_router_add(message_router,
                ast_channel_snapshot_type(), channel_snapshot_update, NULL);
 
        ret |= stasis_message_router_add(message_router,
@@ -1197,4 +1314,3 @@ int manager_channels_init(void)
 
        return 0;
 }
-