[asterisk-dev] SIP subscription with expires=0

George Joseph gjoseph at sangoma.com
Mon Oct 25 11:09:30 CDT 2021


On Mon, Oct 25, 2021 at 1:32 AM Nikša Baldun <it at voxdiversa.hr> wrote:

> According to the RFC, yes:
>
>       In addition to being a request to unsubscribe, a SUBSCRIBE message
>       with "Expires" of 0 also causes a fetch of state; see section
>       3.3.6.
>
> I'll report a bug. Thanks for your reply.
>

Just FYI...  The code snippet quoted is in pubsub_on_rx_subscribe_request()
which only gets called on new dialogs. We do erroneously treat the
expires=0 as a failure when we should send a NOTIFY but not create a
persistent subscription.   We handle expires=0 on *in-dialog* SUBSCRIBE
termination requests correctly in pubsub_on_rx_refresh().


> On 25. 10. 2021. 09:25, Olle E. Johansson wrote:
>
> A subscription with expire:0 should get at least ONE notify, right? I’ve
> just that to check the status without setting up a dialog.
>
> It is not invalid. Report this as a bug.
>
> /O
>
> 25 okt. 2021 kl. 09:22 skrev Nikša Baldun <it at voxdiversa.hr>:
>
> Hello,
>
> I see the following in res_pjsip_pubsub.c:
>
>         if (expires_header->ivalue == 0) {
>             ast_debug(1, "Subscription request from endpoint %s rejected.
> Expiration of 0 is invalid\n",
>                 ast_sorcery_object_get_id(endpoint));
>             pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(),
> rdata, 400, NULL, NULL, NULL);
>                 return PJ_TRUE;
>         }
>
> However, according to RFC 2365, value 0 is perfectly valid, and should
> have the effect of ending the subscription.
>
>    A natural consequence of this scheme is that a SUBSCRIBE with an
>    "Expires" of 0 constitutes a request to unsubscribe from an event.
>
>
> Or is my understanding wrong? Is there some other way to unsubscribe?
>
> Best regards,
>
> Nik
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20211025/903b4a2b/attachment.html>


More information about the asterisk-dev mailing list