Hi Henning,

I added record_route() and now I see an extra record-route and Via: header:

.9........INVITE sip:44800800150@pstn-out.netfuse.net SIP/2.0
Record-Route: <sip:85.13.242.55;lr=on>
Via: SIP/2.0/UDP 85.13.242.55;branch=z9hG4bK388f.04bc8632.1
Via: SIP/2.0/UDP 81.88.163.210:5060;rport=5060;branch=z9hG4bK82ae6ced
    INVITE sip:44800800150@our-pstn-switch SIP/2.0
    Record-Route: <sip:mvno-edge;lr=on>
    Via: SIP/2.0/UDP mvno-edge;branch=z9hG4bK388f.04bc8632.1
    Via: SIP/2.0/UDP mvno-carrier:5060;rport=5060;branch=z9hG4bK82ae6ced
    Contact: <sip:441234567890@mvno-carrier:5060>

I have replaced the relevant IP addresses in the example with mvno-edge, mvno-carrier, and outbound-carrier. So the route got "recorded" but the Contact: still referenced my mvno-carrier when inviting my outbound-carrier.

Accordingly, I do not get the BYE message from my originating mvno-carrier, after I send them 200 OK they try to talk to my outbound-carrier.

Note this is how I am routing the call to my gateway:

        # Change destination URI to our carrier
        $ru = "sip:" + $rU + "@" + $sel(cfg_get.gateways.outbound_carrier_1);

Any other ideas on how the Contact header should be modified?

Cheers
Leo

On 3 May 2013, at 16:29, Henning Westerholt <hw@kamailio.org> wrote:

if you want to ensure that your kamailio stays on the path of the dialog for 
following requests you probably want to use record-route headers for this. 
This is usally done with the rr module, record_route() function.