Wanted to block calls from each phone but to talk to each other if the call is transfered by a third phone

I have a weird request. I want to block specific extensions from calling each other (’‘x’’ extension to call ‘‘y’’ extension) but if they need to call each other ‘‘x’’ extension needs to call a ‘‘z’’ extension which has communication with both to transfer the call to ‘‘y’’ extension.

For the moment i block communication between each other by the code below located in extensions_custom.conf

;disallow calls from extensions 1XX to 2XX
exten => _2XX/_1XX,1,Hangup

Is there any way to make this work?

Thanks in advance!

Is this a multi-tenant situation?

single server with 50 different users locally

I mean why do you want to stop extensions to call each other. That sounds as multi-tenant, for which Asterisk is not the best choice.

they dont want 2 groups to call each other directly but in case they need to talk the reception should be able to put them in touch. don’'t know specific details why but i was asked if it can be done and from what i was searching i can’t find anything just a way to block this 2 groups to call each other. i didnt include the second part of the code:

;disallow calls from extensions 2XX to 1XX
exten => _1XX/_2XX,1,Hangup

Asterisk is not the best choice to do that, but if you want to code it yourself, you might get to accomplish what you are looking for.

Asterisk works perfectly fine for something like this. This has nothing to do with multi-tenancy. Just call control within the organization.

FreePBX has nothing out of the box to do this, but it is quite simple to set up with minor custom context coding.

@2btested123 You want to setup a custom context in extensions_custom.conf. This is found in Admin -> Config Edit.

Here is an example I have for a house phone that can only dial the operator. The phone itself is also set to auto dial 1200. But just in case someone gets around that, the extension is in this context.

[from-house-phone]
exten => 1200,1,Goto(from-internal,${EXTEN},1)
exten => _[*0-9]!,1,Playback(ss-noservice)
exten => h,1,Hangup()

Then in the Advanced tab of the Extension(s) that you want to be in the context, you give them the context.
image

Edit:
You would need a more complex, or at least different bit of context to do what you want.

If your extensions were in simple groups, you could do something like this. (Pulled right out of my butt, may not work).

[from-restricted-extension]
; dialing extensions 1200-1299 is not allowed
exten => _12XX,1,Goto(nocallforyou,1)
; dialing extensions 1400-1499 is not allowed
exten => _14XX,1,Goto(nocallforyou,1)
; dialing anything else is allowed send it back to the normal call flow context
exten => _[*0-9]!,1,Goto(from-internal,${EXTEN},1)
; play the no service message and then hangup;
exten => nocallforyou,1,NoOp()
exten => nocallforyou,n,Playback(ss-noservice)
exten => nocallforyou,n,Hangup()
1 Like

I think this may work. i’ll try this when i have time at work. thanks for the reply

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.