Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Unexpected INVITE form PL (Read 23090 times)
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Unexpected INVITE form PL
10. May 2013 at 22:53
Print Post  
Trying to make a call from CSipSimple (CSS) client via FreeSWITCH (FS) to PhonerLite (PL). There is no audio and call is terminated by FS. Log shows:
1. INVITE (authorized) is sent from CSS via FS to PL
2. Call was answered by PL and OK/INVITE is sent via FS to CSS
3. CSS sends new INVOTE, now with SDP containing only one codec - PCMU
6. PL replies OK/INVITE with SDP containing only one codec - PCMU

Up until now everything looks normal. But suddenly PL sends new INVITE (where "from"/"to" are reversed) with full set of codecs in SDP again and it breaks the call. There is no audio. PL indicates: "in:---, out:u-Law". CSS doesn't respond to the 6 new INVITE messages sent by FS and FS eventually terminates the call by reason [CS_HIBERNATE]...

Question - why after codec was successfully negotiated, PL suddenly sends its own INVITE message, now containing full set of codecs in SDP? Is it necessary?

Running PL v2.08
  
Back to top
 
IP Logged
 
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11421
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Re: Unexpected INVITE form PL
Reply #1 - 13. May 2013 at 10:06
Print Post  
Is there any NAT involved? If no RTP is received at PhonerLite, a re-INVITE is sent.
Can you please send me a Wireshark trace of such scenario from the PC running PhonerLite? Please send this by e-mail.
  
Back to top
WWW  
IP Logged
 
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Re: Unexpected INVITE form PL
Reply #2 - 13. May 2013 at 19:27
Print Post  
NAT is involved (as always).
Here is log, collected from FreeSWITCH:
http://pastebin.com/hFvkD4PN
  
Back to top
 
IP Logged
 
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11421
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Re: Unexpected INVITE form PL
Reply #3 - 15. May 2013 at 09:06
Print Post  
It is a little bit strange. After call establishment CSS sends a re-INVITE. That is answered by PL. Some seconds later PL sends a re-INVITE. Can you please make a Wireshark-Trace on the PL PC? I can see RTP then and STUN messages too. PL sends STUN requests from the RTP port to the peers RTP-port. If the peer answers PL gets the public IP and port used for this connection. If the addresses differs from the old addresses propagated in SDP, a re-INVITE with the new public address is sent.
But the peer never answers this re-INVITE.
To see if this is the expected scenario, I need the Wireshark trace. Please send this by e-mail.
  
Back to top
WWW  
IP Logged
 
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Re: Unexpected INVITE form PL
Reply #4 - 16. May 2013 at 06:26
Print Post  
I hope you understand, that for security reasons I'd prefer do not disclose my IP's within Wiresharks log. But I'd like to provide you with data collected during some tests.

I've just made test call from CSS (CSipSimple) to PL (PhonerLite). After taking the call for several seconds there was silence (no audio). Then, in approximately 3 sec I start to hear audio. Here is the log, connected with Wireshark (watch for port numbers specified after ':'):

00:00 - INVITE, CSS -> PL. SDP:m=4002, many codecs. m=rtcp:4003
00:08 - OK, PL -> CSS. SDP::m=5062, many codecs
00:08 - PL:5063 -> CSS:4003. RTCP - Source description
00:08 - PL:5062 -> CSS:4002. RTP - Unknown RTP version
00:08 - PL:5062 -> CSS:4002. RTP - PT=ITU-T G711 PCMU
00:08 - PL:5062 -> CSS:4002. RTP - PT=ITU-T G711 PCMU
...
PL continues to send RTP packets to CSS, but there is no any messages sent back from CSS to PL
00:09 - INVITE, CSS -> PL. SDP:m=4002, one codec PCMU, m=rtcp:4003
00:09 - OK, PL -> CSS. SDP:m=5062, one codec PCMU
00:09 - PL:5062 -> CSS:4002. RTP - PT=ITU-T G711 PCMU
00:08 - PL:5062 -> CSS:4002. RTP - PT=ITU-T G711 PCMU
...
PL continues to send RTP packets to CSS, but there is no any messages sent back from CSS to PL
00:11 - INVITE, PL -> CSS. SDP:m=5135, many codecs. m=rtcp:5135
first two RTP packets from CSS to PL:
00:11 - CSS:4002 -> PL:5060. RTP - PT=GSM 06.10
00:11 - CSS:4002 -> PL:5060. RTP - PT=GSM 06.10
00:11 - PL:5060 -> CSS:4002. RTP - PT=ITU-T G711 PCMU
00:11 - CSS:4002 -> PL:5060. RTP - PT=GSM 06.10
00:11 - PL:5060 -> CSS:4002. RTP - PT=ITU-T G711 PCMU
00:11 - CSS:4002 -> PL:5060. RTP - PT=GSM 06.10
00:11 - PL:5060 -> CSS:4002. RTP - PT=ITU-T G711 PCMU
00:11 - OK, CSS -> PL. SDP:m=4002, one codec GSM, m=rtcp:4003
00:11 - PL:5060 -> CSS:4002. RTP - Unknown RTP version
00:11 - PL:5060 -> CSS:4002. RTP - PT=GSM 06.10
00:11 - CSS:4002 -> PL:5060. RTP - PT=GSM 06.10
00:11 - PL:5060 -> CSS:4002. RTP - PT=GSM 06.10
00:11 - CSS:4002 -> PL:5060. RTP - PT=GSM 06.10
...
Audio is working since that.
(some details about SDP content you may find in my log, previously mentioned in this thread)

Weird things about it:
1. CSS offers it's usual RTP port 4002, but it doesn't not reply from it for several seconds after the call was answered.
2. In 3 sec PL sends its own INVITE message (offering set of its codecs) and it changes its RTP port form 5062 to 5135 (which will be not used at all, BTW). Only after that moment CSS starts sending its first RTP packets to PL... Watch for the port number that it sends its packets to - it's 5060 (not 5062)! Where this port (5060) comes from? Nevertheless, PL starts to sending RTP packets from this port (5060) back to CSS (4002).
3. Then CSS sends its OK, containing only one codec (GSM, previous codec was PCMU, BTW)
4. Only at that point the audio starts working fine

Questions:
1. Why after 3 sec CSS starts sending RTP to PL:5060 and not to its port 5062? May be it was tried, but 5062 was blocked in NAT router?
2. Why CSS in 3 sec suddenly switches to port 5060 to send RTP packets? Where is comes from? PL sends in its SDP port 5062 first and then it changes it to 5135 (and both were never used) and later it looks like it accepts RTP on port 5060?
3. Do those "Unknown RTP version" packets mean anything?

It's all very strange...
  
Back to top
 
IP Logged
 
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11421
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Re: Unexpected INVITE form PL
Reply #5 - 16. May 2013 at 08:47
Print Post  
When PL doesn't receive any RTP data for some seconds, it sends a re-INVITE with the SIP signaling port as the RTP port. As you see, RTP will be received after this. PL has to dispatch RTP and SIP messages after that.
That is only needed for some strange NAT scenarios. Instead of getting no audio, the signaling port will be used for audio and signaling in PL.
If you doesn't like that and prefer to get no audio at all instead, you can disable that feature in PL. Open the file "sipper.ini" and search for the line containing "RTPoverSIPFallback". The number on the right side is the time (in seconds) after call establishment before doing that re-INVITE. If you set it to 0, it won't be sent at all.

These unknown RTP packets are STUN requests. See here: RFC 5626
  
Back to top
WWW  
IP Logged
 
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Re: Unexpected INVITE form PL
Reply #6 - 16. May 2013 at 20:39
Print Post  
Thank you for the explanations. It made clear a lot of things. But some questions still remain:

I'm watching RTP ports very closely now and see, that when PL launches, it sets in router (via UPnP) NAT rule: External port: 5135  (UDP). Internal port: 5060.

Now, when I make a call PL initially replies to CSS (OK/INVITE message) with SDP: "m: audio 5062 RTP". It makes CSS to send RTP packets to port 5062 (currently blocked by NAT router). That's why we don't see any RTP plackets coming. Reply to the second INVITE (where there is only one codec set) does the same. PL tells to use port 5062 for audio stream...

In several seconds PL sends to CSS its own INVITE message. And interestingly enough, this time it offers port 5135 as its audio port. CSS starts sending packages to 5060 (via external NAT port 5135). As a result, audio starts working OK now.

So, the question is:
Why PL, after setting NAT rule via UPnP to translate external port 5135 into its internal port 5060, initially replies in OK/INVITE SDP offering port 5062 and not 5135?

Again (just for clarification), this case happens when:
a) there is no STUN server assigned
b) in Network configuration UPnP NAT option is checked
  
Back to top
 
IP Logged
 
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Re: Unexpected INVITE form PL
Reply #7 - 16. May 2013 at 22:00
Print Post  
One more thing I think should be noted here.

From my old record I see that PL at launch time sets 2 NAT rules (via UPnP, Ext, Prot, Int):
5135 UDP 5060
5061 TCP 5061

When it accepted incoming call it used to add two additional rules there:
5062 UDP 5062
5063 UDP 5063 
and after the call it remove them back.

Which makes sense when it sends in SDP port 5062...

Now, and I've checked it many times, it doesn't set those two temporary rules when call arrives. It still set them, when it makes outbound call though. But not for an incoming call.
  
Back to top
 
IP Logged
 
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11421
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Re: Unexpected INVITE form PL
Reply #8 - 17. May 2013 at 09:34
Print Post  
Your are right. UPnP isn't used for incoming connections. I fixed that in the beta version now. Please download this beta version from www.phonerlite.de and try again. Please tell me, if it works now.
  
Back to top
WWW  
IP Logged
 
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Re: Unexpected INVITE form PL
Reply #9 - 17. May 2013 at 23:50
Print Post  
There is no audio from CSS to PL at all. Not before PL sends its own re-INVITE message, changing port from 5062 to 5135, and not after that...

Changes, that I see in 2.09b:
1. When I launch PL v2.09b it doesn't create NAT rules, as PL v2.08 did. 
PL v2.08 at its launch time sets these two rules:
5135 UDP 5060 IP.ADR.LAN.PL
5061 TCP 5061 IP.ADR.LAN.PL
I don't know if it's important or not in this case, but that's what I noticed.

2. When new call arrives PL v2.09b temporary adds these two NAT rules (ext.port prot. int.port int.IP):
5062 UDP 5062 IP.ADR.WAN.PL
5063 UDP 5063 IP.ADR.WAN.PL

a) note, both are UDP now. I guess the intention was to make second rule for TCP, right?
b) important! - rules point to WAN IP address, instead of LAN internal address as expected.
As a result there is no audio form CSS to PL at all times...

3. After several seconds PL sends its re-INVITE message with SDP specifying port 5135, which will not be open in router, because PL did not set the rule for it (see p.1).

I'm not sure about initial NAT setup, mentioned in p.1, but I guess it's important to set LAN IP (instead of WAN IP) in NAT rules when call arrives (see p.2). Additionally, keep in mind, that offering port 5135 is useless in this case (because there is no NAT rules for that) and, BTW, PL start sending its RTP from port 5060 and not from 5135... 


P.S. In case we may expect several iterations of the beta package, I think it'd be nice to refer to them via some version numbers (like v2.09b1, v2.09b2, etc). But without it, what I used in this test is v2.09b, CRC32: 6ECDC954 (main executable file).
  
Back to top
 
IP Logged
 
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Re: Unexpected INVITE form PL
Reply #10 - 18. May 2013 at 04:14
Print Post  
Couple of more thoughts...

If PL wants to recover after several seconds of not receiving audio stream and it sends its own re-INVITE message with different RTP port in it, I think it's reasonable to expect, that before sending this request, it sets a new NAT rule, that opens the new public port and redirects it to itself.

Second, why PL uses (I think) hardcoded port 5135? IMHO it'd be better to allow me to set that port in "siper.ini" file. For example you may offer option RTPoverSIPFallbackPort, where I can set fallback port number (default: 5135), or better yet, a range of ports. E.g.:
RTPoverSIPFallback=15213,16000-16005
And BTW, the same approach could apply for the initial RTP port too. For example:
RTPPort=5062,5063,28010-28016
  
Back to top
 
IP Logged
 
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11421
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Re: Unexpected INVITE form PL
Reply #11 - 25. May 2013 at 18:48
Print Post  
Sorry, I was on Holidays and had no time. I will check next week, if current beta works as expected.
  
Back to top
WWW  
IP Logged
 
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Re: Unexpected INVITE form PL
Reply #12 - 20. Jun 2013 at 22:59
Print Post  
Have you had any chance to checked it?
  
Back to top
 
IP Logged
 
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11421
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Re: Unexpected INVITE form PL
Reply #13 - 21. Jun 2013 at 09:42
Print Post  
Didn't you try the latest version?
  
Back to top
WWW  
IP Logged
 
Foner88
YaBB Newbies
*
Offline


Phoner is great!

Posts: 41
Joined: 19. Jul 2011
Re: Unexpected INVITE form PL
Reply #14 - 21. Jun 2013 at 23:34
Print Post  
It's much better now. Problem is fixed in v2.09.
Thanks a lot!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint