302 Moved Temporarily back to originating peer

Hi,

Is it possible to somehow make asterisk return the 302 message from a UA to the peer (SIP GW) it came from? The reason is that the UA has call forwarding on which returns a 302 message and there is no need for asterisk to do anything else than return that back to the sip proxy it came from, so that it can handle it the right way.

If that’s not possible, I would need to be able to rewrite the From for the generated INVITE. It basically works correctly now by doing a new INVITE after a 302 with From as the original From. That however won’t work when it goes to the PSTN as I can only originate calls from local numbers, which means I’d like to rewrite the new From to match the UA sending the 302, i.e. the forwarding party.

Any help would be appreciated.