[SR-Users] topos xavu_field_contact_host kamailio 5.5

Marrold kamailio at marrold.co.uk
Mon Feb 28 02:18:53 CET 2022


Hi Jonathan,

Were you able to solve this problem? I'm running Kamailio in docker and
need to write a different contact in each direction based on the flow - i.e
the contact in the leg to the end device should be the external address,
but the leg to another back end running in docker should be the internal
address.

You mentioned previously fixing something like this with hash tables, I'm
assuming you're rewriting the contact before sending, storing the original
into a hash table and then over-writing any response and calling
msg_apply_changes before the TOPOS processing?

Thanks
Matthew

On Fri, Dec 3, 2021 at 9:44 PM Jonathan Hunter <hunterj91 at hotmail.com>
wrote:

> Hi Karsten,
>
>
>
> Ok cool thanks for that I am testing now.
>
>
>
> I also have the fun on a NAT’d interface so I am playing with setting
> advertised address as well!
>
>
>
> Makes sense thank you for the reply.
>
>
>
> Jon
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows
>
>
>
> *From: *Karsten Horsmann <khorsmann at gmail.com>
> *Sent: *03 December 2021 21:13
> *To: *Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> *Subject: *Re: [SR-Users] topos xavu_field_contact_host kamailio 5.5
>
>
>
> Hi Jonathan,
>
>
>
>
>
> I placed a new route and set the user part
>
>
>
> $xavu(_tps_=>a_contact) = "sbc_a";                $xavu(_tps_=>b_contact)
> = "sbc_b";
>
> And for special cases I set the to user part to the To user for some silly
> pbx boxes.
>
> Can also be that in this mode without setting a/b_contact the normal
> contact user part passes through, didn't test that.
>
>
>
>
>
> Kind regards
>
> Karsten Horsmann
>
>
>
> Jonathan Hunter <hunterj91 at hotmail.com> schrieb am Fr., 3. Dez. 2021,
> 20:03:
>
> Hi Karsten,
>
>
>
> Thank you for your reply.
>
>
>
> Thats interesting I will test it, so I see in the documentation it states;
>
>
>
>
>
> $xavu(_tps_=>a_contact) = "...";
>
>
>
> In your case what did you enter so that it just sets the user part?
>
>
>
> I assume I could just set it to $sel(contact.uri.user) for example and it
> would then add that and the appropriate listen/ socket value ?
>
>
>
> Many thanks!
>
>
>
> Jon
>
> Sent from Mail
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244288948%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VSgYRMddRbDW2G33ooYGms%2B3Hk8Cqq%2Bd%2B2DhWZk2s3o%3D&reserved=0>
> for Windows
>
>
>
> *From: *Karsten Horsmann <khorsmann at gmail.com>
> *Sent: *03 December 2021 18:49
> *To: *Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> *Subject: *Re: [SR-Users] topos xavu_field_contact_host kamailio 5.5
>
>
>
> Hi Jonathan,
>
>
>
>
>
>
>
> I use topos in mode 2 (rewrite user part)
>
> and then it sets the domain part to the listen / socket value AFAIK if you
> only set user part and did not specify the contact host.
>
>
>
>
>
>
>
> #!ifdef WITH_TOPOS
>
> modparam("topos", "storage", "redis")
>
> modparam("topos_redis", "serverid", "CFG_REDIS_NAME")
>
> modparam("topos", "branch_expire", 14400)     modparam("topos",
> "dialog_expire", 14400)
>
> modparam("topos", "clean_interval", 60)
>
> #!ifdef WITH_TOPOS_CONTACT                    modparam("topos",
> "contact_mode", 2)
>
> modparam("topos", "xavu_cfg", "_tps_")        modparam("topos",
> "xavu_field_contact_host", "contact_host")
> modparam("topos", "xavu_field_a_contact", "a_contact")
>
> modparam("topos", "xavu_field_b_contact", "b_contact")
>
> #!endif
>
> #!endif
>
>
>
>
>
> Jonathan Hunter <hunterj91 at hotmail.com> schrieb am Fr., 3. Dez. 2021,
> 10:50:
>
> Hello Henning,
>
>
>
> Ok appreciate the confirmation, could this be a possible option moving
> forwards with the module?
>
>
>
> In the meantime I assume other approach is hash tables as I have done
> before?
>
>
>
> Thanks again appreciate your response.
>
>
>
> Jon
>
>
>
> Sent from Mail
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244298942%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=RhHREw2f0afQZCS24A0%2BrIDshbsVO7%2F%2FFDb0e27MJNc%3D&reserved=0>
> for Windows
>
>
>
> *From: *Henning Westerholt <hw at gilawa.com>
> *Sent: *03 December 2021 09:36
> *To: *Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> *Cc: *Jonathan Hunter <hunterj91 at hotmail.com>
> *Subject: *RE: topos xavu_field_contact_host kamailio 5.5
>
>
>
> Hello Jonathan,
>
>
>
> I see, so you want basically configure different contact addresses for
> A-side and B-side of the call.
>
> This is probably not supported from topos right now, its only possible for
> the user name.
>
>
>
> Cheers,
>
>
>
> Henning
>
>
>
> *From:* Jonathan Hunter <hunterj91 at hotmail.com>
> *Sent:* Friday, December 3, 2021 10:07 AM
> *To:* Henning Westerholt <hw at gilawa.com>; Kamailio (SER) - Users Mailing
> List <sr-users at lists.kamailio.org>
> *Subject:* RE: topos xavu_field_contact_host kamailio 5.5
>
>
>
> Hello Henning,
>
>
>
> Yes your comments make perfect sense.
>
>
>
> Essentially I want to change the contact in-dialog as essentially the
> initial INVITE comes in on a private interface from the carrier, and then
> goes out on a public interface to the subscriber, so the subscriber only
> see’s public IP address in the SIP contact host and responds to it, and the
> carrier only see’s the private IP address in the contact host so they
> respond to the appropriate IP address, so its topology hiding IP addresses
> across interfaces.
>
>
>
> I have done a similar thing with hash tables before and using
> record_route_preset but was hoping I could do a similar thing with  topos
> and leave it to manage the dialog.
>
>
>
> Does that make sense?
>
>
>
> Jon
>
>
>
> Sent from Mail
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244308936%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=tJSVPwkY2c8txXhDih8ut%2FmbhBAWdATpU2Rj%2Be0MpiY%3D&reserved=0>
> for Windows
>
>
>
> *From: *Henning Westerholt <hw at gilawa.com>
> *Sent: *03 December 2021 08:55
> *To: *Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> *Cc: *Jonathan Hunter <hunterj91 at hotmail.com>
> *Subject: *RE: topos xavu_field_contact_host kamailio 5.5
>
>
>
> Hello Jonathan,
>
>
>
> Usually, you want to set the appropriate contact host in the initial
> INVITE and then the dialog stays “with” this contact. This can be done by
> just setting the xavp and is the way the topology module usually works.
>
>
>
> Maybe you can elaborate why you want to change the contact in-dialog, or
> even in one transaction (onreply_route example below).
>
>
>
> Cheers,
>
>
>
> Henning
>
>
>
> --
>
> Henning Westerholt – https://skalatan.de/blog/
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fskalatan.de%2Fblog%2F&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244318939%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=zL12E1LFL1L47la7gW%2BxV4WD9dBLMndluQbggl75jF8%3D&reserved=0>
>
> Kamailio services – https://gilawa.com
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgilawa.com%2F&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244318939%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=8hy0SYQIprCvSJ6GJBI25oW%2BrJV7boJZvmNZ9VVYjfo%3D&reserved=0>
>
>
>
> *From:* Jonathan Hunter <hunterj91 at hotmail.com>
> *Sent:* Friday, December 3, 2021 9:28 AM
> *To:* Henning Westerholt <hw at gilawa.com>; Kamailio (SER) - Users Mailing
> List <sr-users at lists.kamailio.org>
> *Subject:* RE: topos xavu_field_contact_host kamailio 5.5
>
>
>
> HI Henning,
>
>
>
> Yes sorry late night 😊 and thank you for reply.
>
>
>
> Yes I conditionally want to set it, I have tried this but not sure it has
> worked to this point hence why I am wondering if I am missing something.
>
>
>
> Say for example I have request coming in from carrier on 10.10.10.10
> interface and want to route to subscriber who is registered, so flow is
> simple its just;
>
>
>
> Carrier-àkamailioàsubscriber
>
>
>
> On branch route out I have set the contact_host to a particular IP
> address, however on_reply I want to change it again to another IP address,
> can I do that using the $xavu ?
>
>
>
> So branch sees contact host as one IP address, and onreply I change it to
> another IP.
>
>
>
> As currently if I set the Host it stays the same on both sides.
>
>
>
> Does that make sense?
>
>
>
> Jon
>
>
>
> Sent from Mail
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244328925%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=CsYreC40U8IEaLgBctQ7G76W7%2B%2B1hp%2B2eCraxAwBeBA%3D&reserved=0>
> for Windows
>
>
>
> *From: *Henning Westerholt <hw at gilawa.com>
> *Sent: *03 December 2021 08:08
> *To: *Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> *Cc: *Jonathan Hunter <hunterj91 at hotmail.com>
> *Subject: *RE: topos xavu_field_contact_host kamailio 5.5
>
>
>
> Hello,
>
>
>
> There might be a spelling error below, you probably mean:
>
>
>
> “$xavu(_tps_=>contact_host) = "2.2.2.2";
>
> And this works fine but obviously sets the contact_host to 2.2.2.2 across
> both interfaces, I ideally want it to change between 10.10.10.10 and
> 2.2.2.2.”
>
>
>
> Not sure if I understand your question correctly. You could just
> conditionally set the contact host to the different values, depending on
> your configuration logic.
>
>
>
> Cheers,
>
>
>
> Henning
>
>
>
> --
>
> Henning Westerholt – https://skalatan.de/blog/
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fskalatan.de%2Fblog%2F&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244328925%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3vfjRGNKrG35hDG6gclcT3wGk61TBel9WwfjxyAuoJM%3D&reserved=0>
>
> Kamailio services – https://gilawa.com
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgilawa.com%2F&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244338917%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=6GvBmG1FTlHJsVgLumVxlZZpMHdgFds0Db425k3lzvE%3D&reserved=0>
>
>
>
> *From:* sr-users <sr-users-bounces at lists.kamailio.org> *On Behalf Of *Jonathan
> Hunter
> *Sent:* Friday, December 3, 2021 8:57 AM
> *To:* Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> *Subject:* [SR-Users] topos xavu_field_contact_host kamailio 5.5
>
>
>
> Hi All,
>
>
>
> I was wondering if anyone can help, and advise me if I am missing
> something when using topos in an environment where I have more than one
> interface for kamailio.
>
>
>
> Essentially I would like to set the contact_host to 2 different values
> depending on the flow of the SIP requests, as we have a private LAN
> interconnect for example 10.10.10.10, and a public interconnect using
> 2.2.2.2 (for example).
>
>
>
> I notice there is xavu for A-side contact and B-side contact, but what
> about just the contact host?
>
>
>
> As I have set for example;
>
>
>
> modparam("topos", "xavu_cfg", "_tps_")
>
> modparam("topos", "xavu_field_contact_host", "contact_host")
>
> ...
>
>     $xavu(_tps_=>contact_host) = "2.2.2.2";
>
>
>
> And this works fine but obviously sets the contact_host to 8.8.8.8 across
> both interfaces, I ideally want it to change between 10.10.10.10 and
> 2.2.2.2.
>
>
>
> How can I set more than one contact_host $xavu that topos can use? As my
> understanding is you can only set $xavu once, so is there another way to
> manipulate the contact_host on requests coming in and out on different
> interfaces?  I assume I am missing something? :)
>
>
>
> Thanks in advance
>
>
>
> Jon
>
>
>
> Sent from Mail
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244348915%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HTJGIXZyJBZu%2BqM7TcmWwN0WL%2B5y%2BA145WssJ9x506o%3D&reserved=0>
> for Windows
>
>
>
>
>
>
>
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244348915%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=vqUfCMJU8%2B9Bvm%2B%2FsOWa6LU58WvO1b%2FpRc3y0XeePEU%3D&reserved=0>
>
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7C%7C0a4a663af88843289b5108d9b6a1c8d2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637741628244358904%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=4ggmdtTBYrvruQJed9h%2FZdc%2BxrSl554xRmq9I8E6JW0%3D&reserved=0>
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220228/aa053679/attachment.htm>


More information about the sr-users mailing list