Skip to content
LibIms_Steps.ttcn 64.8 KiB
Newer Older
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523
            f_setHeaders_SUBSCRIBE(p_cSeq_s);
            f_Subscription(p_cSeq_s, m_SUBSCRIBE_Request_UE(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via, vc_contact, vc_route_REG));
        }

        //NOTE STF471 added
        /**
         * @desc Sets variables and default initialization for user profile and handle registration and authentication with MD5
         * @param p_cSeq_s The current cseq
         * @param p_register Register template
         */
        function f_IMS_preamble_withRegistrationWoSubscription(
            inout CSeq p_cSeq_s,
            out template REGISTER_Request p_register
        ) runs on ImsComponent  {
            //NOTE STF471: removed f_init_interfaceprofile(p_interface);

            // Variables & defaults initialization
            f_IMS_preamble_woRegistration(p_cSeq_s);

            // Preamble
            f_Registration(p_cSeq_s, p_register, PX_SIP_REGISTER_AUTHENTICATION_ENABLED);

            // deregistration in case of successful registration
            vc_DeregDone := false;
        }

        /**
         * @desc Sets variables and default initialization for user profile and handle registration and authentication with MD5 (basic registration template)
         * @param p_cSeq_s The current cseq
         * @param p_host P-CSCF domain name (formerly value from module parameter PX_IMS_TS_PCSCF_HOME_DOMAIN)
         * @param p_port P-CSCF port number (formerly value from module parameter PX_IMS_TS_PCSCF_PORT)
         */
        function f_IMS_preamble_withRegistrationBasic(
            inout CSeq p_cSeq_s,
            template(value) charstring p_host,
            template(value) integer p_port
        ) runs on ImsComponent  {
            //NOTE STF471: removed f_init_interfaceprofile(p_interface);
            // Variables & defaults initialization
            f_IMS_preamble_woRegistration(p_cSeq_s);

            // Preamble
            f_Registration_IMS(p_cSeq_s, PX_SIP_REGISTER_AUTHENTICATION_ENABLED, p_host, p_port);
            f_setHeaders_SUBSCRIBE(p_cSeq_s);
            f_Subscription(p_cSeq_s, m_SUBSCRIBE_Request_UE(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via, vc_contact, vc_route_REG));
        }

        /**
         * @desc Sets variables and default initialization for user profile and handle registration and authentication with MD5 (basic registration template)
         * @param p_cSeq_s The current cseq
         */
        function f_IMS_preamble_AS(
            inout CSeq p_cSeq_s
        ) runs on ImsComponent  {
            // avoid deregistration in default behavior
            vc_DeregDone := true;
            vc_boo_route := true;
            vc_boo_recordRoute := true;
            vc_cSeq := p_cSeq_s;

            // Defaults
            vc_def_catchSyncStop := activate(a_Sip_catchSyncStop());
            vc_default := activate(a_altstep_AS());

            // Preamble
            //NOTE STF471: removed f_init_interfaceprofile(p_interface);
            //NOTE STF471: removed f_init_userprofile(p_userprofile); // assignment of PIXIT values to component variable
            vc_sdp_local := valueof(m_SDP_bandwidth(m_media_dynPT(PX_SIP_SDP_DYN, PX_SIP_SDP_ENCODING, PX_SIP_SDP_CLOCKRATE, omit), vc_userprofile));
            vc_contact := m_Contact(m_SipUrl_contactIpaddr(vc_userprofile));
        }

    } // end group preambles

    group postambles {

        /**
         * @desc Terminates component and handles deregistration
         * @param p_cSeq_s The current cseq
         */
        function f_IMS_postamble_withDeRegistration(
            CSeq p_cSeq_s
        ) runs on ImsComponent  {
            f_RemoveRegistration(p_cSeq_s);
            f_terminate_component();
        }

        /**
         * @desc Terminates component and optionally handles deregistration on AS as TS
         * @param p_deRegistration Handle deregistration?
         */
        function f_IMS_postamble_AS_withDeRegistration(
            boolean p_deRegistration
        ) runs on ImsComponent  {

            if (p_deRegistration == true) {
                f_awaitingREGISTER_sendReply(mw_REGISTER_Request_Base, true);
            }
            f_terminate_component();
        }

        /**
         * @desc Terminates component without registration
         */
        function f_SIP_postamble_IMS1_withoutRegistration(
        ) runs on ImsComponent  {
            f_terminate_component();
        }

        /**
         * @desc Terminates component without de-registration
         */
        function f_IMS_postamble_withoutDeRegistration(
        ) runs on ImsComponent  {
            f_terminate_component();
        }

        /**
         * @desc Terminates component with de-registration
         * @param p_to_user The selected user's SIP URL
         * @param p_qop of the peer UE (alternatively)
         */
        function f_SIP_postamble_IMS1_awaitDeRegistration(
            in SipUrl p_to_user,
            in charstring p_qop
        ) runs on ImsComponent  {
            var SipUrl v_passociated_url;
            // Awaiting 1st REGISTER
            f_awaitingREGISTER(mw_REGISTER_unauthorizedRequest_IMS);

            // 401 response
            f_sendResponse(m_Response_WWWauthenticate_IMS(c_statusLine401, vc_callId, vc_cSeq, vc_caller_From, vc_caller_To, vc_via, m_wwwAuthenticate(f_calculatecChallenge_forWWWAuthorization(p_qop, valueof(vc_authorization.body[0].digestResponse)))));

            // Awaiting 2nd REGISTER with authorization header
            f_awaitingREGISTER(mw_REGISTER_unauthorizedRequest_IMS);
            
            // 200OK to complete the request
            v_passociated_url := vc_caller_From.addressField.nameAddr.addrSpec;
            f_sendResponse(m_Response_2xxonREGISTER_IMS(c_statusLine200, vc_callId, vc_cSeq, vc_callee_From, vc_callee_To, vc_via, vc_contact, p_to_user, v_passociated_url));

            f_terminate_component();
        }

        /**
         * @desc Terminates component with de-registration
         * @param p_to_user The selected user's SIP URL
         * @param p_qop of the peer UE (alternatively)
         */
        function f_IMS_postamble_awaitDeRegistration(
            in SipUrl p_to_user,
            in charstring p_qop
        ) runs on ImsComponent  {
            var SipUrl v_passociated_url;
            // Awaiting 1st REGISTER
            f_awaitingREGISTER(mw_REGISTER_unauthorizedRequest_IMS);

            // 401 response
            f_sendResponse(m_Response_WWWauthenticate_IMS(c_statusLine401, vc_callId, vc_cSeq, vc_caller_From, vc_caller_To, vc_via, m_wwwAuthenticate(f_calculatecChallenge_forWWWAuthorization(p_qop, valueof(vc_authorization.body[0].digestResponse)))));

            // Awaiting 2nd REGISTER with authorization header
            f_awaitingREGISTER(mw_REGISTER_unauthorizedRequest_IMS);
            
            // 200OK to complete the request
            v_passociated_url := vc_caller_From.addressField.nameAddr.addrSpec;
            f_sendResponse(m_Response_2xxonREGISTER_IMS(c_statusLine200, vc_callId, vc_cSeq, vc_callee_From, vc_callee_To, vc_via, vc_contact, p_to_user, v_passociated_url));

            f_terminate_component();
        }


        /**
         * @desc Awaits de-registration
         * @param p_to_user The selected user's SIP URL
         * @param p_qop of the peer UE (alternatively)
         */
        function f_IMS_awaitDeRegistration(
            in SipUrl p_to_user,
            in charstring p_qop
        ) runs on ImsComponent  {
            var SipUrl v_passociated_url;
            // Awaiting 1st REGISTER
            f_awaitingREGISTER(mw_REGISTER_unauthorizedRequest_IMS);

            // 401 response
            f_sendResponse(m_Response_WWWauthenticate_IMS(c_statusLine401, vc_callId, vc_cSeq, vc_caller_From, vc_caller_To, vc_via, m_wwwAuthenticate(f_calculatecChallenge_forWWWAuthorization(p_qop, valueof(vc_authorization.body[0].digestResponse)))));

            // Awaiting 2nd REGISTER with authorization header
            f_awaitingREGISTER(mw_REGISTER_unauthorizedRequest_IMS);
            
            // 200OK to complete the request
            v_passociated_url := vc_caller_From.addressField.nameAddr.addrSpec;
            f_sendResponse(m_Response_2xxonREGISTER_IMS(c_statusLine200, vc_callId, vc_cSeq, vc_callee_From, vc_callee_To, vc_via, vc_contact, p_to_user, v_passociated_url));
        }

        //NOTE STF471: renamed f_SIP_postamble_UE(1|2)_withoutRegistration to f_SIP_postamble_UE_withoutRegistration
        /**
         * @desc Terminates component without registration
         */
        function f_SIP_postamble_UE_withoutRegistration(
        ) runs on ImsComponent  {
            f_terminate_component();
        }

        /**
         * @desc Sends BYE and awaits response (IMS)
         * @param p_requestUri The Request URI
         * @param p_callId CallId parameter for outgoing BYE
         * @param p_cSeq_s CSeq parameter for outgoing BYE
         * @param p_from From parameter for outgoing BYE
         * @param p_to To parameter for outgoing BYE
         */
        function f_terminateCall_IMS(
            SipUrl p_requestUri,
            CallId p_callId,
            inout CSeq p_cSeq_s,
            From p_from,
            template(value) To p_to
        ) runs on ImsComponent  {
            LibSip_Steps.f_setHeadersBYE(p_cSeq_s);
            // Sending of a BYE request to release the call and expect a final response
            f_SendBYE(m_BYE_Request_IMS(p_requestUri, p_callId, p_cSeq_s, p_from, p_to, vc_via, vc_route));

            tc_resp.start;
            alt {
                [] SIPP.receive(mw_Response_Base(mw_statusLine1xx, p_callId, p_cSeq_s)) {
                    repeat;
                }
                [] SIPP.receive(mw_Response_Base(mw_statusLineFinal, p_callId, p_cSeq_s)) {
                    tc_resp.stop;
                }
            // timeout should be handled in default_alt_step
            }
        } // end function f_terminateCall_IMS

        /**
         * @desc Sends BYE and awaits response (UE)
         * @param p_requestUri The Request URI
         * @param p_callId CallId parameter for outgoing BYE
         * @param p_cSeq_s CSeq parameter for outgoing BYE
         * @param p_from From parameter for outgoing BYE
         * @param p_to To parameter for outgoing BYE
         * @param p_recordRoute RecordRoute parameter for outgoing BYE - default: omit
         */
        function f_terminateCall_UE(
            SipUrl p_requestUri,
            CallId p_callId,
            inout CSeq p_cSeq_s,
            From p_from,
            template(value) To p_to,
            template RecordRoute p_recordRoute := omit
        ) runs on ImsComponent  {
            var Route v_route;
            LibSip_Steps.f_setHeadersBYE(p_cSeq_s);
            // Sending of a BYE request to release the call and expect a final response
            if (ispresent(p_recordRoute)) {
                v_route := {ROUTE_E, valueof(p_recordRoute.routeBody)};
                f_SendBYE(m_BYE_Request_UE(p_requestUri, p_callId, p_cSeq_s, p_from, valueof(p_to), vc_via, v_route));
            }
            else {
                f_SendBYE(m_BYE_Request_UE(p_requestUri, p_callId, p_cSeq_s, p_from, valueof(p_to), vc_via, vc_route));
            }

            tc_resp.start;
            alt {
                [] SIPP.receive(mw_Response_Base(mw_statusLine1xx, p_callId, p_cSeq_s)) {
                    repeat;
                }
                [] SIPP.receive(mw_Response_Base(mw_statusLineFinal, p_callId, p_cSeq_s)) {
                    tc_resp.stop;
                }
            // timeout should be handled in default_alt_step
            }
        } // end function f_terminateCall_UE

        /**
         * @desc Sends BYE and awaits response and De-registration
         * @param p_requestUri The Request URI
         * @param p_callId CallId parameter for outgoing BYE
         * @param p_cSeq_s CSeq parameter for outgoing BYE
         * @param p_from From parameter for outgoing BYE
         * @param p_to To parameter for outgoing BYE
         * @param p_qop of the peer UE (alternatively)
         */
        function f_terminateCall_UE_withDeReg(
            SipUrl p_requestUri,
            CallId p_callId,
            inout CSeq p_cSeq_s,
            From p_from,
            template(value) To p_to,
            in charstring p_qop
        ) runs on ImsComponent  {
            LibSip_Steps.f_setHeadersBYE(p_cSeq_s);
            // Sending of a BYE request to release the call and expect a final response
            f_SendBYE(m_BYE_Request_UE(p_requestUri, p_callId, p_cSeq_s, p_from, p_to, vc_via, vc_route));

            tc_resp.start;
            alt {
                [] SIPP.receive(mw_Response_Base(mw_statusLine1xx, p_callId, p_cSeq_s)) {
                    repeat;
                }
                [] SIPP.receive(mw_Response_Base(mw_statusLineFinal, p_callId, p_cSeq_s)) {
                    tc_resp.stop;
                }
            // timeout should be handled in default_alt_step
            }
            action("Please de-register");
            f_IMS_awaitDeRegistration(p_requestUri, p_qop);
        } // end function f_terminateCall_UE_withDeReg

    }
    group defaults {

        /**
         * @desc Altstep for clearing registration (IMS user)
         * @param p_to_user The selected user's SIP URL
         * @param p_qop of the peer UE (alternatively)
         * @verdict fail for all unexpected branches
         */
        altstep a_clearRegistration_IMSuser(
            in SipUrl p_to_user,
            in charstring p_qop
        ) runs on ImsComponent {
            var Response v_response;
            var Request v_request;
            var SUBSCRIBE_Request v_subscribe_request;
            var REGISTER_Request v_register_request;
            var BYE_Request v_bye_request;
            var CANCEL_Request v_cancel_request;
            var NOTIFY_Request v_notify_request;
            var INFO_Request v_info_request;
            var CSeq v_cSeq;
            [] any timer.timeout {
                log("*** " & testcasename() & ": FAIL: Timeout while waiting for message. ***");
                setverdict(fail);
                all timer.stop;
                vc_callId := vc_callIdReg;
                action("Please de-register");
                f_IMS_awaitDeRegistration(p_to_user, p_qop);
                f_componentStop();
            }
            // allow repeated INVITEs
            [vc_ignore_invite] SIPP.receive(mw_INVITE_Request_Base) {
                repeat;
            }
            // allow repeated BYEs after ack of the first BYE
            [vc_ignore_bye] SIPP.receive(mw_BYE_Request_Base(?)) {
                repeat;
            }
            [] SIPP.receive(mw_ACK_Request_Base(?)) {
                repeat;
            }
            // allow 100 replies
            [] SIPP.receive(mw_Response_Base(c_statusLine100, ?, ?)) {
                repeat;
            }
            // ignore 181 if flag is set (following TS 183004 §4.5.2.1)
            [vc_ignore181] SIPP.receive(mw_Response_Base(c_statusLine181, vc_callId, vc_cSeq)) -> value v_response sender vc_sent_label {
                v_cSeq := valueof(v_response.msgHeader.cSeq);
                f_setHeadersOnReceiptOfResponse(v_response);
                repeat;
            }
            // according to SIP chap.8.1.3.2
            [] SIPP.receive(mw_Response_Base(c_statusLine183, vc_callId, vc_cSeq)) {
                repeat;
            }
            // ignore 484 if flag is set
            [vc_ignore484] SIPP.receive(mw_Response_Base(c_statusLine484, vc_callId, vc_cSeq)) {
                repeat;
            }
            [vc_ignore4xx] SIPP.receive(mw_Response_Base(mw_statusLine4xx, vc_callId, ?)) -> value v_response sender vc_sent_label {
                v_cSeq := valueof(v_response.msgHeader.cSeq);
                f_setHeadersOnReceiptOfResponse(v_response);
                f_SendACK(m_ACK_Request_route(vc_requestUri, vc_callId, v_response.msgHeader.cSeq, vc_from, vc_to, vc_via, vc_route));
                repeat;
            }
            [vc_ignore200OKinv] SIPP.receive(mw_Response_Base(c_statusLine200, vc_callId, ?)) {
                repeat;
            }
            [] SIPP.receive(mw_INFO_Request_Base(vc_callId)) -> value v_info_request sender vc_sent_label {
                f_setHeadersOnReceiptOfRequest(v_info_request);
                f_send200OK();
                repeat;
            }
            // awaiting of Notify
            [] SIPP.receive(mw_NOTIFY_Request_Base(vc_callId)) -> value v_notify_request sender vc_sent_label {
                f_setHeadersOnReceiptOfRequest(v_notify_request);
                f_send200OK();
                repeat;
            }
            // awaiting of subscribe from UE
            [vc_ignore_subscribe] SIPP.receive(mw_SUBSCRIBE_Request_Base) -> value v_subscribe_request sender vc_sent_label {
                f_setHeadersOnReceiptOfSUBSCRIBE(v_subscribe_request);
                f_send200OK();
                repeat;
            }
            // awaiting of subscribe on proxy
            [] SIPP.receive(mw_SUBSCRIBE_Request_Base) -> value v_subscribe_request sender vc_sent_label {
                f_setHeadersOnReceiptOfRequest(v_subscribe_request);
                f_sendResponse(m_Response_Contact(c_statusLine200, vc_callId, vc_cSeq, vc_callee_From, vc_callee_To, vc_via, vc_contact));
                f_SendNOTIFY(m_NOTIFY_Request_contact(v_subscribe_request.msgHeader.contact.contactBody.contactAddresses[0].addressField.nameAddr.addrSpec, vc_callId, vc_cSeq, vc_callee_From, vc_callee_To, vc_via, vc_contact));
                f_awaitingOkResponse(vc_cSeq);
                repeat;
            }
            // unexpected BYE is acknowledged to avoid retransmissions
            [] SIPP.receive(mw_BYE_Request_Base(?)) -> value v_bye_request sender vc_sent_label {
                log("*** " & testcasename() & ": FAIL: Unexpected BYE message received. ***");
                setverdict(fail);
                f_setHeadersOnReceiptOfRequest(v_bye_request);
                f_send200OK();
                action("Please de-register");
                f_IMS_awaitDeRegistration(p_to_user, p_qop);
                f_componentStop();
            }
            // unexpected CANCEL is acknowledged to avoid retransmissions
            [] SIPP.receive(mw_CANCEL_Request_Base(?)) -> value v_cancel_request sender vc_sent_label {
                log("*** " & testcasename() & ": FAIL: Unexpected CANCEL message received. ***");
                setverdict(fail);
                f_setHeadersOnReceiptOfRequest(v_cancel_request);
                // Answer to the CANCEL
                f_send200OK();
                action("Please de-register");
                f_IMS_awaitDeRegistration(p_to_user, p_qop);
                f_componentStop();
            }
            // catch 4xx response
            [] SIPP.receive(mw_Response_Base(mw_statusLine4xx, vc_callId, ?)) -> value v_response sender vc_sent_label {
                log("*** " & testcasename() & ": FAIL: Unexpected 4xx response received. ***");
                setverdict(fail);
                v_cSeq := valueof(v_response.msgHeader.cSeq);
                f_setHeadersOnReceiptOfResponse(v_response);
                LibSip_Steps.f_setHeadersACK();
                f_SendACK(m_ACK_Request_route(vc_requestUri, vc_callId, v_response.msgHeader.cSeq, vc_from, vc_to, vc_via, vc_route));
                action("Please de-register");
                f_IMS_awaitDeRegistration(p_to_user, p_qop);
                f_componentStop();
            }
            // catch 5xx response
            [] SIPP.receive(mw_Response_Base(mw_statusLine5xx, vc_callId, ?)) -> value v_response sender vc_sent_label {
                log("*** " & testcasename() & ": FAIL: Unexpected 5xx response received. ***");
                setverdict(fail);
                v_cSeq := valueof(v_response.msgHeader.cSeq);
                f_setHeadersOnReceiptOfResponse(v_response);
                LibSip_Steps.f_setHeadersACK();
                f_SendACK(m_ACK_Request_route(vc_requestUri, vc_callId, v_response.msgHeader.cSeq, vc_from, vc_to, vc_via, vc_route));
                action("Please de-register");
                f_IMS_awaitDeRegistration(p_to_user, p_qop);
                f_componentStop();
            }
            // catch invalid REGISTER
            [] SIPP.receive(mw_REGISTER_Request_Base) -> value v_register_request sender vc_sent_label {
                log("*** " & testcasename() & ": FAIL: Unexpected REGISTER received. ***");
                setverdict(fail);
                f_componentStop();
            }
            // any
            [] SIPP.receive {
                log("*** " & testcasename() & ": FAIL: Unexpected message received. ***");
                setverdict(fail);
                all timer.stop;
                action("Please de-register");
                f_IMS_awaitDeRegistration(p_to_user, p_qop);
                f_componentStop();
            }
        }

        /**
         * @desc Main default altstep to handle unexpected messages and timeout
         * @verdict fail for all unexpected branches
         */
        altstep a_altstep_AS(
        ) runs on SipComponent {
            var Request v_request;
            var REGISTER_Request v_register_request;
            var BYE_Request v_bye_request;
            var CANCEL_Request v_cancel_request;
            
            [] any timer.timeout {
                log("*** " & testcasename() & ": FAIL: Timeout while waiting for message. ***");
                setverdict(fail);
                all timer.stop;
            }
            // allow repeated INVITEs
            [vc_ignore_invite] SIPP.receive(mw_INVITE_Request_Base) {
                repeat;
            }
            // handle REGISTER requests
            [] SIPP.receive(mw_REGISTER_Request_Base) -> value v_register_request sender vc_sent_label {
                f_setHeadersOnReceiptOfREGISTER(v_register_request);
                // vc_contact := vc_request.msgHeader.contact;
                f_sendResponse(m_Response_Contact(c_statusLine200, vc_callId, vc_cSeq, vc_caller_From, vc_caller_To, vc_via, vc_contact));
                repeat;
            }
            // according to SIP chap.8.1.3.2
            [] SIPP.receive(mw_Response_Base(c_statusLine183, vc_callId, vc_cSeq)) {
                repeat;
            }
            // unexpected CANCEL is acknowledged to avoid retransmissions
            [] SIPP.receive(mw_CANCEL_Request_Base(?)) -> value v_cancel_request sender vc_sent_label {
                log("*** " & testcasename() & ": FAIL: Unexpected CANCEL message received. ***");
                setverdict(fail);
                f_setHeadersOnReceiptOfRequest(v_cancel_request);
                f_send200OK();
            }
            // unexpected BYE is acknowledged to avoid retransmissions
            [] SIPP.receive(mw_BYE_Request_Base(?)) -> value v_bye_request sender vc_sent_label {
                log("*** " & testcasename() & ": FAIL: Unexpected BYE message received. ***");
                setverdict(fail);
                f_setHeadersOnReceiptOfRequest(v_bye_request);
                f_send200OK();
            }
            [] SIPP.receive(mw_Response_Base(?, vc_callId, vc_cSeq)) -> value vc_response {
                log("*** " & testcasename() & ": FAIL: Unexpected response message in " & __SCOPE__ & " received. ***");
                setverdict(fail);
                repeat;
            }
            // any
            [] SIPP.receive {
                log("*** " & testcasename() & ": FAIL: Unexpected message received. ***");
                setverdict(fail);
                all timer.stop;
            }
        }
    }
} // module LibIms_Steps