So here is my insight to the problem:

Because the first listening interface is advertising the 192.168.1 interface, this one is used.
If I change the order to

listen=udp:192.168.1.156:5060 advertise 192.168.1.156:5060
listen=udp:172.23.56.1:5060 advertise 192.168.1.156:5060
listen=tcp:127.0.0.1:5060 

I can use both sockets as expected. 

Ergo: Always use the primary / actual interface before the ones which only advertised it! 




Am 30.03.2020 um 20:06 schrieb Jan-Hendrik Dörner <sr-users@doerner.net>:

so I changed it to 

t_uac_send("NOTIFY", "$(ct{s.substr,1,0}{s.striptail,1})", "$su", "udp:192.168.1.156:5060","Call-ID: $hdr(Call-ID)\r\nSubscription-State: terminated;reason=timeout\r\nEvent: $hdr(Event)\r\nContent-Type: application/url\r\nFrom: $fU\r\nTo: $hdr(From)", "http://server.conf/settings-{mac}");

unfortunately the SIP - Pakets are still send from the wrong IP.

U 192.168.1.152:57145 -> 224.0.1.75:5060 #1
SUBSCRIBE sip:MAC%3a0004137120D8@lan SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.152:57145;rport.
From: <sip:MAC%3a0004137120D8@lan>;tag=1881587606.
CSeq: 1 SUBSCRIBE.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Expires: 0.
Accept: application/url.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.

#
U 192.168.1.156:5060 -> 192.168.1.152:57145 #2
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 192.168.1.152:57145;rport=57145;received=192.168.1.152.
From: <sip:MAC%3a0004137120D8@lan>;tag=1881587606.
To: <sip:MAC%3a0004137120D8@lan>;tag=fb721cde02dffb6bb099728401306798.3eb0.
CSeq: 1 SUBSCRIBE.
Server: kamailio (5.2.5 (x86_64/linux)).
Content-Length: 0.
.

#
U 172.23.56.1:5060 -> 192.168.1.152:57145 #3
NOTIFY sip:192.168.1.152:57145 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.156:5060;branch=z9hG4bKdb57.88b81c37000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=1881587606.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-6c90.
CSeq: 10 NOTIFY.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
#
U 172.23.56.1:5060 -> 192.168.1.152:57145 #4
NOTIFY sip:192.168.1.152:57145 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.156:5060;branch=z9hG4bKdb57.88b81c37000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=1881587606.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-6c90.
CSeq: 10 NOTIFY.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
#




….


But what did help in this particular case is to change the order of the listen Interfaces:

From:

listen=udp:172.23.56.1:5060 advertise 192.168.1.156:5060
listen=udp:192.168.1.156:5060 advertise 192.168.1.156:5060
listen=tcp:127.0.0.1:5060          

mcast="eth0"
listen=udp:224.0.1.75:5060

To:

listen=udp:192.168.1.156:5060 advertise 192.168.1.156:5060
listen=udp:172.23.56.1:5060 advertise 192.168.1.156:5060
listen=tcp:127.0.0.1:5060          

mcast="eth0"
listen=udp:224.0.1.75:5060


Although this workaround works here, it is difficult in cases when sending events to different networks.
(for example check-sync events).




Am 30.03.2020 um 19:01 schrieb Daniel-Constantin Mierla <miconda@gmail.com>:

Hello,

On 30.03.20 18:41, Jan-Hendrik Dörner wrote:
Hello Daniel,

thank you for your reply.

I changed the line mentioned to
t_uac_send("NOTIFY", "$(ct{s.substr,1,0}{s.striptail,1})", "$su", "192.168.1.156","Call-ID: $hdr(Call-ID)\r\nSubscription-State: terminated;reason=timeout\r\nEvent: $hdr(Event)\r\nContent-Type: application/url\r\nFrom: $fU\r\nTo: $hdr(From)", "http://server.conf/settings-{mac}"); 

the result is:
3) Call-ID is fine now ; Problem solved :-)

OK.



1) The Via IP is now changed to the IP and port of the server, but not to the IP of the phone. 

Actually that is the correct value, Via is the address of the entity sending out the request. It is used to route the replies, so Via in Notify has to be the address of the kamailio server so the reply to it is sent by the phone back to Kamailio.



2) The sending interface  / IP is not correct: It now sends _only_ from the wrong IP !!

Can you try with full specs for socket, like "upd:IP:port"?

Cheers,
Daniel


As a result, it repeats sending the NOTIFY-message over and over again since the message does not get to the phone ...
Please see the starting of the SIP-traffic below

U 192.168.1.152:57283 -> 224.0.1.75:5060 #53
SUBSCRIBE sip:MAC%3a0004137120D8@lan SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.152:57283;rport.
From: <sip:MAC%3a0004137120D8@lan>;tag=176419003.
CSeq: 1 SUBSCRIBE.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Expires: 0.
Accept: application/url.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.

#
U 192.168.1.156:5060 -> 192.168.1.152:57283 #54
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 192.168.1.152:57283;rport=57283;received=192.168.1.152.
From: <sip:MAC%3a0004137120D8@lan>;tag=176419003.
To: <sip:MAC%3a0004137120D8@lan>;tag=fb721cde02dffb6bb099728401306798.1182.
CSeq: 1 SUBSCRIBE.
Server: kamailio (5.2.5 (x86_64/linux)).
Content-Length: 0.
.

#
U 172.23.56.1:5060 -> 192.168.1.152:57283 #55
NOTIFY sip:192.168.1.152:57283 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.156:5060;branch=z9hG4bKee8f.0ea476a1000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=176419003.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-9700.
CSeq: 10 NOTIFY.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
#
U 172.23.56.1:5060 -> 192.168.1.152:57283 #56
NOTIFY sip:192.168.1.152:57283 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.156:5060;branch=z9hG4bKee8f.0ea476a1000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=176419003.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-9700.
CSeq: 10 NOTIFY.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
#
U 172.23.56.1:5060 -> 192.168.1.152:57283 #57
NOTIFY sip:192.168.1.152:57283 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.156:5060;branch=z9hG4bKee8f.0ea476a1000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=176419003.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-9700.
CSeq: 10 NOTIFY.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
#
U 192.168.1.152:57283 -> 224.0.1.75:5060 #58
SUBSCRIBE sip:MAC%3a0004137120D8@lan SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.152:57283;rport.
From: <sip:MAC%3a0004137120D8@lan>;tag=1472545741.
CSeq: 1 SUBSCRIBE.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Expires: 0.
Accept: application/url.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.

#
U 192.168.1.156:5060 -> 192.168.1.152:57283 #59
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 192.168.1.152:57283;rport=57283;received=192.168.1.152.
From: <sip:MAC%3a0004137120D8@lan>;tag=1472545741.
To: <sip:MAC%3a0004137120D8@lan>;tag=fb721cde02dffb6bb099728401306798.1182.
CSeq: 1 SUBSCRIBE.
Server: kamailio (5.2.5 (x86_64/linux)).
Content-Length: 0.
.

#
U 172.23.56.1:5060 -> 192.168.1.152:57283 #60
NOTIFY sip:192.168.1.152:57283 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.156:5060;branch=z9hG4bKa0df.967a0433000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=1472545741.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-d106.
CSeq: 10 NOTIFY.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
#
U 172.23.56.1:5060 -> 192.168.1.152:57283 #61
NOTIFY sip:192.168.1.152:57283 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.156:5060;branch=z9hG4bKa0df.967a0433000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=1472545741.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-d106.
CSeq: 10 NOTIFY.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
#

(If I change the IP-parameter to "172.23.56.1" the resulting sending IP is unchanged!)



Am 30.03.2020 um 16:17 schrieb Daniel-Constantin Mierla <miconda@gmail.com>:

Hello,

On 30.03.20 12:07, Jan-Hendrik Dörner wrote:
Hallo,

several telephones send a SIP-multicast SUBSCRIBE message to address 224.0.1.75 if they have no settings-URL configured and receive none over DHCP.

So I configure my kamailio server, to respond to that multicast-request.
But: Although mine is working, I do feel it could be improved, since the NOTIFY packet send out is  not quite as it should be …

Here is what I did (the 172.23.56.1 is my voip-vlan-address)

listen=udp:172.23.56.1:5060 advertise 192.168.1.156:5060
listen=udp:192.168.1.156:5060 advertise 192.168.1.156:5060
listen=tcp:127.0.0.1:5060          

mcast="eth0"
listen=udp:224.0.1.75:5060

….

  if ($Ri == "224.0.1.75"){
       if(is_method("SUBSCRIBE")){
          xlog("L_INFO", "Received pnp-event from IP $si from User-Agent $hdr(User-Agent) und User $fU\r\n" );                                           
          sl_send_reply("200", "OK");                                                                                                                    
          t_uac_send("NOTIFY", "$(ct{s.substr,1,0}{s.striptail,1})", "", "","Subscription-State: terminated;reason=timeout\r\nEvent: $hdr(Event)\r\nContent-Type: application/url\r\nFrom: $fU\r\nTo: $hdr(From)", "http://server.conf/settings-{mac}");
       }else  {                                                                                                                                                                                                                         
         xlog("L_INFO", "Drop message $rm from pnp-Interface \r\n" );
      }                                          
      exit;
   }                    


And here are the SIP-packets  I see on my server (192.168.1.156) coming from my snom-phone (192.168.1.152).
My problems with the NOTIFY -packets are: 
1) How do I set the Via parameters to be the same as in the OK-reply?

Try to set the next hop address to "$su" and combined with 2) maybe it
results in what you want to get.


2) How do I send out the NOTIFY only via the 192.168.1.156 network interface? 

Set the local socket parameter from where to send the NOTIFY.


3) May I send out the NOTIFY with the Call-ID from the SUBSCRIBE message? How?


Provide the Call-Id haeder as part of the headers parameter:

  -
https://www.kamailio.org/docs/modules/stable/modules/tm.html#tm.f.t_uac_send

Cheers,
Daniel



Any help is highly appreciated
Jan-Hendrik

#
U 192.168.1.152:58714 -> 224.0.1.75:5060 #258
SUBSCRIBE sip:MAC%3a0004137120D8@lan SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.152:58714;rport.
From: <sip:MAC%3a0004137120D8@lan>;tag=1750588964.
To: <sip:MAC%3a0004137120D8@lan>.
Call-ID: 1395386659@192.168.1.152.
CSeq: 1 SUBSCRIBE.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Expires: 0.
Accept: application/url.
Contact: <sip:192.168.1.152:58714>.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.

#
U 192.168.1.156:5060 -> 192.168.1.152:58714 #259
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 192.168.1.152:58714;rport=58714;received=192.168.1.152.
From: <sip:MAC%3a0004137120D8@lan>;tag=1750588964.
To: <sip:MAC%3a0004137120D8@lan>;tag=fb721cde02dffb6bb099728401306798.2f00.
Call-ID: 1395386659@192.168.1.152.
CSeq: 1 SUBSCRIBE.
Server: kamailio (5.2.5 (x86_64/linux)).
Content-Length: 0.
.

#
U 192.168.1.156:5060 -> 192.168.1.152:58714 #260
NOTIFY sip:192.168.1.152:58714 SIP/2.0.
Via: SIP/2.0/UDP 224.0.1.75;branch=z9hG4bKf21c.917eaf36000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=1750588964.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-8cfb.
CSeq: 10 NOTIFY.
Call-ID: 24eaa8de01be1768-70960@172.23.56.1.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
http://server.conf/settings-{mac}
#
U 172.23.56.1:5060 -> 192.168.1.152:58714 #261
NOTIFY sip:192.168.1.152:58714 SIP/2.0.
Via: SIP/2.0/UDP 224.0.1.75;branch=z9hG4bKf21c.917eaf36000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=1750588964.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-8cfb.
CSeq: 10 NOTIFY.
Call-ID: 24eaa8de01be1768-70960@172.23.56.1.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
http://server.conf/settings-{mac}
#
U 172.23.56.1:5060 -> 192.168.1.152:58714 #262
NOTIFY sip:192.168.1.152:58714 SIP/2.0.
Via: SIP/2.0/UDP 224.0.1.75;branch=z9hG4bKf21c.917eaf36000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=1750588964.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-8cfb.
CSeq: 10 NOTIFY.
Call-ID: 24eaa8de01be1768-70960@172.23.56.1.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
http://server.conf/settings-{mac}
#
U 192.168.1.152:58714 -> 224.0.1.75:5060 #263
SUBSCRIBE sip:MAC%3a0004137120D8@lan SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.152:58714;rport.
From: <sip:MAC%3a0004137120D8@lan>;tag=1971605806.
To: <sip:MAC%3a0004137120D8@lan>.
Call-ID: 1846532696@192.168.1.152.
CSeq: 1 SUBSCRIBE.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Expires: 0.
Accept: application/url.
Contact: <sip:192.168.1.152:58714>.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.

#
U 192.168.1.156:5060 -> 192.168.1.152:58714 #264
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 192.168.1.152:58714;rport=58714;received=192.168.1.152.
From: <sip:MAC%3a0004137120D8@lan>;tag=1971605806.
To: <sip:MAC%3a0004137120D8@lan>;tag=fb721cde02dffb6bb099728401306798.2f00.
Call-ID: 1846532696@192.168.1.152.
CSeq: 1 SUBSCRIBE.
Server: kamailio (5.2.5 (x86_64/linux)).
Content-Length: 0.
.

#
U 192.168.1.156:5060 -> 192.168.1.152:58714 #265
NOTIFY sip:192.168.1.152:58714 SIP/2.0.
Via: SIP/2.0/UDP 224.0.1.75;branch=z9hG4bK201a.063839a4000000000000000000000000.0.
To: <sip:MAC%3a0004137120D8@lan>;tag=1971605806.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-f31b.
CSeq: 10 NOTIFY.
Call-ID: 24eaa8de01be1768-70963@172.23.56.1.
Max-Forwards: 70.
Content-Length: 33.
User-Agent: kamailio (5.2.5 (x86_64/linux)).
Subscription-State: terminated;reason=timeout.
Event: ua-profile;profile-type="device";vendor="snom";model="snom760";version="8.9.3.80".
Content-Type: application/url.
.
http://server.conf/settings-{mac}
#
U 192.168.1.152:58714 -> 192.168.1.156:5060 #266
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP 224.0.1.75;branch=z9hG4bKf21c.917eaf36000000000000000000000000.0;received=192.168.1.156.
From: <MAC:0004137120D8>;tag=da567df9df3ac234e43969a051db4641-8cfb.
To: <sip:MAC%3A0004137120D8@lan>;tag=1750588964.
Call-ID: 24eaa8de01be1768-70960@172.23.56.1.
CSeq: 10 NOTIFY.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.

#
U 192.168.1.152:58714 -> 192.168.1.156:5060 #267
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP 224.0.1.75;branch=z9hG4bKf21c.917eaf36000000000000000000000000.0;received=192.168.1.156.
From: <MAC:0004137120D8>;tag=da567df9df3ac234e43969a051db4641-8cfb.
To: <sip:MAC%3A0004137120D8@lan>;tag=1750588964.
Call-ID: 24eaa8de01be1768-70960@172.23.56.1.
CSeq: 10 NOTIFY.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.

#
U 192.168.1.152:58714 -> 192.168.1.156:5060 #268
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP 224.0.1.75;branch=z9hG4bK201a.063839a4000000000000000000000000.0;received=192.168.1.156.
From: <MAC:0004137120D8>;tag=da567df9df3ac234e43969a051db4641-f31b.
To: <sip:MAC%3A0004137120D8@lan>;tag=1971605806.
Call-ID: 24eaa8de01be1768-70963@172.23.56.1.
CSeq: 10 NOTIFY.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.


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

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda



_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda

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