pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37313?usp=email )
Change subject: asterisk: IMS: Validate Accept header in MO INVITE
......................................................................
asterisk: IMS: Validate Accept header in MO INVITE
Related: SYS#6968
Change-Id: I7e419ae1cde384590b54c87c198cc411640c4594
---
M asterisk/IMS_ConnectionHandler.ttcn
M library/SIP_Templates.ttcn
2 files changed, 42 insertions(+), 1 deletion(-)
Approvals:
neels: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/asterisk/IMS_ConnectionHandler.ttcn b/asterisk/IMS_ConnectionHandler.ttcn
index 881240b..af44647 100644
--- a/asterisk/IMS_ConnectionHandler.ttcn
+++ b/asterisk/IMS_ConnectionHandler.ttcn
@@ -1174,6 +1174,7 @@
via,
calling_contact,
g_pars.subscr.cp.sip_seq_nr,
+ accept := ts_Accept({ ts_AcceptBody("application/sdp"),
ts_AcceptBody("application/3gpp-ims+xml") }),
min_SE := min_SE,
session_expires := session_expires,
supported := supported,
@@ -1400,6 +1401,7 @@
altstep as_IMS_mo_call_accept(boolean exp_update_to_direct_rtp := false,
boolean fail_others := true) runs on IMS_ConnHdlr
{
+ /* 3GPP TS 24.229 5.1.3.1 Initial INVITE request */
var template (present) PDU_SIP_Request exp_req :=
tr_SIP_INVITE(f_tr_SipUrl_opt_defport(ts_SipUrl_from_Addr_Union(g_pars.subscr.cp.called.addr)),
?,
@@ -1407,6 +1409,7 @@
tr_To(tr_Addr_Union_from_val(g_pars.subscr.cp.called.addr), *),
tr_Via_from(f_tr_HostPort(g_pars.subscr.remote_sip_host,
g_pars.subscr.ipsec_remote_port_s)),
?,
+ accept := tr_Accept(superset(tr_AcceptBody("application/sdp"),
tr_AcceptBody("application/3gpp-ims+xml"))),
supported := tr_Supported(superset("timer")),
body := ?);
var charstring sip_expect_str := log2str(exp_req);
diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn
index ffc4550..bfb3655 100644
--- a/library/SIP_Templates.ttcn
+++ b/library/SIP_Templates.ttcn
@@ -69,6 +69,26 @@
}
}
+// [20.1, RFC2616 14.1]
+template (present) AcceptBody tr_AcceptBody(template (present) charstring mediaRange,
+ template SemicolonParam_List acceptParam := *) := {
+ mediaRange := mediaRange,
+ acceptParam := acceptParam
+}
+template (value) AcceptBody ts_AcceptBody(template (value) charstring mediaRange,
+ template (omit) SemicolonParam_List acceptParam := omit) := {
+ mediaRange := mediaRange,
+ acceptParam := acceptParam
+}
+template (present) Accept tr_Accept(template AcceptBody_List acceptArgs := *) := {
+ fieldName := ACCEPT_E,
+ acceptArgs := acceptArgs
+}
+template (value) Accept ts_Accept(template (omit) AcceptBody_List acceptArgs := omit) :=
{
+ fieldName := ACCEPT_E,
+ acceptArgs := acceptArgs
+}
+
// [20.5]
template (present) Allow tr_Allow(template Method_List methods := *) := {
fieldName := ALLOW_E,
@@ -711,7 +731,8 @@
template (value) Via via,
template (omit) ContentLength content_length := ts_ContentLength(0),
template (omit) ContentType content_type := omit,
- template (omit)Authorization authorization := omit,
+ template (omit) Accept accept := omit,
+ template (omit) Authorization authorization := omit,
template (omit) Allow allow := ts_Allow(c_SIP_defaultMethods),
template (omit) Expires expires := omit,
template (omit) MinExpires minExpires := omit,
@@ -728,6 +749,7 @@
template (omit) UserAgent userAgent := ts_UserAgent({ "osmo-ttcn3-hacks/0.23"
}),
template (omit) WwwAuthenticate wwwAuthenticate := omit
) modifies ts_SIP_msgHeader_empty := {
+ accept := accept,
allow := allow,
authorization := authorization,
callId := {
@@ -771,6 +793,7 @@
template integer seq_nr := ?,
template ContentLength content_length := *,
template ContentType content_type := *,
+ template Accept accept := *,
template Allow allow := *,
template Authorization authorization := *,
template Expires expires := *,
@@ -787,6 +810,7 @@
template UserAgent userAgent := *,
template WwwAuthenticate wwwAuthenticate := *
) modifies t_SIP_msgHeader_any := {
+ accept := accept,
allow := allow,
authorization := authorization,
callId := {
@@ -880,6 +904,7 @@
template (value) Via via,
template (value) Contact contact,
integer seq_nr,
+ template (omit) Accept accept := omit,
template (omit) Min_SE min_SE := omit,
template (omit) Session_expires session_expires := omit,
template (omit) Supported supported := omit,
@@ -890,6 +915,7 @@
via,
content_length := f_ContentLength(body),
content_type := f_ContentTypeOrOmit(ts_CT_SDP, body),
+ accept := accept,
min_SE := min_SE,
session_expires := session_expires,
supported := supported),
@@ -903,6 +929,7 @@
template To to_addr,
template Via via := tr_Via_from(f_tr_HostPort_opt_defport(?)),
template integer seq_nr,
+ template Accept accept := *,
template Min_SE min_SE := *,
template Session_expires session_expires := *,
template Supported supported := *,
@@ -910,6 +937,7 @@
requestLine := tr_SIP_ReqLine(INVITE_E, uri),
msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, ?,
via, "INVITE", seq_nr,
+ accept := accept,
min_SE := min_SE,
session_expires := session_expires),
messageBody := body,
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37313?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7e419ae1cde384590b54c87c198cc411640c4594
Gerrit-Change-Number: 37313
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged