New SIP Channel driver: Always Auth Reject
[asterisk/asterisk.git] / res / res_sip / sip_configuration.c
index 11d4788..ca4660a 100644 (file)
@@ -281,6 +281,11 @@ static int timers_handler(const struct aco_option *opt, struct ast_variable *var
 static void destroy_auths(const char **auths, size_t num_auths)
 {
        int i;
+
+       if (!auths) {
+               return;
+       }
+
        for (i = 0; i < num_auths; ++i) {
                ast_free((char *) auths[i]);
        }
@@ -684,6 +689,13 @@ int ast_res_sip_initialize_configuration(void)
                return -1;
        }
 
+       if (ast_sip_initialize_sorcery_security(sip_sorcery)) {
+               ast_log(LOG_ERROR, "Failed to register SIP security support\n");
+               ast_sorcery_unref(sip_sorcery);
+               sip_sorcery = NULL;
+               return -1;
+       }
+
        ast_sorcery_load(sip_sorcery);
 
        return 0;