Need help building unregular dial plan


I’m new to asterisk, and until now it went pretty well! I already have a pretty simple dial plan and all works good.

But now I have a feature i want to add:

When someone calls me, he gets to a menu and for example presses 1 to contact me, then asterisk calls me and my phone rings,
BUT, when I answer it, I hear a recorded message telling me, let’s say, the caller ID, and asking me what to do with it,
for example, 1-accept the call, 2-send him to the voice mail, 3-send him to a different phone and so on.
Only when I press 1-asterisk connects between me and the caller.

I have no idea how to do it, but I assume this is possible, as asterisk is a super powerful system!

Anyone have an idea that can help me?

Thanks a lot!! :smile::slight_smile:

You should be able to do this starting a macro when someone calls you, in the macro wait for one dtmf, then set a channel variable and then execute the subsequent actions based on the value of that channel variable; to start the macro use the M flag of the third paramter of the Dial application.
From the book Asterisk TFOT 2nd:
M( x [ ^arg ])
Executes the macro x upon the connection of a call, optionally passing arguments
delimited by ^. The macro can also set the MACRO_RESULT channel variable to one of
the following values, to determine what should happen after the macro has
Hangs up both legs of the call.
Acts as if the line encountered congestion.
Acts as if the line was busy. If the j option is specified, it sends the call to
priority n+101, where n is the current priority.
Hangs up the called party and continues on in the dialplan.
Transfers the call to the specified destination.


Marco Bruni

There is a privacy mode in Dial and some specific DIALSTATUS values (e.g. TORTURE) for this sort of application. TFOT doesn’t seem to explain them well. However it is documented, e.g. in and the PDF documentation generated from it.


I’m pretty much a newbie with asterisk, can anyone give me a mini example of a code?

Thanks again!