Errores #83

REGISTER, -Un-REGISTER and re-REGISTER during startup

Added by Iñaki Baz Castillo over 2 years ago. Updated 7 months ago.

Status:Resuelta Start:07/21/2009
Priority:Urgente Due date:
Assigned to:Saúl Ibarra Corretgé % Done:

0%

Category:-
Target version:0.5.1

Description

When YASS is launched it first registers correctly. Then unregisters, and then registers again:

  • 1)
    • REGISTER (CSeq: 16702 - Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB):
    • REGISTER + auth (CSeq: 16703 - Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB):
U 2009/07/21 01:06:11.275896 192.168.1.100:8080 -> SERVER:5060
REGISTER sip:domain SIP/2.0                                     
Via: SIP/2.0/UDP 192.168.1.100:8080;rport;branch=z9hG4bKPjtjNiyMDjlmohCKId4gL-TChJr54JaOWI
Max-Forwards: 70                                                                          
From: <sip:yass@domain>;tag=ag1f50o5ScNSPap0pcmQM-nX4BgqjASh                         
To: <sip:yass@domain>                                                                
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16702 REGISTER                                                                      
User-Agent: YASS - pjsip                                                                  
Contact: <sip:yass@192.168.1.100:8080>                                                    
Expires: 600                                                                              
Content-Length:  0                                                                        

#
U 2009/07/21 01:06:11.331100 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 100 Trying                                                   
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjtjNiyMDjlmohCKId4gL-TChJr54JaOWI;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=ag1f50o5ScNSPap0pcmQM-nX4BgqjASh                         
To: <sip:yass@domain>                                                                
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16702 REGISTER                                                                      
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         

#
U 2009/07/21 01:06:11.331516 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 401 Unauthorized                                             
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjtjNiyMDjlmohCKId4gL-TChJr54JaOWI;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=ag1f50o5ScNSPap0pcmQM-nX4BgqjASh                         
To: <sip:yass@domain>;tag=79b60ccc0e144bee60eb097fa92de92d.92cc                      
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16702 REGISTER                                                                      
WWW-Authenticate: Digest realm="domain", nonce="4a64f88400001928b9680f604b641a4bcb67303431a274dc", qop="auth"                                                                  
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         

#####
U 2009/07/21 01:06:11.684250 192.168.1.100:8080 -> SERVER:5060
REGISTER sip:domain SIP/2.0                                     
Via: SIP/2.0/UDP 192.168.1.100:8080;rport;branch=z9hG4bKPjeEgYOPNqxTUqqKGQMpCetzRJm0vVZHve
Max-Forwards: 70                                                                          
From: <sip:yass@domain>;tag=ag1f50o5ScNSPap0pcmQM-nX4BgqjASh                         
To: <sip:yass@domain>                                                                
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16703 REGISTER                                                                      
User-Agent: YASS - pjsip                                                                  
Contact: <sip:yass@192.168.1.100:8080>                                                    
Expires: 600                                                                              
Authorization: Digest username="yass", realm="domain", nonce="4a64f88400001928b9680f604b641a4bcb67303431a274dc", uri="sip:domain", response="4d145ee7486e755be4d77c14d6b295fe", cnonce="DeZUKyBw6zybUzw-.jllfzURR0YHyoHf", qop=auth, nc=00000001                    
Content-Length:  0                                                                        

#
U 2009/07/21 01:06:11.742030 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 100 Trying                                                   
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjeEgYOPNqxTUqqKGQMpCetzRJm0vVZHve;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=ag1f50o5ScNSPap0pcmQM-nX4BgqjASh                         
To: <sip:yass@domain>                                                                
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16703 REGISTER                                                                      
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         

#
U 2009/07/21 01:06:11.744474 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 200 OK                                                       
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjeEgYOPNqxTUqqKGQMpCetzRJm0vVZHve;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=ag1f50o5ScNSPap0pcmQM-nX4BgqjASh                         
To: <sip:yass@domain>;tag=79b60ccc0e144bee60eb097fa92de92d.a319                      
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16703 REGISTER                                                                      
Contact: <sip:yass@192.168.1.100:8080>;expires=600;received="sip:YASS_PUBLIC_IP:8080"     
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         
  • 2)
    • un-REGISTER (CSeq = 16704 - Call-ID = WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB):
U 2009/07/21 01:06:11.956999 192.168.1.100:8080 -> SERVER:5060
REGISTER sip:domain SIP/2.0                                     
Via: SIP/2.0/UDP 192.168.1.100:8080;rport;branch=z9hG4bKPj9TZr8sRNVqeJ40abnJt2S5z9n-H.VvMY
Max-Forwards: 70                                                                          
From: <sip:yass@domain>;tag=.ZOkT9-4FN0MESaAHoq..PWxK87etfhV                         
To: <sip:yass@domain>                                                                
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16704 REGISTER                                                                      
User-Agent: YASS - pjsip                                                                  
Contact: <sip:yass@192.168.1.100:8080>                                                    
Expires: 0                                                                                
Content-Length:  0                                                                        

#
U 2009/07/21 01:06:12.010829 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 100 Trying                                                   
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPj9TZr8sRNVqeJ40abnJt2S5z9n-H.VvMY;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=.ZOkT9-4FN0MESaAHoq..PWxK87etfhV                         
To: <sip:yass@domain>                                                                
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16704 REGISTER                                                                      
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         

#
U 2009/07/21 01:06:12.011269 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 401 Unauthorized                                             
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPj9TZr8sRNVqeJ40abnJt2S5z9n-H.VvMY;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=.ZOkT9-4FN0MESaAHoq..PWxK87etfhV                         
To: <sip:yass@domain>;tag=79b60ccc0e144bee60eb097fa92de92d.3f0f                      
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16704 REGISTER                                                                      
WWW-Authenticate: Digest realm="domain", nonce="4a64f8850000192bdcadc8e9b2d6bb9198dc34430ef5f256", qop="auth"                                                                  
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         
  • 3)
    • REGISTER (CSeq = 1141 - Call-ID = 0JO-m.g2pLVslB28lRKwX00wO8qFhQty):
U 2009/07/21 01:06:12.041491 192.168.1.100:8080 -> SERVER:5060
REGISTER sip:domain SIP/2.0                                     
Via: SIP/2.0/UDP 192.168.1.100:8080;rport;branch=z9hG4bKPjZI8IHTUaPpIXEW8kfyfRto.CrhLlOdBu
Max-Forwards: 70                                                                          
From: <sip:yass@domain>;tag=lHkKkQUwmlpWhfemhZfJWlTz9eIjuHTd                         
To: <sip:yass@domain>                                                                
Call-ID: 0JO-m.g2pLVslB28lRKwX00wO8qFhQty                                                 
CSeq: 1141 REGISTER                                                                       
User-Agent: YASS - pjsip                                                                  
Contact: <sip:yass@YASS_PUBLIC_IP:8080;transport=UDP>                                     
Expires: 600                                                                              
Content-Length:  0                                                                        

###
U 2009/07/21 01:06:12.096986 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 100 Trying                                                   
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjZI8IHTUaPpIXEW8kfyfRto.CrhLlOdBu;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=lHkKkQUwmlpWhfemhZfJWlTz9eIjuHTd                         
To: <sip:yass@domain>                                                                
Call-ID: 0JO-m.g2pLVslB28lRKwX00wO8qFhQty                                                 
CSeq: 1141 REGISTER                                                                       
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         

#
U 2009/07/21 01:06:12.097015 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 401 Unauthorized                                             
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjZI8IHTUaPpIXEW8kfyfRto.CrhLlOdBu;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=lHkKkQUwmlpWhfemhZfJWlTz9eIjuHTd                         
To: <sip:yass@domain>;tag=79b60ccc0e144bee60eb097fa92de92d.a681                      
Call-ID: 0JO-m.g2pLVslB28lRKwX00wO8qFhQty                                                 
CSeq: 1141 REGISTER                                                                       
WWW-Authenticate: Digest realm="domain", nonce="4a64f8850000192c9c4532cb36e2c3c11b95cfc79142376d", qop="auth"                                                                  
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         
  • 4)
    • un-REGISTER + auth (CSeq = 16705 - Call-ID = WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB):
U 2009/07/21 01:06:12.175593 192.168.1.100:8080 -> SERVER:5060
REGISTER sip:domain SIP/2.0                                     
Via: SIP/2.0/UDP 192.168.1.100:8080;rport;branch=z9hG4bKPj.05Y0pLlsUhzv26triQMxrwr6.q5Oz3i
Max-Forwards: 70                                                                          
From: <sip:yass@domain>;tag=.ZOkT9-4FN0MESaAHoq..PWxK87etfhV                         
To: <sip:yass@domain>                                                                
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16705 REGISTER                                                                      
User-Agent: YASS - pjsip                                                                  
Contact: <sip:yass@192.168.1.100:8080>                                                    
Expires: 0                                                                                
Authorization: Digest username="yass", realm="domain", nonce="4a64f8850000192bdcadc8e9b2d6bb9198dc34430ef5f256", uri="sip:domain", response="751fb333f2d11cc4c1220d3d67a7e756", cnonce="DeZUKyBw6zybUzw-.jllfzURR0YHyoHf", qop=auth, nc=00000001                    
Content-Length:  0                                                                        

#
U 2009/07/21 01:06:12.232547 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 100 Trying                                                   
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPj.05Y0pLlsUhzv26triQMxrwr6.q5Oz3i;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=.ZOkT9-4FN0MESaAHoq..PWxK87etfhV                         
To: <sip:yass@domain>                                                                
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16705 REGISTER                                                                      
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         

#
U 2009/07/21 01:06:12.234070 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 200 OK                                                       
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPj.05Y0pLlsUhzv26triQMxrwr6.q5Oz3i;received=YASS_PUBLIC_IP                                                             
From: <sip:yass@domain>;tag=.ZOkT9-4FN0MESaAHoq..PWxK87etfhV                         
To: <sip:yass@domain>;tag=79b60ccc0e144bee60eb097fa92de92d.88a6                      
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB                                                 
CSeq: 16705 REGISTER                                                                      
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))                                        
Content-Length: 0                                                                         
  • 5)
    • REGISTER + auth (CSeq = 1142 - Call-ID = 0JO-m.g2pLVslB28lRKwX00wO8qFhQty):
U 2009/07/21 01:06:12.278142 192.168.1.100:8080 -> SERVER:5060
REGISTER sip:domain SIP/2.0
Via: SIP/2.0/UDP 192.168.1.100:8080;rport;branch=z9hG4bKPjHzGBbsTXACEkkEwuAaF.zTwCZY0bpS-p
Max-Forwards: 70
From: <sip:yass@domain>;tag=lHkKkQUwmlpWhfemhZfJWlTz9eIjuHTd
To: <sip:yass@domain>
Call-ID: 0JO-m.g2pLVslB28lRKwX00wO8qFhQty
CSeq: 1142 REGISTER
User-Agent: YASS - pjsip
Contact: <sip:yass@YASS_PUBLIC_IP:8080;transport=UDP>
Expires: 600
Authorization: Digest username="yass", realm="domain", nonce="4a64f8850000192c9c4532cb36e2c3c11b95cfc79142376d", uri="sip:domain", response="25c5516ec367a05f53b4f2fca87607d2", cnonce="0RWnj8jOAjnoTLK9FbttAmwRh0HfVRkY", qop=auth, nc=00000001
Content-Length:  0

#
U 2009/07/21 01:06:12.337366 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjHzGBbsTXACEkkEwuAaF.zTwCZY0bpS-p;received=YASS_PUBLIC_IP
From: <sip:yass@domain>;tag=lHkKkQUwmlpWhfemhZfJWlTz9eIjuHTd
To: <sip:yass@domain>
Call-ID: 0JO-m.g2pLVslB28lRKwX00wO8qFhQty
CSeq: 1142 REGISTER
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))
Content-Length: 0

#
U 2009/07/21 01:06:12.339013 SERVER:5060 -> 192.168.1.100:8080
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjHzGBbsTXACEkkEwuAaF.zTwCZY0bpS-p;received=YASS_PUBLIC_IP
From: <sip:yass@domain>;tag=lHkKkQUwmlpWhfemhZfJWlTz9eIjuHTd
To: <sip:yass@domain>;tag=79b60ccc0e144bee60eb097fa92de92d.c88e
Call-ID: 0JO-m.g2pLVslB28lRKwX00wO8qFhQty
CSeq: 1142 REGISTER
Contact: <sip:yass@YASS_PUBLIC_IP:8080;transport=UDP>;expires=600;received="sip:YASS_PUBLIC_IP:8080" 
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))
Content-Length: 0

History

Updated by Saúl Ibarra Corretgé over 2 years ago

WTF?! Just checked and it's really happening! Grrrr

Updated by Iñaki Baz Castillo over 2 years ago

Perhaps the registration is stored in DB (sqlite) and retrieved during application launch (this shouldn't happen of course).

Updated by Saúl Ibarra Corretgé over 2 years ago

Registration is not stored in DB. It's triggered when a properly instanciated account object is created. I'll have to check all initialization process.

Moreover, restart process (when configuration changes need to be applied) has to be checked so that nothing weird happens aupon reload.

Updated by Saúl Ibarra Corretgé over 2 years ago

I've not fixed it yet, but I found the issue!

Don't know why, but pjsua itself is discovering it's IP and updating registration! By looking at log:

23:30:41.438 pjsua_acc.c IP address change detected for account 0 (10.59.1.119:5090 --> 80.36.109.223:5090). Updating registration..

So what happens is:

- pjsua sends REGISTER with contact = PRIVATE_IP
- pjsua detects it's public IP
- pjsua sends UNREGISTER with contact = PRIVATE_IP
- pjsua sends REGISTER with contact = PLUBLIC_IP <------------ w000t!

We are not using STUN, so there must be an option to disable that... Hope to fix it right away!!

Updated by Iñaki Baz Castillo over 2 years ago

opsss, that's really strange!

However, a common wat to detect our public IP is by inspecting the Via "received" param in any reply from the server. For example, pjsip could take it from the first 100: {{{
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.1.100:8080;rport=8080;branch=z9hG4bKPjtjNiyMDjlmohCKId4gL-TChJr54JaOWI;received=YASS_PUBLIC_IP
From: <sip:yass@domain>;tag=ag1f50o5ScNSPap0pcmQM-nX4BgqjASh
To: <sip:yass@domain>
Call-ID: WeQaHu9CAAL.Y8rVZ3ysJ-eKg.f6a7eB
CSeq: 16702 REGISTER
Server: Kamailio (1.6.0-dev0-notls (x86_64/linux))
Content-Length: 0
}}}

Anyhow, this must be a pjsip's configurable option and not enabled by default! Sure there is some way to dissable it.

Updated by Saúl Ibarra Corretgé over 2 years ago

  • Status changed from Nueva to Resuelta

Fixed!

Look at this option and it's default value:

allow_contact_rewrite -- specify whether the account should learn its
Contact address from REGISTER response and
update the registration accordingly. Default is
True.

Now that option is set to disabled by default :)

In order to get the new option applied, delete your ~/.yass directory.

Updated by Iñaki Baz Castillo over 2 years ago

Saúl Ibarra wrote:

allow_contact_rewrite -- specify whether the account should learn its Contact address from REGISTER response and update the registration accordingly. Default is True.

It would be a bood option in some "advanced" SIP menu configuration.

Updated by Saúl Ibarra Corretgé over 2 years ago

Why do you think it would be usefull? We already have STUN support. If you think it'd be appropiate you are free to open a new task for release 0.5.2, this is an easy one :)

Updated by Iñaki Baz Castillo over 2 years ago

STUN is not as good when are are behind a router with various public IP's and different routes for different destinations, so STUN request get a different mapped public IP than the SIP request.

Of course, taking the public IP from the "received" param is just useful for signalling but not for media.

However all this stuff will be improved when "draft-outbound" is a RFC since it states that a SIP proxy must implement a STUN server in the port 5060.

Yes, better forget my suggestion ;)

Also available in: Atom PDF