Newer
Older
} //* end group response_receive
} //* end group modified_templates
} //* end group MessageTemplates
group SDP_Templates {
group SDP_Messages {
group base_templates {
template SDP_Message m_SDP(SDP_media_desc p_media, in SipUserProfile p_userprofile) := {
protocol_version := 0, //* v=0
origin := {
user_name := "voicesession",
session_id := "30000",
session_version := "0",
net_type := c_in,
addr_type := c_ip4,
addr := p_userprofile.contactIpaddr },
//* o=voicesession 12345 12345 IN IP4 172.27.1.219
session_name := "Voice Session", //* s=Voice Session
information := omit,
uri := omit,
emails := omit,
phone_numbers := omit,
connection := {
net_type := c_in,
addr_type := c_ip4,
conn_addr := { addr:= p_userprofile.bearerIpaddr, ttl:=omit, num_of_addr:=omit }
}, //* c=IN IP4 172.27.1.219
bandwidth := omit,
times := { { time_field := { "0", "0" }, time_repeat:=omit
}
}, //* t=0 0
timezone_adjustments := omit,
key := omit,
attributes := omit,
media_list := {p_media}
};
template SDP_Message m_SDP_mediaList(SDP_media_desc_list p_media_list, in SipUserProfile p_userprofile)
:= {
protocol_version := 0, //* v=0
origin := {
user_name := "voicesession",
session_id := "30000",
session_version := "0",
net_type := c_in,
addr_type := c_ip4,
addr := p_userprofile.contactIpaddr },
//* o=voicesession 12345 12345 IN IP4 172.27.1.219
session_name := "Voice Session", //* s=Voice Session
information := omit,
uri := omit,
emails := omit,
phone_numbers := omit,
connection := {
net_type := c_in,
addr_type := c_ip4,
conn_addr := { addr:= p_userprofile.bearerIpaddr, ttl:=omit, num_of_addr:=omit }
}, //* c=IN IP4 172.27.1.219
bandwidth := omit,
times := { { time_field := { "0", "0" }, time_repeat:=omit
}
}, //* t=0 0
timezone_adjustments := omit,
key := omit,
attributes := omit,
media_list := p_media_list
};
template SDP_Message m_SDP_media_attr_preconditions(SDP_media_desc p_media, in SipUserProfile p_userprofile, SDP_attribute_list p_attribute_list)
modifies m_SDP
:= {
media_list := {
{
media_field := {
media := c_audio,
ports := { port_number := 8500, num_of_ports:=omit },
transport := c_rtpAvp,
fmts := { "0" }
}, //* m=audio 8500 RTP/AVP 0
information := omit,
connections := omit,
bandwidth := omit,
key := omit,
}}
}
template SDP_Message m_SDP_attribute(SDP_media_desc p_media, in SipUserProfile p_userprofile, SDP_attribute loc_attribute)
modifies m_SDP
:= {
attributes := {loc_attribute}
};
template SDP_Message mw_SDP := {
protocol_version := 0, //* v=0
origin := ?,
session_name := ?,
information := omit,
uri := omit,
emails := omit,
phone_numbers := omit,
connection := ?,
bandwidth := omit,
times := { { time_field := { "0", "0" }, time_repeat:=omit
}
}, //* t=0 0
timezone_adjustments := omit,
key := omit,
attributes := omit,
media_list := ?
};
}//* end group base_templates
group modified_templates{
template SDP_Message m_SDP_bandwidth(SDP_media_desc p_media, in SipUserProfile p_userprofile)
modifies m_SDP
:= {
bandwidth := {{PX_SIP_SDP_b_modifier, PX_SIP_SDP_b_bandwidth}}
};
template SDP_Message m_SDP_unacceptable(SDP_media_desc p_media, in SipUserProfile p_userprofile)
modifies m_SDP
:= {
protocol_version := 1, //* v=1 unacceptable version of SDP
bandwidth := {{PX_SIP_SDP_b_modifier, PX_SIP_SDP_b_bandwidth}}
};
template SDP_Message m_SDP_encrypted(SDP_media_desc p_media, in SipUserProfile p_userprofile)
modifies m_SDP
:= {
protocol_version := 1, //* v=1 unacceptable version of SDP
bandwidth := {{PX_SIP_SDP_b_modifier, PX_SIP_SDP_b_bandwidth}}
};
}//* end group modified_templates
} //* end group SDP_Messages
group SDP_Fields {
template SDP_media_desc m_media(template SDP_media_field p_mf) := {
media_field := p_mf,
information := omit,
connections := omit,
bandwidth := omit,
key := omit,
attributes := omit
};
template SDP_media_desc m_mediaFieldBandwdthAttributes(template SDP_media_field p_mf, template SDP_bandwidth p_bw, template SDP_attribute_list p_attributes) := {
media_field := p_mf,
information := omit,
connections := omit,
bandwidth := p_bw,
key := omit,
attributes := p_attributes
};
template SDP_media_desc m_media_dynPT(charstring p_PT, charstring p_encod) := {
media_field := {
media := c_audio,//* "audio",
ports := { port_number := 8500, num_of_ports:=omit },
transport := c_rtpAvp,//* "RTP/AVP",
}, //* m=audio 8500 RTP/AVP 8
information := omit,
connections := omit,
bandwidth := omit,
key := omit,
attributes := { { rtpmap := { attr_value := p_PT & " " & p_encod }
}
} //* a=rtpmap:8 PCMA/8000
};
template SDP_media_desc m_media_unsupported := {
media_field := {
media := "video",
ports := { port_number := 11500, num_of_ports:=omit },
transport := "RTP/AVP",
fmts := { "99" }
}, //* m=audio 8500 RTP/AVP 0
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
information := omit,
connections := omit,
bandwidth := omit,
key := omit,
attributes := { {
rtpmap := { attr_value := "99 X-Experimental/180000"}
}}
};
template SDP_bandwidth m_bandwidth(template charstring loc_m, template integer loc_b) := {
modifier:=loc_m,
bandwidth:=loc_b
};
template SDP_bandwidth m_bandwidth_as_64:=
{
modifier:="AS",
bandwidth:=64
}
template SDP_bandwidth mw_bandwidth_rs:=
{
modifier:="RS",
bandwidth:=?
}
template SDP_bandwidth mw_bandwidth_rr:=
{
modifier:="RR",
bandwidth:=?
}
template SDP_media_field m_media_field(charstring p_media, integer p_portNum, charstring p_transport, charstring p_fmts) :=
{
media := p_media,
ports := { port_number := p_portNum, num_of_ports:=omit },
transport := p_transport,
fmts := { p_fmts }
}
template SDP_media_field mw_media_PCMU :=
{
media := c_audio,
ports := { port_number := ?, num_of_ports:=* },
transport := c_rtpAvp,
fmts := { "0" }
}
template SDP_media_field mw_media_PCMA :=
{
media := c_audio,
ports := { port_number := 8500, num_of_ports:=omit },
transport := c_rtpAvp,
fmts := { "8" }
}
template SDP_media_field mw_media_PCMA_U_DPT :=
{
media := c_audio,
ports := { port_number := ?, num_of_ports:=* },
transport := c_rtpAvp,
fmts := { * }
}
template SDP_media_field mw_media_T38 :=
{
media := c_image,
ports := { port_number := ?, num_of_ports:=* },
transport := pattern "*ptl", //* udptl,tcptl
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
fmts := { "t38" }
}
template SDP_media_field mw_media_G722 :=
{
media := c_audio,
ports := { port_number := ?, num_of_ports:=* },
transport := "RTP/AVP",
fmts := { "9" }
}
template SDP_media_field mw_media_AMR_DPT :=
{
media := c_audio,
ports := { port_number := ?, num_of_ports:=* },
transport := c_rtpAvp,
fmts := { * }
}
template SDP_attribute m_attribute_sendonly := {sendonly:={}};
template SDP_attribute mw_attribute_sendonly := {sendonly:={}};//MRO
template SDP_attribute m_attribute_recvonly := {recvonly:={}};
template SDP_attribute mw_attribute_recvonly := {recvonly:={}};//MRO
template SDP_attribute m_attribute_sendrecv := {sendrecv:={}};
template SDP_attribute mw_attribute_sendrecv := {sendrecv:={}};//MRO
template SDP_attribute m_attribute_inactive := {inactive:={}};
template SDP_attribute mw_attribute_inactive := {inactive:={}};//MRO
template SDP_attribute mw_attribute_sendonly_inactive := (mw_attribute_sendonly,mw_attribute_inactive);
template SDP_attribute mw_attribute_sendrecv_recvonly_omit := (mw_attribute_sendrecv,mw_attribute_recvonly,omit);
template SDP_attribute m_attribute_AMR_DPT := { rtpmap := { attr_value := /*pattern "**/PX_SIP_SDP_dyn & " AMR" }};
template SDP_attribute m_attribute_CLEARMODE_DPT := {rtpmap := { attr_value := /*pattern "**/PX_SIP_SDP_dyn & " CLEARMODE/8000" }};
template SDP_attribute m_attribute_G722 := { rtpmap := { attr_value := "9 G722/8000" }};
template SDP_attribute m_attribute_PCMU := { rtpmap := { attr_value := "0 PCMU/8000" }};
template SDP_attribute m_attribute_PCMU_DPT := { rtpmap := { attr_value := /*pattern "**/PX_SIP_SDP_dyn & " PCMU/8000" }};
template SDP_attribute m_attribute_PCMA := { rtpmap := { attr_value := "8 PCMA/8000" }};
template SDP_attribute m_attribute_PCMA_DPT := { rtpmap := { attr_value := /*pattern "**/PX_SIP_SDP_dyn & " PCMA/8000" }};
template SDP_attribute m_attribute_T38 := { unknown := { name:=?, attr_value := pattern "*t38*" }};
template SDP_attribute m_attribute_curr (charstring p_preconditionType, charstring p_statusType, charstring p_direction):=
{
curr:={preconditionType := p_preconditionType,
statusType := p_statusType,
direction := p_direction}
};
template SDP_attribute mw_attribute_curr :=
{
curr := ?
};
template SDP_attribute m_attribute_des (charstring p_preconditionType, charstring p_strength, charstring p_statusType, charstring p_direction):=
{
des:={preconditionType := p_preconditionType,
strength := p_strength,
statusType := p_statusType,
direction := p_direction}
};
template SDP_attribute mw_attribute_des :=
{
des := ?
};
template SDP_attribute m_attribute_conf (charstring p_preconditionType, charstring p_statusType, charstring p_direction):=
{
conf:={preconditionType := p_preconditionType,
statusType := p_statusType,
direction := p_direction}
} //* end group SDP_Fields
} //* end group SDP_Templates
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
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_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
}
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
template MessageBody m_MBody_MIMESdpXml(template SDP_Message p_sdp, template XmlBody p_xmlBody):=
{
mimeMessageBody := {boundary:="PX_SIP_MIME_Boundary",
mimeEncapsulatedList:= {
{content_type:="PX_SIP_SDP_ContentType",
content_disposition:=omit,
mime_encapsulated_part:={sdpMessageBody := p_sdp}},
{content_type:="PX_SIP_ISUP_ContentType",
content_disposition:=omit,
mime_encapsulated_part:={xmlBody := p_xmlBody}}
}
}
}
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_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}}
}
}
}
}
/*
*
* @desc group TemplatePreparationFunctions contain functions which are used for templates
*/
group TemplatePreparationFunctions {
group SDPlen_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_result := v_result + 2+c_CRlen + lengthof(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
); //* "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_result := v_result + 2+c_CRlen + lengthof(p_mb.bandwidth[i].modifier & " ") +
lengthof(int2str(p_mb.bandwidth[i].bandwidth));
}
};
for (var integer i:=0; i<sizeof(p_mb.times); i:=i+1)
{
v_result := v_result + 2+c_CRlen + lengthof(p_mb.times[i].time_field.start_time & " " //* "t="
& p_mb.times[i].time_field.stop_time);
if (ispresent(p_mb.times[i].time_repeat))
{
for (var integer j:=0; j<sizeof(p_mb.times[i].time_repeat[j]); j:=j+1)
{
v_result := v_result + 2+c_CRlen + lengthof(int2str(p_mb.times[i].time_repeat[j].repeat_interval.time)); //* "r="
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
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; j<sizeof(p_mb.times[i].time_repeat[j].offsets[k]); 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].media_field.fmts); 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= "
v_result := v_result + 2+c_CRlen + lengthof(p_mb.media_list[i].bandwidth.modifier)
+ 1 + lengthof(int2str(p_mb.media_list[i].bandwidth.bandwidth));
};
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
/**
*
* @desc Calculation of messagebody-textplain type length
* @param p_mb contain textplain message
* @return lenght
*/
function f_TextPlainLength(MessageBody p_mb) return integer
{
var integer v_result:=2;
v_result:=v_result+lengthof(p_mb.textplain);
return v_result;
};//* end function f_SDPlength
/**
*
* @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;
//* assume SDP_Message ONLY in the message body
if (ischosen(p_mb_par.sdpMessageBody))
{
v_result := f_SDPlength(p_mb_par.sdpMessageBody);
};
// TODO f_XMLlength and f_MIMElength
/* // assume XML_Message ONLY in the message body
if (ischosen(p_mb_par.xmlBody))
{
v_result := f_XMLlength(p_mb_par.xmlBody);
};
// assume MIME_Message in the message body
if (ischosen(p_mb_par.mimeMessageBody))
{
v_result := f_MIMElength(p_mb_par.mimeMessageBody);
};
*/
return v_result
};
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))
{v_result := v_result + 1 + lengthof(int2str(p_element.conn_addr.ttl));};
if (ispresent(p_element.conn_addr.num_of_addr))
{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="
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
{
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 + 2+c_CRlen + lengthof("recvonly")};
if (ischosen(p_element.sendrecv)) {v_result := v_result + 2+c_CRlen + lengthof("sendrecv")};
if (ischosen(p_element.sendonly)) {v_result := v_result + 2+c_CRlen + lengthof("sendonly")};
if (ischosen(p_element.inactive)) {v_result := v_result + 2+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 GiveHeaders {
/**
*
* @desc Return component variable of recordRoute header if vc_boo_recordRoute is true
* @return component variable of recordRoute header
*/
//TODO: clarify if function defined on SipComponent can be used in templates
// function f_recordroute() runs on SipComponent return template RecordRoute
// {
// if (vc_boo_recordRoute)
// {return vc_recordRoute}
// else {return(omit)}
// }
function f_recordroute() return template RecordRoute
/**
*
* @desc Return component variable of Route header if vc_boo_route is true
* @return component variable of recordRoute header
*/
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
//TODO: clarify if function defined on SipComponent can be used in templates
// function f_route() runs on SipComponent return template RecordRoute
// {
// 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(omit)}
// }
function f_route() return template RecordRoute
{
return(omit)
}
/**
*
* @desc Return RecordRoute (2nd parameter) if recordRoute indicator (1st parameter) is true
* @return recordRoute header
*/
function f_recordroute_par(in boolean p_boo_recordRoute, in RecordRoute p_RecordRoute) return template RecordRoute
{
if (p_boo_recordRoute)
{return p_RecordRoute}
else {return(omit)}
}
/**
*
* @desc Return Route (2nd parameter) if recordRoute indicator (1st parameter) is true
* @return Route header
*/
function f_route_par(in boolean p_boo_recordRoute, in Route p_Route) return template Route
if (p_boo_recordRoute)
{return p_Route} //* TODO: Route header need to be in reverse order than RecordRoute, question of return value - RecordRoute
else {return(omit)}
} //* end group GiveHeaders
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
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 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:=limit1; i<limit1+sizeof(p_list2); i:=i+1) {
p_result[i] := p_list2[i]
};
return p_result
}
} //* end group others
} //* group TemplatePreparationFunctions
} //* end module LibSip_Templates