Custom contexts module

My Custom Contexts Module didn’t load correctly. I followed the directions at Elastix Without Tears. I had to save the customcontexts-
0.3.3.tgz?format=raw to my desktop and WinSCP it into /var/www/html/admin/modules. It saved as a .tar file, so instead of typing mv customcontexts-0.3.3.tgz?format=raw customcontexts-0.3.3.tgz I typed mv customcontexts-0.3.3.tgz?format=raw customcontexts-0.3.3.tar

Then
tar -xzvf customcontexts-0.3.3.tar
rm -f customcontexts-0.3.3.tar

Something seemed weird. The Outbound Routes were not consistent on my Contexts. Does anyone see a problem with doing tar instead of tgz? The files all seemed to unpack.

Thanks

You are pulling an old and buggy version of custom-context.

You should be pulling it from the Extended Repository (which means you need to be running version 2.6 or higher, and in any event, version 2.5 and prior is not being supported any longer).

Thanks, p_lindheimer. It was indeed buggy. I disabled it in FreePBX. if I go to the folder where I installed it and do a make clean, will that undo everything I did? I’m confused about this command. How does it know where/when to stop deleting files/folders? Thank you.

Also, while I have your ear, here is my scenario. I have extensions 2000-2009. I want to prevent the first three extensions from 4-digit dialing the rest, and the middle three from dialing the rest, and so on. So I can segregate companies from 4-digit dialing to each other in a mulit-tenancy situation. I am running Elastix 1.6-12. Per the instructionns in Elastix Without Tears, I’ve achieved restricting routes by placing from-restricted in the Extension Context and then defining the [from-restricted] outbound routes in extensions_custom.conf. Is there a way to restrict the extension from dialing certain extenstions in the [from-restricted] scripts in extensions_custom.conf? I’ve tried a few things, but I cannot make it work. Also, If I get the Custom Contexts working, is this achievable there?

Thanks.

You’ll have to get some of the others who do this to help you in more details.

As far as custom-context, you can’t restrict extensions to extension dialing unless you restrict everyone from calling anyone.

There are also lots of subtle issues that will fail when you try to make a multi-tenant setup out of FreePBX, the dialplan is not designed for it. If you understand those limitations and “security” flaws and they are acceptable, it may make a fine solution for you.

From what I have seen, most people who do this don’t understand those though.

concerning the previous post, there is no ‘make clean’ - you simply use Module Admin to uninstall the module and it should remove all appropriate tables and code.

10-4. Love the pic, by the way. Nowhere else I’d rather be than sailing.

warning – this is a long post “the dialplan is not meant for it” Can you clarify? I think I can do things in Elastix that the base FreePBX user cannont. Elastix Without Tears says “While freePBX is a very versatile GUI front-end for Elastix it does not have the facility to configure a PBX for multi-Tenants application. However, Elastix (Asterisk) has the ability to do it with a little creative manipulation.”

This creative manipulation is simply setting up different incominng IVRs (I can uncheck the ability for callers to extension dial on the IVR settings, thereby preventing them from accidentally getting to the wrong company)and creating different call handling contexts in the extensions_custom.conf configuration file. This last part has to be done to direct each company out their appropriate Trunk. I am all SIP, so I could just send them all out the same trunk to my VSP, and I can set the CID in the Extension so ringback will go to the right company, but if I send them all out the same trunk my CDR will show all that trunk, and I"ll have a hard time determining how to bill LD and International. But the way I have it set up it works great – see the commented out routes under each context (ignore from-restricted, I am not using it.)

Now if I could just prevent one extension from 4-digit dialing a defined group. Is there no way to create a 4-digit block of extensions somewhere and then prevent phones from dialing to a commented out set?

[from-internal-primary]

;
; These are all the applications that you will require
;
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-calltrace
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => app-dialvm
include => app-directory
include => app-dnd-off
include => app-dnd-on
include => app-echo-test
include => app-recordings
include => app-speakextennum
include => app-speakingclock
include => app-userlogonoff
include => app-zapbarge
include => app-vmmain
include => ext-group
include => ext-fax
include => ext-meetme
include => ext-findmefollow
include => ext-paging
include => ext-queues
include => ext-test
include => ext-local
include => parkedcalls

;
; #### OutBound Routes ########
; # Below are all restricted routes #
; ###########################
;
; new outbound-restricted-routes

include => outbound-allroutes-custom
include => outrt-001-9_outside
include => outrt-002-primary
;include => outrt-003-medical
;include => outrt-004-dental
exten => foo,1,Noop(bar)
;
; end of outbound-restricted-routes
;
exten => h,1,Hangup
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

[from-internal-dental]

;
; These are all the applications that you will require
;
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-calltrace
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => app-dialvm
include => app-directory
include => app-dnd-off
include => app-dnd-on
include => app-echo-test
include => app-recordings
include => app-speakextennum
include => app-speakingclock
include => app-userlogonoff
include => app-zapbarge
include => app-vmmain
include => ext-group
include => ext-fax
include => ext-meetme
include => ext-findmefollow
include => ext-paging
include => ext-queues
include => ext-test
include => ext-local
include => parkedcalls

;
; #### OutBound Routes ########
; # Below are all restricted routes #
; ###########################
;
; new outbound-restricted-routes

include => outbound-allroutes-custom
include => outrt-001-9_outside
;include => outrt-002-primary
;include => outrt-003-medical
include => outrt-004-dental
exten => foo,1,Noop(bar)
;
; end of outbound-restricted-routes
;
exten => h,1,Hangup
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

[from-internal-medical]

;
; These are all the applications that you will require
;
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-calltrace
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => app-dialvm
include => app-directory
include => app-dnd-off
include => app-dnd-on
include => app-echo-test
include => app-recordings
include => app-speakextennum
include => app-speakingclock
include => app-userlogonoff
include => app-zapbarge
include => app-vmmain
include => ext-group
include => ext-fax
include => ext-meetme
include => ext-findmefollow
include => ext-paging
include => ext-queues
include => ext-test
include => ext-local
include => parkedcalls

;
; #### OutBound Routes ########
; # Below are all restricted routes #
; ###########################
;
; new outbound-restricted-routes

include => outbound-allroutes-custom
include => outrt-001-9_outside
;include => outrt-002-primary
include => outrt-003-medical
;include => outrt-004-dental
exten => foo,1,Noop(bar)
;
; end of outbound-restricted-routes
;
exten => h,1,Hangup
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

[from-restricted]
;
; These are all the applications that you will require
;
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-calltrace
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => app-dialvm
include => app-directory
include => app-dnd-off
include => app-dnd-on
include => app-echo-test
include => app-recordings
include => app-speakextennum
include => app-speakingclock
include => app-userlogonoff
include => app-zapbarge
include => app-vmmain
include => ext-group
include => ext-fax
include => ext-meetme
include => ext-findmefollow
include => ext-paging
include => ext-queues
include => ext-test
include => ext-local
include => parkedcalls

;
; #### OutBound Routes ########
; # Below are all restricted routes #
; ###########################
;
; new outbound-restricted-routes

include => outbound-allroutes-custom
include => outrt-001-9_outside
include => outrt-002-primary
include => outrt-003-medical
include => outrt-004-dental
exten => foo,1,Noop(bar)
;
; end of outbound-restricted-routes
;
exten => h,1,Hangup
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

Unfortunately there are lots of sources of documentation telling you how to do things of varying quality.

I have not read Elastix without tears to make any judgment as to the author’s knowledge in this area or not.

As I have mentioned, there are many different “definitions” of what users want when they are trying to create such “mutli-tenant” setups. In many cases, they may be able to achieve what they want and the “loopholes” may not be important. In other cases, these may be issues.

There are transfer scenarios, follow-me functionality, speeddial, IVR extension dialing, directory dialing, ringgroup scenarios, Queue scenarios, Parking scenarios, etc. - all of which can have impacts on the ‘context’ separation typically required to implement varying degrees of separation. Some of these may matter, some may not, some may not be relevant.

The bottom line, if one is going to embark on creating solutions in this area, they probably owe it to their customers, and themselves, to have a really good understanding of the implications of what they are doing, well beyond the simple readings of “Quick Start Guides” that may or may not be authoritative and/or accurate in the information they provide.

Thanks.

I actually do block some internal calls with Custom Contexts:

Set ext-local to Allow Rules.
Put the allowed extensions in the Dial Rules box.
(Or do it vice versa with Deny Rules)
Same goes for Ring Groups.

Just another reason for keeping this module, which I don’t believe was ever specifically intended for multi-tenant use.

Hi, I’m not sure I understand you. I don’t have the Contexts Module loaded right now, but I do have another box I am going to bring up and will get the new version. I may do this with the newest version of Elastix. At any rate, is there a way to “Set ext-local to Allow Rules.” and “Put the allowed extensions in the Dial Rules box” in FreePBX settings anywhere? In some of the files like extensions_custom.conf or something? I’ve created contexts that force extensions to dial out of certain trunks. I have all the trunks in their from-internal- and I comment out the trunks they can not use. It seems like I should be able to deny all 4-digit dialing, and then allow only certain extensions for a particular extension, or outbound route. What I believe I’ve done in extensions_custom.conf is create the contexts that you do in the Contexts Module. In every Context there are applications that are included. I believe the one that allows for 4-digit dialing is “include => ext-local”. If that is the case, is there not already a global “allow” If I only have 100 extensions on a box and I want to prevent on Context from dialing 95 of them, it seems I should be able to put them all in like I do the Trunks and comment out the restricted ones. Do you see a way to do this? Thank you.

Since this thread is supposedly about the Custom Context module, here’s an example using it to restrict calling between certain extensions.

The following assumes you have the Custom Context MODULE installed correctly.

Department1, exts 2120-2129, Department2, exts 2130-2139

Department1 doesn’t ever want to call Department2, and vice versa.

Make a Custom Context called Dept1
Set ext-local in Internal Dialplan items to Allow Rules
In the dial rules box put 212X
Select this Dept1 context for extensions 2121 - 2129 (on the Extensions page)

Make another Custom Context called Dept2
set ext-local to Allow Rules
In the Dial Rules box enter 213X
Select Dept2 as the context for extensions 2130-2139.

That is a CC doing just one thing, ie blocking some internal calls. In practice a single context can do many things combined, that’s why it is so useful.