So... I have a section of my ser.cfg that I use to handle call forwarding to URIs on other SIP services or to the PSTN.
if(avp_db_load("$ruri/username","s:callfwd")) { avp_pushto("$ruri", "s:callfwd"); # Now set the timeout to 45 seconds (write the integer # 45 to the avp inv_timeout (see the earlier modparam) avp_write("i:45","inv_timeout"); route(1); break; };
The trick is, if I have this BELOW the proxy_authorize() portion of the config, it works for forwards to URIs, but not to forwards for the PSTN (gives me back an error saying it failed proxy authorisation.
Any idea why this would be the case? I've added the PSTN gateway to the trusted table, and everything else seems to work okay except PSTN forwarding.
Is it because I let this rewrite the RURI and then let it run back through the route again to get pushed onto the PSTN? Should I be splitting this up into a callfwd that handles URIs and one that handles PSTN calls (if so, that will get awfully confusing with the number of people who use e164-style usernames for their users)?
I mean... it WORKS where it is. I'm just trying to understand what's happening inside. :)
N.