From 5e7e1b999d31dcb5f03108624759a19e2a6d6fce Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 19 May 2008 16:56:40 +0000 Subject: [PATCH] Mon May 19 11:31:45 EDT 2008 Pekka.Pessi@nokia.com * 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. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8467 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/.update | 2 +- .../sofia-sip/libsofia-sip-ua/nua/nua_stack.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index c7f046c0b6..8aea80c412 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Mon May 19 12:55:48 EDT 2008 +Mon May 19 12:56:22 EDT 2008 diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c index f21f977620..6749fb6041 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c @@ -2541,8 +2541,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)); @@ -2561,6 +2562,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