therikb31 created an issue (kamailio/kamailio#4296)

For network-initiated UE de-registration, `ims_registrar_scscf` is populating 
the `Subscription-State` header of the `NOTIFY` message as 
`active;expires=3581` instead of `terminated`.

### Description

We are simulating a network-initiated UE de-registration by sending a 
**Registration-Termination Request** from the HSS to the S-CSCF for a 
registered IMSI.

**Call Flow**:

1. UE registers to the IMS core
2. S-CSCF performs third-party registration with the Application Server on 
behalf of the UE
3. Application Server subscribes to `Event: reg` for the registered IMSI
4. HSS sends a Registration-Termination Request for network-initiated UE 
de-registration
5. S-CSCF sends a `NOTIFY` to subscribers for the 
`IMS_REGISTRAR_CONTACT_DEREGISTERED` event (issue with the `NOTIFY` SIP message)

**Observation**:

1. `NOTIFY` messages are initiated to subscribers of `Event: reg`, but instead 
of having the `Subscription-State` header set to **terminated**, we observe the 
value **active;expires=3581**.
   (Image for the `NOTIFY` SIP message packet is attached below)

![Image](https://github.com/user-attachments/assets/08abc9a8-43b9-486c-9de5-370e465ea527)

### Troubleshooting

#### Reproduction

To reproduce this, we are performing the following steps:

1. Performing SIP registration of the UE with the target S-CSCF node
2. Sending `SUBSCRIBE` requests from a third-party Application Server and the 
UE with `Event: reg` to get notified of registration events
3. HSS sends a `Registration-Termination Request` to the target S-CSCF for the 
registered IMSI (network-initiated de-registration)

#### Debugging Data

#### Log Messages

While going through the logs, we find that this header is being populated based 
on the expiry timer and a comparison with the current timestamp:

```
2025-06-20 12:45:20 | 19(56) DEBUG: ims_registrar_scscf 
[registrar_notify.c:1716]: create_notifications(): Expires is greater than 
current time! Subscription state: [active;expires=3581]
```

#### SIP Traffic

### Possible Solutions

**Workaround**:

In the `create_notifications()` method of 
`src/modules/ims_registrar_scscf/registrar_notify.c`,
when populating the `Subscription-State` header, if the `event_type` is `10` 
(`IMS_REGISTRAR_CONTACT_DEREGISTERED`), we can populate `Subscription-State` as 
`terminated`.

### Additional Information

---

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4296
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to