What I have done, which might help in your scenario, is to create a Flow variable to pass to the script instead of using the built-in Call.ANI and create a custom variable in the script to receive it.
For example, I created
Flow.scriptANI and used an Update Data action in the Architect Task to assign the format desired using
Replace():
Replace(ToString(Call.Ani),"tel:","0")
------------------------------
George Ganahl GCP (PureCloud) ICCE CCXP
Principal Technology Consultant
Genesys
------------------------------