[asterisk-users] RE: regcontext, NoOp extension vanishes when extension reload

Watkins, Bradley Bradley.Watkins at compuware.com
Tue Dec 5 14:23:36 MST 2006


> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com 
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of 
> JR Richardson
> Sent: Tuesday, December 05, 2006 3:49 PM
> To: asterisk-users at lists.digium.com
> Subject: [asterisk-users] RE: regcontext,NoOp extension 
> vanishes when extension reload
> 
> >
> > Let me guess:  The context in which you have the 2 thru n 
> priorities 
> > is the same one as you're using for regcontext right?
> >
> > Don't do that, bad things will happen (as you've noticed).
> >
> > I'd have to review the code again, but I think what you're 
> seeing is 
> > as a result of this.
> >
> > Regards,
> > - Brad
> >
> 
> No, not exactly, I have a catchall match in the regext 
> priority 2 that sends the call out to another context that 
> further processes it.

The effect is the same, even though all you're doing is a Goto.  The
problem stems from the fact that the context is "created by
'pbx_config'".  When you do an extensions reload pbx_config removes all
contexts for which it believes it is the owner and then starts from
scratch and creates all the dialplan entries in extensions.conf (OK, any
developers reading this will tell you it's more complex and it is, but
this is a close enough approximation).  So when you have a context with
the same name as your regcontext defined in extensions.conf, then any
entries in that context will be removed and only the ones configured in
extensions.conf will be added back (note that below the regexten
priorities have [SIP] as the creator).  It sounds like you've figured
that out on your own empirically.

For what I believe to be the 'correct' way (or at least *a* way that
won't make you pull your hair out) of working with regexten, see my
recent e-mail response Michael van Baak.


> regcontext is sipregistration
> 
> astreg1*CLI> show dialplan sipregistration [ Context 
> 'sipregistration' created by 'pbx_config' ]
>   '53060' =>        1. Noop(53060)                            
>     [SIP]
>   '53061' =>        1. Noop(53061)                            
>     [SIP]
>   '53062' =>        1. Noop(53062)                            
>     [SIP]
>   '53063' =>        1. Noop(53063)                            
>     [SIP]
>   '53090' =>        1. Noop(53090)                            
>     [SIP]
>   '53091' =>        1. Noop(53091)                            
>     [SIP]
>   '53092' =>        1. Noop(53092)                            
>     [SIP]
>   'i' =>            1. Goto(lookupdundi|${INVALID_EXTEN}|1)   
>     [pbx_config]
>   '_NXXXX' =>       2. Goto(localcontact|${EXTEN}|1)          
>     [pbx_config]
> astreg1*CLI>
> -= 9 extensions (9 priorities) in 1 context. =-
> 
> If I take the _NXXXX and the i exten out, and don't put 
> [sipregistration] in the extension.conf file, then i can 
> reload extensions and the NoOp extensions remain in the dial 
> plan.  Thanks for pointing that out, I can find another solution now.
> 
> It makes sense that if [sipregistration] exist in the 
> extension.conf file and a reload extensions is performed, all 
> the dynamic extensions in that context will be removed, 
> because they are not really there in the first place, 
> statically that is.
> 
> I was using the chanisavail cmd to do the local server 
> lookups, but was getting really sporatic results, works good 
> in the lab but not solid in an uncontrolled environment, live 
> traffic.  I'm wondering if I can use a GotoIf statement to 
> check [sipregistration] for an active extension............
> 
> Good stuff, thanks for the insight Brad.

No problem.  I think I might have to go update the wiki (or add an
entry, I've never actually looked to see what exists) about this.  It
comes up pretty often, and there definitely appears to be some
confusion.

Regards,
- Brad
The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. 


More information about the asterisk-users mailing list