Modify Contact header host

hello, I need to modify Contact header host
Contact host : Contact: sip:vds@192.0.2.1:5060

PBX(192.0.2.1)=…=>VDS(192.0.3.1)==>ISP(192.0.4.1)

<--- Transmitting SIP request (414 bytes) to UDP:192.0.4.1:5060 --->
OPTIONS sip:192.0.4.1:5060 SIP/2.0
Via: SIP/2.0/UDP 192.0.2.1:5060;rport;branch=z9hG4bKPje3b9fd63-f9ce-467e-8d3f-a013ba4a29cc
From: <sip:[email protected]>;tag=32b512fa-e470-4cac-b7cf-6222c8dc5af2
To: <sip:192.0.4.1>
Contact: <sip:[email protected]:5060>
Call-ID: 93824789-955c-481d-998f-ea56c6f58c02
CSeq: 14152 OPTIONS
Max-Forwards: 70
User-Agent: FPBX-16.0.40.7(18.20.2)
Content-Length:  0

everything works well, but after 31 seconds the call is dropped
if I use alg then it replaces contact host and the call is not dropped
how to replace Contact header host using asterisk ?

PBX Version: 16.0.40.7
Asterisk Version: 18.20.2

You need to set your external signalling address. You will also normally need to set the media address and the local networks.

See Rewrite the "From" header in calls to remote extensions

values From Domain and Media Address are filled with 192.0.3.1 and address of ISP(192.0.4.1) is in local_net
but Contact header host is not rewriting by VDS(192.0.3.1) and still PBX(192.0.2.1)

I cant change NAT settings external ip address because extensions connected via internet will be down

You didn’t explain that you had multiple disjoint private networks.

I think you need to give a much more detailed explanation of your network.

What does VDS stand for?

ISP isn’t actually going to be your ISP, but possibly part of the infrastructure; basically this network is complicate and it needs a lot of detail to properly understand it.

A local network with only one address looks wrong. I’m not sure if it will be accepted.

You don’t seem to have said what should be in the Contact header; potentially you may need multiple type=transport sections, which will mean using custom configurations.

VDS is NATing ISP interface and VPN interface to PBX network

in local_net many hosts and networks that do not need to be NATed, other NATed via external ip, for this case it doesn’t matter

I need rewrite Contact header host from PBX(which is address on interface 192.0.2.1) by VDS(which is address on interface 192.0.3.1)

I thought so too, but I cant create another transport with the same parameters

I just noticed that there are 192.0, not 192.168 addresses, and the whois entry for the “ISP” doesn’t look like an ISP, to me. I think there has been confusing redaction here! Doing NAT between public addresses is not something that should be happening.

However, taken at face value, the transport for that endpoint needs to have signalling and media addresses 192.0.3.1, and local network is probably 192.0.2.0/24, although you haven’t said what the inside address of VDM is. I don’t though, know how well chan_pjsip handles this sort of, multi-transport, situation, and I’m pretty sure you have to go outside the FreePBX GUI to set it up. chan_sip does not handle such configurations, at all.

what difference does it make what IP addresses ? if it makes it easier for you then let it be 192.168.10.1 and 192.168.20.1 and 192.168.30.1,
it feels like you’re filling up the comment counter

if this could be done in the FreePBX web interface, then I would limit myself to the official documentation, but I asked a specific question how to modify Contact header host

if this can be done using cli or a configuration not described in the documentation or perhaps a side effect of some function, then please point me in the right direction, but if you want to answer something like don’t do that, the provider shouldn’t do that, change the provider, change the infrastructure, change the system administrator
then please refrain from commenting

I’m out.

3 Likes