I do this as well:<div><br></div><div>$var(origFromNumber) = $(re{uri.user});</div><div>$var(finalFromURI) = &quot;sip:81&quot; + $(var(origFromNumber){s.substr,1,0}) + &quot;@&quot; + $fd;</div><div><br></div><div>This works fine for me.  Takes what is essentially a DID and formats it to a SIP PEER string as per the carrier.</div>

<div><br></div><div>You say that var(z) prints correctly in the logs, but according to the parser it&#39;s not a legit URI.  It may just be that your upstream routes don&#39;t recognize this format.</div><div><br></div><div>

We use the usr_loc and db_aliases in order to match the URI up with a destination - have you ensured that there is a valid destination for this SIP URI?</div>