res_hep_rtcp: Provide chan_sip Call-ID for RTCP messages.

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
This commit is contained in:
Joshua Colp
2017-05-09 10:25:29 +00:00
parent 371213217c
commit 10a49ab362
3 changed files with 25 additions and 5 deletions

View 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);