Newer
Older
}
} //end f_awaitingInviteRequest
/**
* @desc function awaiting ACK request
*/
function f_awaitingACK(in template ACK_Request p_ACK) runs on SipComponent
{
var Request v_ACK_Request;
tc_ack.start(PX_SIP_TACK);
alt
{
[] SIPP.receive(p_ACK) -> value v_ACK_Request
{
f_setHeadersOnReceiptOfRequest(v_ACK_Request);
tc_ack.stop;
}
}
} //end f_awaitingAckRequest
/**
*
* @desc function awaiting BYE and sending 200OK response
* @param p_BYE expected BYE
*/
function f_awaitingBYE(in template BYE_Request p_BYE) runs on SipComponent
{
var BYE_Request v_BYE_Request;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[]SIPP.receive (p_BYE) -> value v_BYE_Request sender vc_sent_label
{
vc_ignore_bye:= true;
f_setHeadersOnReceiptOfBYE(v_BYE_Request);
//f_send200OK();
}
}
} // end f_awaitingBYE
/**
*
* @desc function awaiting BYE and sending 200OK response
* @param p_BYE expected BYE
*/
function f_awaitingBYE_sendReply
(in template BYE_Request p_BYE) runs on SipComponent
{
var BYE_Request v_BYE_Request;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[]SIPP.receive (p_BYE) -> value v_BYE_Request sender vc_sent_label
{
vc_ignore_bye:= true;
f_setHeadersOnReceiptOfBYE(v_BYE_Request);
f_send200OK();
}
}
} // end f_awaitingBYE_sendReply
/**
*
* @desc function awaiting BYE and sending 200OK response
* @param p_BYE expected BYE
*/
function f_awaitingBYE_sendReply_PassOnTimeout(in template BYE_Request p_BYE) runs on SipComponent
{
var BYE_Request v_BYE_Request;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[]SIPP.receive (p_BYE) -> value v_BYE_Request sender vc_sent_label
{
vc_ignore_bye:= true;
vc_boo_request := true;
f_setHeadersOnReceiptOfBYE(v_BYE_Request);
f_send200OK();
}
{
vc_boo_request := false;
}
} // end f_awaitingBYE_sendReply_PassOnTimeout
/**
*
* @desc function awaiting CANCEL
* @param p_CANCEL expected CANCEL
*/
function f_awaitingCANCEL(in template CANCEL_Request p_CANCEL) runs on SipComponent
{
var CANCEL_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[]SIPP.receive (p_CANCEL) -> value v_MSG sender vc_sent_label
{
f_setHeadersOnReceiptOfRequest(v_MSG);
}
}
} // end f_awaitingCANCEL
/**
* @desc await MESSAGE request
*/
function f_awaitingMESSAGE(in template MESSAGE_Request p_MSG) runs on SipComponent
{
var MESSAGE_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
{
f_setHeadersOnReceiptOfRequest(v_MSG);
}
[] SIPP.receive(mw_MESSAGE_Request_Base)-> value v_MSG sender vc_sent_label
{
f_setHeadersOnReceiptOfRequest(v_MSG);
log("Received MESSAGE not as expected!");
setverdict (fail);
}
}
} // end of f_awaitingMESSAGE
/**
* @desc await MESSAGE request
* reply with 200 OK
*/
function f_awaitingMESSAGE_sendReply() runs on SipComponent
{
var MESSAGE_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
[] SIPP.receive(mw_MESSAGE_Request_Base)-> value v_MSG sender vc_sent_label
f_setHeadersOnReceiptOfRequest(v_MSG);
//Answer to the MESSAGE
f_send200OK();
}
}
} // end of f_awaitingMESSAGE_sendReply
/**
* @desc await MESSAGE request
*/
function f_awaitingMESSAGE_sendReply_PassOnTimeout(in template MESSAGE_Request p_MSG) runs on SipComponent
{
var MESSAGE_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
{
f_setHeadersOnReceiptOfRequest(v_MSG);
//Answer to the MESSAGE
//f_send200OK();
vc_boo_request := true;
f_send200OK();
//setverdict (pass);
}
{
vc_boo_request := false;
//setverdict (pass);
}
}
} // end of f_awaitingMESSAGE_PassOnTimeout
/**
* @desc await NOTIFY request
*/
function f_awaitingNOTIFY(in template NOTIFY_Request p_MSG) runs on SipComponent
{
var NOTIFY_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
{
tc_wait.stop;
f_getRouteMapIntoRecordRoute(vc_cSeq, v_MSG);
f_setHeadersOnReceiptOfRequest(v_MSG);
}
}
} // end of f_awaitingNOTIFY
/**
* @desc await NOTIFY request
* reply with 200 OK
*/
function f_awaitingNOTIFY_sendReply(in template NOTIFY_Request p_MSG) runs on SipComponent
{
var NOTIFY_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
{
f_getRouteMapIntoRecordRoute(vc_cSeq, v_MSG);
f_setHeadersOnReceiptOfRequest(v_MSG);
//Answer to the NOTIFY
f_send200OK();
}
}
} // end of f_awaitingNOTIFY_sendReply
/**
* @desc await PRACK request
* reply with 200 OK
*/
function f_awaitingPRACK_sendReply(in template PRACK_Request p_MSG) runs on SipComponent
{
var PRACK_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
f_setHeadersOnReceiptOfRequest(v_MSG);
//Answer to the PRACK
f_send200OK();
}
}
} // end of f_awaitingPRACK_sendReply
/**
* @desc await PUBLISH request
* reply with 200 OK
*/
function f_awaitingPUBLISH_sendReply(in template PUBLISH_Request p_MSG) runs on SipComponent
{
var PUBLISH_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
{
f_setHeadersOnReceiptOfRequest(v_MSG);
//Answer to the PUBLISH
f_send200OK();
}
}
} // end of f_awaitingPUBLISH_sendReply
/**
* @desc await UPDATE request
*/
function f_awaitingUPDATE(in template UPDATE_Request p_MSG) runs on SipComponent
{
var UPDATE_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
f_setHeadersOnReceiptOfRequest(v_MSG);
}
}
} // end of f_awaitingUPDATE
/**
* @desc await UPDATE request
* reply with 200 OK
*/
function f_awaitingUPDATE_sendReply(in template UPDATE_Request p_MSG) runs on SipComponent
{
var UPDATE_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
f_setHeadersOnReceiptOfRequest(v_MSG);
//Answer to the UPDATE
f_send200OK();
}
}
} // end of f_awaitingUPDATE_sendReply
/**
* @desc await REFER request
*/
function f_awaitingREFER(in template REFER_Request p_MSG) runs on SipComponent
{
var REFER_Request v_MSG;
tc_wait.start(PX_SIP_TWAIT);
alt
{
[] SIPP.receive(p_MSG)-> value v_MSG sender vc_sent_label
f_setHeadersOnReceiptOfREFER(v_MSG);
}
} // end of f_awaitingUPDATE
} // end AwaitingMessage
group SendMessage {
/**
*
* @desc send ACK message, update the route and recordRoute header fields depending on boolean flags
* @param p_request template of the message to be sent
*/
function f_SendACK(template ACK_Request p_request) runs on SipComponent
{
//p_request.msgHeader.route := f_route(); // update the route header field depending on vc_boo_route
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
// n/a p_request.msgHeader.recordRoute := f_recordroute(); // update the route header field depending on vc_boo_route
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send BYE message, update the route and recordRoute header fields depending on boolean flags
* @param p_request template of the message to be sent
*/
function f_SendBYE(template BYE_Request p_request) runs on SipComponent
{
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send CANCEL message
* @param p_request template of the message to be sent
*/
function f_SendCANCEL(template CANCEL_Request p_request) runs on SipComponent
{
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send INFO message
* @param p_request template of the message to be sent
*/
function f_SendINFO(template INFO_Request p_request) runs on SipComponent
{
f_setHeadersGeneral(vc_cSeq, "INFO"); // cseq, contact, branch, via
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send INVITE message
* @param p_request template of the message to be sent
*/
function f_SendINVITE(template INVITE_Request p_request) runs on SipComponent
{
vc_requestFor407 := valueof(p_request);
SIPP.send(p_request) to vc_sent_label;
vc_request := valueof(p_request);
if(PX_SIP_INVITE_AUTHENTICATION_ENABLED) {a_altstep_401or407();};
}
/**
*
* @desc send PRACK message
* @param p_request template of the message to be sent
*/
vc_rAck := valueof(m_RAck(vc_response.msgHeader.rSeq.responseNum, vc_cSeq.seqNumber, vc_cSeq.method));
f_setHeadersGeneral(vc_cSeq, "PRACK"); // cseq, contact, branch, via
SIPP.send(m_PRACK_Request_Base(
vc_requestUri,
vc_callId,
vc_cSeq,
vc_from,
vc_to,
vc_via,
vc_rAck
)) to vc_sent_label;
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
}
/**
*
* @desc send PUBLISH message
* @param p_request template of the message to be sent
*/
function f_SendPUBLISH(template PUBLISH_Request p_request) runs on SipComponent
{
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send REGISTER message
* @param p_request template of the message to be sent
*/
function f_SendREGISTER(template REGISTER_Request p_request) runs on SipComponent
{
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send SUBSCRIBE message
* @param p_request template of the message to be sent
*/
function f_SendSUBSCRIBE(template SUBSCRIBE_Request p_request) runs on SipComponent
{
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send UPDATE message
* @param p_request template of the message to be sent
*/
function f_SendUPDATE(template UPDATE_Request p_request) runs on SipComponent
{
f_setHeadersGeneral(vc_cSeq, "UPDATE"); // cseq, contact, branch, via
p_request.msgHeader.cSeq := vc_cSeq;
p_request.msgHeader.contact := vc_contact;
p_request.msgHeader.via := vc_via;
SIPP.send(p_request) to vc_sent_label;
if(PX_SIP_INVITE_AUTHENTICATION_ENABLED) {a_altstep_401or407();};
*
* @desc function send MESSAGE message
* @param p_request template of the message to be sent
*/
function f_SendMESSAGE(template MESSAGE_Request p_request) runs on SipComponent
{
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc function send NOTIFY message
* @param p_request template of the notify to be sent
*/
function f_SendNOTIFY(template NOTIFY_Request p_request) runs on SipComponent
{
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send REFER message
* @param p_request template of the message to be sent
*/
function f_SendREFER(template REFER_Request p_request) runs on SipComponent
{
SIPP.send(p_request) to vc_sent_label;
}
/**
*
* @desc send 200 OK
*/
function f_send200OK() runs on SipComponent
{
f_sendResponse(m_Response_Base(c_statusLine200, vc_callId, vc_cSeq, vc_caller_From, vc_caller_To, vc_via));
}
/**
*
* @desc send response
* @param p_request template of the message to be sent
*/
function f_sendResponse(template Response p_response) runs on SipComponent
{
//p_response.msgHeader.route := f_route(); // update the route header field depending on vc_boo_route//TODO check if route header is needed in responses
p_response.msgHeader.recordRoute := f_recordroute(); // update the route header field depending on vc_boo_route
SIPP.send(p_response) to vc_sent_label;
}
} // end SendMessage
group GlobalSteps {
/**
* @desc component initialization
* @param p_cSeq_s cSeq value to be assigned to the component variable
*/
function f_init_component(inout CSeq p_cSeq_s) runs on SipComponent
{
//Variables
vc_cSeq := p_cSeq_s;
//Defaults
vc_def_catchSyncStop := activate(a_Sip_catchSyncStop());
vc_default := activate (a_clearRegistration());
}
/**
* @desc component termination
*/
function f_terminate_component() runs on SipComponent
{
log("component terminated - forced!");
deactivate;
stop;
}
/**
*
* @desc component termination
*/
function f_componentStop() runs on SipComponent
{
syncPort.send(m_syncClientStop);
SIPP.clear;
stop;
}
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
/**
*
* @desc setting of user parameters with PIXIT values
* @param p_user identifies the selected user configuration and location
*/
function f_init_userprofile(in integer p_user) runs on SipComponent
{
vc_userprofile.id := p_user;
select(p_user){
case (c_userProfile_SIP1_home) { //variant c_userProfile_SIP1_home
vc_userprofile.currPort := PX_SIP_TS1_PORT;
vc_userprofile.currIpaddr := PX_SIP_TS1_IPADDR;
vc_userprofile.contactPort := PX_SIP_TS1_PORT;
vc_userprofile.contactIpaddr := PX_SIP_TS1_IPADDR;
vc_userprofile.bearerIpaddr := PX_SIP_TS1_BEARER_IPADDR;
vc_userprofile.homeDomain := PX_SIP_TS1_LOCAL_DOMAIN;
vc_userprofile.publUsername := PX_SIP_TS1_LOCAL_USER;
vc_userprofile.qop := PX_SIP_SUT_UE1_QOP;
vc_userprofile.privUsername := PX_SIP_SUT_UE1_USERNAME;
vc_userprofile.passwd := PX_SIP_SUT_UE1_PASSWD;
vc_userprofile.registrarDomain := PX_SIP_SUT_REGISTRAR_DOMAIN;
}
case (c_userProfile_SIP2_home) { //variant c_userProfile_SIP2_home
vc_userprofile.currPort := PX_SIP_TS2_PORT;
vc_userprofile.currIpaddr := PX_SIP_TS2_IPADDR;
vc_userprofile.contactPort := PX_SIP_TS2_PORT;
vc_userprofile.contactIpaddr := PX_SIP_TS2_IPADDR;
vc_userprofile.bearerIpaddr := PX_SIP_TS2_BEARER_IPADDR;
vc_userprofile.homeDomain := PX_SIP_TS2_LOCAL_DOMAIN;
vc_userprofile.publUsername := PX_SIP_TS2_LOCAL_USER;
vc_userprofile.qop := PX_SIP_SUT_UE2_QOP;
vc_userprofile.privUsername := PX_SIP_SUT_UE2_USERNAME;
vc_userprofile.passwd := PX_SIP_SUT_UE2_PASSWD;
vc_userprofile.registrarDomain := PX_SIP_SUT_REGISTRAR_DOMAIN;
}
}
}
/**
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
* @desc function waits for particular time that allows the SUT to return to idle state
*/
function f_awaitSUTidle() runs on SipComponent
{
vc_ignore4xx := true; // allow 4xx in default
tc_noAct.start;
alt {
[] tc_noAct.timeout{}
}
}
/**
*
* @desc function waits for particular time before next expected message
*/
function f_wait(float p_time) runs on SipComponent
{
tc_noAct.start(p_time);
alt {
[] tc_noAct.timeout{}
}
}
/**
*
* @desc function cause termination of a PTC
* @param p_syncPoint dummy parameter (copied from the common lib)
*/
function f_check2Null(in charstring p_syncPoint) runs on SipComponent
{
//!= pass does not work, because in case of "none" execution shall continue
if (getverdict == inconc or getverdict == fail){
log("**** f_check2Null: Verdict evaluated to fail or inconc. Stopping test execution now ");
f_selfOrClientSyncAndVerdict (p_syncPoint, e_error) ;
}//end if
}
rennoch
committed
/*
rennoch
committed
* @desc original copied from older LibCommon_VerdictControl
*/
function f_getVerdict()
return FncRetCode {
var FncRetCode v_ret := e_error;
if (getverdict == pass or getverdict == none) {
v_ret := e_success;
}
return v_ret;
}
}// end group GlobalSteps
group Registration {
/**
*
* @desc registration and authentication with MD5
* @param p_cSeq_s cseq parameter
* @param p_register register template
* @param p_auth flag indicating if authentication is needed
*/
function f_Registration(inout CSeq p_cSeq_s, out template REGISTER_Request p_register, in boolean p_auth, boolean p_emergency:=false) runs on SipComponent
{
if (PX_SIP_REGISTRATION)
{
f_setHeaders_REGISTER(p_cSeq_s, p_emergency); //TODO need if p_register not set
p_register := m_REGISTER_Request_Base(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
f_SendREGISTER(p_register); //LibSip
//awaiting of 401 and sending 2nd REGISTER and awaiting 200 OK REGISTER
if (p_auth)
{
// receiving 401 Unauthorized response.
// and Re-send REGISTER request with Authorization header
tc_resp.start(PX_SIP_TRESP);
alt
{
[] SIPP.receive (mw_Response_Base(c_statusLine401, vc_callId, p_cSeq_s)) -> value vc_response
{
f_setHeadersOnReceiptOfResponse(p_cSeq_s, vc_response);
// set headers via, cseq and authorization
f_setHeaders_2ndREGISTER(p_cSeq_s);
p_register := m_REGISTER_Request_Base(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
// Re-send protected REGISTER
f_SendREGISTER(p_register);//LibSip
// awaiting 200 OK REGISTER
f_awaitingOkResponse(p_cSeq_s);
f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
}
[] SIPP.receive (mw_Response_Base(c_statusLine200, vc_callId, p_cSeq_s)) -> value vc_response
f_setHeadersOnReceiptOfResponse(vc_cSeq, vc_response);
f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
log ("Authorization was not requested as expected");
}
}
}
else
{
f_awaitingOkResponse(p_cSeq_s);
f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
}
};
}//end function f_Registration
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
/**
*
* @desc registration and authentication with MD5
* @param p_cSeq_s cseq parameter
* @param p_register register template
* @param p_auth flag indicating if authentication is needed
*/
function f_Registration_withTemplate(inout CSeq p_cSeq_s, inout template REGISTER_Request p_register, in boolean p_auth) runs on SipComponent
{
if (PX_SIP_REGISTRATION)
{
//f_setHeaders_REGISTER(p_cSeq_s); TODO need if p_register not set
//p_register := m_REGISTER_Request_Base(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
f_SendREGISTER(p_register); //LibSip
//awaiting of 401 and sending 2nd REGISTER and awaiting 200 OK REGISTER
if (p_auth)
{
// receiving 401 Unauthorized response.
// and Re-send REGISTER request with Authorization header
tc_resp.start(PX_SIP_TRESP);
alt
{
[] SIPP.receive (mw_Response_Base(c_statusLine401, vc_callId, p_cSeq_s)) -> value vc_response
{
tc_resp.stop;
f_setHeadersOnReceiptOfResponse(p_cSeq_s, vc_response);
// set headers via, cseq and authorization
f_setHeaders_2ndREGISTER(p_cSeq_s);
//p_register := m_REGISTER_Request_Base(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
// Re-send protected REGISTER
p_register.requestLine.requestUri := vc_requestUri;
p_register.msgHeader.cSeq := vc_cSeq;
p_register.msgHeader.via := vc_via_REG;
p_register.msgHeader.authorization := vc_authorization;
f_SendREGISTER(p_register);//LibSip
// awaiting 200 OK REGISTER
f_awaitingOkResponse(p_cSeq_s);
f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
}
[] SIPP.receive (mw_Response_Base(c_statusLine200, vc_callId, p_cSeq_s)) -> value vc_response
{
tc_resp.stop;
f_setHeadersOnReceiptOfResponse(vc_cSeq, vc_response);
f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
log ("Authorization was not requested as expected");
}
}
}
else
{
f_awaitingOkResponse(p_cSeq_s);
f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
}
};
}//end function f_Registration_withTemplate
/**
*
* @desc remove registration
* @param p_cSeq_s cseq parameter
*/
function f_RemoveRegistration(inout CSeq p_cSeq) runs on SipComponent
{
var CommaParam_List v_challenge;
var Credentials v_credentials;
//
if(vc_DeregDone)
{
f_componentStop();
}
else {vc_DeregDone := true;}
if (PX_SIP_REGISTRATION)
{
f_setHeaders_deREGISTER(p_cSeq);
//TODO: 1st option
v_request := m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg,
p_cSeq, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization, "0");
//TODO@ 2nd option
// v_request := m_REGISTER_Request_Base(vc_requestUri, vc_callIdReg,
// p_cSeq, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
//v_request.msgHeader.route := f_route();
f_SendREGISTER(v_request);
if (PX_SIP_REGISTER_AUTHENTICATION_ENABLED)
{
// receiving 401 Unauthorized response.
// and Re-send REGISTER request with Authorization header
tc_resp.start(PX_SIP_TRESP);
[] SIPP.receive (mw_Response_Base(c_statusLine401, vc_callIdReg, p_cSeq)) -> value vc_response
// set headers via, cseq and authorization
f_setHeaders_2ndREGISTER(p_cSeq);
// TODO: 1st option
v_request := m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg,
p_cSeq, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization, "0");
// TODO: 2nd option
// v_request := m_REGISTER_Request_Base(vc_requestUri, vc_callIdReg,
// p_cSeq, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
//v_request.msgHeader.route := f_route();
// Re-send protected REGISTER
f_SendREGISTER(v_request);//LibSip
// awaiting 200 OK REGISTER
f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callIdReg, p_cSeq));
[] SIPP.receive (mw_Response_Base(c_statusLine200, vc_callIdReg, p_cSeq))-> value vc_response
f_setHeadersOnReceiptOfResponse(vc_cSeq, vc_response);
//log ("Authorization was not requested as expected");
}
}
}
else
{
f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callIdReg, p_cSeq));
}
}
} // end f_RemoveRegistration
/**
*
* @desc remove registration without authorization
* @param p_cSeq_s cseq parameter
*/
function f_RemoveRegistration_wo_authorization(inout CSeq p_cSeq) runs on SipComponent
{
var SemicolonParam_List tmp_params;
if (PX_SIP_REGISTRATION)
{
f_setHeaders_deREGISTER(p_cSeq);
f_SendREGISTER(m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg, p_cSeq,
vc_from, vc_to, vc_via, vc_contact, vc_authorization, "0" ));
f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callIdReg, p_cSeq));
}
} // end f_RemoveRegistration_wo_authorization
}//end group Registration
group Subscription {
/**
*
* @desc UE send subscrbe, await on 200 OK, await notify and send 200 OK
* @param p_cSeq_s cseq parameter
function f_Subscription(inout CSeq p_cSeq_s,template SUBSCRIBE_Request p_subscribe) runs on SipComponent
if (PX_SIP_SUBSCRIPTION)
{
//f_setHeaders_SUBSCRIBE(p_cSeq_s);
//send SUBSCRIBE
f_SendSUBSCRIBE(p_subscribe);
// awaiting 200 OK SUBSCRIBE
f_awaitingOkResponse(p_cSeq_s);
//await NOTIFY and send reply 200 OK
f_awaitingNOTIFY_sendReply(mw_NOTIFY_Request_Base(vc_callId));
}
}//end function f_Subscription
/**
*
* @desc UE send subscrbe, await on 200 OK, await notify and send 200 OK
* @param p_cSeq_s cseq parameter
* @param p_subscribe subscribe template
* @param p_notify notify template
*/
function f_SubscriptionWithNotification(inout CSeq p_cSeq_s, template SUBSCRIBE_Request p_subscribe, template NOTIFY_Request p_notify) runs on SipComponent
{
if (PX_SIP_SUBSCRIPTION)
{
f_setHeaders_SUBSCRIBE(p_cSeq_s);
//send SUBSCRIBE
f_SendSUBSCRIBE(p_subscribe);
// awaiting 200 OK SUBSCRIBE
f_awaitingOkResponse(p_cSeq_s);
}
if(PX_SIP_NOTIFICATION)
{
//await NOTIFY and send reply 200 OK
f_awaitingNOTIFY_sendReply(p_notify);
}
}//end function f_Subscription
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
/**
*
* @desc UE await subscrbe, send on 200 OK; possibility to handle also other SUBSCRIBE methods where event is different than reg
* @param p_cSeq_s cseq parameter
* @param p_subscribe subscribe template
*/
function f_awaitingSubscription(inout CSeq p_cSeq_s, template SUBSCRIBE_Request p_subscribe) runs on SipComponent
{
var Request v_request;
tc_wait.start(2.0);//awaiting of all SUBSCRIBES
alt
{
[] SIPP.receive(p_subscribe)-> value v_request sender vc_sent_label
{
f_setHeadersOnReceiptOfSUBSCRIBE(v_request);
f_send200OK();
repeat;
}
[] SIPP.receive(mw_SUBSCRIBE_Request_Base)-> value v_request sender vc_sent_label
{
f_setHeadersOnReceiptOfSUBSCRIBE(v_request);
f_send200OK();
repeat;
}
[] tc_wait.timeout
{
setverdict(pass);
}
}
// TODO check how to solve sending of NOTIFY on SUBSCRIBE
}//end function f_awaitingSubscription
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
}//end group Subscription
group Preambles {
/**
*
* @desc Set variables and default initialization for user profile
* @param p_userprofile user profile of call
* @param p_cSeq_s cseq parameter
*/
function f_SIP_preamble_woREG(in integer p_userprofile, inout CSeq p_cSeq_s) runs on SipComponent
{
//varables and altsteps
f_init_component(p_cSeq_s);
//Preamble
f_init_userprofile(p_userprofile); // assignment of PIXIT values to component variable
vc_sdp_local := valueof(m_SDP_bandwidth(valueof(m_media_dynPT(PX_SIP_SDP_dyn, PX_SIP_SDP_encoding)), vc_userprofile));
}
/**
*
* @desc Set variables and default initialization for user profile and handle registration and authentication with MD5
* @param p_userprofile user profile of call
* @param p_cSeq_s cseq parameter
* @param p_register register template
*/
function f_SIP_preamble_withREG(in integer p_userprofile, inout CSeq p_cSeq_s, template REGISTER_Request p_register) runs on SipComponent
{
//preamble
f_SIP_preamble_woREG(p_userprofile, p_cSeq_s);
//Registration, Awaiting
f_Registration(p_cSeq_s, p_register, PX_SIP_REGISTER_AUTHENTICATION_ENABLED);
}
}// end group Preambles
group Postambles {
/**
*
* @desc function send BYE and awaits reponse
* @param p_CallId parameter for outgoing BYE
* @param p_cSeq parameter for outgoing BYE
* @param p_from parameter for outgoing BYE
* @param p_to parameter for outgoing BYE
* @param p_reqHostPort parameter for outgoing BYE
*/
function f_terminateCall(SipUrl p_requestUri, CallId p_CallId, inout CSeq p_cSeq, From p_from,
template To p_to) runs on SipComponent
{
// Sending of a BYE request to release the call and expect a final response
f_SendBYE(m_BYE_Request_cause(p_requestUri, p_CallId, p_cSeq, p_from, valueof(p_to), vc_via, PX_SIP_BYE_CAUSE));
tc_resp.start(PX_SIP_TRESP);
alt
{
[] SIPP.receive (mw_Response_Base(mw_statusLine1xx, p_CallId, p_cSeq))
{
repeat;
}
[] SIPP.receive (mw_Response_Base(mw_statusLineFinal, p_CallId, p_cSeq))
{