moghimigiti
(masoumeh moghim ghadikolaei)
May 9, 2024, 7:34pm
1
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)
comtech
(Com Tech)
May 9, 2024, 7:43pm
2
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
david55
(david55)
May 9, 2024, 8:24pm
3
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
moghimigiti
(masoumeh moghim ghadikolaei)
May 10, 2024, 2:29am
4
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)
system
(system)
Closed
June 13, 2024, 5:42am
8
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.