Commit bb3c721d authored by Pekka Pessi's avatar Pekka Pessi
Browse files

nua_stack.c: include Allow-Events in requests initiating dialog, too

The Allow-Events header is now alwats included with NOTIFY requests, and
initial INVITE, SUBSCRIBE, REFER, and OPTIONS requests.

Thanks to Jerry Richards for pointing out the problem.

parent 84e54f6d
......@@ -2531,8 +2531,9 @@ int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip)
* Next, values previously set with nua_set_params() or nua_set_hparams()
* are used: @Allow, @Supported, @Organization, and @UserAgent headers are
* added to the request if they are not already set.
* are used: @Allow, @Supported, @Organization, @UserAgent and
* @AllowEvents headers are added to the request if they are not already
* set.
if (!sip->sip_allow)
sip_add_dup(msg, sip, (sip_header_t*)NH_PGET(nh, allow));
......@@ -2551,6 +2552,20 @@ int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip)
if (!sip->sip_user_agent && NH_PGET(nh, user_agent))
sip_add_make(msg, sip, sip_user_agent_class, NH_PGET(nh, user_agent));
/** Any node implementing one or more event packages SHOULD include an
* appropriate @AllowEvents header indicating all supported events in
* all methods which initiate dialogs and their responses (such as
* INVITE) and OPTIONS responses.
if (!sip->sip_allow_events &&
NH_PGET(nh, allow_events) &&
(method == sip_method_notify || /* Always in NOTIFY */
(!ds->ds_remote_tag && /* And in initial requests */
(method == sip_method_subscribe || method == sip_method_refer ||
method == sip_method_options ||
method == sip_method_invite))))
sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow_events));
* Next, the stack generates a @Contact header for the request (unless
* the application already gave a @Contact header or it does not want to
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment