asterisk: IMS: validate sendrecv audio attr in INVITE SDP
Related: SYS#6984
Change-Id: I52f421a8168f6f55e182409751ec537c0f5147a8
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,