[Home]

Summary:ASTERISK-09465: regcontext only works in realtime with rtcachefriends=yes
Reporter:Allan Gomes (allangood)Labels:
Date Opened:2007-05-17 16:31:57Date Closed:2011-06-07 14:08:11
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Registration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) debug
Description:Before Asterisk 1.4.x it's possible to use the "regcontext" feature without enabling rtcachefriend with realtime users and now this is no longer possible. This feature is really important if you use DUNDi.

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

This is a output:

Added extension '1001' priority 1 to sipregistration
   -- Added extension '1001' priority 1 to sipregistration
   -- Unregistered SIP '1001'
   -- Registered SIP '1001' at 10.1.6.16 port 5060 expires 60
   -- Added extension '1001' priority 1 to sipregistration
   -- Added extension '1001' priority 1 to sipregistration
asterisk1*CLI> dialplan show sipregistration
[ Context 'sipregistration' created by 'SIP' ]

-= 0 extensions (0 priorities) in 1 context. =-

Looks like Asterisk try to register the extension, but it fail.
And if I enable the rtcachefriend, everithing works perfectly.

Thank you.
Comments:By: Olle Johansson (oej) 2007-05-18 05:26:58

Have you tested with rtcachefriend=yes ?

I don't see any dependency of this in the code and chan_sip does call the extension handler to change, so something is wrong somewhere else. Please set debug to 9 as well as verbosity, turn on SIP debug and try to see if you catch other messages. Make sure that ERROR and DEBUG log are sent to the console in logger.conf

By: Allan Gomes (allangood) 2007-05-18 07:38:51

Yes, with rtcachefriend=yes everything works perfectly.

With debug, I receive this error only when rtcachefriend=no

[May 18 09:30:57] DEBUG[19553]: db.c:197 ast_db_get: Unable to find key '1001' in family 'SIP/Registry'

Doing more tests here, I perceived that this issue occurs on IAX too.
So, the error probably is in another part of the code...

Thank you.



By: Allan Gomes (allangood) 2007-05-25 13:22:09

Can I do anything else?
I need to open another "ticket" in another section?
Do you confirm this bug? (this is really a bug?)

What can I do to help?

Thank you.



By: Joshua C. Colp (jcolp) 2007-05-31 10:58:59

The issue is that the peer gets destroyed in memory immediately after registering. This brings up a thought - how would chan_sip know that the peer was no longer around if it's registration expired? It wouldn't, it has no concept of it so the dialplan logic would just stick around.

By: Allan Gomes (allangood) 2007-05-31 13:02:30

Yes, this is really a problem. But reading the posts I have found an interesting solution (ASTERISK-3546): to use the qualify option to create the contexts. On this option just the reachable/unreachable peers would be added/removed from the contexts and the extention would't be created on the register but just when the peer is reachable.
This is perfect to use with DUNDi.

What do you think about this?

Thank you.



By: Joshua C. Colp (jcolp) 2007-05-31 13:04:42

The peer has to be in memory to use qualify=yes, which requires rtcachefriends.

By: Allan Gomes (allangood) 2007-05-31 13:33:31

Ouch! :)

But, this sounds strange to me.

Look at this:

[May 31 15:27:05] NOTICE[8479]: chan_sip.c:12142 handle_response_peerpoke: Peer '1001' is now Reachable. (58ms / 2000ms)
   -- Added extension '1001' priority 1 to sipregistrations
   -- Added extension '1000' priority 1 to sipregistrations
   -- Added extension '1000' priority 1 to sipregistrations
   -- Added extension '1000' priority 1 to sipregistrations
   -- Added extension '1000' priority 1 to sipregistrations
   -- Added extension '1000' priority 1 to sipregistrations
   -- Added extension '1000' priority 1 to sipregistrations
   -- Added extension '1000' priority 1 to sipregistrations
   -- Added extension '1011' priority 1 to sipregistrations
   -- Added extension '1011' priority 1 to sipregistrations
   -- Added extension '1011' priority 1 to sipregistrations
asterisk1*CLI> dialplan show sipregistrations
[ Context 'sipregistrations' created by 'SIP' ]

-= 0 extensions (0 priorities) in 1 context. =-
asterisk1*CLI>

asterisk1*CLI> sip show settings
asterisk1*CLI>

Global Settings:
----------------
 SIP Port:               5060
 Bindaddress:            0.0.0.0
 Videosupport:           No
 AutoCreatePeer:         No
 Allow unknown access:   No
 Allow subscriptions:    Yes
 Allow overlap dialing:  No
 Promsic. redir:         No
 SIP domain support:     No
 Call to non-local dom.: Yes
 URI user is phone no:   No
 Our auth realm          asterisk
 Realm. auth:            No
 Always auth rejects:    Yes
 Call limit peers only:  Yes
 Direct RTP setup:       No
 User Agent:             VoIP_PBX
 MWI checking interval:  10 secs
 Reg. context:           sipregistrations
 Caller ID:              asterisk
 From: Domain:
 Record SIP history:     Off
 Call Events:            On
 IP ToS SIP:             none
 IP ToS RTP audio:       none
 IP ToS RTP video:       none
 T38 fax pt UDPTL:       No
 RFC2833 Compensation:   No
 SIP realtime:           Enabled

Global Signalling Settings:
---------------------------
 Codecs:                 0x8000e (gsm|ulaw|alaw|h263)
 Codec Order:            none
 T1 minimum:             100
 Relax DTMF:             No
 Compact SIP headers:    No
 RTP Keepalive:          0 (Disabled)
 RTP Timeout:            300
 RTP Hold Timeout:       600
 MWI NOTIFY mime type:   application/simple-message-summary
 DNS SRV lookup:         No
 Pedantic SIP support:   No
 Reg. min duration       10 secs
 Reg. max duration:      60 secs
 Reg. default duration:  30 secs
 Outbound reg. timeout:  20 secs
 Outbound reg. attempts: 0
 Notify ringing state:   No
 Notify hold state:      No
 SIP Transfer mode:      open
 Max Call Bitrate:       384 kbps
 Auto-Framing:           No

Default Settings:
-----------------
 Context:                from-sip
 Nat:                    RFC3581
 DTMF:                   rfc2833
 Qualify:                0
 Use ClientCode:         No
 Progress inband:        Never
 Language:               pt_br
 MOH Interpret:          default
 MOH Suggest:
 Voice Mail Extension:   asterisk

Realtime SIP Settings:
----------------------
 Realtime Peers:         Yes
 Realtime Users:         Yes
 Cache Friends:          No
 Update:                 Yes
 Ignore Reg. Expire:     No
 Save sys. name:         No
 Auto Clear:             120                                                                                                                

With qualify=yes and rtcachefried=no asterisk can know that my peer is reachable. This is true that this only occurs when my peer makes a call, but after this first call * will always look for it.

By: Joshua C. Colp (jcolp) 2007-05-31 13:41:42

Can you clarify some more? Your last statement confuses me.

By: Allan Gomes (allangood) 2007-05-31 14:16:34

Sorry.
Did you say:
"The peer has to be in memory to use qualify=yes, which requires rtcachefriends."

But with rtcachefriends=no and qualify=yes I see this on my * console:

[May 31 15:27:05] NOTICE[8479]: chan_sip.c:12142 handle_response_peerpoke: Peer '1001' is now Reachable. (58ms / 2000ms)

So, this make me think about "qualify=yes requires rtcachefriends". And apparently this is not (totally) true. (The output is to show that with rtcachefriend=no the qualiffy option works)

But, any way, how previous version of asterisk makes regcontext= works?
This was removed from the code?

By: Joshua C. Colp (jcolp) 2007-06-07 12:33:08

I was unable to reproduce your qualify success under 1.4, unless I turned on caching. This was one of the reasons caching was written.

By: Allan Gomes (allangood) 2007-06-07 21:14:57

It's really a funny thing. I have more sip accounts, but only one can qualify... (but all of them are realtime)
I have the "devstate" (from bristuff) and this extension (1001) is the watcher (subscribe) for another extension, this is the only difference from this extension to the others, maybe this explain something...

But forgetting the qualify, how asterisk < 1.4 treat this? Why the peer is destroyed in memory so early? It's possibly to maintain it until the first expiration? If yes, the problem with regcontext will disappear.
Create the extension on user registration and destroy some seconds after register expiration. Some seconds after because if the user re-send the registration (he's alive) asterisk don't need to destroy the extension.

Maybe this will help with this (ASTERISK-9540) issue too.

By: Allan Gomes (allangood) 2007-06-18 09:43:06

Ping?
:)

By: Joshua C. Colp (jcolp) 2007-06-19 09:58:12

I've confirmed that even under 1.2 this doesn't work, and as I've said before it is a known architecture issue with realtime... thus why caching exists in the first place. As for your other suggestions about changes, we like to talk about those on asterisk-dev mailing list so everyone can participate.