res_pjsip_keepalive: Add runtime configurable keepalive module for connection-oriente...
[asterisk/asterisk.git] / res / res_pjsip_authenticator_digest.c
index d0ce36a..8a78125 100644 (file)
@@ -443,15 +443,16 @@ static struct ast_sip_authenticator digest_authenticator = {
 
 static int build_entity_id(void)
 {
-       RAII_VAR(struct ast_uuid *, uu, ast_uuid_generate(), ast_free_ptr);
-       RAII_VAR(char *, eid, ao2_alloc(AST_UUID_STR_LEN, NULL), ao2_cleanup);
+       char *eid;
 
-       if (!uu || !eid) {
+       eid = ao2_alloc(AST_UUID_STR_LEN, NULL);
+       if (!eid) {
                return -1;
        }
 
-       ast_uuid_to_str(uu, eid, AST_UUID_STR_LEN);
+       ast_uuid_generate_str(eid, AST_UUID_STR_LEN);
        ao2_global_obj_replace_unref(entity_id, eid);
+       ao2_ref(eid, -1);
        return 0;
 }
 
@@ -465,6 +466,8 @@ static int reload_module(void)
 
 static int load_module(void)
 {
+       CHECK_PJSIP_MODULE_LOADED();
+
        if (build_entity_id()) {
                return AST_MODULE_LOAD_DECLINE;
        }