diff --git a/README.md b/README.md index 42ec09a..2e7a8b6 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,12 @@ Similar to [01.dialog](#01simple), but expires the dialog before a BYE is receiv Runs a call through dialog where the re-INVITE is challenged by the UAC. +#### 06.auth-update + +Runs a scenario when an UPDATE message is being sent while the calls is being +answered. + +Runs a call through dialog where the re-INVITE is challenged by the UAC. ### Topology Hiding Runs a set of calls using the topology hiding scenario, verifying that the UAS diff --git a/dialog/06.auth-update/defines.yml b/dialog/06.auth-update/defines.yml new file mode 100644 index 0000000..5c39719 --- /dev/null +++ b/dialog/06.auth-update/defines.yml @@ -0,0 +1,3 @@ +--- +uac_ip: 192.168.52.2 + diff --git a/dialog/06.auth-update/opensips.cfg b/dialog/06.auth-update/opensips.cfg new file mode 100644 index 0000000..de30cec --- /dev/null +++ b/dialog/06.auth-update/opensips.cfg @@ -0,0 +1,121 @@ +# +# OpenSIPS residential configuration script +# by OpenSIPS Solutions +# +# 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" + +#### Dialog module +loadmodule "dialog.so" +modparam("dialog", "db_mode", 0) + +#### 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) + +loadmodule "proto_udp.so" + +loadmodule "httpd.so" +loadmodule "mi_http.so" + +####### Routing Logic ######## + +# main request routing logic + +route { + + if (!mf_process_maxfwd_header(10)) { + send_reply(483,"Too Many Hops"); + exit; + } + + if (has_totag()) { + + # handle hop-by-hop ACK (no routing required) + if (is_method("ACK") && t_check_trans()) { + t_relay(); + exit; + } + + # sequential request within a dialog should + # take the path determined by record-routing + if (!loose_route() && !match_dialog()) { + # we do record-routing for all our traffic, so we should not + # receive any sequential requests without Route hdr. + send_reply(404,"Not here"); + exit; + } + + # route it out to whatever destination was set by loose_route() + # in $du (destination URI). + t_relay(); + exit; + } + + # CANCEL processing + if (is_method("CANCEL")) { + if (t_check_trans()) + t_relay(); + exit; + } + + # accept just INVITE requests + if (!is_method("INVITE")) { + send_reply(503, "Service Unavailable"); + exit; + } + + if (!create_dialog()) { + send_reply(500, "Internal Server Error"); + exit; + } + record_route(); + + if (!t_relay()) + send_reply(500, "Internal Error"); + exit; +} diff --git a/dialog/06.auth-update/opensips.sql b/dialog/06.auth-update/opensips.sql new file mode 100644 index 0000000..37dee1d --- /dev/null +++ b/dialog/06.auth-update/opensips.sql @@ -0,0 +1,43 @@ +GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; +CREATE DATABASE opensips; + +USE opensips; + +CREATE TABLE version ( + table_name CHAR(32) NOT NULL, + table_version INT UNSIGNED DEFAULT 0 NOT NULL, + CONSTRAINT t_name_idx UNIQUE (table_name) +) ENGINE=InnoDB; + +INSERT INTO version (table_name, table_version) values ('dialog','12'); +CREATE TABLE dialog ( + dlg_id BIGINT(10) UNSIGNED PRIMARY KEY NOT NULL, + callid CHAR(255) NOT NULL, + from_uri CHAR(255) NOT NULL, + from_tag CHAR(64) NOT NULL, + to_uri CHAR(255) NOT NULL, + to_tag CHAR(64) NOT NULL, + mangled_from_uri CHAR(64) DEFAULT NULL, + mangled_to_uri CHAR(64) DEFAULT NULL, + caller_cseq CHAR(11) NOT NULL, + callee_cseq CHAR(11) NOT NULL, + caller_ping_cseq INT(11) UNSIGNED NOT NULL, + callee_ping_cseq INT(11) UNSIGNED NOT NULL, + caller_route_set TEXT(512), + callee_route_set TEXT(512), + caller_contact CHAR(255), + callee_contact CHAR(255), + caller_sock CHAR(64) NOT NULL, + callee_sock CHAR(64) NOT NULL, + state INT(10) UNSIGNED NOT NULL, + start_time INT(10) UNSIGNED NOT NULL, + timeout INT(10) UNSIGNED NOT NULL, + vars BLOB(4096) DEFAULT NULL, + profiles TEXT(512) DEFAULT NULL, + script_flags CHAR(255) DEFAULT NULL, + module_flags INT(10) UNSIGNED DEFAULT 0 NOT NULL, + flags INT(10) UNSIGNED DEFAULT 0 NOT NULL, + rt_on_answer CHAR(64) DEFAULT NULL, + rt_on_timeout CHAR(64) DEFAULT NULL, + rt_on_hangup CHAR(64) DEFAULT NULL +) ENGINE=InnoDB; diff --git a/dialog/06.auth-update/scenario.yml b/dialog/06.auth-update/scenario.yml new file mode 100644 index 0000000..c7a04f2 --- /dev/null +++ b/dialog/06.auth-update/scenario.yml @@ -0,0 +1,33 @@ +--- +timeout: 10 + +tasks: + - name: OpenSIPS + type: opensips + + - name: SIPP UAS + type: uas-sipp + config_file: scripts/uas.xml + duration: 2000 # duration before re-INVITE and BYE + require: OpenSIPS + keys: + username: {{ username }} + password: {{ password }} + nonce: {{ nonce }} + + - name: SIPP UAC + type: uac-sipp + service: {{ username }} + config_file: scripts/uac.xml + remote: {{ uas_ip }}:{{ uas_port }} + ip: {{ uac_ip }} + caller: caller + username: {{ username }} + password: {{ password }} + require: + - started: + task: SIPP UAS + wait: 0.5 + - after: + task: OpenSIPS + wait: 0.5 diff --git a/dialog/06.auth-update/scripts/uac.xml b/dialog/06.auth-update/scripts/uac.xml new file mode 100644 index 0000000..bf85410 --- /dev/null +++ b/dialog/06.auth-update/scripts/uac.xml @@ -0,0 +1,228 @@ + + + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 8001 INVITE + Contact: + 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 + + ]]> + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 8001 ACK + Contact: + Content-Type: application/sdp + Content-Length: [len] + + ]]> + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 8002 INVITE + [authentication] + Contact: + 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 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + ]]> + + + + + + ;tag=[call_number] + To: [peer_tag_param] + [routes] + CSeq: 8002 ACK + Contact: + Call-ID: [call_id] + Max-Forwards: 70 + Subject: Performance Test + User-Agent: sipp + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + + + diff --git a/dialog/06.auth-update/scripts/uas.xml b/dialog/06.auth-update/scripts/uas.xml new file mode 100644 index 0000000..139a7b2 --- /dev/null +++ b/dialog/06.auth-update/scripts/uas.xml @@ -0,0 +1,353 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +