|
@@ -141,6 +141,9 @@ int hep_capture_id = 1;
|
|
int xheaders_write = 0;
|
|
int xheaders_write = 0;
|
|
int xheaders_read = 0;
|
|
int xheaders_read = 0;
|
|
|
|
|
|
|
|
+str force_send_sock_str = {0, 0};
|
|
|
|
+struct sip_uri * force_send_sock_uri = 0;
|
|
|
|
+
|
|
str dup_uri_str = {0, 0};
|
|
str dup_uri_str = {0, 0};
|
|
struct sip_uri *dup_uri = 0;
|
|
struct sip_uri *dup_uri = 0;
|
|
|
|
|
|
@@ -202,6 +205,7 @@ static param_export_t params[] = {
|
|
{"xheaders_write", INT_PARAM, &xheaders_write },
|
|
{"xheaders_write", INT_PARAM, &xheaders_write },
|
|
{"xheaders_read", INT_PARAM, &xheaders_read },
|
|
{"xheaders_read", INT_PARAM, &xheaders_read },
|
|
{"hep_mode_on", INT_PARAM, &hep_mode_on },
|
|
{"hep_mode_on", INT_PARAM, &hep_mode_on },
|
|
|
|
+ {"force_send_sock", PARAM_STR, &force_send_sock_str },
|
|
{"hep_version", INT_PARAM, &hep_version },
|
|
{"hep_version", INT_PARAM, &hep_version },
|
|
{"hep_capture_id", INT_PARAM, &hep_capture_id },
|
|
{"hep_capture_id", INT_PARAM, &hep_capture_id },
|
|
{"trace_delayed", INT_PARAM, &trace_delayed },
|
|
{"trace_delayed", INT_PARAM, &trace_delayed },
|
|
@@ -290,6 +294,11 @@ static int mod_init(void)
|
|
|
|
|
|
*trace_to_database_flag = trace_to_database;
|
|
*trace_to_database_flag = trace_to_database;
|
|
|
|
|
|
|
|
+ if(hep_version != 1 && hep_version != 2) {
|
|
|
|
+ LM_ERR("unsupported version of HEP");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* Find a database module if needed */
|
|
/* Find a database module if needed */
|
|
if(trace_to_database_flag!=NULL && *trace_to_database_flag!=0) {
|
|
if(trace_to_database_flag!=NULL && *trace_to_database_flag!=0) {
|
|
if (db_bind_mod(&db_url, &db_funcs))
|
|
if (db_bind_mod(&db_url, &db_funcs))
|
|
@@ -378,6 +387,23 @@ static int mod_init(void)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(force_send_sock_str.s!=0)
|
|
|
|
+ {
|
|
|
|
+ force_send_sock_str.len = strlen(force_send_sock_str.s);
|
|
|
|
+ force_send_sock_uri = (struct sip_uri *)pkg_malloc(sizeof(struct sip_uri));
|
|
|
|
+ if(force_send_sock_uri==0)
|
|
|
|
+ {
|
|
|
|
+ LM_ERR("no more pkg memory left\n");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ memset(force_send_sock_uri, 0, sizeof(struct sip_uri));
|
|
|
|
+ if(parse_uri(force_send_sock_str.s, force_send_sock_str.len, force_send_sock_uri)<0)
|
|
|
|
+ {
|
|
|
|
+ LM_ERR("bad dup uri\n");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if(traced_user_avp_str.s && traced_user_avp_str.len > 0)
|
|
if(traced_user_avp_str.s && traced_user_avp_str.len > 0)
|
|
{
|
|
{
|
|
if (pv_parse_spec(&traced_user_avp_str, &avp_spec)==0
|
|
if (pv_parse_spec(&traced_user_avp_str, &avp_spec)==0
|
|
@@ -1564,6 +1590,7 @@ error:
|
|
static int trace_send_hep_duplicate(str *body, str *from, str *to, struct dest_info * dst2)
|
|
static int trace_send_hep_duplicate(str *body, str *from, str *to, struct dest_info * dst2)
|
|
{
|
|
{
|
|
struct dest_info dst;
|
|
struct dest_info dst;
|
|
|
|
+ struct socket_info *si;
|
|
struct dest_info* dst_fin = NULL;
|
|
struct dest_info* dst_fin = NULL;
|
|
struct proxy_l * p=NULL /* make gcc happy */;
|
|
struct proxy_l * p=NULL /* make gcc happy */;
|
|
void* buffer = NULL;
|
|
void* buffer = NULL;
|
|
@@ -1628,6 +1655,19 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to, struct dest_i
|
|
dst_fin = dst2;
|
|
dst_fin = dst2;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (force_send_sock_str.s) {
|
|
|
|
+ LM_DBG("force_send_sock activated, grep for the sock_info\n");
|
|
|
|
+ si = grep_sock_info(&force_send_sock_uri->host,
|
|
|
|
+ (force_send_sock_uri->port_no)?force_send_sock_uri->port_no:SIP_PORT,
|
|
|
|
+ PROTO_UDP);
|
|
|
|
+ if (!si) {
|
|
|
|
+ LM_WARN("cannot grep socket info\n");
|
|
|
|
+ } else {
|
|
|
|
+ LM_DBG("found socket while grep: [%.*s] [%.*s]\n", si->name.len, si->name.s, si->address_str.len, si->address_str.s);
|
|
|
|
+ dst_fin->send_sock = si;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (dst_fin->send_sock == 0) {
|
|
if (dst_fin->send_sock == 0) {
|
|
dst_fin->send_sock=get_send_socket(0, &dst_fin->to, dst_fin->proto);
|
|
dst_fin->send_sock=get_send_socket(0, &dst_fin->to, dst_fin->proto);
|
|
if (dst_fin->send_sock == 0) {
|
|
if (dst_fin->send_sock == 0) {
|