Newer
Older
template Msg_summary_line mw_msgSummaryLine(template charstring p_msgContexClass) :=
{
msg_context_class := p_msgContexClass,
msgs := ?,
urgent_msgs :=*
}
} //end group Templates_SMS
group MessageBodies {
template MessageBody m_MBody_SDP(template SDP_Message p_SDP):=
{
sdpMessageBody := p_SDP
};
template MessageBody m_MBody_XML(template XmlBody p_xmlBody):=
{
xmlBody := p_xmlBody
};
template MessageBody m_mBody_SMS(template SimpleMsgSummary p_SMS):=
simpleMsgSummary := p_SMS
};
template MessageBody m_MBody_longPlainText:=
{
textplain := c_longMessageContent_1300Bytes
};
template MessageBody m_mBody_plainText(charstring p_plaitext):=
{
textplain := p_plaitext
};
template MessageBody m_MBody_sipfrag(charstring p_sipfrag) := {
sipfrag := p_sipfrag
}
template MessageBody m_MBody_MIMESdpXml(template SDP_Message p_sdp, template XmlBody p_xmlBody):=
{
mimeMessageBody := {boundary:="--boundary1", //"PX_SIP_MIME_Boundary",
mimeEncapsulatedList:= {
{content_type:="application/sdp",//"PX_SIP_SDP_ContentType",
content_disposition:=omit,
mime_encapsulated_part:={sdpMessageBody := p_sdp}},
{content_type:="application/vnd.3gpp.cw+xml",//"PX_SIP_ISUP_ContentType",
content_disposition:=omit,
mime_encapsulated_part:={xmlBody := p_xmlBody}}
}
}
}
template MessageBody m_MBody_MIMESdpEncrypted(template SDP_Message p_sdp):=
{
mimeMessageBody := {boundary:="--boundary1", //"PX_SIP_MIME_Boundary",
mimeEncapsulatedList:= {
{content_type:="application/sdp",//"PX_SIP_SDP_ContentType",
//TODO add "Content-Transfer-Encoding:base64"
content_disposition:="attachment;handling=required;filename=smime.p7", //TODO use PIXIT
mime_encapsulated_part:={sdpMessageBody := p_sdp}}
}
}
}
template MessageBody mw_MBody_SDP(template SDP_Message p_SDP):=
{
sdpMessageBody := p_SDP
};
template MessageBody mw_MBody_XML(template XmlBody p_xmlBody):=
{
xmlBody := p_xmlBody
};
template MessageBody mw_mBody_SMS(template SimpleMsgSummary p_SMS):=
simpleMsgSummary := p_SMS
template MessageBody mw_MBody_MIMESdpXml(template SDP_Message p_sdp, template XmlBody p_xmlBody):=
{
mimeMessageBody := {boundary:=?,
mimeEncapsulatedList:= {
{content_type:=?,
content_disposition:=*,
mime_encapsulated_part:={sdpMessageBody := p_sdp}},
{content_type:=?,
content_disposition:=*,
mime_encapsulated_part:={xmlBody := p_xmlBody}}
}
}
}
template MessageBody mw_MBody_MIME_Ims3gpp(
template charstring p_disposition,
):= {
mimeMessageBody := {boundary:=?,
mimeEncapsulatedList:= {
*,
{
content_type:= c_ims3gppAplication,
content_disposition:= p_disposition,
mime_encapsulated_part :={
xmlBody := {
ims3gpp := p_ims3gpp
}
}
},
*
}
}
}
template MessageBody mw_MBody_MIME_Ims3gppCW(
template charstring p_disposition,
):= {
mimeMessageBody := {boundary:=?,
mimeEncapsulatedList:= {
*,
{
content_type:= c_ims3gppCwApplication,
content_disposition:= p_disposition,
mime_encapsulated_part :={
xmlBody := {
ims3gpp := p_ims3gpp
}
}
},
*
}
}
}
* @desc group TemplatePreparationFunctions contain functions which are used for templates
*/
group TemplatePreparationFunctions {
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
group MessageBody_Calculation{
/**
*
* @desc Calculation of Message Body length
* @param p_mb_par contain message body part
* @return message body length
*/
function f_MessageBodyLength(MessageBody p_mb_par) return integer {
var integer v_result:=0;
if (MB_LENGTH_FROM_ENCVAL){ //by default it is set to true
v_result:= lengthof(encvalue(p_mb_par))/8; // length in bypes, let get length of encoded value
}
else{
// assume SDP_Message ONLY in the message body
if (ischosen(p_mb_par.sdpMessageBody))
{
v_result := f_SDPlength(p_mb_par.sdpMessageBody);
};
// assume XML_Body ONLY in the message body
if (ischosen(p_mb_par.xmlBody))
{
v_result := f_XMLBody_Length(p_mb_par.xmlBody, USE_FX_FOR_XML_LENGTH );
};
// assume simpleMsgSummary_Body ONLY in the message body
if (ischosen(p_mb_par.simpleMsgSummary))
{
v_result := f_simpleMsgSummaryBody_Length(p_mb_par.simpleMsgSummary );
};
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
// assume MIME_Message in the message body
if (ischosen(p_mb_par.mimeMessageBody))
{
v_result := f_MIMElength(p_mb_par.mimeMessageBody);
};
//assume sipfrag in the message body
if (ischosen(p_mb_par.sipfrag))
{
v_result := f_TextPlainLength(p_mb_par); //same function due to same type with textplain
};
//assume textplain in the message body
if (ischosen(p_mb_par.textplain))
{
v_result := f_TextPlainLength(p_mb_par);
};
}
return v_result
}
group SDP_Len_calculation {
*
* @desc Calculation of SDP length
* @param p_mb contain sdp message
* @return sdp_lenght
*/
function f_SDPlength(SDP_Message p_mb) return integer
{
var integer v_result:=2; //* due to empty line beginning of message body
var charstring v_auxstring;
v_result := 2 + c_CRlen + lengthof(int2str(p_mb.protocol_version)); //* "v="
v_auxstring := p_mb.origin.user_name & " " & p_mb.origin.session_id & " " & p_mb.origin.session_version & " " & p_mb.origin.net_type & " " & p_mb.origin.addr_type & " " & p_mb.origin.addr;
v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring); //* "o="
v_result := v_result + 2 + c_CRlen + lengthof(p_mb.session_name); //* "s="
if (ispresent(p_mb.information))
{v_auxstring:=p_mb.information; v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring);}; //* "i= "
if (ispresent(p_mb.uri))
{v_auxstring:=p_mb.uri; v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring);}; //* "u="
if (ispresent(p_mb.emails)) {
for (var integer i:=0; i<sizeof(p_mb.emails); i:=i+1)
{v_result := v_result + 2 + c_CRlen + lengthof(p_mb.emails[i].addr_or_phone); //* "e="
if (ispresent(p_mb.emails[i].disp_name))
{v_auxstring:=p_mb.emails[i].disp_name; v_result := v_result + 1 + lengthof(v_auxstring);};
};
};
if (ispresent(p_mb.phone_numbers)) {
for (var integer i:=0; i<sizeof(p_mb.phone_numbers); i:=i+1)
{v_result := v_result + 2 + c_CRlen + lengthof(p_mb.phone_numbers[i].addr_or_phone); //* "p= "
if (ispresent(p_mb.phone_numbers[i].disp_name))
{v_auxstring:=p_mb.phone_numbers[i].disp_name; v_result := v_result + 1 + lengthof(v_auxstring);};
};
};
if (ispresent(p_mb.connection))
{
var integer v_len_con0 := f_SDPlength_connection(p_mb.connection);
v_result := v_result + v_len_con0;
}; //* "c="
if (ispresent(p_mb.bandwidth))
for (var integer i:=0; i<sizeof(p_mb.bandwidth); i:=i+1) { //* "b= "
v_auxstring:= p_mb.bandwidth[i].modifier & " ";
v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring) +
lengthof(int2str(p_mb.bandwidth[i].bandwidth));
for (var integer i:=0; i<sizeof(p_mb.times); i:=i+1) {
v_auxstring:= p_mb.times[i].time_field.start_time & " " & p_mb.times[i].time_field.stop_time;
v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring);//* "t="
if (ispresent(p_mb.times[i].time_repeat))
{
for (var integer j:=0; j<sizeof(p_mb.times[i].time_repeat); j:=j+1)
v_result := v_result + 2 + c_CRlen + lengthof(int2str(p_mb.times[i].time_repeat[j].repeat_interval.time)); //* "r="
if (ispresent(p_mb.times[i].time_repeat[j].repeat_interval.unit))
{
v_auxstring:=p_mb.times[i].time_repeat[j].repeat_interval.unit;
v_result := v_result + 1 + lengthof(v_auxstring);
};
v_result := v_result + 1 + lengthof(int2str(p_mb.times[i].time_repeat[j].active.time));
if (ispresent(p_mb.times[i].time_repeat[j].active.unit))
{
v_auxstring:=p_mb.times[i].time_repeat[j].active.unit;
v_result := v_result + 1 + lengthof(v_auxstring);
};
for (var integer k:=0; k<sizeof(p_mb.times[i].time_repeat[j].offsets); k:=k+1)
{
v_result := v_result + 1 + lengthof(int2str(p_mb.times[i].time_repeat[j].offsets[k].time));
if (ispresent(p_mb.times[i].time_repeat[j].offsets[k].unit))
{
v_auxstring:=p_mb.times[i].time_repeat[j].offsets[k].unit;
v_result := v_result + 1 + lengthof(v_auxstring);
};
}
}
};
};
if (ispresent(p_mb.timezone_adjustments))
{log("timezone adjustments have not been considered in SDP length calculation yet");
}; //* "z="
if (ispresent(p_mb.key)) {
v_result := v_result + 2 + c_CRlen + lengthof(p_mb.key.method); //* "k= "
if (ispresent(p_mb.key.key))
{v_auxstring:=p_mb.key.key; v_result := v_result + 1 + lengthof(v_auxstring);};
};
if (ispresent(p_mb.attributes)) {
for (var integer i:=0; i<sizeof(p_mb.attributes); i:=i+1){ //* "a= "
var integer v_len_con1 := f_SDPlength_attribute(p_mb.attributes[i]);
v_result := v_result + v_len_con1;
};
}; //* "a="
if (ispresent(p_mb.media_list))
{
for (var integer i:=0; i<sizeof(p_mb.media_list); i:=i+1){ //* "m= "
//* for each media_field
//* log("p_mb.media_list[i] ",p_mb.media_list[i]);
v_result := v_result + 2 + c_CRlen + lengthof(p_mb.media_list[i].media_field.media)
+ 1 + lengthof(int2str(p_mb.media_list[i].media_field.ports.port_number));
if (ispresent(p_mb.media_list[i].media_field.ports.num_of_ports))
{v_result := v_result + 1 + lengthof(int2str(p_mb.media_list[i].media_field.ports.num_of_ports));};
v_result := v_result + 1 + lengthof(p_mb.media_list[i].media_field.transport);
for (var integer j:=0; j<sizeof(p_mb.media_list[i].media_field.fmts); j:=j+1){
v_result := v_result + 1 + lengthof(valueof(p_mb.media_list[i].media_field.fmts[j]));
}
if (ispresent(p_mb.media_list[i].information)) {
v_auxstring:=p_mb.media_list[i].information;
v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring); //* "i= "
};
if (ispresent(p_mb.media_list[i].connections)) {
for (var integer j:=0; j<sizeof(p_mb.media_list[i].connections); j:=j+1){
var integer v_len_con2 := f_SDPlength_connection(p_mb.media_list[i].connections[j]);
v_result := v_result + v_len_con2;
}; //* end for
if (ispresent(p_mb.media_list[i].bandwidth)) { //* "b= "
for (var integer j:=0; j<sizeof(p_mb.media_list[i].bandwidth); j:=j+1){
v_result := v_result + 2 + c_CRlen + lengthof(p_mb.media_list[i].bandwidth[j].modifier)
+ 1 + lengthof(int2str(p_mb.media_list[i].bandwidth[j].bandwidth));
}; //* end for
if (ispresent(p_mb.media_list[i].key)) { //* "k= "
v_result := v_result + 1 + lengthof(p_mb.media_list[i].key.method);
if (ispresent(p_mb.media_list[i].key.key)) {
v_auxstring := p_mb.media_list[i].key.key;
v_result := v_result + 1 + lengthof(v_auxstring);
};
};
if (ispresent(p_mb.media_list[i].attributes)) {
for (var integer j:=0; j<sizeof(p_mb.media_list[i].attributes); j:=j+1){ //* "a= "
var integer v_len_attr := f_SDPlength_attribute(p_mb.media_list[i].attributes[j]);
v_result := v_result + v_len_attr;
} //* end for j
}; //* end for i
}; //* end if media_list
};//* end function f_SDPlength
function f_SDPlength_connection(SDP_connection p_element) return integer //* "c="
{
var integer v_result:=0;
var charstring v_auxstring;
v_result := v_result + 2 + c_CRlen + lengthof(p_element.net_type & " " &
p_element.addr_type & " " &
p_element.conn_addr.addr);
if (ispresent(p_element.conn_addr.ttl) and p_element.conn_addr.ttl>0)
{v_result := v_result + 1 + lengthof(int2str(p_element.conn_addr.ttl));};
if (ispresent(p_element.conn_addr.num_of_addr) and p_element.conn_addr.num_of_addr>0)
{v_result := v_result + 1 + lengthof(int2str(p_element.conn_addr.num_of_addr));};
return v_result
} //* f_SDPlength_connection
function f_SDPlength_attribute(SDP_attribute p_element) return integer //* "a="
{
var integer v_result:=0;
var charstring v_auxstring;
if (ischosen(p_element.cat)) {v_result := v_result + 2 + c_CRlen + lengthof("cat:" & p_element.cat.attr_value)};
if (ischosen(p_element.keywds)) {v_result := v_result + 2 + c_CRlen + lengthof("keywds:" & p_element.keywds.attr_value)};
if (ischosen(p_element.tool)) {v_result := v_result + 2 + c_CRlen + lengthof("tool:" & p_element.tool.attr_value)};
if (ischosen(p_element.ptime)) {v_result := v_result + 2 + c_CRlen + lengthof("ptime:" & p_element.ptime.attr_value)};
if (ischosen(p_element.recvonly)) {v_result := v_result +c_CRlen + lengthof("recvonly")};
if (ischosen(p_element.sendrecv)) {v_result := v_result +c_CRlen + lengthof("sendrecv")};
if (ischosen(p_element.sendonly)) {v_result := v_result +c_CRlen + lengthof("sendonly")};
if (ischosen(p_element.inactive)) {v_result := v_result +c_CRlen + lengthof("inactive")};
if (ischosen(p_element.orient)) {v_result := v_result + 2 + c_CRlen + lengthof("orient:" & p_element.orient.attr_value)};
if (ischosen(p_element.sdp_type)) {v_result := v_result + 2 + c_CRlen + lengthof("type:" & p_element.sdp_type.attr_value)};
if (ischosen(p_element.charset)) {v_result := v_result + 2 + c_CRlen + lengthof("charset" & p_element.charset.attr_value)};
if (ischosen(p_element.sdplang)) {v_result := v_result + 2 + c_CRlen + lengthof("sdplang:" & p_element.sdplang.attr_value)};
if (ischosen(p_element.lang)) {v_result := v_result + 2 + c_CRlen + lengthof("lang:" & p_element.lang.attr_value)};
if (ischosen(p_element.framerate)) {v_result := v_result + 2 + c_CRlen + lengthof("framerate:" & p_element.framerate.attr_value)};
if (ischosen(p_element.quality)) {v_result := v_result + 2 + c_CRlen + lengthof("quality:" & p_element.quality.attr_value)};
if (ischosen(p_element.fmtp)) {v_result := v_result + 2 + c_CRlen + lengthof("fmtp:" & p_element.fmtp.attr_value)};
if (ischosen(p_element.curr)) {v_result := v_result + 2 + c_CRlen + lengthof("curr:" & p_element.curr.preconditionType & " "
& p_element.curr.statusType & " " & p_element.curr.direction)};
if (ischosen(p_element.des)) {v_result := v_result + 2 + c_CRlen + lengthof("des:" & p_element.des.preconditionType & " "
& p_element.des.strength & " " & p_element.des.statusType & " " & p_element.des.direction)};
if (ischosen(p_element.conf)) {v_result := v_result + 2 + c_CRlen + lengthof("conf:" & p_element.conf.preconditionType & " "
& p_element.des.statusType & " " & p_element.des.direction)};
if (ischosen(p_element.rtpmap)) {v_result := v_result + 2 + c_CRlen + lengthof("rtpmap:" & p_element.rtpmap.attr_value)};
if (ischosen(p_element.rtcp)) {v_result := v_result + 2 + c_CRlen + lengthof("rtcp:" & p_element.rtcp.attr_value)};
if (ischosen(p_element.unknown))
{v_result := v_result + 2 + c_CRlen + lengthof(p_element.unknown.name);
if (ispresent(p_element.unknown.attr_value))
{var charstring aux := p_element.unknown.attr_value;
v_result := v_result + lengthof(":" & p_element.unknown.attr_value);
};
};
//* log("axr: length attribute=", v_result);
} //* f_SDPlength_attribute
} //* group SDPlen_calculation
group XML_Len_calculation{
/**
* @desc Declaration of external functions to calculate length of message bodies
* switching of internal or external functions are made by boolean module parameter/PIXIT
* USE_FX_FOR_XML_LENGTH declared at top of this module
*/
external function fx_calculateXMLBodyLen(XmlBody p_mb) return integer;
/**
*
* @desc Calculation of XML body length
* @param p_mb contain XML body
* @return xml_length
*/
function f_XMLBody_Length(XmlBody p_mb, boolean p_ext_func) return integer
{
var integer v_result:=0;
if ( p_ext_func){
v_result := fx_calculateXMLBodyLen(p_mb);
}else{
// assume ConferenceInfo ONLY in the XML message body
bergengruen
committed
if (ischosen(p_mb.conference))
bergengruen
committed
v_result := f_XMLBody_ConferenceInfo_Length(p_mb.conference);
};
// assume CUG ONLY in the XML message body
if (ischosen(p_mb.cug))
{
v_result := f_XMLBody_Cug_Length(p_mb.cug);
};
// assume MCID ONLY in the XML message body
if (ischosen(p_mb.mcid))
{
v_result := f_XMLBody_Mcid_Length(p_mb.mcid);
};
// assume CW ONLY in the XML message body
if (ischosen(p_mb.cw))
{
v_result := f_XMLBody_Cw_Length(p_mb.cw);
};
// assume CDIV ONLY in the XML message body
if (ischosen(p_mb.cdivn))
{
v_result := f_XMLBody_Cdivn_Length(p_mb.cdivn);
};
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
// assume PSTNTransit ONLY in the XML message body
if (ischosen(p_mb.pstnTransit))
{
v_result := f_XMLBody_PSTNTransit_Length(p_mb.pstnTransit);
};
// assume Simservs ONLY in the XML message body
if (ischosen(p_mb.simservs))
{
v_result := f_XMLBody_Simservs_Length(p_mb.simservs);
};
// assume ResourceLists ONLY in the XML message body
if (ischosen(p_mb.resourceLists))
{
v_result := f_XMLBody_ResourceList_Length(p_mb.resourceLists);
};
// assume Ims3GPP ONLY in the XML message body
if (ischosen(p_mb.ims3gpp))
{
v_result := f_XMLBody_Ims3GPP_Length(p_mb.ims3gpp);
};
/** Add aditional checks regarding to new variants,
* also implement appropriate function for calculation
*/
}
return v_result
} //* f_XMLBodyLength
group XMLBodies_calculation{
/**
*
* @desc Calculation of XML ConferenceInfo element length
* @param p_mb contain XML ConfInfo body
* @return xml_length
*/
function f_XMLBody_ConferenceInfo_Length(Conference_type p_mb) return integer
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_ConferenceInfo_Length
/**
*
* @desc Calculation of XML CUG element length
* @param p_mb contain XML CUG body
* @return xml_length
*/
function f_XMLBody_Cug_Length(Cug p_mb) return integer
{
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_Cug_Length
/**
*
* @desc Calculation of XML MCID element length
* @param p_mb contain XML MCID body
* @return xml_length
*/
function f_XMLBody_Mcid_Length(Mcid p_mb) return integer
{
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_Mcid_Length
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
/**
*
* @desc Calculation of XML CW element length
* @param p_mb contain XML CW body
* @return xml_length
*/
function f_XMLBody_Cw_Length(Ims_cw p_mb) return integer
{
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_Cw_Length
/**
*
* @desc Calculation of XML CDIVN element length
* @param p_mb contain XML CDIVN body
* @return xml_length
*/
function f_XMLBody_Cdivn_Length(Comm_div_info_type p_mb) return integer
{
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_Cdivn_Length
/**
*
* @desc Calculation of XML PSTNTransit element length
* @param p_mb contain XML PSTNTransit body
* @return xml_length
*/
function f_XMLBody_PSTNTransit_Length(PSTN_transit p_mb) return integer
{
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_PSTNTransit_Length
/** @desc Calculation of XML Simservs element length
* @param p_mb contain XML Simservs body
* @return xml_length
*/
function f_XMLBody_Simservs_Length(Simservs p_mb) return integer
{
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_Simservs_Length
/** @desc Calculation of XML ResourceList length
* @param p_mb contain XML ResourceList body
* @return xml_length
*/
function f_XMLBody_ResourceList_Length(Resource_lists p_mb) return integer
{
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_ResourceList_Length
/** @desc Calculation of XML Ims3GPP length
* @param p_mb contain XML Ims3GPP body
* @return xml_length
*/
function f_XMLBody_Ims3GPP_Length(TIMS3GPP p_mb) return integer
var integer v_result:= lengthof(encvalue(p_mb))/8;
return v_result
} //* f_XMLBody_Ims3GPP_Length
} //* XMLBodies_calculation
}//* group XMLlen_calculation
group simpleMsgSummaryBody_Length{
function f_simpleMsgSummaryBody_Length(SimpleMsgSummary p_mb) return integer
{
var integer v_result:=2; //* due to empty line beginning of message body
var charstring v_auxstring;
v_result := 2+lengthof(p_mb.msg_status_line.msg_type) + 2 + lengthof(p_mb.msg_status_line.msg_status)+c_CRlen; //* "Message-Waiting: yes"
if (ispresent(p_mb.msg_account)) //* "Message-Account"
{v_result := v_result + 2 + lengthof(p_mb.msg_account.msg_type_account)+2+lengthof(p_mb.msg_account.account_URI)+c_CRlen;};
if (ispresent(p_mb.msg_summary_line_list)) {
for (var integer i:=0; i<sizeof(p_mb.msg_summary_line_list); i:=i+1)
{v_result := v_result + 2 + c_CRlen + lengthof(p_mb.msg_summary_line_list[i].msg_context_class)+2+lengthof(p_mb.msg_summary_line_list[i].msgs);
if (ispresent(p_mb.msg_summary_line_list[i].urgent_msgs))
{v_auxstring:=p_mb.msg_summary_line_list[i].urgent_msgs; v_result := v_result + 1 + lengthof(v_auxstring);};
};
};
if (ispresent(p_mb.opt_msg_headers)) {
for (var integer i:=0; i<sizeof(p_mb.opt_msg_headers); i:=i+1)
{v_result := v_result + 2 + c_CRlen + lengthof(p_mb.opt_msg_headers[i]);
};
};
return v_result
}
}
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
group MIME_Len_calculation{
/**
*
* @desc Calculation of MIME length
* @param p_mb contain MIME message
* @return xml_length
*/
function f_MIMElength(MIME_Message p_mb) return integer
{
var integer v_result:=2; //0d0a
v_result := v_result + lengthof(p_mb.boundary) + 2/*0d0a*/;
for (var integer i:=0; i<sizeof(p_mb.mimeEncapsulatedList); i:=i+1){
v_result := v_result + lengthof("Content-Type: ")+ lengthof(p_mb.mimeEncapsulatedList[i].content_type) + 2/*0d0a*/ ;
if (ispresent(p_mb.mimeEncapsulatedList[i].content_disposition)){
v_result := v_result + lengthof("Content-Disposition: ")+ lengthof(p_mb.mimeEncapsulatedList[i].content_disposition) + 2/*0d0a*/ ;
}
//v_result := v_result +2/*0d0a*/; ??? to check
// assume SDP_Message ONLY in the message body
if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.sdpMessageBody))
{
v_result := v_result + f_SDPlength(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.sdpMessageBody);
};
// assume XML_Body ONLY in the message body
if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlBody))
{
v_result := v_result + f_XMLBody_Length(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlBody, USE_FX_FOR_XML_LENGTH );
};
// //assume XML_Message ONLY in the message body
// if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlMessage))
// {
// v_result := v_result + f_XMLlength(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlMessage, USE_FX_FOR_XML_LENGTH );
// };
//v_result := v_result +2/*0d0a*/; ??? to check
}
//v_result := v_result +2/*0d0a*/; ??? to check
return v_result
} //* f_MIMElength
}//* group MIMElen_calculation
group TextPlain_Len_calculation{
/**
*
* @desc Calculation of messagebody-textplain type length
* @param p_mb contain textplain message
* @return lenght
*/
function f_TextPlainLength(MessageBody p_mb) return integer
{
v_result:=v_result+lengthof(p_mb.textplain);
return v_result;
}//* end function f_TextPlainLength
}//*end group TextPlainLen_calculation
}//*group MessageBody_Calculation
group GiveHeaders {
/**
*
* @desc Return component variable of recordRoute header if vc_boo_recordRoute is true
* @return component variable of recordRoute header
*/
function f_recordroute() runs on SipComponent return template RecordRoute
{
template RecordRoute v_recordRoute := omit;
if (vc_boo_recordRoute)
{return vc_recordRoute}
else {return(v_recordRoute)} //* TODO: RecordRoute is not OPTIONAL!!! Check IT!
}
/**
*
* @desc Return component variable of Route header if vc_boo_route is true
* @return component variable of recordRoute header
*/
function f_route() runs on SipComponent return template Route
template Route v_route := omit;
if (vc_boo_route)
{return vc_route} //* TODO: Route header need to be in reverse order than RecordRoute, question of return value - RecordRoute
else {return(v_route)} //* TODO: Route is not OPTIONAL!!! Check IT!
} //* end group GiveHeaders
group others {
/*
*
* @desc function combines two comma parameter lists
* @param p_list1 first list
* @param p_list2 second list
* @return comma parameter list that contains parameters from both input lists
* @verdict
*/
function f_merge_CommaParam_List(CommaParam_List p_list1, CommaParam_List p_list2) return template CommaParam_List
{ var template CommaParam_List p_result;
var integer limit1 := sizeof(p_list1);
for (var integer i:=0; i<limit1; i:=i+1) {
p_result[i] := p_list1[i]
};
for (var integer i:=0; i<sizeof(p_list2); i:=i+1) {
p_result[i+limit1] := p_list2[i]
};
return p_result
}
} //* end group others
} //* group TemplatePreparationFunctions
} //* end module LibSip_Templates