Skip to content

Commit

Permalink
add parking late-bye tests
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Jan 23, 2024
1 parent 7c5be21 commit aa4a79f
Show file tree
Hide file tree
Showing 15 changed files with 1,280 additions and 5 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ Runs the internal topology hiding scenario.
Runs a simple parking scenario where a call is sent to a media server then picked
up by the called entity later.

#### 26.parking-late-bye
Run the same as [26.parking](#26parking) scenario, but delays the bye towards
the initial entity until the pickup is established.

#### 26.parking-late-bye-delay
Run the same as [26.parking-late-bye](#26parking-late-bye) scenario, but
delays the BYE being sent with a configured value.

#### 27.top-hiding-reject
Run the same as [25.top-hiding](#25top-hiding) scenario, but send re-INVITEs
which are rejected.
Expand Down
4 changes: 4 additions & 0 deletions b2b/26.parking-late-bye-delay/defines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
media_ip: 192.168.52.5
media_port: 5060
uac_pickup_port: 5044
113 changes: 113 additions & 0 deletions b2b/26.parking-late-bye-delay/opensips.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#
# OpenSIPS residential configuration script
# by OpenSIPS Solutions <[email protected]>
#
# This script was generated via "make menuconfig", from
# the "Residential" scenario.
# You can enable / disable more features / functionalities by
# re-generating the scenario with different options.#
#
# Please refer to the Core CookBook at:
# https://opensips.org/Resources/DocsCookbooks
# for a explanation of possible statements, functions and parameters.
#


####### Global Parameters #########
######################################################################
/* uncomment the following lines to enable debugging */
#debug_mode=yes

log_level=4
xlog_level=4
log_stderror=yes

udp_workers=4

####### Modules Section ########

#set module path
mpath="/usr/lib/x86_64-linux-gnu/opensips/modules/"

#### SIGNALING module
loadmodule "signaling.so"

#### StateLess module
loadmodule "sl.so"

#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 5)
modparam("tm", "fr_inv_timeout", 30)
modparam("tm", "restart_fr_on_each_reply", 0)
modparam("tm", "onreply_avp_mode", 1)

#### SIP MSG OPerationS module
loadmodule "sipmsgops.so"

#### MAX ForWarD module
loadmodule "maxfwd.so"

#### Record Route Module
loadmodule "rr.so"
/* do not append from tag to the RR (no need for this script) */
modparam("rr", "append_fromtag", 0)

#### B2B modules
loadmodule "b2b_entities.so"
loadmodule "b2b_logic.so"
modparam("b2b_logic", "script_req_route", "b2b_logic_request")
modparam("b2b_logic", "old_entity_term_delay", 2)

loadmodule "cachedb_local.so"

loadmodule "proto_udp.so"

####### Routing Logic ########

# main request routing logic

route {

if (!mf_process_maxfwd_header(10)) {
send_reply(483,"Too Many Hops");
exit;
}

if (has_totag()) {
send_reply(481, "Call/Transaction Does Not Exist");
exit;
}

# accept just INVITE requests
if (!is_method("INVITE")) {
send_reply(503, "Service Unavailable");
exit;
}

if ($rU == "pickup") {
cache_fetch("local", "$fU", $var(b2bl_key));
cache_remove("local", "$fU");

if ($var(b2bl_key) != NULL)
b2b_bridge_request($var(b2bl_key), 0,, "late_bye");
else
send_reply(481, "Call/Transaction Does Not Exist");

exit;
}

b2b_server_new("caller");

b2b_client_new("media", "sip:[email protected]");

b2b_init_request("parking");

cache_store("local", "$tU", "$b2b_logic.key");

exit;
}

route[b2b_logic_request] {
b2b_pass_request();
}
46 changes: 46 additions & 0 deletions b2b/26.parking-late-bye-delay/scenario.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
timeout: 35

tasks:
- name: OpenSIPS
type: opensips

- name: SIPP Media
type: uas-sipp
config_file: scripts/uas.xml
require: OpenSIPS
ip: {{ media_ip }}
port: {{ media_port }}

- name: SIPP UAC
type: uac-sipp
duration: 1
service: {{ username }}
config_file: scripts/uac.xml
proxy: {{ opensips_ip }}:{{ opensips_port }}
caller: caller
require:
- started:
task: SIPP Media
wait: 0.5
- after:
task: OpenSIPS
wait: 0.5

- name: SIPP UAC Pickup
type: uac-sipp
port: {{uac_pickup_port}}
service: pickup
config_file: scripts/uac_pickup.xml
proxy: {{ opensips_ip }}:{{ opensips_port }}
caller: {{ username }}
require:
- started:
task: SIPP UAC
wait: 2
- started:
task: SIPP Media
wait: 0.5
- after:
task: OpenSIPS
wait: 0.5
191 changes: 191 additions & 0 deletions b2b/26.parking-late-bye-delay/scripts/uac.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Basic Sipstone UAC">

<nop>
<action>
<assignstr assign_to="domain" value="[domain]"/>
</action>
</nop>
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
<!-- generated by sipp. To do so, use [call_id] keyword. -->
<send retrans="500" id="1">
<![CDATA[
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
Max-Forwards: 70
From: <sip:[caller]@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:[service]@[remote_ip]:[remote_port]>
Call-ID: parking-late-bye-delay:///[call_id]
CSeq: 1 INVITE
Contact: <sip:[local_ip]:[local_port]>
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>

<recv response="100"
optional="true">
</recv>

<!-- By adding rrs="true" (Record Route Sets), the route sets -->
<!-- are saved and used for following messages sent. Useful to test -->
<!-- against stateful SIP proxies/B2BUAs. -->
<recv response="200" rtd="true" rrs="true">
<action>
<!-- there should only be one Via -->
<ereg regexp=".+" search_in="hdr" header="Via:" check_it="true" assign_to="dummy"/>
<ereg regexp="," search_in="hdr" header="Via:" check_it_inverse="true" assign_to="dummy"/>
<ereg regexp=".+" search_in="hdr" header="Via:" occurence="2" check_it_inverse="true" assign_to="dummy"/>
<!-- there should only be no Route or Record-Route headers -->
<ereg regexp=".+" search_in="hdr" header="Route:" check_it_inverse="true" assign_to="dummy"/>
<!-- check the contact is the proxy -->
<ereg regexp="<sip:([^;@]*)>" search_in="hdr" check_it="true" header="Contact:" assign_to="dummy,contact" />
<strcmp assign_to="result" variable="contact" variable2="domain"/>
<ereg regexp="." search_in="var" check_it_inverse="true" variable="result" assign_to="dummy"/>
<!-- check the tag contains B2B -->
<ereg regexp="[:space:]*<sip:([^>]*)>;tag=B2B." search_in="hdr" check_it="true" header="To:" assign_to="dummy,dummy" />

</action>
</recv>

<!-- Packet lost can be simulated in any send/recv message by -->
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
<send>
<![CDATA[
ACK [next_url] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[caller]@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
[routes]
CSeq: 1 ACK
Contact: <sip:[local_ip]:[local_port]>
Call-ID: parking-late-bye-delay:///[call_id]
Max-Forwards: 70
Subject: Performance Test
User-Agent: sipp
Content-Length: 0
]]>
</send>

<recv request="INVITE" crlf="true" rrs="true">
<action>
<!-- there should only be one Via -->
<ereg regexp=".+" search_in="hdr" header="Via:" check_it="true" assign_to="dummy"/>
<ereg regexp="," search_in="hdr" header="Via:" check_it_inverse="true" assign_to="dummy"/>
<ereg regexp=".+" search_in="hdr" header="Via:" occurence="2" check_it_inverse="true" assign_to="dummy"/>
<!-- there should only be no Route or Record-Route headers -->
<ereg regexp=".+" search_in="hdr" header="Route:" check_it_inverse="true" assign_to="dummy"/>
<!-- check the contact is the proxy -->
<ereg regexp="<sip:([^;@]*)>" search_in="hdr" check_it="true" header="Contact:" assign_to="dummy,contact" />
<strcmp assign_to="result" variable="contact" variable2="domain"/>
<ereg regexp="." search_in="var" check_it_inverse="true" variable="result" assign_to="dummy"/>
<!-- check the From tag contains B2B -->
<ereg regexp="[:space:]*<sip:([^>]*)>;tag=B2B." search_in="hdr" check_it="true" header="From:" assign_to="dummy,dummy" />
</action>
</recv>

<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
[last_Record-Route:]
Contact: <sip:[local_ip]:[local_port]>
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>

<recv request="ACK" crlf="true">
<action>
<!-- there should only be one Via -->
<ereg regexp=".+" search_in="hdr" header="Via:" check_it="true" assign_to="dummy"/>
<ereg regexp="," search_in="hdr" header="Via:" check_it_inverse="true" assign_to="dummy"/>
<ereg regexp=".+" search_in="hdr" header="Via:" occurence="2" check_it_inverse="true" assign_to="dummy"/>
<!-- there should only be no Route or Record-Route headers -->
<ereg regexp=".+" search_in="hdr" header="Route:" check_it_inverse="true" assign_to="dummy"/>
<!-- check the contact is the proxy -->
<ereg regexp="<sip:([^;@]*)>" search_in="hdr" check_it="true" header="Contact:" assign_to="dummy,contact" />
<strcmp assign_to="result" variable="contact" variable2="domain"/>
<ereg regexp="." search_in="var" check_it_inverse="true" variable="result" assign_to="dummy"/>
<!-- check the From tag contains B2B -->
<ereg regexp="[:space:]*<sip:([^>]*)>;tag=B2B." search_in="hdr" check_it="true" header="From:" assign_to="dummy,dummy" />
<ereg regexp=".*" search_in="hdr" header="From" assign_to="remote_from"/>
<ereg regexp=".*" search_in="hdr" header="To" assign_to="remote_to"/>
</action>
</recv>

<!-- This delay can be customized by the -d command-line option -->
<!-- or by adding a 'milliseconds = "value"' option here. -->
<pause/>

<!-- The 'crlf' option inserts a blank line in the statistics report. -->
<send retrans="500">
<![CDATA[
BYE [next_url] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
To:[$remote_from]
From:[$remote_to]
[routes]
CSeq: 2 BYE
Contact: <sip:[local_ip]:[local_port]>
Call-ID: parking-late-bye-delay:///[call_id]
Max-Forwards: 70
User-Agent: sipp
Content-Length: 0
]]>
</send>

<recv response="200" crlf="true">
<action>
<!-- there should only be one Via -->
<ereg regexp=".+" search_in="hdr" header="Via:" check_it="true" assign_to="dummy"/>
<ereg regexp="," search_in="hdr" header="Via:" check_it_inverse="true" assign_to="dummy"/>
<ereg regexp=".+" search_in="hdr" header="Via:" occurence="2" check_it_inverse="true" assign_to="dummy"/>
<!-- there should only be no Route or Record-Route headers -->
<ereg regexp=".+" search_in="hdr" header="Route:" check_it_inverse="true" assign_to="dummy"/>
<!-- check the contact is the proxy -->
<ereg regexp="<sip:([^;@]*)>" search_in="hdr" check_it="true" header="Contact:" assign_to="dummy,contact" />
<strcmp assign_to="result" variable="contact" variable2="domain"/>
<ereg regexp="." search_in="var" check_it_inverse="true" variable="result" assign_to="dummy"/>
</action>
</recv>

<!-- definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="500, 1000, 1500, 2000"/>

<!-- definition of the call length repartition table (unit is ms) -->
<CallLengthRepartition value="500"/>

<Global variables="caller" />
<Reference variables="dummy,contact,result,domain,caller"/>

</scenario>
Loading

0 comments on commit aa4a79f

Please sign in to comment.