Having problems connection after SIp via RTP on PC Windows 7 client

Topics: Question
Feb 11, 2016 at 12:24 PM
Edited Feb 11, 2016 at 12:27 PM

after having heavy Problems with my xamarin Client I made a Windows 7 pc Client (.Net 4.6) of it.

I have a working sip Connection and I get an incoming call from the Gateway / Server, with an Invite and later Ack. I use the exact session description I get from the Server to create a rtp Client:
            if (rtpClient == null || !rtpClient.IsActive)
                Media.Sdp.SessionDescription sessionDescription = new Media.Sdp.SessionDescription(session.ToString());
                sessionDescription.SessionName = session.Name;
                sessionDescription.SessionId = session.Owner.SessionID.ToString();

                rtpClient = Media.Rtp.RtpClient.FromSessionDescription(sessionDescription);
In my case, 114 is the Server / Gateway, 125 is me.

The Session description is:

o=sip 123456 654321 IN IP4
s=A conversation
c=IN IP4
t=0 0
m=audio 7078 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
m=video 9078 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0IAHqtAoPyA,aM44gA==

I always get a
37 6.408811 ICMP 126 Destination unreachable (Port unreachable)

I added some logging to the media.RtpClient.

I found the part where I hang:

In the SendReceive Method I changed it to:
                        //if Rtcp is enabled
                        if (rtcpEnabled && false == (shouldStop || IsDisposed || m_StopRequested))
                            Console.WriteLine("RTCP is enabled");
                            if (//The last report was never received or recieved longer ago then required
                                (tc.LastRtcpReportReceived == TimeSpan.MinValue || tc.LastRtcpReportReceived >= tc.m_ReceiveInterval))
// && //And the socket can read
// /tc.RtcpSocket.Available > 0 ||/ tc.RtcpSocket.Poll((int)(Math.Round(Media.Common.Extensions.TimeSpan.TimeSpanExtensions.TotalMicroseconds(tc.m_ReceiveInterval) / Media.Common.Extensions.TimeSpan.TimeSpanExtensions.MicrosecondsPerMillisecond, MidpointRounding.ToEven) /* 3000/), SelectMode.SelectRead))
                                //ReceiveRtcp Data
                                receivedRtcp += ReceiveData(tc.RtcpSocket, ref tc.RemoteRtcp, out lastError, duplexing, rtcpEnabled, tc.ContextMemory);
                                Console.WriteLine("RTCP receives data");
                                //Check if an error occured
                                if (lastError != SocketError.Success)
                                    Console.WriteLine("RTCP error: "+lastError.ToString());

Only when I remove the RtcpSocket.Poll I get into the part under it.

I get then a console log like this:

RTCP is enabled
RTCP receives data
RTCP error: ConnectionReset
Transportcontext found
RTCP is enabled

Since I am using the IPs and Ports from the SIP, I do not understand how These can be Problem or how to fix that?

I also added a log for Initializing the Transport context in the initialize method:

Transportcontext initialized: localRTP: remoteRTP: localRTCP: remoteRTCP:

and again

Transportcontext initialized: localRTP: remoteRTP: localRTCP: remoteRTCP:

Can you pleaase tell me what I am doing wrong here or what could cause this Problem?

I am still having Problems with my Xamarin Client, but I thought I could just get my Windows Client working.

Help would be great, thanks!

Feb 11, 2016 at 2:59 PM
I think I am having a socket Problem when connecting the rtp Client.
So I set timeout for all sockets to 2000 and set "Punchhole" to always true, when I saw the comments I thought this could fix a possible port Problem.

When Setting the punchhole to always true (only then) I get the following error shown in my wireshark:
9 3.319566 RTP 46 Unknown RTP version 1
It seems to be outgoing from Client to the Server / Gateway when I sent RTP reports.

I don't know if that helps, could this be a Problem?
Feb 17, 2016 at 2:48 PM
Not sure how I didn't see this thread, I will take a look and let you know what I find after I address some of the other issues.

It seems the problems may have something to do with the way you changed the code to use port 30000 always, another application may already be using that port and or the source may not be able to reach that port.

Let me know if this still needs attention.
Marked as answer by juliusfriedman on 2/17/2016 at 6:48 AM