[Users] Mediaproxy module and new equipment

Artur Yakupov artur at novatel.ru
Thu Oct 19 10:33:02 CEST 2006


Hi, all!

Preamble:
I got new equipment - videophone. I tried to make it work with OpenSER 
(version 1.1.0).
Schema:
VIDEOPHONE -> OpenSER -> VIDEOPHONE
I tried to make simple call.

It works but not behind NAT.

With rtpproxy OpenSER logs show such messages:
ERROR: force_rtp_proxy2: can't extract media port from the message
Calls last only few seconds than it get disconnected.

With mediaproxy OpenSER logs show following:
Oct 16 18:01:22 sip mediaproxy[20251]: error: uncaptured python 
exception, closing channel <rtphandler.CommandHandler connected '' at 0x68
2ecc> (exceptions.ValueError:invalid literal for int(): 5012/1 
[/usr/lib/python2.3/asyncore.pyc|readwrite|86] [/usr/lib/python2.3/asyncore
.pyc|handle_read_event|390] 
[/usr/local/mediaproxy/modules/rtphandler.py|handle_read|441] 
[/usr/local/mediaproxy/modules/rtphandler.py|pro
cess|531] [/usr/local/mediaproxy/modules/rtphandler.py|__init__|988] 
[/usr/local/mediaproxy/modules/rtphandler.py|setCaller|880])


I found that source of these troubles is that videophone generates 
INVITE`s in different format than for example Sipura does.
Media streams are described like these:
m=audio 5012/1 RTP/AVP 98 0 8.
m=video 5010/1 RTP/SAVPF 99.

As you can see, sub-field "port" is not in usual format, but it contains 
number of ports according to RFC2327:
m=<media> <port>/<number of ports> <transport> <fmt list>

So, I spended few hours examinating sources of rtpproxy and mediaproxy 
modules and made small trick (patch) to mediaproxy module.
I didn't understand logic of rtpproxy module because lack of time.
Here it is:
--- ./modules/mediaproxy/mediaproxy.c   2006-03-24 21:04:56 +0300
+++ ./modules/mediaproxy/mediaproxy_new.c       2006-10-17 17:53:54 +0400
@@ -825,7 +825,7 @@
 getMediaStreams(str *sdp, str *sessionIP, StreamInfo *streams, int limit)
 {
     str tokens[2], block, zone;
-    char *ptr, *sdpEnd;
+    char *ptr, *sdpEnd, *tmpptr;
     int i, count, streamCount, result;

     sdpEnd = sdp->s + sdp->len;
@@ -845,6 +845,9 @@
                 "line in SDP body\n");
             return -1;
         }
+
+       tmpptr=strchr(tokens[1].s,'/');
+       if ((tmpptr-tokens[1].s)<tokens[1].len ) 
tokens[1].len=tmpptr-tokens[1].s;

         streams[i].type = tokens[0];
         streams[i].port = tokens[1];

It works for me, but I know it is not correct solution.
I hope my small investigation would be useful.
Thanks for your attention.

With best regards,
Artur Yakupov




More information about the sr-users mailing list