Convert CCSS manager events to stasis.
authorJason Parker <jparker@digium.com>
Fri, 19 Jul 2013 18:00:35 +0000 (18:00 +0000)
committerJason Parker <jparker@digium.com>
Fri, 19 Jul 2013 18:00:35 +0000 (18:00 +0000)
(closes issue ASTERISK-21473)

Review: https://reviewboard.asterisk.org/r/2682/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394793 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/stasis_system.h
main/ccss.c
main/stasis_system.c

index 07e16a2..8c6e60f 100644 (file)
@@ -62,6 +62,66 @@ struct stasis_message_type *ast_network_change_type(void);
 struct stasis_message_type *ast_system_registry_type(void);
 
 /*!
+ * \brief A \ref stasis_message_type for CCSS Available messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_available_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Offer Timer Start messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_offertimerstart_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Requested messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_requested_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Request Acknowledged messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_requestacknowledged_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Caller Stop Monitoring messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_callerstopmonitoring_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Caller Start Monitoring messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_callerstartmonitoring_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Caller Recalling messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_callerrecalling_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Recall Complete messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_recallcomplete_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Failure messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_failure_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Monitor Failed messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_monitorfailed_type(void);
+
+/*!
  * \brief Initialize the stasis system topic and message types
  * \retval 0 on success
  * \retval -1 on failure
index 6b59a2f..61e8918 100644 (file)
@@ -52,6 +52,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/cli.h"
 #include "asterisk/manager.h"
 #include "asterisk/causes.h"
+#include "asterisk/stasis_system.h"
 
 /*** DOCUMENTATION
        <application name="CallCompletionRequest" language="en_US">
@@ -1025,6 +1026,136 @@ void ast_set_cc_callback_sub(struct ast_cc_config_params *config, const char * c
        }
 }
 
+static int cc_publish(struct stasis_message_type *message_type, int core_id, struct ast_json *extras)
+{
+       RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+       RAII_VAR(struct ast_json_payload *, payload, NULL, ao2_cleanup);
+       RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+
+       blob = ast_json_pack("{s: i}",
+               "core_id", core_id);
+
+       if (extras) {
+               ast_json_object_update(blob, extras);
+       }
+
+       if (!(payload = ast_json_payload_create(blob))) {
+               return -1;
+       }
+
+       if (!(message = stasis_message_create(message_type, payload))) {
+               return -1;
+       }
+
+       stasis_publish(ast_system_topic(), message);
+
+       return 0;
+}
+
+static void cc_publish_available(int core_id, const char *callee, const char *service)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s, s: s}",
+               "callee", callee,
+               "service", service);
+
+       cc_publish(ast_cc_available_type(), core_id, extras);
+}
+
+static void cc_publish_offertimerstart(int core_id, const char *caller, unsigned int expires)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s, s: i}",
+               "caller", caller,
+               "expires", expires);
+
+       cc_publish(ast_cc_offertimerstart_type(), core_id, extras);
+}
+
+static void cc_publish_requested(int core_id, const char *caller, const char *callee)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s, s: s}",
+               "caller", caller,
+               "callee", callee);
+
+       cc_publish(ast_cc_requested_type(), core_id, extras);
+}
+
+static void cc_publish_requestacknowledged(int core_id, const char *caller)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s}",
+               "caller", caller);
+
+       cc_publish(ast_cc_requestacknowledged_type(), core_id, extras);
+}
+
+static void cc_publish_callerstopmonitoring(int core_id, const char *caller)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s}",
+               "caller", caller);
+
+       cc_publish(ast_cc_callerstopmonitoring_type(), core_id, extras);
+}
+
+static void cc_publish_callerstartmonitoring(int core_id, const char *caller)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s}",
+               "caller", caller);
+
+       cc_publish(ast_cc_callerstartmonitoring_type(), core_id, extras);
+}
+
+static void cc_publish_callerrecalling(int core_id, const char *caller)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s}",
+               "caller", caller);
+
+       cc_publish(ast_cc_callerrecalling_type(), core_id, extras);
+}
+
+static void cc_publish_recallcomplete(int core_id, const char *caller)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s}",
+               "caller", caller);
+
+       cc_publish(ast_cc_recallcomplete_type(), core_id, extras);
+}
+
+static void cc_publish_failure(int core_id, const char *caller, const char *reason)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s, s: s}",
+               "caller", caller,
+               "reason", reason);
+
+       cc_publish(ast_cc_failure_type(), core_id, extras);
+}
+
+static void cc_publish_monitorfailed(int core_id, const char *callee)
+{
+       RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+       extras = ast_json_pack("{s: s}",
+               "callee", callee);
+
+       cc_publish(ast_cc_monitorfailed_type(), core_id, extras);
+}
+
 struct cc_monitor_backend {
        AST_LIST_ENTRY(cc_monitor_backend) next;
        const struct ast_cc_monitor_callbacks *callbacks;
@@ -2262,12 +2393,7 @@ void ast_handle_cc_control_frame(struct ast_channel *inbound, struct ast_channel
 
        cc_extension_monitor_change_is_valid(core_instance, monitor->parent_id, monitor->interface->device_name, 0);
 
-       manager_event(EVENT_FLAG_CC, "CCAvailable",
-               "CoreID: %d\r\n"
-               "Callee: %s\r\n"
-               "Service: %s\r\n",
-               cc_interfaces->core_id, device_name, cc_service_to_string(cc_data->service)
-       );
+       cc_publish_available(cc_interfaces->core_id, device_name, cc_service_to_string(cc_data->service));
 
        cc_unref(core_instance, "Done with core_instance after handling CC control frame");
        cc_unref(monitor, "Unref reference from allocating monitor");
@@ -2933,11 +3059,7 @@ static int cc_caller_offered(struct cc_core_instance *core_instance, struct cc_s
                                core_instance->agent->device_name);
                return -1;
        }
-       manager_event(EVENT_FLAG_CC, "CCOfferTimerStart",
-               "CoreID: %d\r\n"
-               "Caller: %s\r\n"
-               "Expires: %u\r\n",
-               core_instance->core_id, core_instance->agent->device_name, core_instance->agent->cc_params->cc_offer_timer);
+       cc_publish_offertimerstart(core_instance->core_id, core_instance->agent->device_name, core_instance->agent->cc_params->cc_offer_timer);
        ast_log_dynamic_level(cc_logger_level, "Core %d: Started the offer timer for the agent %s!\n",
                        core_instance->core_id, core_instance->agent->device_name);
        return 0;
@@ -2986,11 +3108,7 @@ static void request_cc(struct cc_core_instance *core_instance)
                                                monitor_iter->interface->device_name, 1);
                                cc_unref(monitor_iter, "request_cc failed. Unref list's reference to monitor");
                        } else {
-                               manager_event(EVENT_FLAG_CC, "CCRequested",
-                                       "CoreID: %d\r\n"
-                                       "Caller: %s\r\n"
-                                       "Callee: %s\r\n",
-                                       core_instance->core_id, core_instance->agent->device_name, monitor_iter->interface->device_name);
+                               cc_publish_requested(core_instance->core_id, core_instance->agent->device_name, monitor_iter->interface->device_name);
                        }
                }
        }
@@ -3048,15 +3166,9 @@ static int cc_active(struct cc_core_instance *core_instance, struct cc_state_cha
        if (previous_state == CC_CALLER_REQUESTED) {
                core_instance->agent->callbacks->respond(core_instance->agent,
                        AST_CC_AGENT_RESPONSE_SUCCESS);
-               manager_event(EVENT_FLAG_CC, "CCRequestAcknowledged",
-                       "CoreID: %d\r\n"
-                       "Caller: %s\r\n",
-                       core_instance->core_id, core_instance->agent->device_name);
+               cc_publish_requestacknowledged(core_instance->core_id, core_instance->agent->device_name);
        } else if (previous_state == CC_CALLER_BUSY) {
-               manager_event(EVENT_FLAG_CC, "CCCallerStopMonitoring",
-                       "CoreID: %d\r\n"
-                       "Caller: %s\r\n",
-                       core_instance->core_id, core_instance->agent->device_name);
+               cc_publish_callerstopmonitoring(core_instance->core_id, core_instance->agent->device_name);
                unsuspend(core_instance);
        }
        /* Not possible for previous_state to be anything else due to the is_state_change_valid check at the beginning */
@@ -3098,10 +3210,7 @@ static int cc_caller_busy(struct cc_core_instance *core_instance, struct cc_stat
         */
        suspend(core_instance);
        core_instance->agent->callbacks->start_monitoring(core_instance->agent);
-       manager_event(EVENT_FLAG_CC, "CCCallerStartMonitoring",
-               "CoreID: %d\r\n"
-               "Caller: %s\r\n",
-               core_instance->core_id, core_instance->agent->device_name);
+       cc_publish_callerstartmonitoring(core_instance->core_id, core_instance->agent->device_name);
        return 0;
 }
 
@@ -3132,10 +3241,7 @@ static int cc_recalling(struct cc_core_instance *core_instance, struct cc_state_
        /* Both caller and callee are available, call agent's recall callback
         */
        cancel_available_timer(core_instance);
-       manager_event(EVENT_FLAG_CC, "CCCallerRecalling",
-               "CoreID: %d\r\n"
-               "Caller: %s\r\n",
-               core_instance->core_id, core_instance->agent->device_name);
+       cc_publish_callerrecalling(core_instance->core_id, core_instance->agent->device_name);
        return 0;
 }
 
@@ -3143,21 +3249,14 @@ static int cc_complete(struct cc_core_instance *core_instance, struct cc_state_c
 {
        /* Recall has made progress, call agent and monitor destructor functions
         */
-       manager_event(EVENT_FLAG_CC, "CCRecallComplete",
-               "CoreID: %d\r\n"
-               "Caller: %s\r\n",
-               core_instance->core_id, core_instance->agent->device_name);
+       cc_publish_recallcomplete(core_instance->core_id, core_instance->agent->device_name);
        ao2_t_unlink(cc_core_instances, core_instance, "Unlink core instance since CC recall has completed");
        return 0;
 }
 
 static int cc_failed(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
 {
-       manager_event(EVENT_FLAG_CC, "CCFailure",
-               "CoreID: %d\r\n"
-               "Caller: %s\r\n"
-               "Reason: %s\r\n",
-               core_instance->core_id, core_instance->agent->device_name, args->debug);
+       cc_publish_failure(core_instance->core_id, core_instance->agent->device_name, args->debug);
        ao2_t_unlink(cc_core_instances, core_instance, "Unlink core instance since CC failed");
        return 0;
 }
@@ -3811,10 +3910,7 @@ static int cc_monitor_failed(void *data)
                                cc_extension_monitor_change_is_valid(core_instance, monitor_iter->parent_id,
                                                monitor_iter->interface->device_name, 1);
                                monitor_iter->callbacks->cancel_available_timer(monitor_iter, &monitor_iter->available_timer_id);
-                               manager_event(EVENT_FLAG_CC, "CCMonitorFailed",
-                                       "CoreID: %d\r\n"
-                                       "Callee: %s\r\n",
-                                       monitor_iter->core_id, monitor_iter->interface->device_name);
+                               cc_publish_monitorfailed(monitor_iter->core_id, monitor_iter->interface->device_name);
                                cc_unref(monitor_iter, "Monitor reported failure. Unref list's reference.");
                        }
                }
index 15451ed..2428a96 100644 (file)
@@ -70,11 +70,51 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 static struct stasis_topic *system_topic;
 
 static struct ast_manager_event_blob *system_registry_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_available_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_offertimerstart_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_requested_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_requestacknowledged_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_callerstopmonitoring_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_callerstartmonitoring_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_callerrecalling_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_recallcomplete_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_failure_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_monitorfailed_to_ami(struct stasis_message *message);
 
 STASIS_MESSAGE_TYPE_DEFN(ast_network_change_type);
 STASIS_MESSAGE_TYPE_DEFN(ast_system_registry_type,
        .to_ami = system_registry_to_ami,
        );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_available_type,
+       .to_ami = cc_available_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_offertimerstart_type,
+       .to_ami = cc_offertimerstart_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_requested_type,
+       .to_ami = cc_requested_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_requestacknowledged_type,
+       .to_ami = cc_requestacknowledged_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_callerstopmonitoring_type,
+       .to_ami = cc_callerstopmonitoring_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_callerstartmonitoring_type,
+       .to_ami = cc_callerstartmonitoring_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_callerrecalling_type,
+       .to_ami = cc_callerrecalling_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_recallcomplete_type,
+       .to_ami = cc_recallcomplete_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_failure_type,
+       .to_ami = cc_failure_to_ami,
+       );
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_monitorfailed_type,
+       .to_ami = cc_monitorfailed_to_ami,
+       );
 
 void ast_system_publish_registry(const char *channeltype, const char *username, const char *domain, const char *status, const char *cause)
 {
@@ -134,6 +174,168 @@ static struct ast_manager_event_blob *system_registry_to_ami(struct stasis_messa
                channeltype, username, domain, status, ast_str_buffer(cause_string));
 }
 
+static struct ast_manager_event_blob *cc_available_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *callee;
+       const char *service;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       callee = ast_json_string_get(ast_json_object_get(payload->json, "callee"));
+       service = ast_json_string_get(ast_json_object_get(payload->json, "service"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCAvailable",
+               "CoreID: %d\r\n"
+               "Callee: %s\r\n"
+               "Service: %s\r\n",
+               core_id, callee, service);
+}
+
+static struct ast_manager_event_blob *cc_offertimerstart_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *caller;
+       unsigned int expires;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+       expires = ast_json_integer_get(ast_json_object_get(payload->json, "expires"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCOfferTimerStart",
+               "CoreID: %d\r\n"
+               "Caller: %s\r\n"
+               "Expires: %u\r\n",
+               core_id, caller, expires);
+}
+
+static struct ast_manager_event_blob *cc_requested_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *caller;
+       const char *callee;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+       callee = ast_json_string_get(ast_json_object_get(payload->json, "callee"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCRequested",
+               "CoreID: %d\r\n"
+               "Caller: %s\r\n"
+               "Callee: %s\r\n",
+               core_id, caller, callee);
+}
+
+static struct ast_manager_event_blob *cc_requestacknowledged_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *caller;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCRequestAcknowledged",
+               "CoreID: %d\r\n"
+               "Caller: %s\r\n",
+               core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_callerstopmonitoring_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *caller;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCCallerStopMonitoring",
+               "CoreID: %d\r\n"
+               "Caller: %s\r\n",
+               core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_callerstartmonitoring_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *caller;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCCallerStartMonitoring",
+               "CoreID: %d\r\n"
+               "Caller: %s\r\n",
+               core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_callerrecalling_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *caller;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCCallerRecalling",
+               "CoreID: %d\r\n"
+               "Caller: %s\r\n",
+               core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_recallcomplete_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *caller;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCRecallComplete",
+               "CoreID: %d\r\n"
+               "Caller: %s\r\n",
+               core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_failure_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *caller;
+       const char *reason;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+       reason = ast_json_string_get(ast_json_object_get(payload->json, "reason"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCFailure",
+               "CoreID: %d\r\n"
+               "Caller: %s\r\n"
+               "Reason: %s\r\n",
+               core_id, caller, reason);
+}
+
+static struct ast_manager_event_blob *cc_monitorfailed_to_ami(struct stasis_message *message)
+{
+       struct ast_json_payload *payload = stasis_message_data(message);
+       int core_id;
+       const char *callee;
+
+       core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+       callee = ast_json_string_get(ast_json_object_get(payload->json, "callee"));
+
+       return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCMonitorFailed",
+               "CoreID: %d\r\n"
+               "Callee: %s\r\n",
+               core_id, callee);
+}
+
 struct stasis_topic *ast_system_topic(void)
 {
        return system_topic;
@@ -146,6 +348,16 @@ static void stasis_system_cleanup(void)
        system_topic = NULL;
        STASIS_MESSAGE_TYPE_CLEANUP(ast_network_change_type);
        STASIS_MESSAGE_TYPE_CLEANUP(ast_system_registry_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_available_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_offertimerstart_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_requested_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_requestacknowledged_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_callerstopmonitoring_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_callerstartmonitoring_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_callerrecalling_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_recallcomplete_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_failure_type);
+       STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_monitorfailed_type);
 }
 
 /*! \brief Initialize the system level items for \ref stasis */
@@ -166,5 +378,45 @@ int ast_stasis_system_init(void)
                return -1;
        }
 
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_available_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_offertimerstart_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_requested_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_requestacknowledged_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerstopmonitoring_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerstartmonitoring_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerrecalling_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_recallcomplete_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_failure_type) != 0) {
+               return -1;
+       }
+
+       if (STASIS_MESSAGE_TYPE_INIT(ast_cc_monitorfailed_type) != 0) {
+               return -1;
+       }
+
        return 0;
 }