Browse code

Add a parameter for the type of the RTP-Timeout-Socket (defaults to 1 for Kamailio-XMLRPC)

Carsten Bock authored on 30/08/2010 14:48:49
Showing 2 changed files
... ...
@@ -231,7 +231,6 @@ modparam("rtpproxy", "nortpproxy_str", "a=sdpmangled:yes\r\n")
231 231
 </programlisting>
232 232
 		</example>
233 233
 	</section>
234
-	</section>
235 234
 	<section>
236 235
 		<title><varname>timeout_socket</varname> (string)</title>
237 236
 		<para>
... ...
@@ -254,6 +253,33 @@ modparam("nathelper", "timeout_socket", "http://127.0.0.1:8000/RPC2")
254 253
 </programlisting>
255 254
 		</example>
256 255
 	</section>
256
+	<section>
257
+		<title><varname>timeout_socket_type</varname> (int)</title>
258
+		<para>
259
+		The parameter sets type of the timeout socket, which is transmitted to the RTP-Proxy.
260
+		</para>
261
+		<para>
262
+		If it is not set, type 1 (Kamailio XML-RPC-Socket) is transmitted to the RTP-Proxy.
263
+		</para>
264
+		<para>
265
+		<emphasis>
266
+			Default value is <quote>1</quote>.
267
+		</emphasis>
268
+		</para>
269
+		<example>
270
+		<title>Set <varname>timeout_socket_type</varname> parameter</title>
271
+		<programlisting format="linespecific">
272
+...
273
+modparam("nathelper", "timeout_socket_type", 42)
274
+...
275
+</programlisting>
276
+		</example>
277
+		<para>
278
+		<emphasis>
279
+			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.
280
+		</emphasis>
281
+		</para>
282
+	</section>
257 283
 	</section>
258 284
 
259 285
 	<section>
... ...
@@ -341,6 +341,7 @@ static int *rtpp_socks = 0;
341 341
 unsigned int *natping_state=0;
342 342
 
343 343
 static str timeout_socket_str = {0, 0};
344
+static int timeout_socket_type = 1;
344 345
 
345 346
 static cmd_export_t cmds[] = {
346 347
 	{"set_rtp_proxy_set",  (cmd_function)set_rtp_proxy_set_f,    1,
... ...
@@ -408,6 +409,7 @@ static param_export_t params[] = {
408 409
 	{"rtpproxy_retr",         INT_PARAM, &rtpproxy_retr         },
409 410
 	{"rtpproxy_tout",         INT_PARAM, &rtpproxy_tout         },
410 411
 	{"timeout_socket",    	  STR_PARAM, &timeout_socket_str.s  },
412
+	{"timeout_socket_type",   INT_PARAM, &timeout_socket_type   },
411 413
 	{0, 0, 0}
412 414
 };
413 415
 
... ...
@@ -1816,14 +1818,16 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer)
1816 1818
 		{";", 1},	/* separator */
1817 1819
 		{NULL, 0},	/* medianum */
1818 1820
 		{" ", 1},	/* separator */
1821
+		{NULL, 0},	/* Type of timeout-socket: 1 Kamailio-XML-RPC */
1822
+		{" ", 1},	/* separator */
1819 1823
 		{NULL, 0},	/* Timeout-Socket */
1820 1824
 	};
1821 1825
 	int iovec_param_count;
1822 1826
 
1823 1827
 	char *c1p, *c2p, *bodylimit, *o1p;
1824
-	char medianum_buf[20];
1828
+	char itoabuf_buf[20];
1825 1829
 	int medianum, media_multi;
1826
-	str medianum_str;
1830
+	str itoabuf_str;
1827 1831
 	int c1p_altered;
1828 1832
 	static int swap_warned = 0;
1829 1833
 
... ...
@@ -2102,14 +2106,14 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer)
2102 2106
 #endif
2103 2107
 			if (1 || media_multi) /* XXX netch: can't choose now*/
2104 2108
 			{
2105
-				snprintf(medianum_buf, sizeof medianum_buf, "%d", medianum);
2106
-				medianum_str.s = medianum_buf;
2107
-				medianum_str.len = strlen(medianum_buf);
2108
-				STR2IOVEC(medianum_str, v[13]);
2109
-				STR2IOVEC(medianum_str, v[17]);
2109
+				snprintf(itoabuf_buf, sizeof itoabuf_buf, "%d", medianum);
2110
+				itoabuf_str.s = itoabuf_buf;
2111
+				itoabuf_str.len = strlen(itoabuf_buf);
2112
+				STR2IOVEC(itoabuf_str, v[13]);
2113
+				STR2IOVEC(itoabuf_str, v[17]);
2110 2114
 #ifdef EXTRA_DEBUG
2111
-				LM_DBG("STR2IOVEC(medianum_str, v[13])\n");
2112
-				LM_DBG("STR2IOVEC(medianum_str, v[17])\n");
2115
+				LM_DBG("STR2IOVEC(itoabuf_str, v[13])\n");
2116
+				LM_DBG("STR2IOVEC(itoabuf_str, v[17])\n");
2113 2117
 #endif
2114 2118
 			} else {
2115 2119
 				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)
2174 2178
 				if (to_tag.len > 0) {
2175 2179
 					iovec_param_count = 18;
2176 2180
 					if (timeout_socket_str.len > 0) {
2177
-						iovec_param_count = 20;
2178
-						STR2IOVEC(timeout_socket_str, v[19]);
2181
+						iovec_param_count = 22;
2182
+						snprintf(itoabuf_buf, sizeof itoabuf_buf, "%d", timeout_socket_type);
2183
+						itoabuf_str.s = itoabuf_buf;
2184
+						itoabuf_str.len = strlen(itoabuf_buf);
2185
+						STR2IOVEC(itoabuf_str, v[19]);
2186
+						STR2IOVEC(timeout_socket_str, v[21]);
2179 2187
 					}
2180 2188
 				} else {
2181 2189
 					iovec_param_count = 14;