Hey guys I am looking for a way in which I can block outgoing calls to all non-existent country prefixes (codes example +1,+359 etc). I want to first understand how can I block my colleagues from dialing one phone number which for example is +123XXXXXXXXXX. So far I ended up with a solution for incoming calls, which does not work for me.
Could you please assist me on the matter?
Asterisk requires rules to positively allow outgoing calls to particular codes, so the simple answer is don’t provide such rules.
As it says in the 7 year old thread that you seem to have touched, even if you have a general rule, that, say level 9 makes a call outgoing, you can provide additional rules that match sub-ranges of destinations, which match more specifically and terminate the call. Alternatively, rather than matching level 9 (_9.), you can match each specific valid code (e.g. _90044.)
To selectively block +123 anything, use a dialplan rule for _+123. which ends the call. (Note that this actual pattern will block several North American long distance codes, so I presume some f the Xes aren’t wildcards.)
Maybe could use a boolean operator as GotoIf.
Maybe we (+1), as a country, can’t count as many votes over the course of several days as American Idol can in a single commercial break, but I can assure you, we do still exist
This dialplan snippet may be useful:
[dial]
exten = _+123.,1, verbose(1,[${EXTEN}@${CONTEXT}])
same = n, hangup()
exten = _+x.,1, verbose(1,[${EXTEN}@${CONTEXT}])
same = n, dial(sip/${EXTEN}@your-sip-provider,30,r)
same = n, hangup()
So you are telling me this piece of code:
[dial]
exten = _+123.,1, verbose(1,[${EXTEN}@${CONTEXT}])
same = n, hangup()
exten = _+x.,1, verbose(1,[${EXTEN}@${CONTEXT}])
same = n, dial(sip/${EXTEN}@your-sip-provider,30,r)
same = n, hangup()
Will block me from dialing (+)0123somephonenumber. I have test env with just extensions.
Do you believe that it could stop it lets say: I am on extension 101 and I try to call 123 (this is the actual exampe.)?
Is it okay if I put this into my context?
It will stop you from dialing +123 something, which is what you were asking about. +0123 obviously won’t match, because of the 0, and 123 won’t match because there is no +.
I put the zero, cuz I will of course replace it, since our office asterisk relies on 0 not a plus.
How to actually apply it, should I insert it in a separate context or ?
You’re moving the goal-post
You have many options, such as:
-
Configuring limited extensions to use a separate dialing context.
-
Using dialplan logic to shunt limited extensions based on a substring of ${CHANNEL} or a per-extension variable.
-
Use a database to store the limiting extension attribute and the country codes in a database for a dynamic approach.
-
Something else that wasn’t off the top of my head.
Only you can decide which approach is most appropriate to your environment and within your skill set.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.