Hello,
not being an expert on the presence module - but I quickly look to the code.
It seems that there is no special handling regarding this "Expires:0" logic. It just inserts it into the database/memory and then waits for the timer to remove it. Then the mentioned NOTIFY is send out.
According to the standard this is required:
3.1.6.4 [...] When removing a subscription, the notifier SHOULD send a NOTIFY message with a "Subscription-State" value of "terminated" to inform it that the subscription is being removed. If such a message is sent, the "Subscription-State" header SHOULD contain a "reason=timeout" parameter. The sending of a NOTIFY when a subscription expires allows the corresponding dialog to be terminated, if appropriate.
Cheers,
Henning
When a client sends a SUBSCRIBE with Expires: 0, Kamailio responds correctly with a "202 OK".
But then Kamailio sends a NOTIFY to the same client with "Subscription-State: terminated;reason=timeout".
The client rejects this NOTIFY with a "481 Dialog/Transaction Does Not Exist".
Why does Kamailio send this NOTIFY, and is there any way to fix or disable it because it's always rejected by the client?
The client is IMSDroid, and Kamailio is 5.2.2 with a default configuration.
Packet 1 = Client sending SUBSCRIBE with Expires: 0
SUBSCRIBE sip:X.X.X.X:443;transport=tcp SIP/2.0Via: SIP/2.0/TCP 192.168.0.21:45336;branch=z9hG4bK-670576127From: <sip:username@domain.com>;tag=1372208921To: <sip:kamailio.domain.com>;tag=c4eb72dabf44e7588b972bd3b454ea11-0cd6Call-ID: e8cffa8f-948d-eb99-69ca-c9f18bdf11a0CSeq: 1321654295 SUBSCRIBEExpires: 0Content-Length: 299Max-Forwards: 70Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFERAccept: application/pidf+xmlEvent: presence
Packet 2 = Kamailio responding with 202 OK
SIP/2.0 202 OKVia: SIP/2.0/TCP 192.168.0.21:45336;branch=z9hG4bK-670576127From: <sip:username@domain.com>;tag=1372208921To: <sip:kamailio@domain.com>;tag=c4eb72dabf44e7588b972bd3b454ea11-0cd6Call-ID: e8cffa8f-948d-eb99-69ca-c9f18bdf11a0CSeq: 1321654295 SUBSCRIBEExpires: 0Contact: <sip:X.X.X.X:443;transport=tcp>Server: kamailio (5.2.2 (x86_64/linux))Content-Length: 0
Packet 3 = Kamailio sending a NOTIFY
NOTIFY sip:username@192.168.0.21:45336;transport=tcp SIP/2.0Via: SIP/2.0/TCP X.X.X.X:443;branch=z9hG4bKefe7.5f8ec435000000000000000000000000.0To: <sip:username@domain.com>;tag=1372208921From: <sip:kamailio@domain.com>;tag=c4eb72dabf44e7588b972bd3b454ea11-0cd6CSeq: 3 NOTIFYCall-ID: e8cffa8f-948d-eb99-69ca-c9f18bdf11a0Content-Length: 0Max-Forwards: 70Event: presenceContact: <sip:X.X.X.X:443;transport=tcp>Subscription-State: terminated;reason=timeout
Packet 4 = Client responding to the NOTIFY with "481 Dialog/Transaction Does Not Exist"
SIP/2.0 481 Dialog/Transaction Does Not ExistVia: SIP/2.0/TCP X.X.X.X:443;branch=z9hG4bKefe7.5f8ec435000000000000000000000000.0From: <sip:kamailio@domain.com>;tag=c4eb72dabf44e7588b972bd3b454ea11-0cd6To: <sip:username@domain.com>;tag=1372208921Call-ID: e8cffa8f-948d-eb99-69ca-c9f18bdf11a0CSeq: 3 NOTIFYContent-Length: 0
There are two entries in the Kamailio log:
INFO: {1 1321654295 SUBSCRIBE e8cffa8f-948d-eb99-69ca-c9f18bdf11a0} presence [notify.c:1614]: send_notify_request(): NOTIFY sip:username@domain.com via sip:Y.Y.Y.Y:45336;transport=tcp on behalf of sip:kamailio.domain.com for event presence : e8cffa8f-948d-eb99-69ca-c9f18bdf11a0
ERROR: {2 3 NOTIFY e8cffa8f-948d-eb99-69ca-c9f18bdf11a0} presence [subscribe.c:497]: delete_subs(): Failed to delete subscription from memory [slot: 174 ev: sip:kamailio.domain.com pu: presence ci: e8cffa8f-948d-eb99-69ca-c9f18bdf11a0 ft: 1372208921 tt: c4eb72dabf44e7588b972bd3b454ea11-0cd6]
These are the presence settings in the Kamailio config file:
#!ifdef WITH_PRESENCE# ----- presence params -----modparam("presence", "db_url", DBURL)modparam("presence", "send_fast_notify", 0)
# ----- presence_xml params -----modparam("presence_xml", "db_url", DBURL)modparam("presence_xml", "force_active", 1)modparam("presence_xml", "force_dummy_presence", 0)#!endif
Appreciate your help.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services