Skip to content

Commit

Permalink
Add new b2b tests for some corner case scenarios
Browse files Browse the repository at this point in the history
(cherry picked from commit a5c473d)
  • Loading branch information
razvancrainea committed Sep 18, 2023
1 parent f4e4145 commit 897825d
Show file tree
Hide file tree
Showing 21 changed files with 3,115 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,25 @@ 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.

#### 27.top-hiding-reject
Run the same as [25.top-hiding](#25top-hiding) scenario, but send re-INVITEs
which are rejected.

#### 28.top-hiding-overlapping
Run the same as [25.top-hiding](#25top-hiding) scenario, but send re-INVITEs
in such a manner that they overlap.

#### 29.refer-unattended-uas-491-uas
Runs a b2b transfer scenario where there is a race between a re-INVITE
generated by the caller and the one generated by the referee. In this case,
the referee/uac sends its re-INVITE after the 491.

#### 30.refer-unattended-uas-491-uac
Run the same as
[29.refer-unattended-uas-491-uas](#29refer-unattended-uas-491-uas)
scenario, but the referee no longer sends the re-INVITE, thus we retry
the bridging after 2.1-4s.

### UAC Auth

Verifies the behavior of uac_auth module.
Expand Down
88 changes: 88 additions & 0 deletions b2b/27.top-hiding-reject/opensips.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#
# 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"

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;
}

# initialize the internal topology hiding scenario
b2b_init_request("top hiding");

exit;
}
22 changes: 22 additions & 0 deletions b2b/27.top-hiding-reject/scenario.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
timeout: 20

tasks:
- name: OpenSIPS
type: opensips

- name: SIPP UAS
type: uas-sipp
config_file: scripts/uas.xml
duration: 3000
require: OpenSIPS

- name: SIPP UAC
type: uac-sipp
config_file: scripts/uac.xml
username: {{ username }}
remote: {{ uas_ip }}:{{ uas_port }}
require:
started:
task: SIPP UAS
wait: 0.5
151 changes: 151 additions & 0 deletions b2b/27.top-hiding-reject/scripts/uac.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?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: [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>

<recv response="180" 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: [call_id]
Max-Forwards: 70
Subject: Performance Test
User-Agent: sipp
Content-Length: 0
]]>
</send>

<recv request="INVITE" crlf="true" rrs="true">
</recv>

<pause milliseconds="200"/>

<send retrans="500">
<![CDATA[
SIP/2.0 488 Not Acceptable Here
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
[last_Record-Route:]
Contact: <sip:[local_ip]:[local_port]>
]]>
</send>

<recv request="ACK" crlf="true" rrs="true">
</recv>

<recv request="BYE" 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: 0
]]>
</send>

<!-- 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 897825d

Please sign in to comment.