Module: sip-router
Branch: kamailio_3.0
Commit: d8af3a4b17bf1ca71df1d977d986f407ff34cfc2
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d8af3a4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Jan 6 15:39:46 2010 +0100
tm: documented t_relay_to() function
---
modules/tm/README | 39 +++++++++++++++++++++-
modules/tm/doc/functions.xml | 74 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 109 insertions(+), 4 deletions(-)
diff --git a/modules/tm/README b/modules/tm/README
index 33125c8..a971836 100644
--- a/modules/tm/README
+++ b/modules/tm/README
@@ -104,6 +104,7 @@ Juha Heinanen
1.5.34. t_set_disable_6xx(0|1)
1.5.35. t_set_disable_failover(0|1)
1.5.36. t_replicate(params)
+ 1.5.37. t_relay_to(proxy, flags)
1.6. TM Module API
@@ -2014,14 +2015,48 @@ route {
# sent to 1.2.3.4:5060 over tcp
t_replicate("sip:1.2.3.4:5060;transport=tcp");
-# sent to 1.2.3.4:5060 over tls
-$var(h) = "1.2.3.4:5060";
+# sent to 1.2.3.4:5061 over tls
+$var(h) = "1.2.3.4:5061";
t_replicate("sip:$var(h);transport=tls");
# sent to 1.2.3.4:5060 over udp
t_replicate_to_udp("1.2.3.4", "5060");
...
+1.5.37. t_relay_to(proxy, flags)
+
+ Forward the SIP request to a specific address, controlling internal
+ behavior via flags.
+
+ There are several function prototypes:
+ * t_relay_to(),
+ * t_relay_to(proxy),
+ * t_relay_to(flags)
+ * t_relay_to(proxy, flags)
+
+ Meaning of the parameters is as follows:
+ * proxy - address where the request should be sent. Format is:
+ "proto:host:port" - any of proto or port can be ommitted, along
+ with the semicolon after or before.
+ * flags - bitmask integer value to control the internal behavior.
+ Bits can be:
+ + 0x01 - do not generate 100 reply.
+ + 0x02 - do not generate reply on internal error (NOTE: has no
+ effect anymore).
+ + 0x04 - disable dns failover.
+
+ Example 74. t_replicate usage
+...
+# sent to 1.2.3.4:5060 over tcp
+t_relay_to("tcp:1.2.3.4:5060");
+
+# sent to 1.2.3.4 over tls
+t_relay_to("tls:1.2.3.4");
+
+# sent to dst URI or R-URI without a 100 reply
+t_relay_to("0x01");
+...
+
1.6. TM Module API
Revision History
diff --git a/modules/tm/doc/functions.xml b/modules/tm/doc/functions.xml
index dc2835d..dc4207c 100644
--- a/modules/tm/doc/functions.xml
+++ b/modules/tm/doc/functions.xml
@@ -1387,8 +1387,8 @@ route {
# sent to 1.2.3.4:5060 over tcp
t_replicate("sip:1.2.3.4:5060;transport=tcp");
-# sent to 1.2.3.4:5060 over tls
-$var(h) = "1.2.3.4:5060";
+# sent to 1.2.3.4:5061 over tls
+$var(h) = "1.2.3.4:5061";
t_replicate("sip:$var(h);transport=tls");
# sent to 1.2.3.4:5060 over udp
@@ -1397,5 +1397,75 @@ t_replicate_to_udp("1.2.3.4", "5060");
</programlisting>
</example>
</section>
+ <section id="t_relay_to">
+ <title>
+ <function>t_relay_to(proxy, flags)</function>
+ </title>
+ <para>
+ Forward the SIP request to a specific address, controlling internal
+ behavior via flags.
+ </para>
+ <para>
+ There are several function prototypes:
+ <itemizedlist>
+ <listitem>
+ <function>t_relay_to()</function>,
+ </listitem>
+ <listitem>
+ <function>t_relay_to(proxy)</function>,
+ </listitem>
+ <listitem>
+ <function>t_relay_to(flags)</function>
+ </listitem>
+ <listitem>
+ <function>t_relay_to(proxy, flags)</function>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>Meaning of the parameters is as follows:</para>
+ <itemizedlist>
+ <listitem>
+ <para><emphasis>proxy</emphasis> - address where the request should
+ be sent. Format is: "proto:host:port" - any of proto or port can be
+ ommitted, along with the semicolon after or before.
+ </para>
+ </listitem>
+ <listitem>
+ <para><emphasis>flags</emphasis> - bitmask integer value to control
+ the internal behavior. Bits can be:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para><emphasis>0x01</emphasis> - do not generate 100 reply.
+ </para>
+ </listitem>
+ <listitem>
+ <para><emphasis>0x02</emphasis> - do not generate reply on internal
+ error (NOTE: has no effect anymore).
+ </para>
+ </listitem>
+ <listitem>
+ <para><emphasis>0x04</emphasis> - disable dns failover.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ <example>
+ <title><function>t_replicate</function> usage</title>
+ <programlisting>
+...
+# sent to 1.2.3.4:5060 over tcp
+t_relay_to("tcp:1.2.3.4:5060");
+
+# sent to 1.2.3.4 over tls
+t_relay_to("tls:1.2.3.4");
+
+# sent to dst URI or R-URI without a 100 reply
+t_relay_to("0x01");
+...
+ </programlisting>
+ </example>
+ </section>
</section>
Module: sip-router
Branch: kamailio_3.0
Commit: 9cf36478222aaf573a6cd7b65e6a4fd6227eb8cd
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9cf3647…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Jan 5 18:27:46 2010 +0100
snmpstats: fix param type checking
- parameter type is given from definition of params not from modparam
value type, resulting in mismatches for parameters that have
USE_FUNC_PARAM flag set
- reported by Santiago Gimeno
---
modules_k/snmpstats/snmpObjects.c | 2 +-
modules_k/snmpstats/utilities.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules_k/snmpstats/snmpObjects.c b/modules_k/snmpstats/snmpObjects.c
index b797317..b9b36af 100644
--- a/modules_k/snmpstats/snmpObjects.c
+++ b/modules_k/snmpstats/snmpObjects.c
@@ -611,7 +611,7 @@ static int set_if_valid_threshold(modparam_t type, void *val, char *varStr,
return -1;
}
- if (type != INT_PARAM) {
+ if (PARAM_TYPE_MASK(type) != INT_PARAM) {
LM_ERR("%s called with type %d instead of %d!\n",
varStr, type, INT_PARAM);
return -1;
diff --git a/modules_k/snmpstats/utilities.c b/modules_k/snmpstats/utilities.c
index 2097f88..9b4011d 100644
--- a/modules_k/snmpstats/utilities.c
+++ b/modules_k/snmpstats/utilities.c
@@ -78,7 +78,7 @@ int stringHandlerSanityCheck( modparam_t type, void *val, char *parameterName)
char *theString = (char *)val;
/* Make sure the function was called correctly. */
- if (type != STR_PARAM) {
+ if (PARAM_TYPE_MASK(type) != STR_PARAM) {
LM_ERR("the %s parameter was assigned a type %d instead of %d\n",
parameterName, type, STR_PARAM);
return 0;
Hi Daniel!
Thanks for topoh, a great module.
1. topology hiding is skipped for REGISTER and PUBLISH - why? For
example I use Kamailio as an outbound proxy for our office as some kind
of firewall and want to add topology hiding (to hide the details of our
LAN). In this scenario it is also needed to mangle REGISTER and PUBLISH too.
Are there any issues from implementation point of view which prevents
mangling for REGISTER|PUBLISH?
I tried removing the method-check and it seems to work fine (at least
for REGISTER with single Contact headers)
Of course this brings in another problem - at the upstream server the
registered Contact is now sip:10.1.1.2;line=sr-......
It would be necessary to have the host part configurable, e.g. in my
setup I would set it to the public IP address of the outbound proxy.
Thus,
str th_ip = {"10.1.1.2", 0};
should be the default and there should be a module paramter to override it.
2. the module uses a default value for encryption. IMO this is insecure.
IMO, either the mask_key parameter should be mandatory or a random one
should be generated at startup.
regards
klaus
Module: sip-router
Branch: kamailio_3.0
Commit: d4db8304926d30a4244b9ee05d21b5614eae5f94
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d4db830…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Jan 4 21:32:24 2010 +0100
core: define module_loaded to use find_module_by_name
- it was declared but not implemented
- in use by snmpstats and perlvdb modules
- reported by Santiago Gimeno
---
sr_module.h | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/sr_module.h b/sr_module.h
index 426729c..10afc55 100644
--- a/sr_module.h
+++ b/sr_module.h
@@ -389,6 +389,10 @@ int init_child(int rank);
int init_modules(void);
struct sr_module* find_module_by_name(char* mod);
+/* true if the module with name 'mod_name' is loaded */
+#define module_loaded(mod_name) (find_module_by_name(mod_name)!=0)
+
+
/*! \brief
* Find a parameter with given type and return it's
* address in memory
@@ -520,18 +524,4 @@ int get_int_fparam(int* dst, struct sip_msg* msg, fparam_t* param);
int get_regex_fparam(regex_t *dst, struct sip_msg* msg, fparam_t* param);
-/* functions needed for kamailio/openser compatibility */
-
-/*! \brief Check if module is loaded
- * \return Returns 1 if the module with name 'name' is loaded, and zero otherwise. */
-int module_loaded(char *name);
-
-/*! \brief Counts the additional the number of processes
- requested by modules */
-int count_module_procs(void);
-
-
-/*! \brief Forks and starts the additional processes required by modules */
-int start_module_procs(void);
-
#endif /* sr_module_h */