[Home]

Summary:ASTERISK-12204: [patch] 'context' doesn't change when 'sip reload' issued when driven from realtime
Reporter:Nick Barnes (bcnit)Labels:
Date Opened:2008-06-16 10:21:53Date Closed:2009-08-19 15:35:10
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20090819__issue12869__2.diff.txt
Description:I drive sip configuration from realtime and have 'rtcachefriends=yes' in sip.conf.

If I change the context of a SIP device in the database and then 'sip reload' at the CLI, the context for that device does not change in Asterisk.

****** ADDITIONAL INFORMATION ******

The CLI sample below demonstrates the problem:


[root@pbx09a asterisk]# mysql -t -p -e "select context from sip where name='204'" asterisk
Enter password:
+------------+
| context    |
+------------+
| from-agent |
+------------+
[root@pbx09a asterisk]# asterisk -rx 'sip show peer 204'


 * Name       : 204
 Realtime peer: No
 Secret       : <Set>
 MD5Secret    : <Not set>
 Context      : from-agent
 Subscr.Cont. : <Not set>
 Language     : en
 Accountcode  : BAN
 AMA flags    : Unknown
 Transfer mode: open
 CallingPres  : Presentation Allowed, Not Screened
 Callgroup    :
 Pickupgroup  :
 Mailbox      :
 VM Extension : voicemail
 LastMsgsSent : 32767/65535
 Call limit   : 2
 Dynamic      : Yes
 Callerid     : "204" <204>
 MaxCallBR    : 384 kbps
 Expire       : 580
 Insecure     : no
 Nat          : RFC3581
 ACL          : Yes
 T38 pt UDPTL : No
 CanReinvite  : No
 PromiscRedir : No
 User=Phone   : No
 Video Support: No
 Text Support : No
 Trust RPID   : No
 Send RPID    : Yes
 Subscriptions: Yes
 Overlap dial : No
 DTMFmode     : rfc2833
 Timer T1     : 500
 Timer B      : 32000
 ToHost       :
 Addr->IP     : 192.168.1.116 Port 2054
 Defaddr->IP  : 0.0.0.0 Port 2054
 Transport    : UDP
 Def. Username: 204
 SIP Options  : (none)
 Codecs       : 0x8 (alaw)
 Codec Order  : (alaw:20)
 Auto-Framing :  No
 100 on REG   : No
 Status       : OK (15 ms)
 Useragent    : snom320/7.1.30
 Reg. Contact : sip:204@192.168.1.116:2054;line=clmlov67
 Qualify Freq : 60000 ms
 Sess-Timers  : Accept
 Sess-Refresh : uas
 Sess-Expires : 1800 secs
 Min-Sess     : 90 secs

[root@pbx09a asterisk]# mysql -t -p -e "update sip set context='from-authorised' where name='204'" asterisk
Enter password:
[root@pbx09a asterisk]# mysql -t -p -e "select context from sip where name='204'" asterisk
Enter password:
+-----------------+
| context         |
+-----------------+
| from-authorised |
+-----------------+
[root@pbx09a asterisk]# asterisk -rx 'sip reload'
[root@pbx09a asterisk]# asterisk -rx 'sip show peer 204'                        

 * Name       : 204
 Realtime peer: No
 Secret       : <Set>
 MD5Secret    : <Not set>
 Context      : from-agent
 Subscr.Cont. : <Not set>
 Language     : en
 Accountcode  : BAN
 AMA flags    : Unknown
 Transfer mode: open
 CallingPres  : Presentation Allowed, Not Screened
 Callgroup    :
 Pickupgroup  :
 Mailbox      :
 VM Extension : voicemail
 LastMsgsSent : 32767/65535
 Call limit   : 2
 Dynamic      : Yes
 Callerid     : "204" <204>
 MaxCallBR    : 384 kbps
 Expire       : 530
 Insecure     : no
 Nat          : RFC3581
 ACL          : Yes
 T38 pt UDPTL : No
 CanReinvite  : No
 PromiscRedir : No
 User=Phone   : No
 Video Support: No
 Text Support : No
 Trust RPID   : No
 Send RPID    : Yes
 Subscriptions: Yes
 Overlap dial : No
 DTMFmode     : rfc2833
 Timer T1     : 500
 Timer B      : 32000
 ToHost       :
 Addr->IP     : 192.168.1.116 Port 2054
 Defaddr->IP  : 0.0.0.0 Port 2054
 Transport    : UDP
 Def. Username: 204
 SIP Options  : (none)
 Codecs       : 0x8 (alaw)
 Codec Order  : (alaw:20)
 Auto-Framing :  No
 100 on REG   : No
 Status       : OK (37 ms)
 Useragent    : snom320/7.1.30
 Reg. Contact : sip:204@192.168.1.116:2054;line=clmlov67
 Qualify Freq : 60000 ms
 Sess-Timers  : Accept
 Sess-Refresh : uas
 Sess-Expires : 1800 secs
 Min-Sess     : 90 secs

Comments:By: Nick Barnes (bcnit) 2008-06-16 10:39:13

This seems to be a much bigger problem.

If I change any value (or even delete the record), the command 'sip show peer 204' still shows as existing with the old details.

In the example below, I show that this is the case:


[root@pbx09a asterisk]# asterisk -rx 'realtime load sippeers name 204'
No rows found matching search criteria.
[root@pbx09a asterisk]# asterisk -rx 'realtime load sippeers name 204x'
                  Column Name  Column Value
         --------------------  --------------------
                           id  311
                         name  204x
                         host  dynamic
                          nat  no
                         type  friend
                  accountcode  BAN
                     callerid  204 <204>
                   call-limit  2
               cancallforward  yes
                  canreinvite  no
                      context  from-authorised
                     dtmfmode  rfc2833
                     language  en
                         deny  0.0.0.0/0.0.0.0
                       permit  0.0.0.0/0.0.0.0
                  musiconhold  default
                      qualify  yes
                       secret  bank57
                     disallow  all
                        allow  alaw
                  fullcontact  sip:204@192.168.1.116:2057
                  fullcontact  line=ho1d1yj6
                       ipaddr  192.168.1.116
                         port  2057
                   regseconds  1213630511
                  defaultuser  204
[root@pbx09a asterisk]# asterisk -rx 'sip show peer 204'


 * Name       : 204
 Realtime peer: No
 Secret       : <Set>
 MD5Secret    : <Not set>
 Context      : from-agent
 Subscr.Cont. : <Not set>
 Language     : en
 Accountcode  : BAN
 AMA flags    : Unknown
 Transfer mode: open
 CallingPres  : Presentation Allowed, Not Screened
 Callgroup    :
 Pickupgroup  :
 Mailbox      :
 VM Extension : voicemail
 LastMsgsSent : 32767/65535
 Call limit   : 2
 Dynamic      : Yes
 Callerid     : "204" <204>
 MaxCallBR    : 384 kbps
 Expire       : 521
 Insecure     : no
 Nat          : RFC3581
 ACL          : Yes
 T38 pt UDPTL : No
 CanReinvite  : No
 PromiscRedir : No
 User=Phone   : No
 Video Support: No
 Text Support : No
 Trust RPID   : No
 Send RPID    : Yes
 Subscriptions: Yes
 Overlap dial : No
 DTMFmode     : rfc2833
 Timer T1     : 500
 Timer B      : 32000
 ToHost       :
 Addr->IP     : 192.168.1.116 Port 2057
 Defaddr->IP  : 0.0.0.0 Port 2054
 Transport    : UDP
 Def. Username: 204
 SIP Options  : (none)
 Codecs       : 0x8 (alaw)
 Codec Order  : (alaw:20)
 Auto-Framing :  No
 100 on REG   : No
 Status       : OK (42 ms)
 Useragent    : snom320/7.1.30
 Reg. Contact : sip:204@192.168.1.116:2057;line=ho1d1yj6
 Qualify Freq : 60000 ms
 Sess-Timers  : Accept
 Sess-Refresh : uas
 Sess-Expires : 1800 secs
 Min-Sess     : 90 secs

[root@pbx09a asterisk]# asterisk -rx 'sip show peer 204x'
Peer 204x not found.

By: Tilghman Lesher (tilghman) 2008-06-27 16:09:50

Could you update to the latest 1.6.0 SVN?  I cannot reproduce this problem at all.

By: Nick Barnes (bcnit) 2008-07-03 10:24:14

This is happening on a production machine, so I can't easily do an upgrade on it (I'm probably asking too much by running beta in production anyway!).

I'll try and set up a duplicate environment on a test machine.

By: Olle Johansson (oej) 2008-07-03 11:01:04

You have to remove peers from memory to force a reload from your database. SIP RELOAD does not reload all realtime peers from database if I understand correctly. Maybe  the prune CLI command can help you here.

By: Tilghman Lesher (tilghman) 2008-07-03 12:21:08

oej:  actually, a "sip reload" clears out all realtime caches.  I have been unable to reproduce this issue.  Can you reproduce it, as stated above?

By: Tilghman Lesher (tilghman) 2008-07-14 15:30:04

Unable to reproduce and no further response.

By: Tilghman Lesher (tilghman) 2009-08-19 14:59:54

Reopened at the request of lasko, with information to reproduce.

By: Brandon Height (lasko) 2009-08-19 15:26:29

Tested the patch provided and appears to have resolved the issue.

By: Digium Subversion (svnbot) 2009-08-19 15:30:13

Repository: asterisk
Revision: 213093

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r213093 | tilghman | 2009-08-19 15:30:12 -0500 (Wed, 19 Aug 2009) | 7 lines

If we have realtime caching enabled, 'sip reload' must purge users/peers, even if the config files haven't changed.
(closes issue ASTERISK-12204)
Reported by: bcnit
Patches:
      20090819__issue12869__2.diff.txt uploaded by tilghman (license 14)
Tested by: lasko

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=213093

By: Digium Subversion (svnbot) 2009-08-19 15:33:55

Repository: asterisk
Revision: 213094

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_sip.c

------------------------------------------------------------------------
r213094 | tilghman | 2009-08-19 15:33:55 -0500 (Wed, 19 Aug 2009) | 14 lines

Merged revisions 213093 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r213093 | tilghman | 2009-08-19 15:29:41 -0500 (Wed, 19 Aug 2009) | 7 lines
 
 If we have realtime caching enabled, 'sip reload' must purge users/peers, even if the config files haven't changed.
 (closes issue ASTERISK-12204)
  Reported by: bcnit
  Patches:
        20090819__issue12869__2.diff.txt uploaded by tilghman (license 14)
  Tested by: lasko
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=213094

By: Digium Subversion (svnbot) 2009-08-19 15:34:45

Repository: asterisk
Revision: 213095

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_sip.c

------------------------------------------------------------------------
r213095 | tilghman | 2009-08-19 15:34:44 -0500 (Wed, 19 Aug 2009) | 14 lines

Merged revisions 213093 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r213093 | tilghman | 2009-08-19 15:29:41 -0500 (Wed, 19 Aug 2009) | 7 lines
 
 If we have realtime caching enabled, 'sip reload' must purge users/peers, even if the config files haven't changed.
 (closes issue ASTERISK-12204)
  Reported by: bcnit
  Patches:
        20090819__issue12869__2.diff.txt uploaded by tilghman (license 14)
  Tested by: lasko
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=213095

By: Digium Subversion (svnbot) 2009-08-19 15:35:10

Repository: asterisk
Revision: 213096

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_sip.c

------------------------------------------------------------------------
r213096 | tilghman | 2009-08-19 15:35:09 -0500 (Wed, 19 Aug 2009) | 14 lines

Merged revisions 213093 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r213093 | tilghman | 2009-08-19 15:29:41 -0500 (Wed, 19 Aug 2009) | 7 lines
 
 If we have realtime caching enabled, 'sip reload' must purge users/peers, even if the config files haven't changed.
 (closes issue ASTERISK-12204)
  Reported by: bcnit
  Patches:
        20090819__issue12869__2.diff.txt uploaded by tilghman (license 14)
  Tested by: lasko
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=213096