Hi,
first of all you definitely do not want to put the contact received in the INVITE in the 200 OK, since you will, in the best case generate a loop of the UAC sending the ACK to itself.
About having to call msg_apply_changes this comes probably by the fact that you've already manipulated the header with  fix_nated_contact(). Due to kamailio's internals you cannot change the headers twice in a row without invoking msg_apply_changes().
For your main problem with the ACK, I'd rather look at the Record-Route. I see in the 200 OK that Record-Route has a private IP. Unless the caller is on the same network or on a network that can communicate with your server, you need to have there a public address (or a double Record-Route if your server is running on two interfaces).
Have a look at "advertise" parameter of listen directive and to http://www.kamailio.org/docs/modules/devel/modules/rr.html#rr.p.enable_double_rr.

Best regards,

Federico

On Tue, Sep 25, 2018 at 12:24 AM Ben Hood <ben@relops.com> wrote:

> On 24 Sep 2018, at 23:04, Alex Balashov <abalashov@evaristesys.com> wrote:
>
> On Mon, Sep 24, 2018 at 10:46:44PM +0100, Ben Hood wrote:
>
>> I was trying (as a temporary hack) to mangle this to become
>>
>> Contact: <sip:2018092417381900003@81.x.x.x <sip:2018092417381900003@81.x.x.x>>
>
> But that's not grammatically valid…

You are absolutely correct, but I don’t think that is what I wrote (might be a typo from me?). I was trying to produce:

Contact: <sip:2018092423082500003@81.x.x.x>

Which I have now achieved by adding

msg_apply_changes();

after the invocation of subst_hf().

Seems that the SIP buffer needs to be explicitly finalised before transport.

However, my theory about patching the Contact header to make the remote system happy is wrong - the 200 OK is still not ACK’ed. So I need to look into the NAT’ing a bit more to see what might be going on - but this is a different question to how to use subst_hf().

Many thanks for helping me out with this, very much appreciated.







_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users