Module: sip-router
Branch: carstenbock/rtpproxy
Commit: 7264d5c4ad8c25f8e63ecf2a21af9d6519c778f7
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7264d5c…
Author: Carsten Bock <lists(a)bock.info>
Committer: Carsten Bock <lists(a)bock.info>
Date: Mon Aug 30 16:48:49 2010 +0200
Add a parameter for the type of the RTP-Timeout-Socket (defaults to 1 for
Kamailio-XMLRPC)
---
modules_k/rtpproxy/doc/rtpproxy_admin.xml | 28 ++++++++++++++++++++++++++-
modules_k/rtpproxy/rtpproxy.c | 30 ++++++++++++++++++----------
2 files changed, 46 insertions(+), 12 deletions(-)
diff --git a/modules_k/rtpproxy/doc/rtpproxy_admin.xml
b/modules_k/rtpproxy/doc/rtpproxy_admin.xml
index f23bc58..0074b6d 100644
--- a/modules_k/rtpproxy/doc/rtpproxy_admin.xml
+++ b/modules_k/rtpproxy/doc/rtpproxy_admin.xml
@@ -231,7 +231,6 @@ modparam("rtpproxy", "nortpproxy_str",
"a=sdpmangled:yes\r\n")
</programlisting>
</example>
</section>
- </section>
<section>
<title><varname>timeout_socket</varname> (string)</title>
<para>
@@ -254,6 +253,33 @@ modparam("nathelper", "timeout_socket",
"http://127.0.0.1:8000/RPC2")
</programlisting>
</example>
</section>
+ <section>
+ <title><varname>timeout_socket_type</varname> (int)</title>
+ <para>
+ The parameter sets type of the timeout socket, which is transmitted to the RTP-Proxy.
+ </para>
+ <para>
+ If it is not set, type 1 (Kamailio XML-RPC-Socket) is transmitted to the RTP-Proxy.
+ </para>
+ <para>
+ <emphasis>
+ Default value is <quote>1</quote>.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>timeout_socket_type</varname>
parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("nathelper", "timeout_socket_type", 42)
+...
+</programlisting>
+ </example>
+ <para>
+ <emphasis>
+ The only supported Type on the RTP-Proxy is currently <quote>1</quote> or
<quote>0</quote> which is the default socket-type of the RTP-Proxy which is
not compatible to Kamailio.
+ </emphasis>
+ </para>
+ </section>
</section>
<section>
diff --git a/modules_k/rtpproxy/rtpproxy.c b/modules_k/rtpproxy/rtpproxy.c
index f34a1e7..f526581 100644
--- a/modules_k/rtpproxy/rtpproxy.c
+++ b/modules_k/rtpproxy/rtpproxy.c
@@ -341,6 +341,7 @@ static int *rtpp_socks = 0;
unsigned int *natping_state=0;
static str timeout_socket_str = {0, 0};
+static int timeout_socket_type = 1;
static cmd_export_t cmds[] = {
{"set_rtp_proxy_set", (cmd_function)set_rtp_proxy_set_f, 1,
@@ -408,6 +409,7 @@ static param_export_t params[] = {
{"rtpproxy_retr", INT_PARAM, &rtpproxy_retr },
{"rtpproxy_tout", INT_PARAM, &rtpproxy_tout },
{"timeout_socket", STR_PARAM, &timeout_socket_str.s },
+ {"timeout_socket_type", INT_PARAM, &timeout_socket_type },
{0, 0, 0}
};
@@ -1816,14 +1818,16 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int
offer)
{";", 1}, /* separator */
{NULL, 0}, /* medianum */
{" ", 1}, /* separator */
+ {NULL, 0}, /* Type of timeout-socket: 1 Kamailio-XML-RPC */
+ {" ", 1}, /* separator */
{NULL, 0}, /* Timeout-Socket */
};
int iovec_param_count;
char *c1p, *c2p, *bodylimit, *o1p;
- char medianum_buf[20];
+ char itoabuf_buf[20];
int medianum, media_multi;
- str medianum_str;
+ str itoabuf_str;
int c1p_altered;
static int swap_warned = 0;
@@ -2102,14 +2106,14 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int
offer)
#endif
if (1 || media_multi) /* XXX netch: can't choose now*/
{
- snprintf(medianum_buf, sizeof medianum_buf, "%d", medianum);
- medianum_str.s = medianum_buf;
- medianum_str.len = strlen(medianum_buf);
- STR2IOVEC(medianum_str, v[13]);
- STR2IOVEC(medianum_str, v[17]);
+ snprintf(itoabuf_buf, sizeof itoabuf_buf, "%d", medianum);
+ itoabuf_str.s = itoabuf_buf;
+ itoabuf_str.len = strlen(itoabuf_buf);
+ STR2IOVEC(itoabuf_str, v[13]);
+ STR2IOVEC(itoabuf_str, v[17]);
#ifdef EXTRA_DEBUG
- LM_DBG("STR2IOVEC(medianum_str, v[13])\n");
- LM_DBG("STR2IOVEC(medianum_str, v[17])\n");
+ LM_DBG("STR2IOVEC(itoabuf_str, v[13])\n");
+ LM_DBG("STR2IOVEC(itoabuf_str, v[17])\n");
#endif
} else {
v[12].iov_len = v[13].iov_len = 0;
@@ -2174,8 +2178,12 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int
offer)
if (to_tag.len > 0) {
iovec_param_count = 18;
if (timeout_socket_str.len > 0) {
- iovec_param_count = 20;
- STR2IOVEC(timeout_socket_str, v[19]);
+ iovec_param_count = 22;
+ snprintf(itoabuf_buf, sizeof itoabuf_buf, "%d", timeout_socket_type);
+ itoabuf_str.s = itoabuf_buf;
+ itoabuf_str.len = strlen(itoabuf_buf);
+ STR2IOVEC(itoabuf_str, v[19]);
+ STR2IOVEC(timeout_socket_str, v[21]);
}
} else {
iovec_param_count = 14;