pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37271?usp=email )
Change subject: asterisk: IMS: validate sendrecv audio attr in INVITE SDP ......................................................................
asterisk: IMS: validate sendrecv audio attr in INVITE SDP
Related: SYS#6984 Change-Id: I52f421a8168f6f55e182409751ec537c0f5147a8 --- M asterisk/IMS_ConnectionHandler.ttcn M library/SDP_Templates.ttcn 2 files changed, 35 insertions(+), 0 deletions(-)
Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified
diff --git a/asterisk/IMS_ConnectionHandler.ttcn b/asterisk/IMS_ConnectionHandler.ttcn index b9a9852..58ca87a 100644 --- a/asterisk/IMS_ConnectionHandler.ttcn +++ b/asterisk/IMS_ConnectionHandler.ttcn @@ -463,6 +463,22 @@ } }
+/* GSMA IR.92 2.2.4 Call Establishment and Termination */ +private function f_ims_validate_INVITE_SDP(SDP_Message sdp) runs on IMS_ConnHdlr +{ + /* "The UE must indicate in the SDP of the initial INVITE that the audio media + * is send-receive i.e. either by including the direction attribute "a=sendrecv" + * or by omitting the direction attributes. */ + if (ispresent(sdp.attributes)) { + if (match (sdp.attributes, superset(tr_SDP_recvonly)) or + match (sdp.attributes, superset(tr_SDP_sendonly))) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str(g_name & ": Unexpected SDP direction attribute != sendrecv: ", + sdp.attributes)); + } + } +} + private function f_ims_parse_security_client(Security_client security_client) runs on IMS_ConnHdlr { var boolean found := false; @@ -1326,6 +1342,7 @@
f_ims_validate_register_P_Access_Network_info(g_rx_sip_req, exp_present := true); f_ims_validate_INVITE_Contact(g_rx_sip_req.msgHeader.contact); + f_ims_validate_INVITE_SDP(g_pars.subscr.cp.peer_sdp);
if (g_pars.subscr.cp.require_precondition_ext and not peer_support_precondition) { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, diff --git a/library/SDP_Templates.ttcn b/library/SDP_Templates.ttcn index ece6147..ef91953 100644 --- a/library/SDP_Templates.ttcn +++ b/library/SDP_Templates.ttcn @@ -147,6 +147,14 @@ } }
+template (present) SDP_attribute tr_SDP_recvonly := { + recvonly := {} +} + +template (present) SDP_attribute tr_SDP_sendonly := { + sendonly := {} +} + /* rfc3312 */ const charstring c_SDP_PRECON_TYPE_qos := "qos"; const charstring c_SDP_PRECON_STRENGTH_TAG_mandatory := "mandatory";