[SR-Users] Kamailio and RTPProxy
Juan Perez
juan_perez_2014 at yahoo.com
Wed Oct 29 15:29:31 CET 2014
I narrowed down the problem to a comparison made in this function:
send_rtpp_command(struct rtpp_node *node, struct iovec *v, int vcnt) line 1618
inside the rtpproxy.c file (kamailio-4.2/kamailio/modules/rtpproxy/rtpproxy.c, lines 1693, 1694 )
if (len >= (v[0].iov_len - 1)
&& memcmp(buf, v[0].iov_base, (v[0].iov_len - 1)) == 0)
What I see is this: kamailio starts up and sends 4 requests to rtpproxy to verify these versions:
/* Supported version of the RTP proxy command protocol */
#define SUP_CPROTOVER 20040107
/* Required additional version of the RTP proxy command protocol */
#define REQ_CPROTOVER "20050322"
/* Additional version necessary for re-packetization support */
#define REP_CPROTOVER "20071116"
#define PTL_CPROTOVER "20081102"
In all those requests the function "send_rtpp_command" is used. The proxy sends/recv inside a for loop (at max rtpproxy_retr tries) and when the proxy receives something is when it does the comparison:
if (len >= (v[0].iov_len - 1)
&& memcmp(buf, v[0].iov_base, (v[0].iov_len - 1)) == 0)
len has the number of bytes received and the v[0].iov_base has the pid_v when checking the SUP_CPROTOVER.rtpproxy receives "13582_0 V" and replies with 20040107#012 ex:
Oct 29 13:37:31 ip-10-0-2-68 rtpproxy[14268]: DBUG:get_command: received command "13582_0 V"
Oct 29 13:37:31 ip-10-0-2-68 rtpproxy[14268]: DBUG:rtpc_doreply: sending reply "20040107#012"
and it is comparing 2 diff things so the comparison fails and the logic goes to the "badproxy" label where the test is flag as failed and hence the rtpproxy is marked as unavailable and all the other version checks are stopped
when checking for REQ_CPROTOVER it sends 13582_1 VF 20050322 and receives "1#012", the comparison should fail for the same reason
Oct 29 13:37:31 ip-10-0-2-68 rtpproxy[14268]: DBUG:get_command: received command "13582_1 VF 20050322"
Oct 29 13:37:31 ip-10-0-2-68 rtpproxy[14268]: DBUG:rtpc_doreply: sending reply "1#012"
etc etc.
I commented out all the sections inside the rtpp_test function that go to the "error" label and also inside rtpp_checkcap I always return 1. Now at the end when running ./kamctl fifo nh_show_rtpp it looks enabled:
[root at ip-10-0-2-68 sbin]# ./kamctl fifo nh_show_rtpp
which: no greadlink in (/sbin:/bin:/usr/sbin:/usr/bin:/)
which: no gdb in (/sbin:/bin:/usr/sbin:/usr/bin:/)
udp:127.0.0.1:7722:: set=0
index:: 0
disabled:: 0
weight:: 1
recheck_ticks:: 95595268
[root at ip-10-0-2-68 sbin]#
but I dont know how safe this is. I dont know if when I start using it (sending other commands to modify SDP etc) it will still work
Can somebody tell me which version of both apps (kamailio and rtpproxy) are fully compatible?
txs a lotjp2014
On Monday, October 27, 2014 8:22 PM, Juan Perez <juan_perez_2014 at yahoo.com> wrote:
I installed Kamailio 4.2 and the latest rtpproxy. When starting Kamailio I see these lines:
Oct 27 21:54:26 ip-10-0-2-68 kamailio: DEBUG: <core> [sr_module.c:590]: load_module(): load_module: trying to load </usr/local
Oct 27 21:54:26 ip-10-0-2-68 kamailio: DEBUG: <core> [sr_module.c:357]: register_module(): register PV from: rtpproxy
Oct 27 21:54:26 ip-10-0-2-68 kamailio: DEBUG: <core> [cfg.lex:1724]: pp_define(): defining id: MOD_rtpproxy
Oct 27 21:54:32 ip-10-0-2-68 ./kamailio[3887]: ERROR: rtpproxy [rtpproxy.c:1707]: send_rtpp_command(): timeout waiting reply f
Oct 27 21:54:32 ip-10-0-2-68 ./kamailio[3887]: ERROR: rtpproxy [rtpproxy.c:1716]: send_rtpp_command(): proxy <udp:10.0.2.68:77
Oct 27 21:54:32 ip-10-0-2-68 ./kamailio[3887]: WARNING: rtpproxy [rtpproxy.c:1573]: rtpp_test(): can't get version of the RTP
Oct 27 21:54:32 ip-10-0-2-68 ./kamailio[3887]: WARNING: rtpproxy [rtpproxy.c:1610]: rtpp_test(): support for RTP proxy <udp:10
Oct 27 21:54:37 ip-10-0-2-68 ./kamailio[3898]: ERROR: rtpproxy [rtpproxy.c:1707]: send_rtpp_command(): timeout waiting reply f
Oct 27 21:54:37 ip-10-0-2-68 ./kamailio[3898]: ERROR: rtpproxy [rtpproxy.c:1716]: send_rtpp_command(): proxy <udp:10.0.2.68:77
Oct 27 21:54:37 ip-10-0-2-68 ./kamailio[3898]: WARNING: rtpproxy [rtpproxy.c:1573]: rtpp_test(): can't get version of the RTP
I run rtpproxy like this:
/usr/local/rtpproxy-install-dir/bin/rtpproxy -l <public ip here> -s udp:10.0.2.68:7722 -F -d DBUG:LOG_LOCAL3
I have these linee in the kamailio.cfg file
loadmodule "rtpproxy.so"
# ----- rtpproxy params -----
modparam("rtpproxy", "rtpproxy_sock", "udp:10.0.2.68:7722")
I have tried with localhost, with 127.0.0.1 and get the same results ( I mean configure kamailio to contact rttpproxy with localhost instead of ip and at the same time running rtpproxy with the same reference.
I can see the rtpproxy running/listening
[root at ip-10-0-2-68 sbin]# netstat -lnp | grep rtpproxy
udp 0 0 10.0.2.68:7722 0.0.0.0:* 3608/rtpproxy
I can also see these lines:
[root at ip-10-0-2-68 sbin]# netstat -np | grep 7722
udp 0 0 10.0.2.68:49772 10.0.2.68:7722 ESTABLISHED 3928/./kamailio
udp 0 0 10.0.2.68:36097 10.0.2.68:7722 ESTABLISHED 3897/./kamailio
udp 0 0 10.0.2.68:49158 10.0.2.68:7722 ESTABLISHED 3906/./kamailio
udp 0 0 10.0.2.68:37129 10.0.2.68:7722 ESTABLISHED 3904/./kamailio
udp 0 0 10.0.2.68:39052 10.0.2.68:7722 ESTABLISHED 3926/./kamailio
udp 0 0 10.0.2.68:38161 10.0.2.68:7722 ESTABLISHED 3919/./kamailio
udp 0 0 10.0.2.68:53144 10.0.2.68:7722 ESTABLISHED 3887/./kamailio
udp 0 0 10.0.2.68:39721 10.0.2.68:7722 ESTABLISHED 3905/./kamailio
udp 0 0 10.0.2.68:59563 10.0.2.68:7722 ESTABLISHED 3909/./kamailio
udp 0 0 10.0.2.68:51884 10.0.2.68:7722 ESTABLISHED 3921/./kamailio
udp 0 0 10.0.2.68:46902 10.0.2.68:7722 ESTABLISHED 3930/./kamailio
udp 0 0 10.0.2.68:33981 10.0.2.68:7722 ESTABLISHED 3931/./kamailio
udp 0 0 10.0.2.68:60221 10.0.2.68:7722 ESTABLISHED 3898/./kamailio
udp 0 0 10.0.2.68:35651 10.0.2.68:7722 ESTABLISHED 3900/./kamailio
udp 0 0 10.0.2.68:33105 10.0.2.68:7722 ESTABLISHED 3927/./kamailio
udp 0 0 10.0.2.68:43349 10.0.2.68:7722 ESTABLISHED 3887/./kamailio
udp 0 0 10.0.2.68:39259 10.0.2.68:7722 ESTABLISHED 3899/./kamailio
udp 0 0 10.0.2.68:35170 10.0.2.68:7722 ESTABLISHED 3907/./kamailio
udp 0 0 10.0.2.68:38760 10.0.2.68:7722 ESTABLISHED 3908/./kamailio
In the rtpproxy I see that it is sent data and it replies too, I even got a wireshark capture showing that as well:
Oct 27 21:54:41 ip-10-0-2-68 rtpproxy[3608]: DBUG:get_command: received command "3931_2 V"
Oct 27 21:54:41 ip-10-0-2-68 rtpproxy[3608]: DBUG:rtpc_doreply: sending reply "20040107#012"
Oct 27 21:54:41 ip-10-0-2-68 rtpproxy[3608]: DBUG:get_command: received command "3927_2 V"
Oct 27 21:54:41 ip-10-0-2-68 rtpproxy[3608]: DBUG:rtpc_doreply: sending reply "20040107#012"
Oct 27 21:54:41 ip-10-0-2-68 rtpproxy[3608]: DBUG:get_command: received command "3926_2 V"
Oct 27 21:54:41 ip-10-0-2-68 rtpproxy[3608]: DBUG:rtpc_doreply: sending reply "20040107#012"
Oct 27 21:54:41 ip-10-0-2-68 rtpproxy[3608]: DBUG:get_command: received command "3928_2 V"
Oct 27 21:54:41 ip-10-0-2-68 rtpproxy[3608]: DBUG:rtpc_doreply: sending reply "20040107#012"
But somehow kamailio does not see it:
[root at ip-10-0-2-68 sbin]# ./kamctl fifo nh_show_rtpp
which: no greadlink in (/sbin:/bin:/usr/sbin:/usr/bin:/)
which: no gdb in (/sbin:/bin:/usr/sbin:/usr/bin:/)
udp:10.0.2.68:7722:: set=0
index:: 0
disabled:: 1
weight:: 1
recheck_ticks:: 53253287
I even when to the kamailio code and saw something that may have something to do with it but havent tried it yet:, in the implementation of the function "send_rtpp_command" I see that the socket created is using TCP. But I tried configuring kamailio/rtpproxy to use tcp instead but I also got the same results, kamailio seems to fail to acknoledgwe the replies from rtpproxy.
I also have SELINUX disabled and the iptables are not running.
I dont know what else to check, if somebody can shed some light into this I'd appreciate it.
jp2014
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20141029/f11b98e3/attachment.html>
More information about the sr-users
mailing list