FreePBX | Register | Issues | Wiki | Portal | Support

Hooking for fun and income

(Lorne Gaetz) #21

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:

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

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.

(Itzik) #22

Got it.

Thank you