res_srtp: Add support for libsrtp2.1.
[asterisk/asterisk.git] / res / res_hep_rtcp.c
index 7191f46..31b9c48 100644 (file)
@@ -53,12 +53,22 @@ static char *assign_uuid(struct ast_json *json_channel)
                return NULL;
        }
 
-       if (uuid_type == HEP_UUID_TYPE_CALL_ID && ast_begins_with(channel_name, "PJSIP")) {
-               struct ast_channel *chan = ast_channel_get_by_name(channel_name);
+       if (uuid_type == HEP_UUID_TYPE_CALL_ID) {
+               struct ast_channel *chan = NULL;
                char buf[128];
 
-               if (chan && !ast_func_read(chan, "CHANNEL(pjsip,call-id)", buf, sizeof(buf))) {
-                       uuid = ast_strdup(buf);
+               if (ast_begins_with(channel_name, "PJSIP")) {
+                       chan = ast_channel_get_by_name(channel_name);
+
+                       if (chan && !ast_func_read(chan, "CHANNEL(pjsip,call-id)", buf, sizeof(buf))) {
+                               uuid = ast_strdup(buf);
+                       }
+               } else if (ast_begins_with(channel_name, "SIP")) {
+                       chan = ast_channel_get_by_name(channel_name);
+
+                       if (chan && !ast_func_read(chan, "SIP_HEADER(call-id)", buf, sizeof(buf))) {
+                               uuid = ast_strdup(buf);
+                       }
                }
 
                ast_channel_cleanup(chan);
@@ -171,6 +181,7 @@ static int unload_module(void)
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "RTCP HEPv3 Logger",
+       .support_level = AST_MODULE_SUPPORT_EXTENDED,
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_DEFAULT,