|Summary:||ASTERISK-05338: chan_sip forgets IP address of dynamic client when registration expires|
|Reporter:||Ryan Hulsker (rhulsker)||Labels:|
|Date Opened:||2005-10-20 19:52:01||Date Closed:||2005-10-28 13:12:22|
|Environment:||Attachments:||( 0) patch.txt|
|Description:||Dynamic sip peers who's registration expires cannot be contacted by Asterisk at all after the expiry.|
The attached patch works by copying the last known IP address of the peer into the Default IP parameter when the registration expires.
During a network outage, the peer's registration may expire, This patch will allow Asterisk to resume connecting calls as soon as the network comes back up, instead of having to wait until the peer re-registers.
****** ADDITIONAL INFORMATION ******
I will be faxing my disclamer tonight.
This will also help in situations with multiple Asterisk servers without 3rd party load balancing or failover gear.
My situation is like this
Cisco5400 w/ PRI <-> Dual Asterisk servers <-> SIP Phones
The Dual Asterisk servers share a replicated MYSQL database.
The Cisco will happily load balance inbound calls between the 2 sip servers, and the phones will only register with one server, but will happily fail over to the other one if required.
If a phone registers with Server1 its IP address is recorded in the sip_conf database.
If a call comes in to Server2 for that phone, and it has never registered, the server will use the last known IP in the sip_conf database and the call will work.
But if the phone has registered with both servers at some point, and is currently registered to Server1, the peer entry on Server2 shows (Unknown) after the registration expires, and the call does not get routed. This patch fixes that.
|Comments:||By: Mark Spencer (markster) 2005-10-21 00:36:48|
This would seem to defeat the point of registration? Perhaps if someone said "defaultip=dynamic" then this sort of behavior could be enabled?
By: Ryan Hulsker (rhulsker) 2005-10-21 17:33:39
The problem right now is that the behavior is inconsistent when Asterisk is configured for realtime SIP configuration, and rtignoreexpire=yes, rtcachefriends=yes, rtupdate=yes.
When a peer registers, its ip address is recorded in the DB, if asterisk goes down, and comes back up, it will use the last known ip from realtime to route calls until the peer registers because it ignores the expiry.
However, if the network goes down and comes back up after the registration expires, the peer is still in memory with a 0ed out ip, and calls do not get routed.
I guess the proper fix is to have the ip copied into defaultip only if the rtignoreexpire=yes and the client is dynamic.
That would make rtignoreexpire apply to when asterisk starts up, as well as when a registration expires due to a network outage or somthing.
I will submit another patch if you like this solution.
By: Clod Patry (junky) 2005-10-21 23:36:13
rhulsker: what's your disclaimer status?
We would need it to make any review on your patch.
By: Olle Johansson (oej) 2005-10-22 04:17:48
The idea with an expired registration is that it should expire. We should not remember the IP address after expiration in any case - realtime or not. If we ignore the expiry after a restart with realtime that is a bug in itself that should be fixed.
If the network is down so a phone can't register it should try again when the network is up. It's a client issue.
By: Mark Spencer (markster) 2005-10-28 13:11:59
I've actually renamed the "rtignoreregexpire" to "ignoreregexpire" so that should now allow you to do what you want with non-realtime peers.
By: Mark Spencer (markster) 2005-10-28 13:12:22
(I should still point out that I don't think this is a good idea though)