To manipulate the request URIi [1] (from PSTNi [2] known as B-number) before ex. sending to a gateway, you can use strip(a); to strip a number of characters or digits and you can use prefix("123"); to add a prefix. Then you just use rewritehostport() to change the host and port of the request URI and then call t_relay().
There are also many other commands and modules for advanced request URI manipulation. Please refer to the documentation of each module.