[Asterisk-Users] Is this a bug or by design? Workaround?

Stig Andersson stig at ymex.se
Fri Feb 18 03:42:58 MST 2005


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/



More information about the asterisk-users mailing list