Hi, sorry for this noop question, but does anybody know how to cut the first digit of a variable? example: 044612345 should be after cut operation: 44612345 My try in the extension.conf: exten => _0[0-9].,2,Cut(mynum=EXTEN,/ ,1) exten => _0[0-9].,3,Dial(Zap/g1/${mynum},90,T) but it didn't work, my problem is the delemiter, I have no delemiter, the default is "-" but how to use the function cut() without an delemiter? Just snip the first digit of a phonenumber. MfG, Christian Reelfs
Christian Reelfs <chris@mynnga.de> writes:> Hi, sorry for this noop question, > but does anybody know how to cut the first digit of a variable? > > example: > 044612345 > should be after cut operation: > 44612345Look at README.variables! It says: ,---- | The format for removing characters from a variable can be expressed as: | | ${variable_name[:offset[:length]]} | | If you want to remove the first N characters from the string assigned | to a variable, simply append a colon and the number of characters to | remove from the beginning of the string to the variable name. | | ;Remove the first character of extension, save in "number" variable | exten => _9X.,1,Set(number=${EXTEN:1}) `---- cu, Wolfgang
On Fri, 2006-03-31 at 14:03 +0200, Christian Reelfs wrote:> Hi, sorry for this noop question, > but does anybody know how to cut the first digit of a variable? > > example: > 044612345 > should be after cut operation: > 44612345 > > My try in the extension.conf: > > exten => _0[0-9].,2,Cut(mynum=EXTEN,/ ,1) > exten => _0[0-9].,3,Dial(Zap/g1/${mynum},90,T) >Try just: exten => _[0-9].,1,Dial(Zap/g1/${EXTEN:1}) Pete
Christian Reelfs wrote:> example: > 044612345 > should be after cut operation: > 44612345 > > My try in the extension.conf:> exten => _0[0-9].,2,Cut(mynum=EXTEN,/ ,1) > exten => _0[0-9].,3,Dial(Zap/g1/${mynum},90,T) > > but it didn't work, my problem is the delemiter, I have no delemiter, > the default is "-" but how to use the function cut() without an delemiter? > Just snip the first digit of a phonenumber.Use the substring notation as in: ${mynum:1} which snips the first character from the string. See the docs for more info http://www.voip-info.org/wiki/view/Asterisk+variables Trevor Raynsford Software Engineer Aculab -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060331/640cd196/attachment.htm
Reasonably Related Threads
- Aculab
- SpeexEncoder requires 320 samples to process a Frame, not 160
- Asterisk Call File using Local Channel not passing Variable back to Dialplan
- [PATCH 1/2] exa: turn WaitMarker into a NOP.
- Problem with REMAINDER? 957%60 be 15 remainder 57 not 15 remainder -3 ?