Hooking for fun and income

You can’t do what you’ve proposed. If you don’t wish to follow the example above for “How do I apply custom dialplan selectively on some outbound calls?”, then you will need something like this:

[macro-dialout-one-predial-hook]
exten => s,1,Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf)
exten => s,n,GosubIf($["${AMPUSER}"="5004"]?custom-stuff,s,1)
exten => s,n,MacroExit

[custom-stuff]
exten => s,1,Noop(Stating the custom stuff process...)
exten => s,n,TrySystem(doing-stuff-here)
exten => s,n,Return

To your other question, AFAIK you can’t use the extension wildcards in a condition, you will need to parse the variable, i.e. check to see if LEN == 5 characters and if 1st char = = “1” and 4th char == “5” then do this. More work but more elegant to use the regex function core show function REGEX at asterisk console.

2 Likes

Got it.

Thank you

1 Like

I really love it. its damn good.

2 Likes

3 posts were split to a new topic: Dial hooks for offline extensions

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

This topic was automatically closed after 162 days. New replies are no longer allowed.