diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | apps/confbridge/conf_config_parser.c | 32 | ||||
-rw-r--r-- | include/asterisk/utils.h | 10 | ||||
-rw-r--r-- | main/astobj2_container.c | 6 | ||||
-rw-r--r-- | main/astobj2_hash.c | 2 | ||||
-rw-r--r-- | main/astobj2_rbtree.c | 2 | ||||
-rw-r--r-- | main/channel_internal_api.c | 4 | ||||
-rw-r--r-- | main/event.c | 2 | ||||
-rw-r--r-- | main/security_events.c | 4 | ||||
-rw-r--r-- | res/res_corosync.c | 12 | ||||
-rw-r--r-- | res/res_pjsip.c | 6 | ||||
-rw-r--r-- | res/res_pjsip/location.c | 11 | ||||
-rw-r--r-- | res/res_pjsip_mwi.c | 121 | ||||
-rw-r--r-- | res/res_pjsip_outbound_authenticator_digest.c | 10 | ||||
-rw-r--r-- | res/res_pjsip_pubsub.c | 2 | ||||
-rw-r--r-- | res/res_pjsip_t38.c | 9 | ||||
-rw-r--r-- | res/res_stasis_playback.c | 2 | ||||
-rw-r--r-- | res/res_stasis_recording.c | 4 |
18 files changed, 204 insertions, 37 deletions
diff --git a/.gitignore b/.gitignore index c2406440c..4b19213cc 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ makeopts.embed_rules menuselect-tree *.sha1 *.pyc +*.gcno +*.gcda diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c index af5dfcea9..6d6f7ab34 100644 --- a/apps/confbridge/conf_config_parser.c +++ b/apps/confbridge/conf_config_parser.c @@ -941,12 +941,17 @@ static const struct ast_datastore_info confbridge_datastore = { .type = "confbridge", .destroy = func_confbridge_destroy_cb }; + int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data, const char *value) { struct ast_datastore *datastore; struct func_confbridge_data *b_data; char *parse; struct ast_variable tmpvar = { 0, }; + struct ast_variable template = { + .name = "template", + .file = "CONFBRIDGE" + }; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(type); AST_APP_ARG(option); @@ -1019,7 +1024,14 @@ int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data ast_datastore_free(datastore); } return 0; - } else if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) { + } + + if (b_data && !b_data->b_usable && strcasecmp(args.option, "template")) { + template.value = DEFAULT_BRIDGE_PROFILE; + aco_process_var(&bridge_type, "dialplan", &template, &b_data->b_profile); + } + + if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) { b_data->b_usable = 1; return 0; } @@ -1029,7 +1041,14 @@ int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data user_profile_destructor(&b_data->u_profile); memset(&b_data->u_profile, 0, sizeof(b_data->u_profile)); return 0; - } else if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) { + } + + if (b_data && !b_data->u_usable && strcasecmp(args.option, "template")) { + template.value = DEFAULT_USER_PROFILE; + aco_process_var(&user_type, "dialplan", &template, &b_data->u_profile); + } + + if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) { b_data->u_usable = 1; return 0; } @@ -1045,7 +1064,14 @@ int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data ast_datastore_free(datastore); } return 0; - } else if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) { + } + + if (b_data && !b_data->m_usable && strcasecmp(args.option, "template")) { + template.value = DEFAULT_MENU_PROFILE; + aco_process_var(&menu_type, "dialplan", &template, &b_data->menu); + } + + if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) { b_data->m_usable = 1; return 0; } diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index f3f571972..664e347cf 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -1031,19 +1031,13 @@ char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size); */ #if defined(__clang__) - -#if defined(__has_feature) && __has_feature(blocks) typedef void (^_raii_cleanup_block_t)(void); static inline void _raii_cleanup_block(_raii_cleanup_block_t *b) { (*b)(); } #define RAII_VAR(vartype, varname, initval, dtor) \ _raii_cleanup_block_t _raii_cleanup_ ## varname __attribute__((cleanup(_raii_cleanup_block),unused)) = NULL; \ - vartype varname = initval; \ - _raii_cleanup_ ## varname = ^{ dtor(varname); } - -#else - #error "CLANG must support the 'blocks' feature to compile Asterisk." -#endif /* #if defined(__has_feature) && __has_feature(blocks) */ + __block vartype varname = initval; \ + _raii_cleanup_ ## varname = ^{ {(void)dtor(varname);} } #elif defined(__GNUC__) diff --git a/main/astobj2_container.c b/main/astobj2_container.c index dc6f5e5c5..5a27a0ae5 100644 --- a/main/astobj2_container.c +++ b/main/astobj2_container.c @@ -510,6 +510,12 @@ struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) void ao2_iterator_restart(struct ao2_iterator *iter) { + if (!is_ao2_object(iter->c)) { + ast_log(LOG_ERROR, "Iterator container is not valid.\n"); + ast_assert(0); + return; + } + /* Release the last container node reference if we have one. */ if (iter->last_node) { enum ao2_lock_req orig_lock; diff --git a/main/astobj2_hash.c b/main/astobj2_hash.c index 37d4b6017..066999f49 100644 --- a/main/astobj2_hash.c +++ b/main/astobj2_hash.c @@ -186,6 +186,8 @@ static void hash_ao2_node_destructor(void *v_doomed) * same node. */ my_container = (struct ao2_container_hash *) doomed->common.my_container; + ast_assert(is_ao2_object(my_container)); + __adjust_lock(my_container, AO2_LOCK_REQ_WRLOCK, 1); #if defined(AO2_DEBUG) diff --git a/main/astobj2_rbtree.c b/main/astobj2_rbtree.c index 2e3a73eaa..d8195d47f 100644 --- a/main/astobj2_rbtree.c +++ b/main/astobj2_rbtree.c @@ -878,6 +878,8 @@ static void rb_ao2_node_destructor(void *v_doomed) * same node. */ my_container = (struct ao2_container_rbtree *) doomed->common.my_container; + ast_assert(is_ao2_object(my_container)); + __adjust_lock(my_container, AO2_LOCK_REQ_WRLOCK, 1); #if defined(AO2_DEBUG) diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c index 624bdd1cb..835b9ce37 100644 --- a/main/channel_internal_api.c +++ b/main/channel_internal_api.c @@ -1457,6 +1457,10 @@ struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj), tmp = ao2_alloc(sizeof(*tmp), destructor); #endif + if (!tmp) { + return NULL; + } + if ((ast_string_field_init(tmp, 128))) { return ast_channel_unref(tmp); } diff --git a/main/event.c b/main/event.c index 8880b9699..019dfcac0 100644 --- a/main/event.c +++ b/main/event.c @@ -199,7 +199,7 @@ const char *ast_event_get_type_name(const struct ast_event *event) type = ast_event_get_type(event); - if (type >= ARRAY_LEN(event_names)) { + if ((unsigned int)type >= ARRAY_LEN(event_names)) { ast_log(LOG_ERROR, "Invalid event type - '%u'\n", type); return ""; } diff --git a/main/security_events.c b/main/security_events.c index 1d8295265..d549d6201 100644 --- a/main/security_events.c +++ b/main/security_events.c @@ -886,7 +886,7 @@ const char *ast_security_event_severity_get_name( static int check_event_type(const enum ast_security_event_type event_type) { - if (event_type >= AST_SECURITY_EVENT_NUM_TYPES) { + if ((unsigned int)event_type >= AST_SECURITY_EVENT_NUM_TYPES) { ast_log(LOG_ERROR, "Invalid security event type %u\n", event_type); return -1; } @@ -1172,7 +1172,7 @@ return_error: int ast_security_event_report(const struct ast_security_event_common *sec) { - if (sec->event_type >= AST_SECURITY_EVENT_NUM_TYPES) { + if ((unsigned int)sec->event_type >= AST_SECURITY_EVENT_NUM_TYPES) { ast_log(LOG_ERROR, "Invalid security event type\n"); return -1; } diff --git a/res/res_corosync.c b/res/res_corosync.c index 58290c7cc..e2b0596d1 100644 --- a/res/res_corosync.c +++ b/res/res_corosync.c @@ -883,6 +883,12 @@ static int load_module(void) goto failed; } + if (load_config(0)) { + /* simply not configured is not a fatal error */ + res = AST_MODULE_LOAD_DECLINE; + goto failed; + } + if ((cs_err = corosync_cfg_initialize(&cfg_handle, &cfg_callbacks)) != CS_OK) { ast_log(LOG_ERROR, "Failed to initialize cfg: (%d)\n", (int) cs_err); goto failed; @@ -913,12 +919,6 @@ static int load_module(void) goto failed; } - if (load_config(0)) { - /* simply not configured is not a fatal error */ - res = AST_MODULE_LOAD_DECLINE; - goto failed; - } - ast_cli_register_multiple(corosync_cli, ARRAY_LEN(corosync_cli)); return AST_MODULE_LOAD_SUCCESS; diff --git a/res/res_pjsip.c b/res/res_pjsip.c index 7bf6486f5..bde0de1ec 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -2717,7 +2717,8 @@ static int create_out_of_dialog_request(const pjsip_method *method, struct ast_s if (sip_dialog_create_from(pool, &from, endpoint ? endpoint->fromuser : NULL, endpoint ? endpoint->fromdomain : NULL, &remote_uri, &selector)) { ast_log(LOG_ERROR, "Unable to create From header for %.*s request to endpoint %s\n", - (int) pj_strlen(&method->name), pj_strbuf(&method->name), ast_sorcery_object_get_id(endpoint)); + (int) pj_strlen(&method->name), pj_strbuf(&method->name), + endpoint ? ast_sorcery_object_get_id(endpoint) : "<none>"); pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool); return -1; } @@ -2725,7 +2726,8 @@ static int create_out_of_dialog_request(const pjsip_method *method, struct ast_s if (pjsip_endpt_create_request(ast_sip_get_pjsip_endpoint(), method, &remote_uri, &from, &remote_uri, &from, NULL, -1, NULL, tdata) != PJ_SUCCESS) { ast_log(LOG_ERROR, "Unable to create outbound %.*s request to endpoint %s\n", - (int) pj_strlen(&method->name), pj_strbuf(&method->name), ast_sorcery_object_get_id(endpoint)); + (int) pj_strlen(&method->name), pj_strbuf(&method->name), + endpoint ? ast_sorcery_object_get_id(endpoint) : "<none>"); pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool); return -1; } diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index 21650417f..45370dd24 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -290,6 +290,8 @@ static int permanent_contact_validate(void *data) pj_pool_t *pool; pj_str_t contact_uri; static const pj_str_t HCONTACT = { "Contact", 7 }; + pjsip_contact_hdr *contact_hdr; + int rc = 0; pool = pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(), "Permanent Contact Validation", 256, 256); if (!pool) { @@ -297,13 +299,14 @@ static int permanent_contact_validate(void *data) } pj_strdup2_with_null(pool, &contact_uri, value); - if (!pjsip_parse_hdr(pool, &HCONTACT, contact_uri.ptr, contact_uri.slen, NULL)) { - pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool); - return -1; + if (!(contact_hdr = pjsip_parse_hdr(pool, &HCONTACT, contact_uri.ptr, contact_uri.slen, NULL)) + || !(PJSIP_URI_SCHEME_IS_SIP(contact_hdr->uri) + || PJSIP_URI_SCHEME_IS_SIPS(contact_hdr->uri))) { + rc = -1; } pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool); - return 0; + return rc; } static int permanent_uri_sort_fn(const void *obj_left, const void *obj_right, int flags) diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c index 9c275af46..2ab7dfee0 100644 --- a/res/res_pjsip_mwi.c +++ b/res/res_pjsip_mwi.c @@ -100,12 +100,14 @@ struct mwi_stasis_subscription { */ struct mwi_subscription { /*! Container of \ref mwi_stasis_subscription structures. - * A single MWI subscription may be fore multiple mailboxes, thus + * A single MWI subscription may be for multiple mailboxes, thus * requiring multiple stasis subscriptions */ struct ao2_container *stasis_subs; /*! The SIP subscription. Unsolicited MWI does not use this */ struct ast_sip_subscription *sip_sub; + /*! AORs we should react to for unsolicited MWI NOTIFY */ + char *aors; /*! Is the MWI solicited (i.e. Initiated with an external SUBSCRIBE) ? */ unsigned int is_solicited; /*! Identifier for the subscription. @@ -196,6 +198,7 @@ static void mwi_subscription_destructor(void *obj) ast_debug(3, "Destroying MWI subscription for endpoint %s\n", sub->id); ao2_cleanup(sub->sip_sub); ao2_cleanup(sub->stasis_subs); + ast_free(sub->aors); } static struct mwi_subscription *mwi_subscription_alloc(struct ast_sip_endpoint *endpoint, @@ -232,6 +235,14 @@ static struct mwi_subscription *mwi_subscription_alloc(struct ast_sip_endpoint * } sub->is_solicited = is_solicited; + if (!is_solicited && !ast_strlen_zero(endpoint->aors)) { + sub->aors = ast_strdup(endpoint->aors); + if (!sub->aors) { + ao2_ref(sub, -1); + return NULL; + } + } + ast_debug(3, "Created %s MWI subscription for endpoint %s\n", is_solicited ? "solicited" : "unsolicited", sub->id); return sub; @@ -796,21 +807,32 @@ static int serialized_cleanup(void *userdata) return 0; } +static int send_notify(void *obj, void *arg, int flags) +{ + struct mwi_subscription *mwi_sub = obj; + struct ast_taskprocessor *serializer = mwi_sub->is_solicited ? ast_sip_subscription_get_serializer(mwi_sub->sip_sub) : NULL; + + if (ast_sip_push_task(serializer, serialized_notify, ao2_bump(mwi_sub))) { + ao2_ref(mwi_sub, -1); + } + + return 0; +} + static void mwi_stasis_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) { struct mwi_subscription *mwi_sub = userdata; if (stasis_subscription_final_message(sub, msg)) { - ao2_ref(mwi_sub, +1); - ast_sip_push_task(NULL, serialized_cleanup, mwi_sub); + if (ast_sip_push_task(NULL, serialized_cleanup, ao2_bump(mwi_sub))) { + ao2_ref(mwi_sub, -1); + } return; } if (ast_mwi_state_type() == stasis_message_type(msg)) { - struct ast_taskprocessor *serializer = mwi_sub->is_solicited ? ast_sip_subscription_get_serializer(mwi_sub->sip_sub) : NULL; - ao2_ref(mwi_sub, +1); - ast_sip_push_task(serializer, serialized_notify, mwi_sub); + send_notify(mwi_sub, NULL, 0); } } @@ -858,6 +880,7 @@ static int unsubscribe(void *obj, void *arg, int flags) struct mwi_subscription *mwi_sub = obj; ao2_callback(mwi_sub->stasis_subs, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, unsubscribe_stasis, NULL); + return CMP_MATCH; } @@ -887,6 +910,83 @@ static void create_mwi_subscriptions(void) ao2_ref(mwi_subscriptions, -1); } +/*! \brief Function called to send MWI NOTIFY on any unsolicited mailboxes relating to this AOR */ +static int send_contact_notify(void *obj, void *arg, int flags) +{ + struct mwi_subscription *mwi_sub = obj; + const char *aor = arg; + + if (!mwi_sub->aors || !strstr(mwi_sub->aors, aor)) { + return 0; + } + + if (ast_sip_push_task(NULL, serialized_notify, ao2_bump(mwi_sub))) { + ao2_ref(mwi_sub, -1); + } + + return 0; +} + + +/*! \brief Function called when a contact is created or updated */ +static void mwi_contact_changed_observer(const void *object) +{ + char *id = ast_strdupa(ast_sorcery_object_get_id(object)), *aor = NULL; + struct ao2_container *mwi_subscriptions = ao2_global_obj_ref(unsolicited_mwi); + + if (!mwi_subscriptions) { + return; + } + + aor = strsep(&id, ";@"); + + ao2_callback(mwi_subscriptions, OBJ_NODATA, send_contact_notify, aor); + ao2_ref(mwi_subscriptions, -1); +} + +/*! \brief Observer for contacts so unsolicited MWI is sent when a contact changes */ +static const struct ast_sorcery_observer mwi_contact_observer = { + .created = mwi_contact_changed_observer, + .updated = mwi_contact_changed_observer, +}; + +/*! \brief Task invoked to send initial MWI NOTIFY for unsolicited */ +static int send_initial_notify_all(void *obj) +{ + struct ao2_container *mwi_subscriptions = ao2_global_obj_ref(unsolicited_mwi); + + if (!mwi_subscriptions) { + return 0; + } + + ao2_callback(mwi_subscriptions, OBJ_NODATA, send_notify, NULL); + ao2_ref(mwi_subscriptions, -1); + + return 0; +} + +/*! \brief Event callback which fires initial unsolicited MWI NOTIFY messages when we're fully booted */ +static void mwi_startup_event_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message) +{ + struct ast_json_payload *payload; + const char *type; + + if (stasis_message_type(message) != ast_manager_get_generic_type()) { + return; + } + + payload = stasis_message_data(message); + type = ast_json_string_get(ast_json_object_get(payload->json, "type")); + + if (strcmp(type, "FullyBooted")) { + return; + } + + ast_sip_push_task(NULL, send_initial_notify_all, NULL); + + stasis_unsubscribe(sub); +} + static int reload(void) { create_mwi_subscriptions(); @@ -901,6 +1001,14 @@ static int load_module(void) return AST_MODULE_LOAD_DECLINE; } create_mwi_subscriptions(); + ast_sorcery_observer_add(ast_sip_get_sorcery(), "contact", &mwi_contact_observer); + + if (ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) { + ast_sip_push_task(NULL, send_initial_notify_all, NULL); + } else { + stasis_subscribe_pool(ast_manager_get_topic(), mwi_startup_event_cb, NULL); + } + return AST_MODULE_LOAD_SUCCESS; } @@ -910,6 +1018,7 @@ static int unload_module(void) if (mwi_subscriptions) { ao2_callback(mwi_subscriptions, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, unsubscribe, NULL); ao2_global_obj_release(unsolicited_mwi); + ast_sorcery_observer_remove(ast_sip_get_sorcery(), "contact", &mwi_contact_observer); } ast_sip_unregister_subscription_handler(&mwi_handler); return 0; diff --git a/res/res_pjsip_outbound_authenticator_digest.c b/res/res_pjsip_outbound_authenticator_digest.c index 64238a868..35e59f21a 100644 --- a/res/res_pjsip_outbound_authenticator_digest.c +++ b/res/res_pjsip_outbound_authenticator_digest.c @@ -105,6 +105,7 @@ static int digest_create_request_with_auth(const struct ast_sip_auth_vector *aut pjsip_transaction *tsx, pjsip_tx_data **new_request) { pjsip_auth_clt_sess auth_sess; + pjsip_cseq_hdr *cseq; if (pjsip_auth_clt_init(&auth_sess, ast_sip_get_pjsip_endpoint(), tsx->pool, 0) != PJ_SUCCESS) { @@ -120,6 +121,15 @@ static int digest_create_request_with_auth(const struct ast_sip_auth_vector *aut switch (pjsip_auth_clt_reinit_req(&auth_sess, challenge, tsx->last_tx, new_request)) { case PJ_SUCCESS: + /* PJSIP creates a new transaction for new_request (meaning it creates a new + * branch). However, it recycles the Call-ID, from-tag, and CSeq from the + * original request. Some SIP implementations will not process the new request + * since the CSeq is the same as the original request. Incrementing it here + * fixes the interop issue + */ + cseq = pjsip_msg_find_hdr((*new_request)->msg, PJSIP_H_CSEQ, NULL); + ast_assert(cseq != NULL); + ++cseq->cseq; return 0; case PJSIP_ENOCREDENTIAL: ast_log(LOG_WARNING, "Unable to create request with auth." diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index 0f08a0ff4..bd40a197f 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -1019,6 +1019,7 @@ static int subscription_remove_serializer(void *obj) * remove the serializer will be successful. */ ast_sip_dialog_set_serializer(sub_tree->dlg, NULL); + ast_sip_dialog_set_endpoint(sub_tree->dlg, NULL); pjsip_dlg_dec_session(sub_tree->dlg, &pubsub_module); return 0; @@ -1188,6 +1189,7 @@ static void subscription_setup_dialog(struct sip_subscription_tree *sub_tree, pj pjsip_dlg_inc_session(dlg, &pubsub_module); sub_tree->dlg = dlg; ast_sip_dialog_set_serializer(dlg, sub_tree->serializer); + ast_sip_dialog_set_endpoint(dlg, sub_tree->endpoint); pjsip_evsub_set_mod_data(sub_tree->evsub, pubsub_module.id, sub_tree); } diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c index ac31086a6..06a73cc11 100644 --- a/res/res_pjsip_t38.c +++ b/res/res_pjsip_t38.c @@ -470,6 +470,11 @@ static void t38_attach_framehook(struct ast_sip_session *session) .chan_breakdown_cb = t38_masq, }; + /* If the channel's already gone, bail */ + if (!session->channel) { + return; + } + /* Only attach the framehook if t38 is enabled for the endpoint */ if (!session->endpoint->media.t38.enabled) { return; @@ -504,14 +509,14 @@ static void t38_attach_framehook(struct ast_sip_session *session) ast_channel_unlock(session->channel); } -/*! \brief Function called when an INVITE goes out */ +/*! \brief Function called when an INVITE arrives */ static int t38_incoming_invite_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata) { t38_attach_framehook(session); return 0; } -/*! \brief Function called when an INVITE comes in */ +/*! \brief Function called when an INVITE is sent */ static void t38_outgoing_invite_request(struct ast_sip_session *session, struct pjsip_tx_data *tdata) { t38_attach_framehook(session); diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c index 2eac55f19..dc6e8f2b8 100644 --- a/res/res_stasis_playback.c +++ b/res/res_stasis_playback.c @@ -629,7 +629,7 @@ enum stasis_playback_oper_results stasis_app_playback_operation( playback_opreation_cb cb; SCOPED_AO2LOCK(lock, playback); - ast_assert(playback->state < STASIS_PLAYBACK_STATE_MAX); + ast_assert((unsigned int)playback->state < STASIS_PLAYBACK_STATE_MAX); if (operation >= STASIS_PLAYBACK_MEDIA_OP_MAX) { ast_log(LOG_ERROR, "Invalid playback operation %u\n", operation); diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c index df7f8b33a..50e0697b1 100644 --- a/res/res_stasis_recording.c +++ b/res/res_stasis_recording.c @@ -595,13 +595,13 @@ enum stasis_app_recording_oper_results stasis_app_recording_operation( recording_operation_cb cb; SCOPED_AO2LOCK(lock, recording); - if (recording->state >= STASIS_APP_RECORDING_STATE_MAX) { + if ((unsigned int)recording->state >= STASIS_APP_RECORDING_STATE_MAX) { ast_log(LOG_WARNING, "Invalid recording state %u\n", recording->state); return -1; } - if (operation >= STASIS_APP_RECORDING_OPER_MAX) { + if ((unsigned int)operation >= STASIS_APP_RECORDING_OPER_MAX) { ast_log(LOG_WARNING, "Invalid recording operation %u\n", operation); return -1; |