Hi all,
I'm trying to run a kamailio DMQ node inside a docker container. All works fine but i have one issue with DMQ. Since the kamailio process inside the container is behind a nat i have set the advertise address to the external ip, this works fine for the via headers but DMQ keeps sending the internal interface in the KDMQ notification_peer messages. The external ip is in there as well. Example:
SIP/2.0 200 OK Via: SIP/2.0/UDP 10.10.10.13;branch=z9hG4bK2dcb.c6326de2000000000000000000000000.0 To: sip:notification_peer@10.10.10.94:5060;tag=616b7acb681ed5e9cbc485b3faa09d62.0a3d From: sip:notification_peer@10.10.10.13:5060;tag=e8f29c06c4b85a188f6533f08d60feb6-ff29 CSeq: 10 KDMQ Call-ID: 17042656602ca532-23367@x.x.x.x Content-Type: text/plain Server: kamailio (5.1.4 (x86_64/linux)) Content-Length: 222
sip:10.10.10.13:5060;status=active sip:10.10.10.12:5060;status=active sip:10.10.10.92:5060;status=active sip:10.10.10.93:5060;status=active sip:10.10.10.94:5060;status=active <-- entry for container external ip sip:172.17.0.2:5060;status=disabled <-- entry for container internal ip
I tried to strip this entry using the replace_body_atonce in the tm:local-request route. This works fine for the KDMQ request, but when i try to remove the same line from 200OK responses that are send out as a response to incomming KDMQ messages this seems to fail. I use the following code:
# Working code (for outgoing KDMQ requests): event_route [tm:local-request] { if(is_method("KDMQ") && $rU == "notification_peer") replace_body_atonce("sip:172.17.0.*:5060;status=.*", ""); }
# Failing code (for 200OK responses): reply_route { xlog("L_ALERT", "REPLY: Sending out reply, tU is $tU rs is $rs\n"); if ($rs == "200" && $tU == "notification_peer") { replace_body_atonce("sip:172.17.0.*:5060;status=.*", ""); } }
I'm running kamailio 5.1.4. Is there a way to strip a line from the body of a local generated 200OK response? Or is there a way to avoid that DMQ inserts the internal container ip in the first place.
Thanks,
Jan Hazenberg
Hi all,
Is there any other way to filter DMQ peers? I now have a issue with dmq_usrloc when running in a docker container. When the node comes online the peer is sending the KDMQ usrloc packet (with the registered contacts) to the internal container ip and not the actual external ip. Both ip's show up as DMQ peers, after a few keepalive failures the dmq peer with the internal container ip becomes inactive and no updates are sent to that peer. But the usrloc sync seems to happen before the peer is inactive.
I tried to strip the peers with the internal container ip's, this works for the requests, but i'm not able to fix this for the responses.
Thanks,
Jan
jenus@cyberchaos.nl schreef op 2019-05-02 08:59:
Hi,
I can take a look at this although I’ll be travelling until next week so may not get to it until then.
In the meantime, can you send the KDMQ sync request which is sent by the node which is coming online, along with your DMQ related config and also the set advertise address line.
Cheers,
Charles
On Mon, 17 Jun 2019 at 19:31, jenus@cyberchaos.nl wrote:
Can you share the settings you are using :
modparam("dmq", "server_address", "?") modparam("dmq", "notification_address", "?")
On Mon, Jun 17, 2019 at 11:30 AM jenus@cyberchaos.nl wrote:
Did you set them to the public IP address (elastic IP or whatever) on each of them.
Since you are natted, I guess you are using the listen=udp x.x.x.x advertise x.x.x.x parameter.
similar IP preset is needed in this case.
On Mon, Jun 17, 2019 at 12:00 PM Julien Chavanton jchavanton@gmail.com wrote:
Julien,
I have the following config:
Host ip: 10.20.8.88 Internal container ip: 172.17.0.2
listen=udp:172.17.0.2:5063 advertise 10.20.8.88:5063
# ----- dmq params ----- modparam("dmq", "server_address", "sip:172.17.0.2:5063") modparam("dmq", "num_workers", 4) modparam("dmq", "ping_interval", 90) modparam("dmq", "notification_address", "sip:sip12.voip.domain.test:5063") (on the other node this is sip11.domain.test) modparam("dmq", "multi_notify", 1)
# ----- dmq_usrloc params ----- modparam("dmq_usrloc", "enable", 1) modparam("dmq_usrloc", "sync", 1) modparam("dmq_usrloc", "batch_msg_contacts", 50) # 50 contacts / message modparam("dmq_usrloc", "batch_size", 10000) # 10000 contacts / batch modparam("dmq_usrloc", "batch_usleep", 500000) # one batch every 500ms
Here is the output of the kamcmd dmq.list_nodes
root@9d81434d491f:/# kamcmd dmq.list_nodes { host: 10.20.8.89 port: 5063 resolved_ip: 10.20.8.89 status: active last_notification: 0 local: 0 } { host: 10.20.8.88 port: 5063 resolved_ip: 10.20.8.88 status: active last_notification: 0 local: 0 } { host: 172.17.0.2 port: 5063 resolved_ip: 172.17.0.2 status: active last_notification: 0 local: 1 }
I will collect some traces as well of the sync request as requested by Charles.
Thanks,
Jan
Julien Chavanton schreef op 2019-06-17 21:00:
All
Here the KDMQ reqest from the node that comes online:
------------------ Kamailio start on 10.20.8.89, sends a request to the active node 10.20.8.88 ------------------ KDMQ sip:usrloc@10.20.8.88:5063 SIP/2.0 Via: SIP/2.0/UDP 10.20.8.89:5063;branch=z9hG4bKd5bb.c2abf9b4000000000000000000000000.0 To: sip:usrloc@10.20.8.88:5063 From: sip:usrloc@172.17.0.2:5063;tag=eeb67b6ee91998d3c4ad015de5249b76-7d61 CSeq: 10 KDMQ Call-ID: 58f8ada547fd5ba0-225@172.17.0.2 Content-Length: 12 User-Agent: kamailio (5.1.8 (x86_64/linux)) Max-Forwards: 1 Content-Type: application/json
{"action":3}
SIP/2.0 200 OK Via: SIP/2.0/UDP 10.20.8.89:5063;branch=z9hG4bKd5bb.c2abf9b4000000000000000000000000.0 To: sip:usrloc@10.20.8.88:5063;tag=616b7acb681ed5e9cbc485b3faa09d62.f2b6 From: sip:usrloc@172.17.0.2:5063;tag=eeb67b6ee91998d3c4ad015de5249b76-7d61 CSeq: 10 KDMQ Call-ID: 58f8ada547fd5ba0-225@172.17.0.2 Server: kamailio (5.1.8 (x86_64/linux)) Content-Length: 0 -----------------
But after this to response from 10.20.8.88 back to 10.20.8.89 with the usrloc data. If i replace the primary node that should send the usrloc info with the original kamailio server that is not running in docker i see a KDMQ usrloc@... back to the server that is starting with all the usrloc data in the body.
Let me know if you need more details or debug logs.
Thanks,
Jan
jenus@cyberchaos.nl schreef op 2019-06-18 08:51:
The value of the server address parameter is what appears in the from header - so if you want replies to go to your advertised/public address then this is what the server address should be set to.
Do the messages now contain the correct IP since updating the server address?
Cheers,
Charles
On Tue, 18 Jun 2019 at 12:09, jenus@cyberchaos.nl wrote:
Charles,
Yes i now only see the "external" host ip in the DMQ packets (except for the callid header):
-------------- Session Initiation Protocol (KDMQ) Request-Line: KDMQ sip:usrloc@10.20.8.88:5063 SIP/2.0 Method: KDMQ Request-URI: sip:usrloc@10.20.8.88:5063 Request-URI User Part: usrloc Request-URI Host Part: 10.20.8.88 Request-URI Host Port: 5063 [Resent Packet: False] Message Header Via: SIP/2.0/UDP 10.20.8.89:5063;branch=z9hG4bK6bd9.e406be74000000000000000000000000.0 Transport: UDP Sent-by Address: 10.20.8.89 Sent-by port: 5063 Branch: z9hG4bK6bd9.e406be74000000000000000000000000.0 To: sip:usrloc@10.20.8.88:5063 SIP to address: sip:usrloc@10.20.8.88:5063 SIP to address User Part: usrloc SIP to address Host Part: 10.20.8.88 SIP to address Host Port: 5063 From: sip:usrloc@10.20.8.89:5063;tag=eeb67b6ee91998d3c4ad015de5249b76-9cd9 SIP from address: sip:usrloc@10.20.8.89:5063 SIP from address User Part: usrloc SIP from address Host Part: 10.20.8.89 SIP from address Host Port: 5063 SIP from tag: eeb67b6ee91998d3c4ad015de5249b76-9cd9 CSeq: 10 KDMQ Sequence Number: 10 Method: KDMQ Call-ID: 30b095bd0e83ad17-388@172.17.0.2 Content-Length: 12 User-Agent: kamailio (5.1.8 (x86_64/linux)) Max-Forwards: 1 Content-Type: application/json Message Body JavaScript Object Notation: application/json Object Member Key: "action" Number value: 3
--------------
Jan
Charles Chance schreef op 2019-06-18 13:43:
Perfect - glad that resolved the issue for you.
Best,
Charles
On Tue, 18 Jun 2019 at 13:59, jenus@cyberchaos.nl wrote:
Hi Jan,
What happens if you set the dmq server address to the advertised address?
listen=udp:172.17.0.2:5063 advertise 10.20.8.88:5063 modparam("dmq", "server_address", "*sip:10.20.8.88:5063 http://10.20.8.88:5063*")
Cheers,
Charles
On Tue, 18 Jun 2019 at 07:53, jenus@cyberchaos.nl wrote: