pjproject
pjproject copied to clipboard
Add support to set event subscription NOTIFY Subscription-State "expires" param
The Subscription-State header field in a NOTIFY request can contain parameters, such as "expires" and "reason".
Subscription-State = "Subscription-State" HCOLON substate-value
*( SEMI subexp-params )
substate-value = "active" / "pending" / "terminated"
/ extension-substate
subexp-params = ("reason" EQUAL event-reason-value)
/ ("expires" EQUAL delta-seconds)
/ ("retry-after" EQUAL delta-seconds)
/ generic-param
Currently PJSIP can only set the reason, but not the other parameters, using the API pjsip_evsub_notify( pjsip_evsub *sub, pjsip_evsub_state state, const pj_str_t *state_str, const pj_str_t *reason, pjsip_tx_data **p_tdata). So it's desirable to add an option to set the expires as well, which is useful for:
If the value of the "Subscription-State" header is "active" or
"pending", the notifier SHOULD also include in the "Subscription-
State" header an "expires" parameter which indicates the time
remaining on the subscription. The notifier MAY use this mechanism
to shorten a subscription; however, this mechanism MUST NOT be used
to lengthen a subscription.
If we do this, we probably need to:
- add a new API
pjsip_evsub_notify2(sub, state, state_str, notify_param, p_tdata)with notify_param containing reason and expires, that can also be extensible in the future. - handle processing of incoming NOTIFY with the expires param.