Summary:ASTERISK-12585: [patch] chan_sip does not always create regexten for registering peers
Reporter:Dmitry Andrianov (dimas)Labels:
Date Opened:2008-08-15 10:04:48Date Closed:2008-10-14 18:00:04
Versions:Frequency of
Environment:Attachments:( 0) v1-13309.patch
( 1) v2-13309.patch
Description:parse_register_contact contact function only calls register_peer_exten in the case peer's IP/port changes. This is wrong because peer regexten may not be re-created under some circumstances. Scenario

1. Realtime SIP peers database
2. Peer registers with Asterisk.
3. ipaddr and port columns in the database receive peer's real ip+port
4. regexten is created for the peer
5. Asterisk resterted
6. Peer re-registers.
7. This time, peer's data (including ipaddr+port) loaded from the DB
8. Assuming that address and port are the same, Asterisk won't create regexten (because of if (inaddrcmp(&peer->addr, &oldsin)) check in the parse_register_contact)
Comments:By: Dmitry Andrianov (dimas) 2008-08-15 10:08:18

Two notes:
1. The same may be true for 1.6 as well - haven't tested
2. The patch may not apply cleanly because of differetn line numbers - my chan_sip.c is patched inside-out with T38 stuff (so I had to "extract" this patch from what svn diff actually returned). So I recommend either allowing patch utility search wider line-range, or just applying manually - the patch is simple.

By: Dmitry Andrianov (dimas) 2008-08-17 18:46:40

Fixed typo, new version uploaded

By: Digium Subversion (svnbot) 2008-10-14 18:00:02

Repository: asterisk
Revision: 149207

U   branches/1.4/channels/chan_sip.c

r149207 | mmichelson | 2008-10-14 18:00:01 -0500 (Tue, 14 Oct 2008) | 9 lines

Call register_peer_exten even in the case that the peer's
IP/port does not change.

(closes issue ASTERISK-12585)
Reported by: dimas
     v2-13309.patch uploaded by dimas (license 88)