Module: kamailio
Branch: master
Commit: c593d7492ddb957a862dd31b5ce9e09fdf54a8e5
URL: https://github.com/kamailio/kamailio/commit/c593d7492ddb957a862dd31b5ce9e09…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-07T14:10:04+02:00
textops: documentation for remove_hf_exp(...)
---
Modified: src/modules/textops/doc/textops_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/c593d7492ddb957a862dd31b5ce9e09…
Patch: https://github.com/kamailio/kamailio/commit/c593d7492ddb957a862dd31b5ce9e09…
---
diff --git a/src/modules/textops/doc/textops_admin.xml b/src/modules/textops/doc/textops_admin.xml
index 539697fced..68b3676703 100644
--- a/src/modules/textops/doc/textops_admin.xml
+++ b/src/modules/textops/doc/textops_admin.xml
@@ -10,9 +10,9 @@
<!-- Module User's Guide -->
<chapter>
-
+
<title>&adminguide;</title>
-
+
<section>
<title>Overview</title>
<para>
@@ -32,11 +32,11 @@
processing in &kamailio; script.
</para>
<para>
- Search ignores folded lines. For example,
+ Search ignores folded lines. For example,
search(<quote>(From|f):.*@foo.bar</quote>)
doesn't match the following From header field:
<programlisting format="linespecific">
-From: medabeda
+From: medabeda
<sip:medameda@foo.bar>;tag=1234
</programlisting>
</para>
@@ -1154,8 +1154,7 @@ remove_hf("m")
</listitem>
</itemizedlist>
<para>
- This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
- FAILURE_ROUTE and BRANCH_ROUTE.
+ This function can be used from ANY_ROUTE.
</para>
<example>
<title><function>remove_hf_re</function> usage</title>
@@ -1170,6 +1169,48 @@ if(remove_hf_re("^P-"))
</example>
</section>
+ <section id="textops.f.remove_hf_exp">
+ <title>
+ <function moreinfo="none">remove_hf_exp(expmatch, expskip)</function>
+ </title>
+ <para>
+ Remove from message all headers with name matching regular
+ expression <quote>expmatch</quote>, but not matching regular
+ expression <quote>expskip</quote>.
+ </para>
+ <para>
+ Returns true if at least one header is found and removed.
+ </para>
+ <para>Meaning of the parameters is as follows:</para>
+ <itemizedlist>
+ <listitem>
+ <para><emphasis>expmatch</emphasis> - regular expression to match
+ the header name to be removed.
+ </para>
+ </listitem>
+ <listitem>
+ <para><emphasis>expskip</emphasis> - regular expression to match
+ the header name to be skipped from removal.
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ <example>
+ <title><function>remove_hf_exp</function> usage</title>
+ <programlisting format="linespecific">
+...
+if(remove_hf_exp("^P-", "^P-Keep-"))
+{
+ # All headers starting with "P-" removed,
+ # except the ones starting with "P-Keep-"
+}
+...
+</programlisting>
+ </example>
+ </section>
+
<section id="textops.f.has_body">
<title>
<function moreinfo="none">has_body()</function>,
@@ -1177,7 +1218,7 @@ if(remove_hf_re("^P-"))
</title>
<para>
The function returns <emphasis>true</emphasis> if the SIP message
- has a body attached. The checked includes also the
+ has a body attached. The checked includes also the
<quote>Content-Length</quote> header presence and value.
</para>
<para>
@@ -1187,7 +1228,7 @@ if(remove_hf_re("^P-"))
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
- <para><emphasis>mime</emphasis> - mime to be checked against the
+ <para><emphasis>mime</emphasis> - mime to be checked against the
<quote>Content-Type</quote> header. If not present or 0, this
check will be disabled.
</para>
Module: kamailio
Branch: master
Commit: 851367053d6b4d64161a50fa7408d0dd750922d5
URL: https://github.com/kamailio/kamailio/commit/851367053d6b4d64161a50fa7408d0d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-07T14:03:29+02:00
core: fixup helper function for two regex parameters
---
Modified: src/core/mod_fix.c
Modified: src/core/mod_fix.h
---
Diff: https://github.com/kamailio/kamailio/commit/851367053d6b4d64161a50fa7408d0d…
Patch: https://github.com/kamailio/kamailio/commit/851367053d6b4d64161a50fa7408d0d…
---
diff --git a/src/core/mod_fix.c b/src/core/mod_fix.c
index 4fd0fa4ca7..d817b75565 100644
--- a/src/core/mod_fix.c
+++ b/src/core/mod_fix.c
@@ -207,7 +207,7 @@ struct regex_fixup {
int fixup_regexp_null(void** param, int param_no)
{
struct regex_fixup* re;
-
+
if (param_no != 1)
return E_UNSPEC;
if ((re=pkg_malloc(sizeof(*re))) ==0) {
@@ -226,11 +226,15 @@ int fixup_regexp_null(void** param, int param_no)
return E_UNSPEC;
}
+int fixup_regexp_regexp(void** param, int param_no)
+{
+ return fixup_regexp_null(param, 1);
+}
int fixup_free_regexp_null(void** param, int param_no)
{
struct regex_fixup* re;
-
+
if (param_no != 1)
return E_UNSPEC;
if (*param) {
@@ -242,6 +246,11 @@ int fixup_free_regexp_null(void** param, int param_no)
return 0;
}
+int fixup_free_regexp_regexp(void** param, int param_no)
+{
+ return fixup_free_regexp_null(param, 1);
+}
+
/* fixup_pvar_*() has to be written "by hand", since
it needs to save the original pointer (the fixup users expects
a pointer to the pv_spec_t in *param and hence the original value
@@ -638,4 +647,4 @@ int fixup_free_spve_pvar(void** param, int param_no)
if(param_no==2)
return fixup_free_pvar_null(param, 1);
return E_UNSPEC;
-}
\ No newline at end of file
+}
diff --git a/src/core/mod_fix.h b/src/core/mod_fix.h
index a8388ee84d..835342ab86 100644
--- a/src/core/mod_fix.h
+++ b/src/core/mod_fix.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2008 iptelorg GmbH
*
* Permission to use, copy, modify, and distribute this software for any
@@ -36,7 +36,7 @@
/**
* generic parameter that holds a string, an int, a pseudo-variable
* or a ser select, avp, or subst.
- *
+ *
* Note: used only for compatibility with existing kamailio code,
* please use fparam_t directly in the future.
*
@@ -86,13 +86,8 @@ int fixup_uint_uint(void** param, int param_no);
int fixup_regexp_null(void** param, int param_no);
int fixup_free_regexp_null(void** param, int param_no);
-#if 0
-int fixup_regexp_none(void** param, int param_no);
-int fixup_free_regexp_none(void** param, int param_no);
-/* not implemened yet */
-int fixup_regexpNL_null(void** param, int param_no);
-int fixup_regexpNL_none(void** param, int param_no);
-#endif
+int fixup_regexp_regexp(void** param, int param_no);
+int fixup_free_regexp_regexp(void** param, int param_no);
int fixup_pvar_null(void **param, int param_no);
int fixup_free_pvar_null(void** param, int param_no);