diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index fd80581003..846f92997f 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -598,6 +598,8 @@ struct ast_sip_endpoint_subscription_configuration { struct ast_sip_mwi_configuration mwi; /*! Context for SUBSCRIBE requests */ char context[AST_MAX_CONTEXT]; + /*! Whether or not to log failed notify (Example: Endpoint '1000' state subscription failed: Extension '1010' does not exist in context.....) */ + unsigned int log_subscription_error; }; /*! diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index f95ee9e240..088c950fdd 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -2025,6 +2025,7 @@ int ast_res_pjsip_initialize_configuration(void) call_offer_pref_handler, incoming_call_offer_pref_to_str, NULL, 0, 0); ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "outgoing_call_offer_pref", "remote", call_offer_pref_handler, outgoing_call_offer_pref_to_str, NULL, 0, 0); + ast_sorcery_object_field_register(sip_sorcery, "endpoint", "log_subscription_error", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, subscription.log_subscription_error)); if (ast_sip_initialize_sorcery_transport()) { ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n"); diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c index df9a35f332..9b72d69060 100644 --- a/res/res_pjsip_exten_state.c +++ b/res/res_pjsip_exten_state.c @@ -415,9 +415,11 @@ static int new_subscribe(struct ast_sip_endpoint *endpoint, const char *context = S_OR(endpoint->subscription.context, endpoint->context); if (!ast_exists_extension(NULL, context, resource, PRIORITY_HINT, NULL)) { - ast_log(LOG_NOTICE, "Endpoint '%s' state subscription failed: " - "Extension '%s' does not exist in context '%s' or has no associated hint\n", - ast_sorcery_object_get_id(endpoint), resource, context); + if (endpoint->subscription.log_subscription_error) { + ast_log(LOG_NOTICE, "Endpoint '%s' state subscription failed: " + "Extension '%s' does not exist in context '%s' or has no associated hint\n", + ast_sorcery_object_get_id(endpoint), resource, context); + } return 404; }