[VoIP] Zaptel end-of-dialing
Shane Young
voiptandem at shaneyoung.com
Thu Sep 6 14:21:55 CDT 2007
Again, there are several ways to skin a cat (or dialplan)...
If you dial 18217301#
Your EXTEN variable is set to 18217301#.
When it's passed to the macro, the variable name is MACRO_EXTEN
You could use ${MACRO_EXTEN:0:11) to skip 0 digits and use the next 11
digits, this eliminating the 12th digit (#)
The nice thing is you can use the same thing even if you don't dial the #.
It will still skip 0 digits and use the next 11.
Another way might be to do something like this:
[somecontext]
exten => _1X.,1,Macro(dial-cnet)
exten => _1X.#,1,GoTo(somecontext,${EXTEN:0:11},1)
The first one would just fire after the timer and follow the normal path.
The second one would loop back and "start over" as if you had dialed
the number without the # ad the end, but would not wait for any
addtional digits. It would then pick the first entry.
the voip-info wiki gives information about the use of substrings
within a variable:
http://www.voip-info.org/wiki/index.php?page=Asterisk+variables
Substrings
${foo:offset:length}
returns a substring of the string foo, beginning at offset offset and
returning the next length characters.
If offset is negative, it is taken leftwards from the right hand end
of the string.
If length is omitted or is negative, then all the rest of the string
beginning at offset is returned.
Examples:
${123456789:1} - returns the string 23456789
${123456789:-4} - returns the string 6789
${123456789:0:3} - returns the string 123
${123456789:2:3} - returns the string 345
${123456789:-4:3} - returns the string 678
Examples of use:
exten => _NXX.,1,SetVar(areacode=${EXTEN:0:3}) - get the first 3
digits of ${EXTEN}
exten => _516XXXXXXX,1,Dial(${EXTEN:3}) - get all but the
first 3 digits of ${EXTEN}
exten => 100,1,SetVar(whichVowel=4)
exten => 100,2,SetVar(foo=AEIOU:${whichVowel}:1) - sets ${foo} to
the single letter 'U'
Quoting Greg Blakely <greg at vyger.net>:
> Okay. That works, except for figuring out how to send the correct digits
> to the dial-cnet macro.
>
> I am wondering if it wouldn't be easiest to modify the dial-cnet macro
> to ignore the # sign. Any ideas on how to do that? Or to send the
> macro the correct digits, for that matter?
> _______________________________________________
> VoIP mailing list
> VoIP at ckts.info
> http://lists.ckts.info/mailman/listinfo/voip
> Project Web Page: http://www.ckts.info/
>
--Shane
+1-821-7311 CNET
More information about the VoIP
mailing list