MT#57562 sems (CE): Add Allow header in 200 OK when empty

This is a partial rework of b67428d.
The patch was always saving the Allow header
from the initial INVITE and replacing the Allow
header in the 200 OK with that.
This fixed an issue with AA, where Allow
header in the 200 OK, generated by the AA, was
empty. But it causes an issue in case of normal
calls between A and B.

In general we want to keep the Allow header in
the 200 OK, if exist.
Instead, we want to add the Allow header in the 200 OK
response in case the 200 OK does not contain
the Allow header. In this case we won't set the
original Allow from the INVITE but instead we will
set a default Allow header (SIP_REPLY_DEFAULT_ALLOW)
containing all the major SIP method.

Change-Id: I6bf5a2cc7e0228f7b99d28963d16c14c463be695
mr11.4.1
Daniel Grotti 3 years ago
parent a4d32f4013
commit cdcbbb7866

@ -342,9 +342,6 @@ void AmBasicSipDialog::onRxRequest(const AmSipRequest& req)
string ua = getHeader(req.hdrs, SIP_HDR_USER_AGENT);
setRemoteUA(ua);
string allow = getHeader(req.hdrs, SIP_HDR_ALLOW);
setRemoteAllowHf(allow);
}
/* Dlg not yet initialized? */
@ -361,11 +358,6 @@ void AmBasicSipDialog::onRxRequest(const AmSipRequest& req)
setRouteSet( req.route );
set1stBranch( req.via_branch );
setOutboundInterface( req.local_if );
if (allow_hf.empty()) { /* if Allow hf is still empty */
string allow = getHeader(req.hdrs, SIP_HDR_ALLOW);
setRemoteAllowHf(allow);
}
}
if (onRxReqStatus(req) && hdl)
@ -620,14 +612,10 @@ int AmBasicSipDialog::reply(const AmSipRequest& req,
reply.cseq = req.cseq;
reply.cseq_method = req.method;
/* add/update Allow header in 200OK, if wasn't empty in previously received request */
if (reply.code == 200 && !allow_hf.empty()) {
/* make sure to remove if already added into hdrs */
string allow = getHeader(reply.hdrs, SIP_HDR_ALLOW);
if (!allow.empty()) removeHeader(reply.hdrs, SIP_HDR_ALLOW);
allow = allow_hf; /* must be added, when receiving request in AmBasicSipDialog::onRxRequest() */
reply.hdrs += SIP_HDR_COLSP(SIP_HDR_ALLOW) + allow + CRLF;
/* Add Allow header in 200OK with default Allow, if it is empty */
if (reply.code == 200 && getHeader(reply.hdrs, SIP_HDR_ALLOW).empty()) {
/* Add default Allow list, supporting all major methods */
reply.hdrs += SIP_HDR_ALLOW_FULL CRLF;
}
if (body != NULL)

@ -112,8 +112,6 @@ protected:
string route;
string allow_hf;
string next_hop;
bool next_hop_1st_req;
bool patch_ruri_next_hop;
@ -294,10 +292,6 @@ public:
virtual void setRemoteUA(const string& new_remote_ua)
{ remote_ua = new_remote_ua; }
const string& getRemoteAllowHf() const { return allow_hf; }
virtual void setRemoteAllowHf(const string& new_allow_hf)
{ allow_hf = new_allow_hf; }
const string& getRouteSet() const { return route; }
virtual void setRouteSet(const string& new_rs)
{ route = new_rs; }

@ -49,6 +49,7 @@
#define SIP_HDR_PROXY_AUTHENTICATE "Proxy-Authenticate"
#define SIP_HDR_WWW_AUTHENTICATE "WWW-Authenticate"
#define SIP_HDR_ALLOW "Allow"
#define SIP_HDR_ALLOW_FULL "Allow: INVITE,ACK,OPTIONS,CANCEL,BYE,UPDATE,PRACK,INFO,SUBSCRIBE,NOTIFY,REFER,MESSAGE,PUBLISH"
#define SIP_HDR_RETRY_AFTER "Retry-After"
#define SIP_HDR_ACCEPT "Accept"
#define SIP_HDR_EVENT "Event"

Loading…
Cancel
Save