Aserisk Realtime - Extensions

Hi, I started using Asterisk Realtime and its working really well so far, I havent done anything really tricky so far.

I have a simple question.

When I add a new sip user on my database and say this new user is 6001 and uses the context TEST.

The phone can register, but is unable to receive a call, since it`s not on TEST context.

So I need to insert a value on my extensions table for 6001 on context TEST.

Then it works, my question is, I`ll always have to add a sip user and then a new entry in extensions?

P.S - the example is all internal, exten => 6001,1,Dial(SIP/${EXTEN}).

Thanks a lot.


The context in which you put the outgoing call rule need not be the same as that named in device entry.

Although it is bad practice, you can make the resource name the same as the extension number, and use a wildcard pattern. You could also use a table lookup.

Hi David, I kinda didn`t get it what you said.

I have a running asterisk here in the company which I don`t have any root access, and it works the way I want to do.

When you want to create a new sip user, you go to the page, fill in the form and just select the context you want this new sip user to be part of.

So, basically, you just create the sip user and don`t worry about adding a line on extensions for that new sip user.

How can I achieve that?

p.s - check the image, that select box is all context I have created.

Contexts define how calls from the phone are handled. They do not determine how calls to the phone are handled; that is determined by the context associated with the caller.

For a sip phone, you will eventually end up doing:

exten => xxxxx,n,Dial(SIP/yyyyyyy)

If you name your phones such that yyyyyyy is the same as xxxxx, you can replace xxxxx by _X. and yyyyyyy by ${EXTEN}. As this now contains neither xxxxx, nor yyyyyyy, you don’t need to change it every time you add a new phone.

However, this is bad practice (although extremely commonly done) as it means that an attacker can easily find valid values for yyyyyyy, and therefore only needs to concentrate on finding valid passwords.