How can I remove all the leading zeros in callers entires?

I use read asterisk command to ask customer to enter a customer number and sometimes they add zero to their custno. Dont know how many 0 they may add. Let say they enter 00123 or 0123 and I am looking for 123. How can I strip these zeros?

exten => 9801001,1,Read(CustNum,custom/CCR0001,8,1,4)

These will probably help. If it’s always the last X digits of the customer entry, you probably only need the first link.
Manipulating Variables Basics - Asterisk Documentation

Asterisk func len - VoIP-Info

Asterisk cmd GotoIf - VoIP-Info

I think:

$[0+${CustNum}]

might work, as I can’t see any warnings about initial 0s signalling octal.

Otherwise use the dialplan expression regular expression operator.

2 Likes

Thank you!. $[0+${CustNum}] worked.

Thanks David55 for sharing this, I was also facing the same issue. Now my issue has resolved by the solution you provided.

(Steve)