what's the intended behaviour of ${variable:a:b}? given that ${exten} = 501234 until yesterday ${exten:2} would give '1234' with current CVS ${exten:2} is '50' while ${exten:2:4} is '1234' how do I just strip characters/digits in front of the variable without specifying a length? I was doing things like: exten => _00.,1,Goto(context,${EXTEN:2},1) thanks, lele
the handler for ${exten:2} is commented out from current cvs (pbx.c line 749). I think that mark is adding substring support with double : syntax, but that broke the single : syntax. You can use ${EXTEN-1} ,that works, although is deprecated. matteo. Il mar, 2003-03-18 alle 18:49, Lele Forzani ha scritto:> what's the intended behaviour of ${variable:a:b}? > > > given that ${exten} = 501234 > > > until yesterday ${exten:2} would give '1234' > > with current CVS ${exten:2} is '50' while ${exten:2:4} is '1234' > > how do I just strip characters/digits in front of the variable without > specifying a length? > > > I was doing things like: > exten => _00.,1,Goto(context,${EXTEN:2},1) > > thanks, > lele > > > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users
The problem is here: if ((first=strchr(cp3,':'))) { *first='\0'; offset=atoi(first+1); if ((second=strchr(first+1,':'))) { *second='\0'; offset2=atoi(second+1); } else { offset2=offset; offset=0; } If you have a a double : you get from first to the last offset. If you have a single : you get only the first offset+1 . That must be fixed to handle the full strlen if have only a single : That's all. hope mark fix that (or is a feature). matteo Il mar, 2003-03-18 alle 18:49, Lele Forzani ha scritto:> what's the intended behaviour of ${variable:a:b}? > > > given that ${exten} = 501234 > > > until yesterday ${exten:2} would give '1234' > > with current CVS ${exten:2} is '50' while ${exten:2:4} is '1234' > > how do I just strip characters/digits in front of the variable without > specifying a length? > > > I was doing things like: > exten => _00.,1,Goto(context,${EXTEN:2},1) > > thanks, > lele > > > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users
It's fixed now.> what's the intended behaviour of ${variable:a:b}?it's the same as substring application> given that ${exten} = 501234 > until yesterday ${exten:2} would give '1234'and it does now> > with current CVS ${exten:2} is '50' while ${exten:2:4} is '1234' > > how do I just strip characters/digits in front of the variable without > specifying a length?you can do ${variable:a} or ${variable:a:1000} :) Martin> > > I was doing things like: > exten => _00.,1,Goto(context,${EXTEN:2},1) > > thanks, > lele > > > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users >