Hi guys, i’m running 1.4.37 and FreePBX 2.5.1.5.
I need to do some advance manipulation like page 144 of “Asterisk the Definitive Guide 4th Edition”:
More Advanced Digit Manipulation
The ${EXTEN} variable properly has the syntax ${EXTEN : x : y} , where x is the starting
position and y is the number of digits to return. Given the following dial string:
94169671111
we can extract the following digit strings using the ${EXTEN:x:y} construct:
• ${EXTEN:1:3} would contain 416
• ${EXTEN:4:7} would contain 9671111
• ${EXTEN:-4:4} would start four digits from the end and return four digits, giving
us 1111
• ${EXTEN:2:-4} would start two digits in and exclude the last four digits, giving us
16967
• ${EXTEN:-6:-4} would start six digits from the end and exclude the last four digits,
giving us 67
• ${EXTEN:1} would give us everything after the first digit, or 4169671111 (if the
number of digits to return is left blank, it will return the entire remaining string)
This is a very powerful construct, but most of these variations are not very common in
normal use. For the most part, you will be using ${EXTEN} (or perhaps ${EXTEN:1} if
you need to strip off an external access code, such as a prepended 9).
When i change the “Outbound Route” i put this in the Dial Pattern box:
88|0[23]xx15xxxxxxx
I need to Remove “15” inside the number but i don’t know how do this!
This is the file “extension_additional.conf”
[outrt-006-prueba]
include => outrt-006-prueba-custom
exten => _880[23]xx15xxxxxxx,1,Set(MOHCLASS=${IF($["x${MOHCLASS}"="x"]?baco-spot:${MOHCLASS})})
exten => _880[23]xx15xxxxxxx,n,Macro(user-callerid,SKIPTTL,)
exten => _880[23]xx15xxxxxxx,n,Set(_NODEST=)
exten => _880[23]xx15xxxxxxx,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _880[23]xx15xxxxxxx,n,Macro(dialout-trunk,14,${EXTEN:2},,)
exten => _880[23]xx15xxxxxxx,n,Macro(outisbusy,)
; end of [outrt-006-prueba]
And this is the modified version. I put this in "extensions_override_freepbx.conf "
[outrt-006-prueba]
include => outrt-006-prueba-custom
exten => _880[23]xx15xxxxxxx,1,Set(MOHCLASS=${IF($["x${MOHCLASS}"="x"]?baco-spot:${MOHCLASS})})
exten => _880[23]xx15xxxxxxx,n,Macro(user-callerid,SKIPTTL,)
exten => _880[23]xx15xxxxxxx,n,Set(_NODEST=)
exten => _880[23]xx15xxxxxxx,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _880[23]xx15xxxxxxx,n,Macro(dialout-trunk,14,${EXTEN:2:4}${EXTEN:8:6},,)
exten => _880[23]xx15xxxxxxx,n,Macro(outisbusy,)
; end of [outrt-006-prueba]
The only diference between those lines is
exten => _88x.,n,Macro(dialout-trunk,14,${EXTEN:2:4}${EXTEN:8:6},)
I don’t know how to match this expresion.
I try cutting something like this:
880[23]xx15|[23]xx+xxxxxxx
This only put in the dial command “[23]xx+xxxxxxx” but not translate the param [23]xx to the real information.
Thanks for your time.
gamba47