I have made fairly complex dialplan which uses REGEXP matching for allowing or disallowing certain calls, depending on the called extension. This works great so far, but there is one problem which I wasn’t able to solve:
The plan does not handle all possible extensions a user could dial. For example, I have respected the advice which is given in the documents and avoided the extension pattern “_.”, meaning that the respective context won’t handle the case where a user dials an extension which is a single digit (e.g. “1”). If a user does so, Asterisk cancels the call (as it should be), thereby sending the message “not found” to the respective phone.
I would like to change that message (code) to “forbidden”. I have found out that I can send the “forbidden” code to the phones by doing something like “Hangup(21)” in the dialplan. Naturally, this only works in cases where I am in control of the Hangup; it won’t work in case Asterisk cancels the call automatically. Could anybody please tell me how I could change the code which is sent to phones when Asterisk can’t find a matching extension (pattern) in the dialplan? Is there some hook to manipulate the causecode?
There seem to be some dialplan applications which are sending codes for “busy” or “congestion” to the other party, but I couldn’t find an application for sending “forbidden” …
Thank you very much,