Newer
Older
fieldName := VIA_E,
viaBody := {valueof(m_ViaBody_currIpaddr(vc_branch, vc_userprofile))}
};
}// end function f_setHeadersGeneral
/**
*
* @desc setting of general and basic Bye header fields
* in additon to the addresses (To, From, ReqUri)
* @param p_cSeq_s
*/
function f_setHeadersBYE(inout CSeq p_cSeq_s) runs on SipComponent
{
f_setHeadersGeneral(p_cSeq_s, "BYE"); // cseq, contact, branch, via
//vc_callId := { fieldName:=CALL_ID_E, callid:=f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr };
f_addTagInTo(vc_to);
vc_cancel_To := vc_to;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
}// end function f_setHeadersBYE
/**
*
* @desc setting of general and basic CANCEL header fields
* @param p_cSeq_s
*/
function f_setHeadersCANCEL(inout CSeq p_cSeq_s) runs on SipComponent
{
p_cSeq_s.method := "CANCEL";
//vc_branch := c_branchCookie & f_getRndTag(); // STF 406: CANCEL and ACK should have the same branch as the INVITE
vc_via:={
fieldName := VIA_E,
viaBody := {valueof(m_ViaBody_currIpaddr(vc_branch, vc_userprofile))}
};
}// end function f_setHeadersCANCEL
*
* @desc function sets header field for the next outgoing REGISTER message
* @param p_cSeq_s CSeq parameter to be applied
*/
function f_setHeaders_REGISTER(inout CSeq p_cSeq_s) runs on SipComponent
{
var SemicolonParam_List v_params;
f_setHeadersGeneral(p_cSeq_s, "REGISTER"); // cseq, contact, branch, via
vc_requestUri:=
{
scheme := c_sipScheme,
hostPort := {host:=vc_userprofile.registrarDomain, portField:=omit}}},
urlParameters := omit,
headers := omit
};
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
vc_callId := { fieldName:=CALL_ID_E, callid:=f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr };
vc_callIdReg := vc_callId; //remember callId for de-registration
vc_to := valueof(m_To(m_SipUrl_currDomain(vc_userprofile)));
v_params := {{id:=c_tagId, paramValue:=f_getRndTag()}}
vc_from := {fieldName := FROM_E,
addressField :=vc_to.addressField,
fromParams := v_params
};
if(not vc_firstREGISTER_sent)
{
v_params := {{id:=c_expiresId, paramValue:=c_shortRegistration}};
vc_contact.contactBody.contactAddresses[0].contactParams := v_params;
}
vc_firstREGISTER_sent := true;//f_setHeaders_Register is called in deREGISTER function
vc_authorization :=
{
fieldName := AUTHORIZATION_E,
body := {f_calculatecCredentials_empty(vc_userprofile)}
vc_via_REG := vc_via;
}// end function setHeaders_REGISTER
/**
*
* @desc function sets via, cseq and authorization header for the next outgoing (protected) REGISTER
function f_setHeaders_2ndREGISTER(inout CSeq p_cSeq_s) runs on SipComponent
{
var CommaParam_List v_challenge;
//Increment CSeq sequence number
p_cSeq_s.seqNumber := p_cSeq_s.seqNumber + 1;
vc_cSeq := p_cSeq_s;
hostPort := {host:=vc_userprofile.registrarDomain, portField:=omit}}},
//new branch tag due to different branch tag in new REGISTER method
vc_branch := c_branchCookie & f_getRndTag();
vc_via_REG :={
fieldName := VIA_E,
viaBody := {valueof(m_ViaBody_currIpaddr(vc_branch, vc_userprofile))}
};
// Extract challenge and calculate credentials for a response.
v_challenge := vc_response.msgHeader.wwwAuthenticate.challenge.digestCln;
// Prepair right answer
vc_authorization :=
{
fieldName := AUTHORIZATION_E,
body := {f_calculatecCredentials(vc_userprofile, "REGISTER", v_challenge)}
}
}// end function f_setHeaders_2ndREGISTER
/**
*
* @desc function sets via, cseq and authorization header for the next outgoing (protected) REGISTER
* NO response in Authorization header to cause an error
* @verdict
*/
function f_setHeaders_2ndREGISTER_wo_response() runs on SipComponent
{
var CommaParam_List v_challenge;
vc_branch := c_branchCookie & f_getRndTag();
vc_via_REG :={
fieldName := VIA_E,
viaBody := {valueof(m_ViaBody_currIpaddr(vc_branch, vc_userprofile))}
};
if(ischosen(vc_response.msgHeader.wwwAuthenticate.challenge.otherChallenge))
// Extract challenge and calculate credentials for a response.
{
v_challenge := vc_response.msgHeader.wwwAuthenticate.challenge.otherChallenge.authParams;
}
else
{
v_challenge := vc_response.msgHeader.wwwAuthenticate.challenge.digestCln;
}
// Increment CSeq sequence number
vc_cSeq.seqNumber := vc_cSeq.seqNumber + 1;
// Prepair right answer
vc_authorization :=
{
fieldName := AUTHORIZATION_E,
body := {f_calculatecCredentials_wo_response(vc_userprofile, "REGISTER", v_challenge)}
}
}// end function f_setHeaders_2ndREGISTER_wo_response
/**
*
* @desc function sets via, cseq and authorization header with different private name for the next outgoing (protected) REGISTER
* @verdict
*/
function f_setHeaders_2ndREGISTER_authorizationWithDifferentUserName() runs on SipComponent
{
var CommaParam_List v_challenge;
vc_branch := c_branchCookie & f_getRndTag();
hostPort := {host:=vc_userprofile.registrarDomain, portField:=omit}}},
vc_via_REG :={
fieldName := VIA_E,
viaBody := {valueof(m_ViaBody_currIpaddr(vc_branch, vc_userprofile))}
};
// Extract challenge and calculate credentials for a response.
v_challenge := vc_response.msgHeader.wwwAuthenticate.challenge.otherChallenge.authParams;
// Increment CSeq sequence number
vc_cSeq.seqNumber := vc_cSeq.seqNumber + 1;
// Prepair right answer
vc_authorization :=
{
fieldName := AUTHORIZATION_E,
body := {f_calculatecCredentialsAndChangeUserName(vc_userprofile, "REGISTER", v_challenge)}
}
}// end function f_setHeaders_2ndREGISTER_authorizationWithDifferentUserName
/**
*
* @desc function sets header fields for the next outgoing REGISTER (de-registration)
* @param p_cSeq_s cSeq to be used
* @verdict
*/
function f_setHeaders_deREGISTER(inout CSeq p_cSeq_s) runs on SipComponent
{
var SemicolonParam_List v_params;
f_setHeadersGeneral(p_cSeq_s, "REGISTER"); // cseq, contact, branch, via
vc_requestUri:=
hostPort := {host:=vc_userprofile.registrarDomain, portField:=omit}}},
urlParameters := omit,
headers := omit
vc_to := valueof(m_To(m_SipUrl_currDomain(vc_userprofile)));
v_params := {{id:=c_tagId, paramValue:=f_getRndTag()}}
vc_from := {fieldName := FROM_E,
addressField :=vc_to.addressField,
fromParams := v_params
};
vc_contact :=
{
fieldName := CONTACT_E,
contactBody := {wildcard := "*" }
};
} // end function f_setHeaders_deREGISTER
/**
* @desc setting of general and basic Invite header fields
* in additon to the addresses (To, From, ReqUri)
* @param p_cSeq_s
*/
function f_setHeadersINVITE(inout CSeq p_cSeq_s) runs on SipComponent
{
f_setHeadersGeneral(p_cSeq_s, "INVITE"); // cseq, contact, branch, via
vc_callId := { fieldName:=CALL_ID_E, callid:=f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr };
vc_cancel_To := vc_to;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
}// end function f_setHeadersINVITE
/**
*
* @desc setting of general and basic Update header fields
* in additon to the addresses (To, From, ReqUri)
* @param p_cSeq_s
*/
function f_setHeadersUPDATE(inout CSeq p_cSeq_s) runs on SipComponent
{
f_setHeadersGeneral(p_cSeq_s, "UPDATE"); // cseq, contact, branch, via
vc_callId := { fieldName:=CALL_ID_E, callid:=f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr };
vc_cancel_To := vc_to;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
/**
*
* @desc setting of general and basic Message header fields
* in additon to the addresses (To, From, ReqUri)
* @param p_cSeq_s
*/
function f_setHeadersMESSAGE(inout CSeq p_cSeq_s) runs on SipComponent
{
f_setHeadersGeneral(p_cSeq_s, "MESSAGE"); // cseq, contact, branch, via
vc_callId := { fieldName:=CALL_ID_E, callid:=f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr };
vc_cancel_To := vc_to;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
}// end function f_setHeadersMESSAGE
/**
*
* @desc setting of general and basic Notify header fields
* in additon to the addresses (To, From, ReqUri)
* @param p_cSeq_s
*/
function f_setHeadersNOTIFY(inout CSeq p_cSeq_s) runs on SipComponent
{
f_setHeadersGeneral(p_cSeq_s, "NOTIFY"); // cseq, contact, branch, via
vc_cancel_To := vc_to;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
/**
*
* @desc setting of general and basic Publish header fields
* in additon to the addresses (To, From, ReqUri)
* @param p_cSeq_s
*/
function f_setHeadersPUBLISH(inout CSeq p_cSeq_s) runs on SipComponent
{
f_setHeadersGeneral(p_cSeq_s, "PUBLISH"); // cseq, contact, branch, via
//after SUBSCRIBE message callid shall be same
//vc_callId := { fieldName:=CALL_ID_E, callid:=f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr };
vc_cancel_To := vc_to;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
}// end function f_setHeadersPUBLISH
/**
*
* @desc function sets header field for the next outgoing SUBSCRIBE message
* @param p_cSeq_s CSeq parameter to be applied
*/
function f_setHeaders_SUBSCRIBE(inout CSeq p_cSeq_s) runs on SipComponent
{
var SemicolonParam_List v_params;
f_setHeadersGeneral(p_cSeq_s, "SUBSCRIBE"); // cseq, contact, branch, via
vc_requestUri:=valueof(m_SipUrl_currDomain(vc_userprofile));
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
vc_callId := {
fieldName := CALL_ID_E,
callid := f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr
}
vc_to := valueof(m_To(m_SipUrl_currDomain(vc_userprofile)));
vc_cancel_To := vc_to;
v_params := {{id := c_tagId, paramValue := f_getRndTag()}};
vc_from := {
fieldName := FROM_E,
addressField := vc_to.addressField,
fromParams := v_params
}// end function setHeaders_SUBSCRIBE
/**
*
* @desc setting of general and basic Subscribe header fields
* in additon to the addresses (To, From, ReqUri)
* @param p_cSeq_s
*/
function f_setHeadersSUBSCRIBE(inout CSeq p_cSeq_s) runs on SipComponent
{
f_setHeadersGeneral(p_cSeq_s, "SUBSCRIBE"); // cseq, contact, branch, via
vc_callId := { fieldName:=CALL_ID_E, callid:=f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr };
vc_cancel_To := vc_to;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
/**
*
* @desc setting of general and basic REFER header fields
* in additon to the addresses (To, From, ReqUri)
* @param p_cSeq_s
*/
function f_setHeadersREFER(inout CSeq p_cSeq_s) runs on SipComponent
{
f_setHeadersGeneral(p_cSeq_s, "REFER"); // cseq, contact, branch, via
//vc_callId := { fieldName:=CALL_ID_E, callid:=f_getRndCallId(p_cSeq_s) & c_AT & vc_userprofile.currIpaddr };
vc_cancel_To := vc_to;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
vc_reqHostPort := vc_requestUri.components.sip.hostPort;
}// end function f_setHeadersREFER
*
* @desc This function reads all necessary headers from the received REGISTER message and generate the tag for the answer
* @param p_Request REGISTER that has been received
*/
function f_setHeadersOnReceiptOfREGISTER(Request p_Request)
runs on SipComponent {
f_setHeadersOnReceiptOfRequest(p_Request);
vc_callId := p_Request.msgHeader.callId;
vc_caller_From := vc_from;
f_addTagInTo(vc_to);
vc_caller_To := vc_to;
vc_requestUri := p_Request.requestLine.requestUri;
vc_cancel_To := p_Request.msgHeader.toField;
if (ispresent(p_Request.msgHeader.contact) and (not ischosen(p_Request.msgHeader.contact.contactBody.wildcard))) {
vc_reqHostPort := f_getContactAddr(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
}
// update callee information and pick up tag if the call need to be canceled
vc_callee_To := {fieldName := TO_E,
addressField := vc_caller_From.addressField,
toParams := vc_caller_From.fromParams};
vc_callee_From := {fieldName := FROM_E,
addressField := vc_caller_To.addressField,
fromParams := vc_caller_To.toParams};
if (ispresent(p_Request.msgHeader.authorization)) {
vc_authorization := p_Request.msgHeader.authorization;
};
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
} // end f_setHeadersOnReceiptOfREGISTER
/**
*
* @desc This function reads all necessary headers from the received SUBSCRIBE message and generate the tag for the answer
* @param p_Request SUBSCRIBE that has been received
*/
function f_setHeadersOnReceiptOfSUBSCRIBE(Request p_Request)
runs on SipComponent {
f_setHeadersOnReceiptOfRequest(p_Request);
vc_callId := p_Request.msgHeader.callId;
vc_caller_From := vc_from;
f_addTagInTo(vc_to);
vc_caller_To := vc_to;
vc_requestUri := p_Request.requestLine.requestUri;
vc_cancel_To := p_Request.msgHeader.toField;
if (ispresent(p_Request.msgHeader.contact)) {
vc_reqHostPort := f_getContactAddr(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
}
// update callee information and pick up tag if the call need to be canceled
vc_callee_To := {fieldName := TO_E,
addressField := vc_caller_From.addressField,
toParams := vc_caller_From.fromParams};
vc_callee_From := {fieldName := FROM_E,
addressField := vc_caller_To.addressField,
fromParams := vc_caller_To.toParams};
} // end f_setHeadersOnReceiptOfSUBSCRIBE
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
function f_setHeadersOnReceiptOfREFER(Request p_Request)
runs on SipComponent {
f_setHeadersOnReceiptOfRequest(p_Request);
vc_requestUri := p_Request.requestLine.requestUri;
vc_cancel_To := p_Request.msgHeader.toField;
if (ispresent(p_Request.msgHeader.contact)) {
vc_reqHostPort := f_getContactAddr(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
vc_requestUri := f_getContactUri(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
}
// update callee information and pick up tag if the call need to be canceled
vc_callee_To := {fieldName := TO_E,
addressField := vc_caller_From.addressField,
toParams := vc_caller_From.fromParams};
vc_callee_From := {fieldName := FROM_E,
addressField := vc_caller_To.addressField,
fromParams := vc_caller_To.toParams};
} // end f_setHeadersOnReceiptOfSUBSCRIBE
* @desc function reads all necessary headers from
* the received INVITE message and generate the tag for the answer
* @param p_Request received INVITE message
* @verdict
*/
function f_setHeadersOnReceiptOfINVITE(Request p_Request) runs on SipComponent {
f_setHeadersOnReceiptOfRequest(p_Request);
vc_callId := p_Request.msgHeader.callId;
vc_cancel_To := p_Request.msgHeader.toField;
f_addTagInTo(vc_to);
vc_caller_From := vc_from;
vc_caller_To := vc_to;
if (ispresent(p_Request.msgHeader.contact)) {
vc_reqHostPort :=
f_getContactAddr(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
vc_requestUri := f_getContactUri(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
};
// update callee information and pick up tag if the call need to be canceled
vc_callee_To := {fieldName := TO_E,
addressField := vc_caller_From.addressField,
toParams := vc_caller_From.fromParams};
vc_callee_From := {fieldName := FROM_E,
addressField := vc_caller_To.addressField,
fromParams := vc_caller_To.toParams};
if (ispresent(p_Request.msgHeader.privacy)) {
vc_privacy := p_Request.msgHeader.privacy;
};
if (ispresent(p_Request.messageBody)) {
//cleaning of attributes before assignment
if (ispresent(vc_sdp_remote.media_list))
{
var integer v_length := sizeof(vc_sdp_remote.media_list);
for (var integer i:=0; i<v_length; i:=i+1)
{
if (ispresent(vc_sdp_remote.media_list[i].attributes))
{
}
// save SDP if present
if ( ischosen(p_Request.messageBody.sdpMessageBody))
{
vc_sdp_remote := p_Request.messageBody.sdpMessageBody;
vc_sdp_remote_is_valid := true;
f_prepare_SDP_answer();
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
};
// save XML if present
if ( ischosen(p_Request.messageBody.xmlBody))
{
vc_xml_remote := p_Request.messageBody.xmlBody;
}
if ( ischosen(p_Request.messageBody.mimeMessageBody))
{
for (var integer j:=0; j<sizeof(p_Request.messageBody.mimeMessageBody.mimeEncapsulatedList); j:=j+1){
if (match(p_Request.messageBody.mimeMessageBody.mimeEncapsulatedList[j].content_type,c_sdpAplication))
{
vc_sdp_remote := p_Request.messageBody.mimeMessageBody.mimeEncapsulatedList[j].mime_encapsulated_part.sdpMessageBody;
vc_sdp_remote_is_valid := true;
f_prepare_SDP_answer();
};
if (match(p_Request.messageBody.mimeMessageBody.mimeEncapsulatedList[j].content_type,c_xmlAplication))
{
vc_xml_remote := p_Request.messageBody.mimeMessageBody.mimeEncapsulatedList[j].mime_encapsulated_part.xmlBody;
};
}
}
};
if (ispresent(p_Request.msgHeader.supported.optionsTags)) {
for (var integer i := sizeof(p_Request.msgHeader.supported.optionsTags); i>0; i:=i-1)
{
if (p_Request.msgHeader.supported.optionsTags[i-1]=="100rel")
{ vc_supported_100rel := true };
if (p_Request.msgHeader.supported.optionsTags[i-1]=="precondition")
{ vc_supported_precondition := true }
}
};
} // end f_setHeadersOnReceiptOfINVITE
/**
*
* @desc function reads header field of a received BYE message
* @param p_Request received BYE
*/
function f_setHeadersOnReceiptOfBYE(Request p_BYE_Request)
runs on SipComponent
{
f_setHeadersOnReceiptOfRequest(p_BYE_Request);
vc_callId := p_BYE_Request.msgHeader.callId;
} // end f_setHeadersOnReceiptOfBYE
/**
*
* @desc function reads header field from an incoming Request message
* @param p_Request received Request message
*/
function f_setHeadersOnReceiptOfRequest(Request p_Request) runs on SipComponent {
vc_request := p_Request;
vc_callId := p_Request.msgHeader.callId;
vc_cSeq := p_Request.msgHeader.cSeq;
vc_iut_CSeq := p_Request.msgHeader.cSeq;
vc_from := p_Request.msgHeader.fromField;
vc_caller_From := p_Request.msgHeader.fromField;
vc_to := p_Request.msgHeader.toField;
vc_caller_To := p_Request.msgHeader.toField;
vc_via := p_Request.msgHeader.via;
// update sent_label according to received via header field
f_getViaReplyAddr(vc_via.viaBody, vc_sent_label);
// Catch route
vc_boo_recordRoute:=false;
//add tag field into To header if tag is not present
if (not(ispresent(p_Request.msgHeader.toField.toParams)))
{
vc_to.toParams := {{id := c_tagId, paramValue := f_getRndTag()}};
vc_caller_To := vc_to;
}
if (ispresent(p_Request.msgHeader.recordRoute))
{
vc_boo_recordRoute:=true;
vc_recordRoute := p_Request.msgHeader.recordRoute;
}
} // end f_setHeadersOnReceiptOfRequest
/**
*
* @desc functions reads header fields from an incoming Response message
* @param p_cSeq
* @param p_response received response message
* @verdict
*/
function f_setHeadersOnReceiptOfResponse(inout CSeq p_cSeq, Response p_response) runs on SipComponent
{
var integer v_i, v_j, v_nbroute;
var Contact v_contact; //only for local purpose
vc_response := p_response;
//vc_cSeq := p_cSeq; //must not save global c_seq because it can overwrite temporary cSeq
vc_to :=p_response.msgHeader.toField;
vc_from :=p_response.msgHeader.fromField;
vc_caller_To := vc_to;
vc_caller_From := vc_from;
if (ispresent(p_response.msgHeader.contact))
{
v_contact := p_response.msgHeader.contact;
if (ischosen(v_contact.contactBody.contactAddresses))
{
vc_reqHostPort := f_getContactAddr(v_contact.contactBody.contactAddresses[0]);
vc_requestUri := f_getContactUri(v_contact.contactBody.contactAddresses[0]);
}
}
else
{
if (ischosen(vc_to.addressField.nameAddr))
{
vc_reqHostPort := vc_to.addressField.nameAddr.addrSpec.components.sip.hostPort;
vc_reqHostPort := vc_to.addressField.addrSpecUnion.components.sip.hostPort;
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
vc_callee_To:={fieldName := TO_E,
addressField := vc_caller_From.addressField,
toParams := vc_caller_From.fromParams};
vc_callee_From:= {fieldName := FROM_E,
addressField := vc_caller_To.addressField,
fromParams := vc_caller_To.toParams};
vc_via:= p_response.msgHeader.via;
// Route Management
if (ispresent(p_response.msgHeader.recordRoute))
{
vc_recordRoute := p_response.msgHeader.recordRoute;
v_nbroute := sizeof(vc_recordRoute.routeBody);
// copy and reverse the order of the routes in route header
for (v_i:=0; v_i<=(v_nbroute - 1); v_i:=v_i+1)
{
v_j:= v_nbroute - 1 - v_i;
vc_route.routeBody[v_j]:=vc_recordRoute.routeBody[v_i];
}
vc_route.fieldName := ROUTE_E;
vc_boo_recordRoute := true;
vc_boo_route := true;
}
else
{
vc_boo_recordRoute := false;
vc_boo_route := false;
};
// extentions due to new fields in PRACK and UPDATE messages
if (ispresent(p_response.msgHeader.rSeq)) {
vc_rAck :=
{ fieldName := RACK_E,
responseNum := valueof(p_response.msgHeader.rSeq.responseNum),
seqNumber := valueof(p_response.msgHeader.cSeq.seqNumber),
method := valueof(p_response.msgHeader.cSeq.method)
};
};
// extentions due to new HistoryInfo fields 180 or 200OK messages
if (ispresent(p_response.msgHeader.historyInfo)) {
vc_historyInfoList := valueof(p_response.msgHeader.historyInfo.historyInfoList);
vc_history_is_valid := true
}
else {vc_history_is_valid := false};
//sdpMessageBody answer
if (ispresent(p_response.messageBody)) {
if ( ischosen(p_response.messageBody.sdpMessageBody))
{
vc_sdp_remote := p_response.messageBody.sdpMessageBody;
vc_sdp_remote_is_valid := true;
}
if ( ischosen(p_response.messageBody.xmlBody))
{
vc_xml_remote := p_response.messageBody.xmlBody;
}
if ( ischosen(p_response.messageBody.mimeMessageBody))
{
for (var integer j:=0; j<sizeof(p_response.messageBody.mimeMessageBody.mimeEncapsulatedList); j:=j+1){
if (match(p_response.messageBody.mimeMessageBody.mimeEncapsulatedList[j].content_type,c_sdpAplication))
{
vc_sdp_remote := p_response.messageBody.mimeMessageBody.mimeEncapsulatedList[j].mime_encapsulated_part.sdpMessageBody;
};
if (match(p_response.messageBody.mimeMessageBody.mimeEncapsulatedList[j].content_type,c_xmlAplication))
{
vc_xml_remote := p_response.messageBody.mimeMessageBody.mimeEncapsulatedList[j].mime_encapsulated_part.xmlBody;
};
}
}
};
}// end function f_setHeadersOnReceiptOfResponse
/**
*
* @desc functions reads ServiceRoute header field from an incoming 200 Response message in registration
* @param p_cSeq
* @param p_response received response message
*/
function f_getServiceRouteMapIntoRouteInRegistration(inout CSeq p_cSeq, Response p_response) runs on SipComponent
{
var integer v_i, v_j, v_nbroute;
var ServiceRoute v_serviceRoute;
// Route Management
if (ispresent(p_response.msgHeader.serviceRoute))
{
v_serviceRoute := p_response.msgHeader.serviceRoute;
v_nbroute := sizeof(v_serviceRoute.routeBody);
// copy and reverse the order of the routes in route header
for (v_i:=0; v_i<=(v_nbroute - 1); v_i:=v_i+1)
{
v_j:= v_nbroute - 1 - v_i;
vc_route.routeBody[v_j]:=v_serviceRoute.routeBody[v_i];
}
vc_route.fieldName := ROUTE_E;
vc_route_REG := vc_route;
vc_boo_route := true;
}
}// end function f_getServiceRouteMapIntoRouteInRegistration
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
/**
*
* @desc functions reads Route header field from an incoming Request message and generate RecordRoute
* @param p_cSeq
* @param p_request received request message
*/
function f_getRouteMapIntoRecordRoute(inout CSeq p_cSeq, Request p_request) runs on SipComponent
{
var integer v_i, v_j, v_nbroute;
var Route v_route;
// Route Management
if (ispresent(p_request.msgHeader.route))
{
v_route := p_request.msgHeader.route;
v_nbroute := sizeof(v_route.routeBody);
// copy and reverse the order of the routes in route header
for (v_i:=0; v_i<=(v_nbroute - 1); v_i:=v_i+1)
{
v_j:= v_nbroute - 1 - v_i;
vc_recordRoute.routeBody[v_j]:=v_route.routeBody[v_i];
}
vc_boo_recordRoute := true;
}
}// end function f_getRouteMapIntoRecordRoute
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
} // end group SetHeaders
} // end group FieldOperations
group SDPOperations{
/**
* @desc check if message body include SDP attribute (2nd parameter)
* for any media
*
*/
function f_check_attribute(in SDP_Message p_sdp, in template SDP_attribute p_attribute) runs on SipComponent return boolean {
if (ispresent(p_sdp.media_list)) {
for (var integer j:=0; j<sizeof(p_sdp.media_list); j:=j+1){
if (ispresent(p_sdp.media_list[j].attributes)) {
for (var integer i:=0; i<sizeof(p_sdp.media_list[j].attributes); i:=i+1){
if (match(p_sdp.media_list[j].attributes[i],p_attribute))
{return(true);};
};
}
};
}
if (ispresent(p_sdp.attributes)) {
for (var integer j:=0; j<sizeof(p_sdp.attributes); j:=j+1){
if (match(p_sdp.attributes[j],p_attribute)) {return(true);};
};
}
return(false);
}
/**
* @desc check if message body include SDP (session level) attribute (2nd parameter)
* for any media
*
*/
function f_check_session_attribute(in SDP_Message p_sdp, in template SDP_attribute p_attribute) runs on SipComponent return boolean {
if (ispresent(p_sdp.attributes)) {
for (var integer j:=0; j<sizeof(p_sdp.attributes); j:=j+1){
if (match(p_sdp.attributes[j],p_attribute)) {return(true);};
};
}
return(false);
}
*
* @desc identify an SDP direction attribute (session or first media attribute) in a SDP message and return its answer value
* @param p_sdp the SDP message that has been received
* @param p_attribute incoming SDP attribute that need to be used for the SDP direction (answer)
* @return the new attribute (to be send out) derived from the incoming SDP value
function f_get_attribute_answer(in SDP_Message p_sdp, in template SDP_attribute p_attribute) runs on SipComponent return SDP_attribute {
var template SDP_attribute v_attribute := p_attribute;
// check if the selected attribute is included in the SDP offer (session attributes)
if (ispresent(p_sdp.attributes)) {
for (var integer j:=0; j<sizeof(p_sdp.attributes); j:=j+1){
if (match(p_sdp.attributes[j],p_attribute)) {v_attribute := p_sdp.attributes[j];};
};
}
// check if the selected attribute is included in the SDP offer (any of the media attributes)
else {if (ispresent(p_sdp.media_list)) {
for (var integer j:=0; j<sizeof(p_sdp.media_list); j:=j+1){
if (ispresent(p_sdp.media_list[j].attributes)) {
for (var integer i:=0; i<sizeof(p_sdp.media_list[j].attributes); i:=i+1){
if (match(p_sdp.media_list[j].attributes[i],p_attribute))
{v_attribute := p_sdp.media_list[j].attributes[i];};
};
}
};
{
case (mw_attribute_sendonly) {return(valueof(m_attribute_recvonly));}
case (mw_attribute_sendrecv) {return(valueof(m_attribute_sendrecv));}//MRO
case (mw_attribute_inactive) {return(valueof(m_attribute_inactive));}//MRO
case (mw_attribute_recvonly) {return(valueof(m_attribute_sendonly));}//MRO
}
return(valueof(m_attribute_sendrecv));//the default return value in case of missing attribute offer
}
/**
* @desc check if message body include SDP bandwidth (2nd parameter)
* either for the session or a media description
*/
function f_check_bandwidth(in SDP_Message loc_sdp, in template SDP_bandwidth loc_bandw) runs on SipComponent return boolean {
if (ispresent(loc_sdp.bandwidth)) {
for (var integer j:=0; j<sizeof(loc_sdp.bandwidth); j:=j+1){
if (match(loc_sdp.bandwidth[j],loc_bandw)) {return(true);};
};
};
if (ispresent(loc_sdp.media_list)) {
for (var integer j:=0; j<sizeof(loc_sdp.media_list); j:=j+1){
if (ispresent(loc_sdp.media_list[j].bandwidth)) {
for(var integer i:=0; i< sizeof(loc_sdp.media_list[j].bandwidth); i:=i+1) {
if (match(loc_sdp.media_list[j].bandwidth[i],loc_bandw)) {
return(true);};
}
}
};
};
return(false);
}
/**
* @desc check if message body include SDP media (2nd parameter)
*
*/
function f_check_media(in SDP_Message loc_sdp, in template SDP_media_desc loc_media) runs on SipComponent return boolean {
if (ispresent(loc_sdp.media_list)) {
for (var integer j:=0; j<sizeof(loc_sdp.media_list); j:=j+1){
if (match(loc_sdp.media_list[j].media_field.transport,loc_media.media_field.transport) and
match(loc_sdp.media_list[j].media_field.fmts,loc_media.media_field.fmts))
{return(true);};
};
}
return(false);
}
/**
* @desc
* check if message body include precondition mechanism (a=des and
* a=curr) retrun true, else false
* @param loc_sdp SDP message
*/
function f_check_precondition(in SDP_Message loc_sdp) runs on SipComponent return boolean {
if (f_check_attribute(loc_sdp, mw_attribute_des) or
f_check_attribute(loc_sdp, mw_attribute_curr))
{return(true);}
return(false);
}
/**
* @desc check if message body include SDP media direction return true, else false