> It took me a while to understand what you were saying ... more clarity
> to your emails!
>

I was trying to be clear and complete.  So many times if you forget to mention 
1 thing or another, or are too long, you get non-helpful comments back.  But I 
will try harder.  Right now Asterisk is as clear as mud with regards to this 
issue, so I am trying to insert some clarity into the process.  Your comments 
do help with my objective, thank you.

> I see where the code says " If we have a context defined, overwrite
> the original context" and after consideration
> I agree with you ... the only problem is that even if you don't define
> the "context=blah" for the user... that user
> inherits the "default" context
>

No, the default is only used if a peer context is not defined.  If a peer is 
defined, it will use the peer context (if set).  Otherwise if the domain 
context is used, it overrides everything.

> However since you did find it in the source code I'm sure you can fix
> it for yourself. Just check against the "default_context"
> and do not overwrite the user's context if it's default.
>

Done for my code, but I was not sure if me maintaining a separate version of 
Asterisk was correct for the community.  I would rather see clarity from the 
source, but I wished to discuss it on the user channel first to make sure I was 
not missing something in everyone's configuration.

> Or add another flag to the user's definition for example
> is_context_set that would be NULL if no context keyword is processed
> from the sip.conf etc.
> That is easier to check instead of comparing against default_context
>

Easier would be to say (pseudo code):

        if (sip_pvt->context == null) {
                if (sip_pvt->domain->context == null) {
                        if (default_context == null) {
                                /* Set the context to whatever is specified in 
sip.conf */
                                sip_pvt->context == default_context;
                        } else {
                                /* If all else has failed */
                                sip_pvt->context = 'default';
                        }
                } else {
                        /* use the domain */
                        sip_pvt->context = sip_pvt->domain->context;
                }
        }  /* assume that the context in the peer definition is correct. */

Hopefully that helps clarify.  I am thinking I should just open a bug issue and 
post the code, but I didn't want to do that if there was some reason to have 
this rather odd sequence of default, peer, domain.


_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to