mirror of https://github.com/sipwise/kamailio.git
* remove already applied patches * revert 79be32bcc45775f703319730d405727b0a983726 from upstream collides with our implementation * refresh patches * add upstream patches from 5.5 Change-Id: I64b551e31b07c7d2df644e7c2d98c2b27639be3amr9.5.1
parent
f274ec75e6
commit
8d03aef662
@ -0,0 +1,510 @@
|
||||
From 58fc634fe98953a2dfa1dd1ba9cf5e5c1d57416f Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Wed, 12 May 2021 11:40:59 +0200
|
||||
Subject: [PATCH] Revert "pua_dialoginfo: disable publish notifications for
|
||||
subsequent requests (key: publish_dialog_req_within)"
|
||||
|
||||
This reverts commit 79be32bcc45775f703319730d405727b0a983726.
|
||||
---
|
||||
.../pua_dialoginfo/doc/pua_dialoginfo.xml | 9 -
|
||||
.../doc/pua_dialoginfo_admin.xml | 66 +-----
|
||||
src/modules/pua_dialoginfo/pua_dialoginfo.c | 188 ++++++------------
|
||||
src/modules/pua_dialoginfo/pua_dialoginfo.h | 3 -
|
||||
4 files changed, 61 insertions(+), 205 deletions(-)
|
||||
|
||||
diff --git a/src/modules/pua_dialoginfo/doc/pua_dialoginfo.xml b/src/modules/pua_dialoginfo/doc/pua_dialoginfo.xml
|
||||
index df1e08557e..fd0a3fac5f 100644
|
||||
--- a/src/modules/pua_dialoginfo/doc/pua_dialoginfo.xml
|
||||
+++ b/src/modules/pua_dialoginfo/doc/pua_dialoginfo.xml
|
||||
@@ -45,11 +45,6 @@
|
||||
<email>phil.lavin@synety.com</email>
|
||||
</address>
|
||||
</editor>
|
||||
- <editor>
|
||||
- <firstname>Frederic</firstname>
|
||||
- <surname>Gaisnon</surname>
|
||||
- <email>frederic.gaisnon@gmail.com</email>
|
||||
- </editor>
|
||||
</authorgroup>
|
||||
<copyright>
|
||||
<year>2006</year>
|
||||
@@ -59,10 +54,6 @@
|
||||
<year>2008</year>
|
||||
<holder>Klaus Darilion IPCom</holder>
|
||||
</copyright>
|
||||
- <copyright>
|
||||
- <year>2021</year>
|
||||
- <holder>MomentTech</holder>
|
||||
- </copyright>
|
||||
</bookinfo>
|
||||
<toc></toc>
|
||||
|
||||
diff --git a/src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml b/src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml
|
||||
index 191ee5f4e7..81ef722a4f 100644
|
||||
--- a/src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml
|
||||
+++ b/src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml
|
||||
@@ -536,71 +536,7 @@ modparam("pua_dialoginfo", "callee_trying", 1)
|
||||
</programlisting>
|
||||
</example>
|
||||
</section>
|
||||
-
|
||||
- <section>
|
||||
- <title><varname>caller_entity_when_publish_disabled</varname> (int)</title>
|
||||
- <para>
|
||||
- Must be a valid sip uri.
|
||||
- If this parameter is set, this uri is used as caller entity in
|
||||
- publish xml body if associated dialog has the flag
|
||||
- disable_caller_publish_flag set.
|
||||
- Note only the flag received on dialog creation is used to activate
|
||||
- this feature.
|
||||
- </para>
|
||||
- <para>
|
||||
- <emphasis>Default value is <quote>NULL</quote>.</emphasis>
|
||||
- </para>
|
||||
- <example>
|
||||
- <title>Set <varname>caller_entity_when_publish_disabled</varname> parameter</title>
|
||||
- <programlisting format="linespecific">
|
||||
-...
|
||||
-modparam("pua_dialoginfo", "caller_entity_when_publish_disabled", "sip:caller@publish.disabled.com")
|
||||
-...
|
||||
- </programlisting>
|
||||
- </example>
|
||||
- </section>
|
||||
-
|
||||
- <section>
|
||||
- <title><varname>callee_entity_when_publish_disabled</varname> (int)</title>
|
||||
- <para>
|
||||
- Must be a valid sip uri.
|
||||
- If this parameter is set, this uri is used as callee entity in
|
||||
- publish xml body if associated dialog has the flag
|
||||
- disable_callee_publish_flag set.
|
||||
- Note only the flag received on dialog creation is used to activate
|
||||
- this feature.
|
||||
- </para>
|
||||
- <para>
|
||||
- <emphasis>Default value is <quote>NULL</quote>.</emphasis>
|
||||
- </para>
|
||||
- <example>
|
||||
- <title>Set <varname>callee_entity_when_publish_disabled</varname> parameter</title>
|
||||
- <programlisting format="linespecific">
|
||||
-...
|
||||
-modparam("pua_dialoginfo", "callee_entity_when_publish_disabled", "sip:callee@publish.disabled.com")
|
||||
-...
|
||||
- </programlisting>
|
||||
- </example>
|
||||
- </section>
|
||||
-
|
||||
- <section>
|
||||
- <title><varname>publish_dialog_req_within</varname> (int)</title>
|
||||
- <para>
|
||||
- If this parameter is set to 1, subsequents requests received in dialog generate
|
||||
- corresponding publish request.
|
||||
- </para>
|
||||
- <para>
|
||||
- <emphasis>Default value is <quote>1</quote>.</emphasis>
|
||||
- </para>
|
||||
- <example>
|
||||
- <title>Set <varname>publish_dialog_req_within</varname> parameter</title>
|
||||
- <programlisting format="linespecific">
|
||||
-...
|
||||
-modparam("pua_dialoginfo", "publish_dialog_req_within", 0)
|
||||
-...
|
||||
- </programlisting>
|
||||
- </example>
|
||||
- </section>
|
||||
+ </section>
|
||||
|
||||
<section id="pua_dialoginfo.p.attribute_display">
|
||||
<title><varname>attribute_display</varname> (int)</title>
|
||||
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.c b/src/modules/pua_dialoginfo/pua_dialoginfo.c
|
||||
index 7e7afe2eae..9ff64aa023 100644
|
||||
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.c
|
||||
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.c
|
||||
@@ -63,7 +63,6 @@ MODULE_VERSION
|
||||
#define DEF_CALLEE_TRYING 0
|
||||
#define DEF_DISABLE_CALLER_PUBLISH_FLAG -1
|
||||
#define DEF_DISABLE_CALLEE_PUBLISH_FLAG -1
|
||||
-#define DEF_PUBLISH_DIALOG_REQ_WITHIN 1
|
||||
|
||||
/* define PUA_DIALOGINFO_DEBUG to activate more verbose
|
||||
* logging and dialog info callback debugging
|
||||
@@ -81,8 +80,6 @@ int_str pubruri_callee_avp_name;
|
||||
|
||||
static str caller_dlg_var = {0, 0}; /* pubruri_caller */
|
||||
static str callee_dlg_var = {0, 0}; /* pubruri_callee */
|
||||
-static str caller_entity_when_publish_disabled = {0, 0}; /* pubruri_caller */
|
||||
-static str callee_entity_when_publish_disabled = {0, 0}; /* pubruri_callee */
|
||||
|
||||
/* Module parameter variables */
|
||||
int include_callid = DEF_INCLUDE_CALLID;
|
||||
@@ -98,7 +95,7 @@ int disable_caller_publish_flag = DEF_DISABLE_CALLER_PUBLISH_FLAG;
|
||||
int disable_callee_publish_flag = DEF_DISABLE_CALLEE_PUBLISH_FLAG;
|
||||
char * pubruri_caller_avp = DEF_PUBRURI_CALLER_AVP;
|
||||
char * pubruri_callee_avp = DEF_PUBRURI_CALLEE_AVP;
|
||||
-int publish_dialog_req_within = DEF_PUBLISH_DIALOG_REQ_WITHIN;
|
||||
+
|
||||
|
||||
int puadinfo_attribute_display = 0;
|
||||
|
||||
@@ -128,9 +125,6 @@ static param_export_t params[]={
|
||||
{"callee_trying", INT_PARAM, &callee_trying },
|
||||
{"disable_caller_publish_flag", INT_PARAM, &disable_caller_publish_flag },
|
||||
{"disable_callee_publish_flag", INT_PARAM, &disable_callee_publish_flag },
|
||||
- {"caller_entity_when_publish_disabled", PARAM_STR, &caller_entity_when_publish_disabled },
|
||||
- {"callee_entity_when_publish_disabled", PARAM_STR, &callee_entity_when_publish_disabled },
|
||||
- {"publish_dialog_req_within", INT_PARAM, &publish_dialog_req_within },
|
||||
{"attribute_display", PARAM_INT, &puadinfo_attribute_display },
|
||||
{0, 0, 0 }
|
||||
};
|
||||
@@ -258,7 +252,6 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
|
||||
{
|
||||
str tag = {0,0};
|
||||
str uri = {0,0};
|
||||
- str identity_local = {0,0};
|
||||
str target = {0,0};
|
||||
struct dlginfo_cell *dlginfo = NULL;
|
||||
|
||||
@@ -281,33 +274,25 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
|
||||
uri = dlginfo->to_uri;
|
||||
}
|
||||
|
||||
- if (dlginfo->disable_caller_publish) {
|
||||
- identity_local=caller_entity_when_publish_disabled;
|
||||
- } else {
|
||||
- identity_local=dlginfo->from_uri;
|
||||
- }
|
||||
-
|
||||
- if (dlginfo->disable_callee_publish) {
|
||||
- uri=callee_entity_when_publish_disabled;
|
||||
- }
|
||||
-
|
||||
switch (type) {
|
||||
case DLGCB_FAILED:
|
||||
case DLGCB_TERMINATED:
|
||||
case DLGCB_EXPIRED:
|
||||
LM_DBG("dialog over, from=%.*s\n", dlginfo->from_uri.len,
|
||||
dlginfo->from_uri.s);
|
||||
- if ((!dlginfo->disable_caller_publish) && (disable_caller_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_caller_publish_flag))))) {
|
||||
+ if (disable_caller_publish_flag == -1 || !(request
|
||||
+ && (request->flags & (1<<disable_caller_publish_flag))))
|
||||
+ {
|
||||
dialog_publish_multi("terminated", dlginfo->pubruris_caller,
|
||||
- &identity_local, &uri, &(dlginfo->callid), 1,
|
||||
+ &(dlginfo->from_uri), &uri, &(dlginfo->callid), 1,
|
||||
10, 0, 0, &(dlginfo->from_contact),
|
||||
&target, send_publish_flag==-1?1:0);
|
||||
}
|
||||
- if ((!dlginfo->disable_callee_publish) && (disable_callee_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_callee_publish_flag))))) {
|
||||
+ if (disable_callee_publish_flag == -1 || !(request
|
||||
+ && (request->flags & (1<<disable_callee_publish_flag))))
|
||||
+ {
|
||||
dialog_publish_multi("terminated", dlginfo->pubruris_callee,
|
||||
- &uri, &identity_local, &(dlginfo->callid), 0,
|
||||
+ &uri, &(dlginfo->from_uri), &(dlginfo->callid), 0,
|
||||
10, 0, 0, &target, &(dlginfo->from_contact),
|
||||
send_publish_flag==-1?1:0);
|
||||
}
|
||||
@@ -317,17 +302,19 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
|
||||
case DLGCB_CONFIRMED_NA:
|
||||
LM_DBG("dialog confirmed, from=%.*s\n", dlginfo->from_uri.len,
|
||||
dlginfo->from_uri.s);
|
||||
- if ((!dlginfo->disable_caller_publish) && (disable_caller_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_caller_publish_flag))))) {
|
||||
+ if (disable_caller_publish_flag == -1 || !(request
|
||||
+ && (request->flags & (1<<disable_caller_publish_flag))))
|
||||
+ {
|
||||
dialog_publish_multi("confirmed", dlginfo->pubruris_caller,
|
||||
- &identity_local, &uri, &(dlginfo->callid), 1,
|
||||
+ &(dlginfo->from_uri), &uri, &(dlginfo->callid), 1,
|
||||
dlginfo->lifetime, 0, 0, &(dlginfo->from_contact), &target,
|
||||
send_publish_flag==-1?1:0);
|
||||
}
|
||||
- if ((!dlginfo->disable_callee_publish) && (disable_callee_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_callee_publish_flag))))) {
|
||||
+ if (disable_callee_publish_flag == -1 || !(request
|
||||
+ && (request->flags & (1<<disable_callee_publish_flag))))
|
||||
+ {
|
||||
dialog_publish_multi("confirmed", dlginfo->pubruris_callee, &uri,
|
||||
- &identity_local, &(dlginfo->callid), 0,
|
||||
+ &(dlginfo->from_uri), &(dlginfo->callid), 0,
|
||||
dlginfo->lifetime, 0, 0, &target, &(dlginfo->from_contact),
|
||||
send_publish_flag==-1?1:0);
|
||||
}
|
||||
@@ -363,51 +350,54 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
|
||||
tag.len = 0;
|
||||
}
|
||||
}
|
||||
- if ((!dlginfo->disable_caller_publish) && (disable_caller_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_caller_publish_flag))))) {
|
||||
+ if (disable_caller_publish_flag == -1 || !(request
|
||||
+ && (request->flags & (1<<disable_caller_publish_flag))))
|
||||
+ {
|
||||
if (caller_confirmed) {
|
||||
dialog_publish_multi("confirmed", dlginfo->pubruris_caller,
|
||||
- &identity_local, &uri, &(dlginfo->callid), 1,
|
||||
+ &(dlginfo->from_uri), &uri, &(dlginfo->callid), 1,
|
||||
dlginfo->lifetime, &(dlginfo->from_tag), &tag,
|
||||
&(dlginfo->from_contact), &target,
|
||||
send_publish_flag==-1?1:0);
|
||||
} else {
|
||||
dialog_publish_multi("early", dlginfo->pubruris_caller,
|
||||
- &identity_local, &uri, &(dlginfo->callid), 1,
|
||||
+ &(dlginfo->from_uri), &uri, &(dlginfo->callid), 1,
|
||||
dlginfo->lifetime, &(dlginfo->from_tag), &tag,
|
||||
&(dlginfo->from_contact), &target,
|
||||
send_publish_flag==-1?1:0);
|
||||
}
|
||||
}
|
||||
- if ((!dlginfo->disable_callee_publish) && (disable_callee_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_callee_publish_flag))))) {
|
||||
+ if (disable_callee_publish_flag == -1 || !(request &&
|
||||
+ (request->flags & (1<<disable_callee_publish_flag))))
|
||||
+ {
|
||||
dialog_publish_multi("early", dlginfo->pubruris_callee, &uri,
|
||||
- &identity_local, &(dlginfo->callid), 0,
|
||||
+ &(dlginfo->from_uri), &(dlginfo->callid), 0,
|
||||
dlginfo->lifetime, &tag, &(dlginfo->from_tag), &target,
|
||||
&(dlginfo->from_contact), send_publish_flag==-1?1:0);
|
||||
}
|
||||
|
||||
} else {
|
||||
- if ((!dlginfo->disable_caller_publish) && (disable_caller_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_caller_publish_flag))))) {
|
||||
+ if (disable_caller_publish_flag == -1 || !(request &&
|
||||
+ (request->flags & (1<<disable_caller_publish_flag))))
|
||||
+ {
|
||||
if (caller_confirmed) {
|
||||
dialog_publish_multi("confirmed", dlginfo->pubruris_caller,
|
||||
- &identity_local, &uri, &(dlginfo->callid), 1,
|
||||
+ &(dlginfo->from_uri), &uri, &(dlginfo->callid), 1,
|
||||
dlginfo->lifetime, 0, 0, &(dlginfo->from_contact),
|
||||
&target, send_publish_flag==-1?1:0);
|
||||
|
||||
} else {
|
||||
dialog_publish_multi("early", dlginfo->pubruris_caller,
|
||||
- &identity_local, &uri, &(dlginfo->callid), 1,
|
||||
+ &(dlginfo->from_uri), &uri, &(dlginfo->callid), 1,
|
||||
dlginfo->lifetime, 0, 0, &(dlginfo->from_contact),
|
||||
&target, send_publish_flag==-1?1:0);
|
||||
}
|
||||
}
|
||||
- if ((!dlginfo->disable_callee_publish) && (disable_callee_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_callee_publish_flag)))))
|
||||
+ if (disable_callee_publish_flag == -1 || !(request
|
||||
+ && (request->flags & (1<<disable_callee_publish_flag))))
|
||||
{
|
||||
dialog_publish_multi("early", dlginfo->pubruris_callee, &uri,
|
||||
- &identity_local, &(dlginfo->callid), 0,
|
||||
+ &(dlginfo->from_uri), &(dlginfo->callid), 0,
|
||||
dlginfo->lifetime, 0, 0, &target,
|
||||
&(dlginfo->from_contact), send_publish_flag==-1?1:0);
|
||||
}
|
||||
@@ -416,17 +406,19 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
|
||||
default:
|
||||
LM_ERR("unhandled dialog callback type %d received, from=%.*s\n",
|
||||
type, dlginfo->from_uri.len, dlginfo->from_uri.s);
|
||||
- if ((!dlginfo->disable_caller_publish) && (disable_caller_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_caller_publish_flag))))) {
|
||||
+ if (disable_caller_publish_flag == -1 || !(request &&
|
||||
+ (request->flags & (1<<disable_caller_publish_flag))))
|
||||
+ {
|
||||
dialog_publish_multi("terminated", dlginfo->pubruris_caller,
|
||||
- &identity_local, &uri, &(dlginfo->callid), 1,
|
||||
+ &(dlginfo->from_uri), &uri, &(dlginfo->callid), 1,
|
||||
10, 0, 0, &(dlginfo->from_contact), &target,
|
||||
send_publish_flag==-1?1:0);
|
||||
}
|
||||
- if ((!dlginfo->disable_callee_publish) && (disable_callee_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_callee_publish_flag))))) {
|
||||
+ if (disable_callee_publish_flag == -1 || !(request &&
|
||||
+ (request->flags & (1<<disable_callee_publish_flag))))
|
||||
+ {
|
||||
dialog_publish_multi("terminated", dlginfo->pubruris_callee, &uri,
|
||||
- &identity_local, &(dlginfo->callid), 0,
|
||||
+ &(dlginfo->from_uri), &(dlginfo->callid), 0,
|
||||
10, 0, 0, &target, &(dlginfo->from_contact),
|
||||
send_publish_flag==-1?1:0);
|
||||
}
|
||||
@@ -482,7 +474,7 @@ struct str_list* get_str_list(unsigned short avp_flags, int_str avp_name) {
|
||||
|
||||
}
|
||||
|
||||
-struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable_caller_publish, int disable_callee_publish)
|
||||
+struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type)
|
||||
{
|
||||
struct dlginfo_cell *dlginfo;
|
||||
int len;
|
||||
@@ -506,8 +498,6 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
|
||||
|
||||
/* copy from dlg structure to dlginfo structure */
|
||||
dlginfo->lifetime = override_lifetime ? override_lifetime : dlg->lifetime;
|
||||
- dlginfo->disable_caller_publish = disable_caller_publish;
|
||||
- dlginfo->disable_callee_publish = disable_callee_publish;
|
||||
dlginfo->from_uri.s = (char*)dlginfo + sizeof(struct dlginfo_cell);
|
||||
dlginfo->from_uri.len = dlg->from_uri.len;
|
||||
dlginfo->to_uri.s = dlginfo->from_uri.s + dlg->from_uri.len;
|
||||
@@ -609,25 +599,14 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
|
||||
}
|
||||
|
||||
/* register dialog callbacks which triggers sending PUBLISH */
|
||||
- if (publish_dialog_req_within) {
|
||||
- if (dlg_api.register_dlgcb(dlg,
|
||||
+ if (dlg_api.register_dlgcb(dlg,
|
||||
DLGCB_FAILED| DLGCB_CONFIRMED_NA | DLGCB_TERMINATED
|
||||
| DLGCB_EXPIRED | DLGCB_REQ_WITHIN | DLGCB_EARLY,
|
||||
__dialog_sendpublish, dlginfo, free_dlginfo_cell) != 0) {
|
||||
- LM_ERR("cannot register callback for interesting dialog types\n");
|
||||
- free_dlginfo_cell(dlginfo);
|
||||
- return NULL;
|
||||
- }
|
||||
- } else {
|
||||
- if (dlg_api.register_dlgcb(dlg,
|
||||
- DLGCB_FAILED| DLGCB_CONFIRMED_NA | DLGCB_TERMINATED
|
||||
- | DLGCB_EXPIRED | DLGCB_EARLY,
|
||||
- __dialog_sendpublish, dlginfo, free_dlginfo_cell) != 0) {
|
||||
- LM_ERR("cannot register callback for interesting dialog types\n");
|
||||
- free_dlginfo_cell(dlginfo);
|
||||
- return NULL;
|
||||
- }
|
||||
- }
|
||||
+ LM_ERR("cannot register callback for interesting dialog types\n");
|
||||
+ free_dlginfo_cell(dlginfo);
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
#ifdef PUA_DIALOGINFO_DEBUG
|
||||
/* dialog callback testing (registered last to be executed frist) */
|
||||
@@ -651,10 +630,6 @@ __dialog_created(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
|
||||
{
|
||||
struct sip_msg *request = _params->req;
|
||||
struct dlginfo_cell *dlginfo;
|
||||
- str identity_remote = {0,0};
|
||||
- str identity_local = {0,0};
|
||||
- int disable_caller_publish = 0;
|
||||
- int disable_callee_publish = 0;
|
||||
|
||||
if (request==NULL || request->REQ_METHOD != METHOD_INVITE)
|
||||
return;
|
||||
@@ -665,46 +640,26 @@ __dialog_created(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
|
||||
LM_DBG("new INVITE dialog created: from=%.*s\n",
|
||||
dlg->from_uri.len, dlg->from_uri.s);
|
||||
|
||||
- if (disable_caller_publish_flag != -1 && caller_entity_when_publish_disabled.len > 0 &&
|
||||
- (request && (request->flags & (1<<disable_caller_publish_flag)))) {
|
||||
- disable_caller_publish = 1;
|
||||
- }
|
||||
-
|
||||
- if (disable_callee_publish_flag != -1 && callee_entity_when_publish_disabled.len > 0 &&
|
||||
- (request && (request->flags & (1<<disable_callee_publish_flag)))) {
|
||||
- disable_callee_publish=1;
|
||||
- }
|
||||
-
|
||||
- dlginfo=get_dialog_data(dlg, type, disable_caller_publish, disable_callee_publish);
|
||||
+ dlginfo=get_dialog_data(dlg, type);
|
||||
if(dlginfo==NULL)
|
||||
return;
|
||||
|
||||
- if (disable_caller_publish) {
|
||||
- identity_local=caller_entity_when_publish_disabled;
|
||||
- } else {
|
||||
- identity_local=dlginfo->from_uri;
|
||||
- }
|
||||
-
|
||||
- if (disable_callee_publish) {
|
||||
- identity_remote=callee_entity_when_publish_disabled;
|
||||
- } else {
|
||||
- identity_remote=(include_req_uri)?dlg->req_uri:dlg->to_uri;
|
||||
- }
|
||||
-
|
||||
- if ((!disable_caller_publish) && (disable_caller_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_caller_publish_flag))))) {
|
||||
+ if (disable_caller_publish_flag == -1 || !(request && (request->flags
|
||||
+ & (1<<disable_caller_publish_flag))))
|
||||
+ {
|
||||
dialog_publish_multi("Trying", dlginfo->pubruris_caller,
|
||||
- &identity_local,
|
||||
- &identity_remote,
|
||||
+ &(dlg->from_uri),
|
||||
+ (include_req_uri)?&(dlg->req_uri):&(dlg->to_uri),
|
||||
&(dlg->callid), 1, dlginfo->lifetime,
|
||||
0, 0, 0, 0, (send_publish_flag==-1)?1:0);
|
||||
}
|
||||
|
||||
- if (callee_trying && ((!disable_callee_publish) && (disable_callee_publish_flag == -1 || !(request
|
||||
- && (request->flags & (1<<disable_callee_publish_flag)))))) {
|
||||
+ if (callee_trying && (disable_callee_publish_flag == -1 || !(request
|
||||
+ && (request->flags & (1<<disable_callee_publish_flag)))))
|
||||
+ {
|
||||
dialog_publish_multi("Trying", dlginfo->pubruris_callee,
|
||||
- &identity_remote,
|
||||
- &identity_local,
|
||||
+ (include_req_uri)?&(dlg->req_uri):&(dlg->to_uri),
|
||||
+ &(dlg->from_uri),
|
||||
&(dlg->callid), 0, dlginfo->lifetime,
|
||||
0, 0, 0, 0, (send_publish_flag==-1)?1:0);
|
||||
}
|
||||
@@ -718,7 +673,7 @@ __dialog_loaded(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
|
||||
LM_DBG("INVITE dialog loaded: from=%.*s\n",
|
||||
dlg->from_uri.len, dlg->from_uri.s);
|
||||
|
||||
- dlginfo=get_dialog_data(dlg, type, 0, 0);
|
||||
+ dlginfo=get_dialog_data(dlg, type);
|
||||
if(dlginfo!=NULL) {
|
||||
LM_DBG("dialog info initialized (from=%.*s)\n",
|
||||
dlg->from_uri.len, dlg->from_uri.s);
|
||||
@@ -736,7 +691,6 @@ static int mod_init(void)
|
||||
|
||||
str s;
|
||||
pv_spec_t avp_spec;
|
||||
- struct sip_uri ruri_uri;
|
||||
|
||||
if(caller_dlg_var.len<=0) {
|
||||
LM_WARN("pubruri_caller_dlg_var is not set"
|
||||
@@ -748,28 +702,6 @@ static int mod_init(void)
|
||||
" - restore on restart disabled\n");
|
||||
}
|
||||
|
||||
- if((caller_entity_when_publish_disabled.len > 0) && (disable_caller_publish_flag == -1)) {
|
||||
- LM_WARN("caller_entity_when_publish_disabled is set but disable_caller_publish_flag is not defined"
|
||||
- " - caller_entity_when_publish_disabled cannot be used \n");
|
||||
- }
|
||||
-
|
||||
- if((callee_entity_when_publish_disabled.len > 0) && (disable_callee_publish_flag == -1)) {
|
||||
- LM_WARN("callee_entity_when_publish_disabled is set but disable_callee_publish_flag is not defined"
|
||||
- " - callee_entity_when_publish_disabled cannot be used \n");
|
||||
- }
|
||||
-
|
||||
- if ((caller_entity_when_publish_disabled.len > 0) &&
|
||||
- (parse_uri(caller_entity_when_publish_disabled.s, caller_entity_when_publish_disabled.len, &ruri_uri) < 0)) {
|
||||
- LM_ERR("caller_entity_when_publish_disabled is not a valid SIP uri\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if ((callee_entity_when_publish_disabled.len > 0) &&
|
||||
- (parse_uri(callee_entity_when_publish_disabled.s, callee_entity_when_publish_disabled.len, &ruri_uri) < 0)) {
|
||||
- LM_ERR("callee_entity_when_publish_disabled is not a valid SIP uri\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
bind_pua= (bind_pua_t)find_export("bind_pua", 1,0);
|
||||
if (!bind_pua)
|
||||
{
|
||||
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.h b/src/modules/pua_dialoginfo/pua_dialoginfo.h
|
||||
index 2551beb4fa..01fc876999 100644
|
||||
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.h
|
||||
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.h
|
||||
@@ -45,9 +45,6 @@ struct dlginfo_cell {
|
||||
struct str_list* pubruris_caller;
|
||||
struct str_list* pubruris_callee;
|
||||
unsigned int lifetime;
|
||||
- /*dialog module does not always resend all flags, so we use flags set on first request*/
|
||||
- int disable_caller_publish;
|
||||
- int disable_callee_publish;
|
||||
};
|
||||
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,98 +0,0 @@
|
||||
--- a/src/modules/rtpengine/rtpengine.c
|
||||
+++ b/src/modules/rtpengine/rtpengine.c
|
||||
@@ -119,7 +119,8 @@
|
||||
int via, to, packetize, transport, directional;
|
||||
bencode_item_t *dict, *flags, *direction, *replace, *rtcp_mux, *sdes,
|
||||
*t38,
|
||||
- *codec, *codec_strip, *codec_offer, *codec_transcode, *codec_mask;
|
||||
+ *codec, *codec_strip, *codec_offer, *codec_transcode, *codec_mask,
|
||||
+ *codec_set, *codec_except;
|
||||
str call_id, from_tag, to_tag;
|
||||
};
|
||||
|
||||
@@ -2082,6 +2083,29 @@
|
||||
[0x06] = "UDP/TLS/RTP/SAVPF",
|
||||
};
|
||||
|
||||
+static int parse_codec_flag(struct ng_flags_parse *ng_flags, const str *key, const str *val,
|
||||
+ const char *cmp1, const char *cmp2, const char *dictstr,
|
||||
+ bencode_item_t **dictp)
|
||||
+{
|
||||
+ str s;
|
||||
+
|
||||
+ if (!str_key_val_prefix(key, cmp1, val, &s)) {
|
||||
+ if (!cmp2)
|
||||
+ return 0;
|
||||
+ if (!str_key_val_prefix(key, cmp2, val, &s))
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!*dictp) {
|
||||
+ *dictp = bencode_list(ng_flags->dict->buffer);
|
||||
+ bencode_dictionary_add(ng_flags->codec, dictstr,
|
||||
+ *dictp);
|
||||
+ }
|
||||
+ bencode_list_add_str(*dictp, &s);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enum rtpe_operation *op,
|
||||
const char *flags_str)
|
||||
{
|
||||
@@ -2135,47 +2159,18 @@
|
||||
goto next;
|
||||
}
|
||||
|
||||
- if (str_key_val_prefix(&key, "transcode", &val, &s)
|
||||
- || str_key_val_prefix(&key, "codec-transcode", &val, &s))
|
||||
- {
|
||||
- if (!ng_flags->codec_transcode) {
|
||||
- ng_flags->codec_transcode = bencode_list(ng_flags->dict->buffer);
|
||||
- bencode_dictionary_add(ng_flags->codec, "transcode",
|
||||
- ng_flags->codec_transcode);
|
||||
- }
|
||||
- bencode_list_add_str(ng_flags->codec_transcode, &s);
|
||||
+ if (parse_codec_flag(ng_flags, &key, &val, "transcode", "codec-transcode", "transcode", &ng_flags->codec_transcode))
|
||||
goto next;
|
||||
- }
|
||||
-
|
||||
- if (str_key_val_prefix(&key, "codec-strip", &val, &s)) {
|
||||
- if (!ng_flags->codec_strip) {
|
||||
- ng_flags->codec_strip = bencode_list(ng_flags->dict->buffer);
|
||||
- bencode_dictionary_add(ng_flags->codec, "strip",
|
||||
- ng_flags->codec_strip);
|
||||
- }
|
||||
- bencode_list_add_str(ng_flags->codec_strip, &s);
|
||||
+ if (parse_codec_flag(ng_flags, &key, &val, "codec-strip", NULL, "strip", &ng_flags->codec_strip))
|
||||
goto next;
|
||||
- }
|
||||
-
|
||||
- if (str_key_val_prefix(&key, "codec-offer", &val, &s)) {
|
||||
- if (!ng_flags->codec_offer) {
|
||||
- ng_flags->codec_offer = bencode_list(ng_flags->dict->buffer);
|
||||
- bencode_dictionary_add(ng_flags->codec, "offer",
|
||||
- ng_flags->codec_offer);
|
||||
- }
|
||||
- bencode_list_add_str(ng_flags->codec_offer, &s);
|
||||
+ if (parse_codec_flag(ng_flags, &key, &val, "codec-offer", NULL, "offer", &ng_flags->codec_offer))
|
||||
goto next;
|
||||
- }
|
||||
-
|
||||
- if (str_key_val_prefix(&key, "codec-mask", &val, &s)) {
|
||||
- if (!ng_flags->codec_mask) {
|
||||
- ng_flags->codec_mask = bencode_list(ng_flags->dict->buffer);
|
||||
- bencode_dictionary_add(ng_flags->codec, "mask",
|
||||
- ng_flags->codec_mask);
|
||||
- }
|
||||
- bencode_list_add_str(ng_flags->codec_mask, &s);
|
||||
+ if (parse_codec_flag(ng_flags, &key, &val, "codec-mask", NULL, "mask", &ng_flags->codec_mask))
|
||||
+ goto next;
|
||||
+ if (parse_codec_flag(ng_flags, &key, &val, "codec-set", NULL, "set", &ng_flags->codec_set))
|
||||
+ goto next;
|
||||
+ if (parse_codec_flag(ng_flags, &key, &val, "codec-except", NULL, "except", &ng_flags->codec_except))
|
||||
goto next;
|
||||
- }
|
||||
|
||||
/* check for specially handled items */
|
||||
switch (key.len) {
|
@ -1,56 +0,0 @@
|
||||
From 967dd294ba424bf66e27bebe4d6261e0c8a66471 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Fri, 16 Apr 2021 09:44:24 +0200
|
||||
Subject: [PATCH] core: usr avp - fix detection of invalid name and ids
|
||||
|
||||
- use the fields designated for str name or int id, code analyzers can
|
||||
follow properly the execution path
|
||||
- regression introduced in ca1821837dfe7dd6630f628d968ed4d1178c7040
|
||||
|
||||
(cherry picked from commit e4506385ca5a56d4861f36e85c1049599cba398f)
|
||||
---
|
||||
src/core/usr_avp.c | 17 +++++++++--------
|
||||
1 file changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/core/usr_avp.c b/src/core/usr_avp.c
|
||||
index e80e52d79d..8d8fa34603 100644
|
||||
--- a/src/core/usr_avp.c
|
||||
+++ b/src/core/usr_avp.c
|
||||
@@ -148,16 +148,11 @@ avp_t *create_avp (avp_flags_t flags, avp_name_t name, avp_value_t val)
|
||||
struct str_str_data *ssd;
|
||||
int len;
|
||||
|
||||
- if (name.s.s == NULL || name.s.len == 0) {
|
||||
- LM_ERR("0 ID or NULL NAME AVP!");
|
||||
- goto error;
|
||||
- }
|
||||
-
|
||||
/* compute the required mem size */
|
||||
len = sizeof(struct usr_avp);
|
||||
if (flags&AVP_NAME_STR) {
|
||||
if ( name.s.s==0 || name.s.len==0) {
|
||||
- LM_ERR("EMPTY NAME AVP!");
|
||||
+ LM_ERR("NULL or EMPTY NAME AVP!");
|
||||
goto error;
|
||||
}
|
||||
if (flags&AVP_VAL_STR) {
|
||||
@@ -168,8 +163,14 @@ avp_t *create_avp (avp_flags_t flags, avp_name_t name, avp_value_t val)
|
||||
len += sizeof(struct str_int_data)-sizeof(union usr_avp_data)
|
||||
+ name.s.len + 1; /* Terminating zero for regex search */
|
||||
}
|
||||
- } else if (flags&AVP_VAL_STR) {
|
||||
- len += sizeof(str)-sizeof(union usr_avp_data) + val.s.len + 1;
|
||||
+ } else {
|
||||
+ if(name.n==0) {
|
||||
+ LM_ERR("0 ID AVP!");
|
||||
+ goto error;
|
||||
+ }
|
||||
+ if (flags&AVP_VAL_STR) {
|
||||
+ len += sizeof(str)-sizeof(union usr_avp_data) + val.s.len + 1;
|
||||
+ }
|
||||
}
|
||||
|
||||
avp = (struct usr_avp*)shm_malloc( len );
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,26 @@
|
||||
From 4a4835e122bb3a53d2a1794640e1dec66736a897 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Thu, 6 May 2021 11:37:58 +0200
|
||||
Subject: [PATCH] lwsc: set ws_ping_pong_interval only for libwebsockets 3.x
|
||||
|
||||
(cherry picked from commit 048ed4210d52fb817ae6b03756d95e9b25899330)
|
||||
---
|
||||
src/modules/lwsc/lwsc_mod.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/modules/lwsc/lwsc_mod.c b/src/modules/lwsc/lwsc_mod.c
|
||||
index 17eb0ca30a..a6985acb6d 100644
|
||||
--- a/src/modules/lwsc/lwsc_mod.c
|
||||
+++ b/src/modules/lwsc/lwsc_mod.c
|
||||
@@ -529,7 +529,7 @@ static lwsc_endpoint_t* lwsc_get_endpoint(str *wsurl, str *wsproto)
|
||||
ep->crtinfo.protocols = ep->protocols;
|
||||
ep->crtinfo.gid = -1;
|
||||
ep->crtinfo.uid = -1;
|
||||
-#if LWS_LIBRARY_VERSION_MAJOR >= 3
|
||||
+#if LWS_LIBRARY_VERSION_MAJOR == 3
|
||||
ep->crtinfo.ws_ping_pong_interval = 5; /*secs*/
|
||||
#endif
|
||||
/* 1 internal and 1 (+ 1 http2 nwsi) */
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,45 +0,0 @@
|
||||
From 98805c723fbe01556e56d5b00ffc686b92014847 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Fri, 27 Nov 2020 12:22:52 +0100
|
||||
Subject: [PATCH] ndb_redis: set message level to debug on reconnect
|
||||
|
||||
* logging error makes no sense here since there's going
|
||||
to be a reconnection afterwards
|
||||
---
|
||||
src/modules/ndb_redis/redis_client.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
|
||||
index 15a86f7b10..42880310f2 100644
|
||||
--- a/src/modules/ndb_redis/redis_client.c
|
||||
+++ b/src/modules/ndb_redis/redis_client.c
|
||||
@@ -1011,7 +1011,7 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
|
||||
/* null reply, reconnect and try again */
|
||||
if(rsrv->ctxRedis->err)
|
||||
{
|
||||
- LM_ERR("Redis error: %s\n", rsrv->ctxRedis->errstr);
|
||||
+ LM_DBG("Redis error: %s\n", rsrv->ctxRedis->errstr);
|
||||
}
|
||||
if(redisc_reconnect_server(rsrv)==0)
|
||||
{
|
||||
@@ -1054,7 +1054,7 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
|
||||
/* null reply, reconnect and try again */
|
||||
if(rsrv->ctxRedis->err)
|
||||
{
|
||||
- LM_ERR("Redis error: %s\n", rsrv->ctxRedis->errstr);
|
||||
+ LM_DBG("Redis error: %s\n", rsrv->ctxRedis->errstr);
|
||||
}
|
||||
if(redisc_reconnect_server(rsrv)==0)
|
||||
{
|
||||
@@ -1152,7 +1152,7 @@ again:
|
||||
/* null reply, reconnect and try again */
|
||||
if(rsrv->ctxRedis->err)
|
||||
{
|
||||
- LM_ERR("Redis error: %s\n", rsrv->ctxRedis->errstr);
|
||||
+ LM_DBG("Redis error: %s\n", rsrv->ctxRedis->errstr);
|
||||
}
|
||||
|
||||
if(res)
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,77 +0,0 @@
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Thu, 5 Nov 2020 12:12:38 +0100
|
||||
Subject: [PATCH] permissions: add reload_delta parameter
|
||||
|
||||
- make the rate limit of maximum allowed RPC reload configurable
|
||||
using the new 'reload_delta' paramenter.
|
||||
---
|
||||
src/modules/permissions/permissions.c | 5 +++++
|
||||
src/modules/permissions/permissions.h | 1 +
|
||||
src/modules/permissions/rpc.c | 8 +++++---
|
||||
3 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/modules/permissions/permissions.c b/src/modules/permissions/permissions.c
|
||||
index 6b45619..9d9e6d0 100644
|
||||
--- a/src/modules/permissions/permissions.c
|
||||
+++ b/src/modules/permissions/permissions.c
|
||||
@@ -60,6 +60,7 @@ static char* perm_deny_suffix = ".deny";
|
||||
|
||||
/* for allow_trusted and allow_address function */
|
||||
str perm_db_url = {NULL, 0}; /* Don't connect to the database by default */
|
||||
+int perm_reload_delta = 5;
|
||||
|
||||
/* for allow_trusted function */
|
||||
int perm_db_mode = DISABLE_CACHE; /* Database usage mode: 0=no cache, 1=cache */
|
||||
@@ -186,6 +187,7 @@ static param_export_t params[] = {
|
||||
{"port_col", PARAM_STR, &perm_port_col },
|
||||
{"max_subnets", PARAM_INT, &_perm_max_subnets },
|
||||
{"load_backends", PARAM_INT, &_perm_load_backends },
|
||||
+ {"reload_delta", PARAM_INT, &perm_reload_delta },
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
@@ -594,6 +596,9 @@ static int mod_init(void)
|
||||
}
|
||||
*perm_rpc_reload_time = 0;
|
||||
|
||||
+ if(perm_reload_delta < 0)
|
||||
+ perm_reload_delta = 5;
|
||||
+
|
||||
if(permissions_init_rpc()!=0) {
|
||||
LM_ERR("failed to register RPC commands\n");
|
||||
return -1;
|
||||
diff --git a/src/modules/permissions/permissions.h b/src/modules/permissions/permissions.h
|
||||
index c094185..2a417ff 100644
|
||||
--- a/src/modules/permissions/permissions.h
|
||||
+++ b/src/modules/permissions/permissions.h
|
||||
@@ -59,6 +59,7 @@ extern str perm_ip_addr_col; /* Name of ip address column */
|
||||
extern str perm_mask_col; /* Name of mask column */
|
||||
extern str perm_port_col; /* Name of port column */
|
||||
extern int perm_peer_tag_mode; /* Matching mode */
|
||||
+extern int perm_reload_delta; /* seconds between RPC reloads */
|
||||
|
||||
/* backends to be loaded */
|
||||
#define PERM_LOAD_ADDRESSDB (1<<0)
|
||||
diff --git a/src/modules/permissions/rpc.c b/src/modules/permissions/rpc.c
|
||||
index b6a6f9a..cff9523 100644
|
||||
--- a/src/modules/permissions/rpc.c
|
||||
+++ b/src/modules/permissions/rpc.c
|
||||
@@ -30,13 +30,15 @@
|
||||
#include "permissions.h"
|
||||
|
||||
|
||||
-int rpc_check_reload(rpc_t* rpc, void* ctx) {
|
||||
- if(perm_rpc_reload_time==NULL) {
|
||||
+int rpc_check_reload(rpc_t *rpc, void *ctx)
|
||||
+{
|
||||
+ if(perm_rpc_reload_time == NULL) {
|
||||
LM_ERR("not ready for reload\n");
|
||||
rpc->fault(ctx, 500, "Not ready for reload");
|
||||
return -1;
|
||||
}
|
||||
- if(*perm_rpc_reload_time!=0 && *perm_rpc_reload_time > time(NULL) - 5) {
|
||||
+ if(*perm_rpc_reload_time != 0
|
||||
+ && *perm_rpc_reload_time > time(NULL) - perm_reload_delta) {
|
||||
LM_ERR("ongoing reload\n");
|
||||
rpc->fault(ctx, 500, "ongoing reload");
|
||||
return -1;
|
@ -1,109 +0,0 @@
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Thu, 5 Nov 2020 11:04:48 +0100
|
||||
Subject: permissions: basic safety for concurent rpc reload
|
||||
|
||||
* same logic as 99d5da8d595961063249f871a5d150474fa6f317
|
||||
---
|
||||
src/modules/permissions/permissions.c | 14 +++++++++++++-
|
||||
src/modules/permissions/permissions.h | 1 +
|
||||
src/modules/permissions/rpc.c | 25 +++++++++++++++++++++++++
|
||||
3 files changed, 39 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/modules/permissions/permissions.c b/src/modules/permissions/permissions.c
|
||||
index 18cf398..6b45619 100644
|
||||
--- a/src/modules/permissions/permissions.c
|
||||
+++ b/src/modules/permissions/permissions.c
|
||||
@@ -88,7 +88,7 @@ str perm_address_file = STR_NULL; /* Full path to file with address records
|
||||
*/
|
||||
static int perm_check_all_branches = 1;
|
||||
|
||||
-
|
||||
+time_t *perm_rpc_reload_time = NULL;
|
||||
int _perm_max_subnets = 512;
|
||||
|
||||
int _perm_load_backends = 0xFFFF;
|
||||
@@ -587,6 +587,13 @@ static int mod_init(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ perm_rpc_reload_time = shm_malloc(sizeof(time_t));
|
||||
+ if(perm_rpc_reload_time == NULL) {
|
||||
+ SHM_MEM_ERROR;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ *perm_rpc_reload_time = 0;
|
||||
+
|
||||
if(permissions_init_rpc()!=0) {
|
||||
LM_ERR("failed to register RPC commands\n");
|
||||
return -1;
|
||||
@@ -674,6 +681,11 @@ static void mod_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
+ if(perm_rpc_reload_time!=NULL) {
|
||||
+ shm_free(perm_rpc_reload_time);
|
||||
+ perm_rpc_reload_time = 0;
|
||||
+ }
|
||||
+
|
||||
for(i = 0; i < perm_rules_num; i++) {
|
||||
if(perm_allow[i].rules) free_rule(perm_allow[i].rules);
|
||||
if(perm_allow[i].filename) pkg_free(perm_allow[i].filename);
|
||||
diff --git a/src/modules/permissions/permissions.h b/src/modules/permissions/permissions.h
|
||||
index 785d6c9..c094185 100644
|
||||
--- a/src/modules/permissions/permissions.h
|
||||
+++ b/src/modules/permissions/permissions.h
|
||||
@@ -66,6 +66,7 @@ extern int perm_peer_tag_mode; /* Matching mode */
|
||||
#define PERM_LOAD_ALLOWFILE (1<<2)
|
||||
#define PERM_LOAD_DENYFILE (1<<3)
|
||||
extern int _perm_load_backends; /* */
|
||||
+extern time_t *perm_rpc_reload_time;
|
||||
|
||||
typedef struct int_or_pvar {
|
||||
unsigned int i;
|
||||
diff --git a/src/modules/permissions/rpc.c b/src/modules/permissions/rpc.c
|
||||
index 844cdec..b6a6f9a 100644
|
||||
--- a/src/modules/permissions/rpc.c
|
||||
+++ b/src/modules/permissions/rpc.c
|
||||
@@ -30,10 +30,30 @@
|
||||
#include "permissions.h"
|
||||
|
||||
|
||||
+int rpc_check_reload(rpc_t* rpc, void* ctx) {
|
||||
+ if(perm_rpc_reload_time==NULL) {
|
||||
+ LM_ERR("not ready for reload\n");
|
||||
+ rpc->fault(ctx, 500, "Not ready for reload");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if(*perm_rpc_reload_time!=0 && *perm_rpc_reload_time > time(NULL) - 5) {
|
||||
+ LM_ERR("ongoing reload\n");
|
||||
+ rpc->fault(ctx, 500, "ongoing reload");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ *perm_rpc_reload_time = time(NULL);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*! \brief
|
||||
* RPC function to reload trusted table
|
||||
*/
|
||||
void rpc_trusted_reload(rpc_t* rpc, void* c) {
|
||||
+
|
||||
+ if(rpc_check_reload(rpc, c) < 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (reload_trusted_table_cmd () != 1) {
|
||||
rpc->fault(c, 500, "Reload failed.");
|
||||
return;
|
||||
@@ -67,6 +87,11 @@ void rpc_trusted_dump(rpc_t* rpc, void* c) {
|
||||
* RPC function to reload address table
|
||||
*/
|
||||
void rpc_address_reload(rpc_t* rpc, void* c) {
|
||||
+
|
||||
+ if(rpc_check_reload(rpc, c) < 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (reload_address_table_cmd () != 1) {
|
||||
rpc->fault(c, 500, "Reload failed.");
|
||||
return;
|
@ -0,0 +1,32 @@
|
||||
From 33db4ffc558b7a9d4c291c929b9e73b3cf8b16f0 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Wed, 5 May 2021 18:56:04 +0200
|
||||
Subject: [PATCH] tm: lw parser - fix matching To header in lw_get_hf_name()
|
||||
|
||||
(cherry picked from commit 4ab6e05df56afb7802a2cd125e89b9282a1c6c85)
|
||||
---
|
||||
src/modules/tm/lw_parser.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/modules/tm/lw_parser.c b/src/modules/tm/lw_parser.c
|
||||
index d13ec58311..6f48304f53 100644
|
||||
--- a/src/modules/tm/lw_parser.c
|
||||
+++ b/src/modules/tm/lw_parser.c
|
||||
@@ -188,9 +188,11 @@ char *lw_get_hf_name(char *begin, char *end, enum _hdr_types_t *type)
|
||||
|
||||
case 't': /* To */
|
||||
if(LOWER_BYTE(*(p + 1)) == 'o') {
|
||||
- p += 2;
|
||||
- *type = HDR_TO_T;
|
||||
- break;
|
||||
+ if((*(p + 2) == ' ') || (*(p + 2) == ':')) {
|
||||
+ p += 2;
|
||||
+ *type = HDR_TO_T;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
if((*(p + 1) == ' ') || (*(p + 1) == ':')) {
|
||||
p++;
|
||||
--
|
||||
2.20.1
|
||||
|
Loading…
Reference in new issue