Protect room extensions from each other

Hello,

I have a box with freepbx-2.2.1 installed (I know, fairly old).

The pbx is installed in a sort of Hotel where there’is a reception and 35 rooms.

I would like the reception to be able to ring the rooms, the rooms to be able to ring the reception, but need to avoid rooms to ring each other (for jokes, etc…).

I’ve tried this in extensions_custom.conf:

;[from-internal-custom]
exten => _1[0123]X,1,playback(ss-noservice)
exten => _1[0123]X,n,Hangup()
include => from-internal

Then I’ve assigned the “from-internal-custom” context to extensions via the web admin (by means of the “context” field).

Result, rooms are unable to ring each other, but the reception is unable to ring rooms as well.

Is it possible to set up a protection in order that only calls between rooms are prohibited, but rooms can still ring the reception and reception can still ring the rooms?!

Thank you very much
Stefano

Could I maybe write something like this?!

exten => _1[0123]X,n,GotoIf($[${fromext} =~ _1[0123]X ?:goodbye)
include => from-internal

meaning with that that if $fromext (that I hope to be a globally set variable) matches _1[0123]X expression the call is hung up?

Thank you for your kind answer, but I’m still stuck… I really don’t understand the logic of dialplans, would it be possible to give me an example? What kind of condition could I use? Do regular expressions work? How can I express the simple statement “If call is coming from THIS extension -> hangup; else if call is coming from THIS OTHER extension -> simply continue as normal”.

I must admit this dialplan language, after having mastered perl, java, prolog, python, ruby and much more, is still very uncertain to me.

Then, considering the system is in production and that I cannot do many tests with people in the rooms… it’s even more difficult. I try to make an example here.

Now I have:

[from-internal-custom]
exten => _1[0123]X,1,playback(ss-noservice)
exten => _1[0123]X,n,Hangup()
include => from-internal

I could change it to ?!:
exten => _1[0123] GotoIf(${SOURCE matches _1[0123]}?:goodbye)

But this is only a made up syntax. Could someone help me to figure out the right one?

Thank you!
Stefano

Just expand that dialplan code to do a check of the caller ID before deciding block the call.

How can I do that? The concept is: if extension 101 (room) wants to call extension 102 (another room) -> REFUSE. If extension 101 wants to call extension 44 (reception) -> OK. If extension 44 (reception) wants to call wherever -> OK.

I put extensions 101 to 135 on a separate context (from-internal-custom) but freepbx seems to ignore this.

How can I insert a condition based on the source extension?

Thank you!
S.

And further to that,

https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Function_CALLERID

http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-CHP-6-SECT-3.html

Of course the colon is a mistake… my snippet is:

[from-internal-custom]
exten => _1[0123]X,1,playback(ss-noservice)
exten => _1[0123]X,n,Hangup()
include => from-internal