Hi All

I am using OpenSER as a proxy to make outbound calls my config is very simple if the number dialled is not an openser account route it to the PSTN gw.


if(does_uri_exist()){
# local uri does exist, is probably a user.
# lookup location
if(lookup("location")){
route(1);
return;
}
} else {
# probably a call to pstn....
route(2);
return;
}

and
route[2]
{
# pstn handling, simply route out to pstn.
sethostport("xx.xx.xx.xx:5060");
route(1);
}



The problem is that once the SIP packet arrives at the PSTN GW it does NOT have the correct TO: set. Therefore the call does not get routed .

In the example below TO: is sip:calledNumber@myOpenserDomain instead of sip:calledNumber@PSTN.GATEWAY.IP.IP

Caller: ali [!at] jabber.splendor.net (replace the [!at] with a @)
Callee: 009613041708
OpenSerDomain: jabber.splendor.net


U +0.289348 PSTN.GW.IP.IP:5060 -> 193.237.226.252:5060
SIP/2.0 404 Not Found .
Via: SIP/2.0/UDP 193.237.226.252;rport;branch=z9hG4bK6828.10c0315.0.
Via: SIP/2.0/UDP 192.168.0.176:65068;received=193.227.186.146;branch=z9hG4bK-d87543-be62c55d821be10d-1--d87543-;rport=65068.
Record-Route: <sip:193.237.226.252;lr=on>.
From: "ssafass" <sip:ali@jabber.splendor.net>;tag=f36d6608.
To: "009613041705" <sip:009613041705@jabber.splendor.net>;tag=GR52RWG346-34.
Call-ID: 0942e159a72eab40ZmViZWY4YTVlOTRlOGJmZTM5ZDdkZGJiZjFmMTlmMjk..
CSeq: 1 INVITE.
Contact: "0000" <sip:PSTN.GW.IP.IP:5060>.
User-Agent: eyeBeam release 1003s stamp 31159.
Content-Length: 0.

I did a siptrace on the interface of the SIP proxy

http://pastebin.com/d56426d63

This is my config:

http://pastebin.com/m128ca16e