mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
res_hep: Add support for named capture agents.
Adds support for the capture agent name field of the Homer protocol to Asterisk by allowing users to specify a name that will be sent to the HEP server. ASTERISK-30322 #close Change-Id: I6136583017f9dd08daeb8be02f60fb8df4639a2b
This commit is contained in:
committed by
Friendly Automation
parent
b365ea8601
commit
531eacd6c9
@@ -22,6 +22,9 @@ capture_password = foo ; If specified, the authorization password
|
|||||||
capture_id = 1234 ; A unique integer identifier for this
|
capture_id = 1234 ; A unique integer identifier for this
|
||||||
; server. This ID will be embedded sent
|
; server. This ID will be embedded sent
|
||||||
; with each packet from this server.
|
; with each packet from this server.
|
||||||
|
;capture_name = asterisk ; A unique string identifier for this
|
||||||
|
; server. This ID will be embedded sent
|
||||||
|
; with each packet from this server.
|
||||||
uuid_type = call-id ; Specify the preferred source for the Homer
|
uuid_type = call-id ; Specify the preferred source for the Homer
|
||||||
; correlation UUID. Valid options are:
|
; correlation UUID. Valid options are:
|
||||||
; - 'call-id' for the PJSIP or chan_sip SIP
|
; - 'call-id' for the PJSIP or chan_sip SIP
|
||||||
|
5
doc/CHANGES-staging/res_hep.txt
Normal file
5
doc/CHANGES-staging/res_hep.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Subject: Add support for named capture agent.
|
||||||
|
|
||||||
|
A name for the capture agent can now be specified
|
||||||
|
using the capture_name option which, if specified,
|
||||||
|
will be sent to the HEP server.
|
@@ -78,6 +78,9 @@
|
|||||||
<configOption name="capture_id" default="0">
|
<configOption name="capture_id" default="0">
|
||||||
<synopsis>The ID for this capture agent.</synopsis>
|
<synopsis>The ID for this capture agent.</synopsis>
|
||||||
</configOption>
|
</configOption>
|
||||||
|
<configOption name="capture_name" default="">
|
||||||
|
<synopsis>The name for this capture agent.</synopsis>
|
||||||
|
</configOption>
|
||||||
</configObject>
|
</configObject>
|
||||||
</configFile>
|
</configFile>
|
||||||
</configInfo>
|
</configInfo>
|
||||||
@@ -155,6 +158,9 @@ enum hepv3_chunk_types {
|
|||||||
|
|
||||||
/*! THE UUID FOR THIS PACKET */
|
/*! THE UUID FOR THIS PACKET */
|
||||||
CHUNK_TYPE_UUID = 0X0011,
|
CHUNK_TYPE_UUID = 0X0011,
|
||||||
|
|
||||||
|
/*! THE CAPTURE AGENT NAME */
|
||||||
|
CHUNK_TYPE_CAPTURE_AGENT_NAME = 0X0013,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INITIALIZE_GENERIC_HEP_IDS(hep_chunk, type) do { \
|
#define INITIALIZE_GENERIC_HEP_IDS(hep_chunk, type) do { \
|
||||||
@@ -240,6 +246,7 @@ struct hepv3_global_config {
|
|||||||
AST_DECLARE_STRING_FIELDS(
|
AST_DECLARE_STRING_FIELDS(
|
||||||
AST_STRING_FIELD(capture_address); /*!< Address to send to */
|
AST_STRING_FIELD(capture_address); /*!< Address to send to */
|
||||||
AST_STRING_FIELD(capture_password); /*!< Password for Homer server */
|
AST_STRING_FIELD(capture_password); /*!< Password for Homer server */
|
||||||
|
AST_STRING_FIELD(capture_name); /*!< Capture name for this agent */
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -458,7 +465,7 @@ static int hep_queue_cb(void *data)
|
|||||||
unsigned int packet_len = 0, sock_buffer_len;
|
unsigned int packet_len = 0, sock_buffer_len;
|
||||||
struct hep_chunk_ip4 ipv4_src, ipv4_dst;
|
struct hep_chunk_ip4 ipv4_src, ipv4_dst;
|
||||||
struct hep_chunk_ip6 ipv6_src, ipv6_dst;
|
struct hep_chunk_ip6 ipv6_src, ipv6_dst;
|
||||||
struct hep_chunk auth_key, payload, uuid;
|
struct hep_chunk auth_key, payload, uuid, capturename;
|
||||||
void *sock_buffer;
|
void *sock_buffer;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@@ -512,6 +519,10 @@ static int hep_queue_cb(void *data)
|
|||||||
INITIALIZE_GENERIC_HEP_IDS_VAR(&auth_key, CHUNK_TYPE_AUTH_KEY, strlen(config->general->capture_password));
|
INITIALIZE_GENERIC_HEP_IDS_VAR(&auth_key, CHUNK_TYPE_AUTH_KEY, strlen(config->general->capture_password));
|
||||||
packet_len += (sizeof(auth_key) + strlen(config->general->capture_password));
|
packet_len += (sizeof(auth_key) + strlen(config->general->capture_password));
|
||||||
}
|
}
|
||||||
|
if (!ast_strlen_zero(config->general->capture_name)) {
|
||||||
|
INITIALIZE_GENERIC_HEP_IDS_VAR(&capturename, CHUNK_TYPE_CAPTURE_AGENT_NAME, strlen(config->general->capture_name));
|
||||||
|
packet_len += (sizeof(capturename) + strlen(config->general->capture_name));
|
||||||
|
}
|
||||||
INITIALIZE_GENERIC_HEP_IDS_VAR(&uuid, CHUNK_TYPE_UUID, strlen(capture_info->uuid));
|
INITIALIZE_GENERIC_HEP_IDS_VAR(&uuid, CHUNK_TYPE_UUID, strlen(capture_info->uuid));
|
||||||
packet_len += (sizeof(uuid) + strlen(capture_info->uuid));
|
packet_len += (sizeof(uuid) + strlen(capture_info->uuid));
|
||||||
INITIALIZE_GENERIC_HEP_IDS_VAR(&payload,
|
INITIALIZE_GENERIC_HEP_IDS_VAR(&payload,
|
||||||
@@ -556,6 +567,14 @@ static int hep_queue_cb(void *data)
|
|||||||
memcpy(sock_buffer + sock_buffer_len, capture_info->uuid, strlen(capture_info->uuid));
|
memcpy(sock_buffer + sock_buffer_len, capture_info->uuid, strlen(capture_info->uuid));
|
||||||
sock_buffer_len += strlen(capture_info->uuid);
|
sock_buffer_len += strlen(capture_info->uuid);
|
||||||
|
|
||||||
|
/* Capture Agent Name */
|
||||||
|
if (!ast_strlen_zero(config->general->capture_name)) {
|
||||||
|
memcpy(sock_buffer + sock_buffer_len, &capturename, sizeof(capturename));
|
||||||
|
sock_buffer_len += sizeof(capturename);
|
||||||
|
memcpy(sock_buffer + sock_buffer_len, config->general->capture_name, strlen(config->general->capture_name));
|
||||||
|
sock_buffer_len += strlen(config->general->capture_name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Packet! */
|
/* Packet! */
|
||||||
memcpy(sock_buffer + sock_buffer_len, &payload, sizeof(payload));
|
memcpy(sock_buffer + sock_buffer_len, &payload, sizeof(payload));
|
||||||
sock_buffer_len += sizeof(payload);
|
sock_buffer_len += sizeof(payload);
|
||||||
@@ -681,6 +700,7 @@ static int load_module(void)
|
|||||||
aco_option_register(&cfg_info, "capture_address", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 1, STRFLDSET(struct hepv3_global_config, capture_address));
|
aco_option_register(&cfg_info, "capture_address", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 1, STRFLDSET(struct hepv3_global_config, capture_address));
|
||||||
aco_option_register(&cfg_info, "capture_password", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct hepv3_global_config, capture_password));
|
aco_option_register(&cfg_info, "capture_password", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct hepv3_global_config, capture_password));
|
||||||
aco_option_register(&cfg_info, "capture_id", ACO_EXACT, global_options, "0", OPT_UINT_T, 0, STRFLDSET(struct hepv3_global_config, capture_id));
|
aco_option_register(&cfg_info, "capture_id", ACO_EXACT, global_options, "0", OPT_UINT_T, 0, STRFLDSET(struct hepv3_global_config, capture_id));
|
||||||
|
aco_option_register(&cfg_info, "capture_name", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct hepv3_global_config, capture_name));
|
||||||
aco_option_register_custom(&cfg_info, "uuid_type", ACO_EXACT, global_options, "call-id", uuid_type_handler, 0);
|
aco_option_register_custom(&cfg_info, "uuid_type", ACO_EXACT, global_options, "call-id", uuid_type_handler, 0);
|
||||||
|
|
||||||
if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
|
if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
|
||||||
|
Reference in New Issue
Block a user