Dynamic Contact Hostname

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic Contact Hostname

Mark Farmer
Hi everyone

I am looking for a way to control the hostname part of the contact header. Reading the documentation I think set_advertised_address() is what I need but if I call set_advertised_address("FQDN") followed by topology_hiding("UC") the contact header is incorrect.

If I set 'listen=tls:XXX.XXX.XXX.XXX:5061 as FQDN:5061' and only call topology_hiding("UC") then the contact header hostname is set to FQDN.

How can I control this?

Many thanks!
Mark.


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Contact Hostname

Ben Newlin

Have you tried using set_advertised_address *after* engaging topology_hiding? We do this and it works fine for us.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Mark Farmer <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Monday, March 16, 2020 at 8:29 AM
To: OpenSIPS users mailling list <[hidden email]>
Subject: [OpenSIPS-Users] Dynamic Contact Hostname

 

Hi everyone

 

I am looking for a way to control the hostname part of the contact header. Reading the documentation I think set_advertised_address() is what I need but if I call set_advertised_address("FQDN") followed by topology_hiding("UC") the contact header is incorrect.

 

If I set 'listen=tls:XXX.XXX.XXX.XXX:5061 as FQDN:5061' and only call topology_hiding("UC") then the contact header hostname is set to FQDN.

 

How can I control this?

 

Many thanks!

Mark.

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Contact Hostname

Mark Farmer
Hi Ben, thanks for the suggestion.
Doesn't seem to be working for me sadly. This is my code - xlog() confirms that the variable is available and all of the other functions are doing as they should.
This is OpenSIPS 2.4.7

...
$var(fqdn) ="my.fqdn";
...
 } else if (is_from_gw("2")) {
                        xlog("CUSTOM_LOG: Call goes to Microsoft $rd");
                        uac_replace_from("sip:$fU@$var(fqdn)");
                        xlog("CUSTOM_LOG: SIP From: Set to sip:$fU@$var(fqdn)");
                        uac_replace_to("sip:$rU@$rd");
                        xlog("CUSTOM_LOG: SIP To: Set to sip:$rU@$rd");
                        xlog("CUSTOM_LOG: Setting advertised address to $var(fqdn)");
                        topology_hiding("UC");
                        set_advertised_address("$var(fqdn)");
                        if(remove_hf("P-Asserted-Identity")) {
                                insert_hf("P-Asserted-Identity: $fU <sip:$fU@$var(fqdn)>\r\n");
                                xlog("CUSTOM_LOG: Changed PAI Header on Outbound Call...");
                        }
                }
...

Mark.


On Mon, 16 Mar 2020 at 13:04, Ben Newlin <[hidden email]> wrote:

Have you tried using set_advertised_address *after* engaging topology_hiding? We do this and it works fine for us.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Mark Farmer <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Monday, March 16, 2020 at 8:29 AM
To: OpenSIPS users mailling list <[hidden email]>
Subject: [OpenSIPS-Users] Dynamic Contact Hostname

 

Hi everyone

 

I am looking for a way to control the hostname part of the contact header. Reading the documentation I think set_advertised_address() is what I need but if I call set_advertised_address("FQDN") followed by topology_hiding("UC") the contact header is incorrect.

 

If I set 'listen=tls:XXX.XXX.XXX.XXX:5061 as FQDN:5061' and only call topology_hiding("UC") then the contact header hostname is set to FQDN.

 

How can I control this?

 

Many thanks!

Mark.

 

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


--
Mark Farmer
[hidden email]

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Contact Hostname

Mark Farmer
In case it helps someone else, i got it working by removing the Contact header & reconstructing it:

if (is_from_gw("2")) {
                remove_hf("Contact","g");
                insert_hf("Contact: <sip:$fU@$var(fqdn):5061;did=$DLG_did>\r\n");
        }

Mark.


On Mon, 16 Mar 2020 at 13:40, Mark Farmer <[hidden email]> wrote:
Hi Ben, thanks for the suggestion.
Doesn't seem to be working for me sadly. This is my code - xlog() confirms that the variable is available and all of the other functions are doing as they should.
This is OpenSIPS 2.4.7

...
$var(fqdn) ="my.fqdn";
...
 } else if (is_from_gw("2")) {
                        xlog("CUSTOM_LOG: Call goes to Microsoft $rd");
                        uac_replace_from("sip:$fU@$var(fqdn)");
                        xlog("CUSTOM_LOG: SIP From: Set to sip:$fU@$var(fqdn)");
                        uac_replace_to("sip:$rU@$rd");
                        xlog("CUSTOM_LOG: SIP To: Set to sip:$rU@$rd");
                        xlog("CUSTOM_LOG: Setting advertised address to $var(fqdn)");
                        topology_hiding("UC");
                        set_advertised_address("$var(fqdn)");
                        if(remove_hf("P-Asserted-Identity")) {
                                insert_hf("P-Asserted-Identity: $fU <sip:$fU@$var(fqdn)>\r\n");
                                xlog("CUSTOM_LOG: Changed PAI Header on Outbound Call...");
                        }
                }
...

Mark.


On Mon, 16 Mar 2020 at 13:04, Ben Newlin <[hidden email]> wrote:

Have you tried using set_advertised_address *after* engaging topology_hiding? We do this and it works fine for us.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Mark Farmer <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Monday, March 16, 2020 at 8:29 AM
To: OpenSIPS users mailling list <[hidden email]>
Subject: [OpenSIPS-Users] Dynamic Contact Hostname

 

Hi everyone

 

I am looking for a way to control the hostname part of the contact header. Reading the documentation I think set_advertised_address() is what I need but if I call set_advertised_address("FQDN") followed by topology_hiding("UC") the contact header is incorrect.

 

If I set 'listen=tls:XXX.XXX.XXX.XXX:5061 as FQDN:5061' and only call topology_hiding("UC") then the contact header hostname is set to FQDN.

 

How can I control this?

 

Many thanks!

Mark.

 

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


--
Mark Farmer
[hidden email]


--
Mark Farmer
[hidden email]

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users