[SR-Users] How to correctly answer a PnP-SUBSCRIBE message

Jan-Hendrik Dörner sr-users at doerner.net
Mon Mar 30 12:07:12 CEST 2020


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?
2) How do I send out the NOTIFY only via the 192.168.1.156 network interface? 
3) May I send out the NOTIFY with the Call-ID from the SUBSCRIBE message? How?

Any help is highly appreciated
Jan-Hendrik

#
U 192.168.1.152:58714 -> 224.0.1.75:5060 #258
SUBSCRIBE sip:MAC%3a0004137120D8 at lan SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.152:58714;rport.
From: <sip:MAC%3a0004137120D8 at lan>;tag=1750588964.
To: <sip:MAC%3a0004137120D8 at lan>.
Call-ID: 1395386659 at 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 at lan>;tag=1750588964.
To: <sip:MAC%3a0004137120D8 at lan>;tag=fb721cde02dffb6bb099728401306798.2f00.
Call-ID: 1395386659 at 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 at lan>;tag=1750588964.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-8cfb.
CSeq: 10 NOTIFY.
Call-ID: 24eaa8de01be1768-70960 at 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 at lan>;tag=1750588964.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-8cfb.
CSeq: 10 NOTIFY.
Call-ID: 24eaa8de01be1768-70960 at 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 at lan>;tag=1750588964.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-8cfb.
CSeq: 10 NOTIFY.
Call-ID: 24eaa8de01be1768-70960 at 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 at lan SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.152:58714;rport.
From: <sip:MAC%3a0004137120D8 at lan>;tag=1971605806.
To: <sip:MAC%3a0004137120D8 at lan>.
Call-ID: 1846532696 at 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 at lan>;tag=1971605806.
To: <sip:MAC%3a0004137120D8 at lan>;tag=fb721cde02dffb6bb099728401306798.2f00.
Call-ID: 1846532696 at 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 at lan>;tag=1971605806.
From: <MAC%3a0004137120D8>;tag=da567df9df3ac234e43969a051db4641-f31b.
CSeq: 10 NOTIFY.
Call-ID: 24eaa8de01be1768-70963 at 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 at lan>;tag=1750588964.
Call-ID: 24eaa8de01be1768-70960 at 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 at lan>;tag=1750588964.
Call-ID: 24eaa8de01be1768-70960 at 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 at lan>;tag=1971605806.
Call-ID: 24eaa8de01be1768-70963 at 172.23.56.1.
CSeq: 10 NOTIFY.
User-Agent: snom760/8.9.3.80.
Content-Length: 0.
.




More information about the sr-users mailing list