]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_hep_rtcp: Provide chan_sip Call-ID for RTCP messages.
authorJoshua Colp <jcolp@digium.com>
Tue, 9 May 2017 10:25:29 +0000 (10:25 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 9 May 2017 10:38:51 +0000 (05:38 -0500)
This change adds the required logic to allow the SIP
Call-ID to be placed into the HEP RTCP traffic if the
chan_sip module is used. In cases where the option is
enabled but the channel is not either SIP or PJSIP then
the code will fallback to the channel name as done
previously.

Based on the change on Nir's branch at:
team/nirs/hep-chan-sip-support

ASTERISK-26427

Change-Id: I09ffa5f6e2fdfd99ee999650ba4e0a7aad6dc40d

CHANGES
configs/samples/hep.conf.sample
res/res_hep_rtcp.c

diff --git a/CHANGES b/CHANGES
index 010b7e1363b95a4ff7aa0ba8f37afae0a8913dfa..04da51a0e6bb97394f95388d71135c52a679c0ab 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -33,6 +33,12 @@ res_pjsip_config_wizard
    endpoint/outbound_proxy, aor/outbound_proxy and registration/outbound_proxy
    parameters.
 
+res_hep_rtcp
+------------------
+ * If the 'call-id' value is specified for the uuid_type option and a
+   chan_sip channel is used the resulting HEP traffic will now contain the
+   SIP Call-ID instead of the Asterisk channel name.
+
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 14.3.0 to Asterisk 14.4.0 ------------
 ------------------------------------------------------------------------------
index 3d1e74139944a6a2b4343666bc96d3f7223f1511..32bd8df39ff60427ee367d92a6f92e7ff994bdd6 100644 (file)
@@ -24,5 +24,9 @@ capture_id = 1234                  ; A unique integer identifier for this
                                    ; with each packet from this server.
 uuid_type = call-id                ; Specify the preferred source for the Homer
                                    ; correlation UUID. Valid options are:
-                                   ; - 'call-id' for the PJSIP SIP Call-ID
+                                   ; - 'call-id' for the PJSIP or chan_sip SIP
+                                   ;             Call-ID
                                    ; - 'channel' for the Asterisk channel name
+                                   ; Note: If 'call-id' is specified but the
+                                   ; channel is not PJSIP or chan_sip then the
+                                   ; Asterisk channel name will be used instead.
index fb80184b9a3486a69f83e44aba172d4e377c8e0a..bedccc78e6b205af21fc337a9911fd9b17d18728 100644 (file)
@@ -55,12 +55,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);