Contexts


#1

I am fairly new to *, but starting to use it some. I have a question about contexts. Here is an example of what I want to do.

I will have a sip-in context for inbound from sip providers which works fine, a business context for business users and a home context for my family users.

How can I set up includes to let the business and home context call each other, the home context make local calls while blocking long distance calls and the business context make local, long distance calls and call the home context.

What would include what. I have tried about every combination I can think of but nothing seems to work quite right.


#2

[sip-in]
include => sip-phones

[sip-phones]
exten => [sip phone extension]

[out-ld]
include => out-local
exten => [match long distance dial pattern]

[out-local]
include => sip-phones
exten => [match local dial pattern]


The context for your sip provider (in sip.conf) would be sip-in. Your home users would use out-local (in sip.conf) and your business users would use out-ld (in sip.conf)


#3

Thanks for the reply. The problem I have is that in this case my kids cannot call my main. So my home users cannot call my business phones, even though the business users can call the home users ok.

Here is a little test snippet I am using. I am just hitting announcements instead of trunks for testing purposes.

[long-distance]
exten => _91NXXNXXXXXX,1,Playback(demo-abouttotry)
;
[local]
exten => _9NXXXXXX,1,Playback(demo-abouttotry)
;
[kids] ; sip.conf context = kids
include => local
exten => 310,1,Voicemail(u310)
;
[main] ; sip.conf context = main
include => long-distance
include => kids
exten => 300,1,Dial(SIP/300,20,r)
exten => 300,2,Voicemail(u300)
exten => 300,102,Voicemail(b300)
exten => 300,103,Hangup
;

Kids can call local only, no long distance or anyone in context main.
Main can call kids, local, and Long Distance

As I say, this is a test setup I am using to learn *, but it should be working the same as a production system.


#4

Your example isn’t very clear as you haven’t indicated who is at what extension. But, going by your comments below it, and assuming the kids’ extension is 310 and the main extension is 300, the reason kids (extension) can’t call main (extension) is because you haven’t included “main” (context) in “kids” (context).

Contexts are about who can call them, rather than who is in them (if you see what i mean!). It’s probably not very helpful to call an extension and a context by the same name - not unless you like being confused, anyway! :wink:


#5

Sorry, let me try to say it a little clearer.

I have 2 sip devices, 300 and 310. In sip.conf, ext. 300 points to business context, ext 310 points to home context.

In extensions.conf I have the following contexts.

longdistance (includes a long distance extension _91NXXNXXXXXX)
local (includes a local extension _9NXXXXXX)
emergency (includes 911 extension)
business (extension 300)
home (extension 310)

I want extension 300 to be able to call home, emergency, local and longdistance

I want extension 310 to be able to call business, emergency and local but not longdistance

If I include longdisance, emergency, local and home in business, I can call all of them. However, home cannot call me.

If I then include business in my home context, then home can call business as well as all the includes in the business context. Without including business context, home cannot call business. So, when I include business in my home context, home can call all included contexts in business as well as business.

Am I doing something wrong or is this the way it is supposed to work. If this is correct, how do you do departments for example that need to call each other but not every context.that is included in the other departments? :question:


#6

I had to do some logic somersaults to get to this, but i think i’ve got my head around it what your problem is! :wink:

The thing is to put all extensions that can be called by the most restricted context actually in that context. Then, include that context in the next least restricted context, plus anything they can call that the more restricted context can’t call. Etc…

So in “[home]”, you define extension 300 and include emergency and local. In “[business]”, define extension 310 and include home and longdistance.

I know it might seem wrong that the “business” phone is in the “[home]” context, and vice versa, but if you think about it, i think you’ll find that’s what you want.

You could write ext 310 into “[home]” as well, rather than into “[business]” - but they probably don’t want to call themselves! Either way, it probably doesn’t make much difference.


#7

Thinking about it, that’s probably not the most logical way to do it unless you want to define the emergency extension in “[home]” and save having the extra complication of a separate “[emergency]” context.

With a separate “[emergency]” context, a more logical way to do it would be to include “[emergency]”, “[local]” and “[longdistance]” in “[business]” - rather than including “[home]” in it.