Stig Andersson
2005-Feb-18 03:42 UTC
[Asterisk-Users] Is this a bug or by design? Workaround?
Hi,
I need to use the trailing 5 digits of a callerid. callerid may be anything
from a length of 4 to 10 digits in this case.
Using this:
-----------
SubString,cid=${CALLERIDNUM}|-5|5
Works great, BUT shows this message:
"The use of Substring application is deprecated. Please use
${variable:a:b} instead"
So, I try
---------
SetVar(cid=${CALLERIDNUM:-5:5})
The result is a empty string if CALLERIDNUM is less than 5 digits long,
which is NOT the case of SubString. SubString command returns what remains of
the variable,
that is - if CALLERIDNUM is 4 digits in length, it returns 4 digits. If
CALLERIDNUM is 6 digits,
it returns 5 digits.
If this approach should replace "Substring" - it should behave
identically, shouldn't it?
If by design, is there a workaround?
/Stig
-------------------------------------------------------------------------------------
N Y H E T E R!
- IP-telefoni, spara tusenlappar om ?ret!
- Rikst?ckande ADSL 0,25-24Mbit
- Internetaccess (Modem/ISDN64+128 via Ymex - utan abonnemangskostnad!
- Eposttj?nster, ?ven UUCP, Uppringd SMTP, MX fallback, Dom?nPOP
- Surf24 - en billig bredbandstj?nst fr?n Ymex f?r kunder i H?rn?sand/?landsbro.
-------------------------------------------------------------------------------------
Get your emailed Web-forms into a database of your choice!!!
Checkout DBFORM V1.0, see details at http://www.ymex.se
-------------------------------------------------------------------------------------
Ymex AB| Alv?gen 7 | 871 52 H?rn?sand | Sweden | http://www.ymex.se/
Olle E. Johansson
2005-Feb-18 05:53 UTC
[Asterisk-Users] Is this a bug or by design? Workaround?
Stig Andersson wrote:> So, I try > --------- > SetVar(cid=${CALLERIDNUM:-5:5}) > > The result is a empty string if CALLERIDNUM is less than 5 digits long, > which is NOT the case of SubString. SubString command returns what remains of the variable, > that is - if CALLERIDNUM is 4 digits in length, it returns 4 digits. If CALLERIDNUM is 6 digits, > it returns 5 digits. > > If this approach should replace "Substring" - it should behave identically, shouldn't it? > > If by design, is there a workaround?This was fixed in cvs head this week, maybe coming up soon in cvs stable. /Olle