diff --git a/data/tutorials/osips/opensips/etc/opensips/opensips.cfg b/data/tutorials/osips/opensips/etc/opensips/opensips.cfg index ab6947d90..97de18cd2 100644 --- a/data/tutorials/osips/opensips/etc/opensips/opensips.cfg +++ b/data/tutorials/osips/opensips/etc/opensips/opensips.cfg @@ -199,7 +199,7 @@ route{ } # do lookup with method filtering - if (!lookup("location","m")) { + if (!lookup("location","method-filtering")) { t_reply(404, "Not Found"); exit; } diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 5fb861863..d8e76af31 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -128,11 +128,11 @@ Regarding the SIP Servers, click on the tab corresponding to the choice you made .. code-block:: bash - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 049AD65B - echo "deb https://apt.opensips.org buster 3.3-releases" >/etc/apt/sources.list.d/opensips.list - echo "deb https://apt.opensips.org buster cli-nightly" >/etc/apt/sources.list.d/opensips-cli.list - apt-get update - sudo apt-get install opensips opensips-mysql-module opensips-cgrates-module opensips-cli + curl https://apt.opensips.org/opensips-org.gpg -o /usr/share/keyrings/opensips-org.gpg + echo "deb [signed-by=/usr/share/keyrings/opensips-org.gpg] https://apt.opensips.org bookworm 3.4-releases" >/etc/apt/sources.list.d/opensips.list + echo "deb [signed-by=/usr/share/keyrings/opensips-org.gpg] https://apt.opensips.org bookworm cli-nightly" >/etc/apt/sources.list.d/opensips-cli.list + apt-get update + sudo apt-get install opensips opensips-mysql-module opensips-cgrates-module opensips-cli Configuration and initialization -------------------------------- @@ -217,22 +217,124 @@ Regarding the SIP Servers, we have prepared custom configurations in advance, as - user accounts configuration not needed since it's enough for them to only be defined within CGRateS; - for simplicity, no authentication was configured (WARNING: Not suitable for production). - creating database for the DRouting module, using the following command: + .. code-block:: bash opensips-cli -x database create - + + After creating the database for DRouting module populate the tables with routing info: + + .. code-block:: bash + + insert into dr_gateways (gwid,type,address) values("gw2_1",0,"sip:127.0.0.1:5082"); + insert into dr_gateways (gwid,type,address) values("gw1_1",0,"sip:127.0.0.1:5081"); + insert into dr_carriers (carrierid,gwlist) values("route1","gw1_1"); + insert into dr_carriers (carrierid,gwlist) values("route2","gw2_1"); + To start OpenSIPS_ with the prepared custom configuration, run: - .. code-block:: bash + .. code-block:: bash + + sudo mv /etc/opensips /etc/opensips.old + sudo cp -r /usr/share/cgrates/tutorials/osips/opensips/etc/opensips /etc + sudo systemctl restart opensips - /usr/share/cgrates/tutorials/osips_native/opensips/etc/init.d/opensips start To verify that OpenSIPS_ is running, run the following command: - .. code-block:: bash + .. code-block:: bash + + opensips-cli -x mi uptime + + + Since we are using OpenSIPS_ with DRouting module we have to set up a SIP entity that OpenSIPS_ can forward the calls to for our setup. + In this example we use SIPp a free Open Source test tool / traffic generator for the SIP protocol. + The install SiPp use commands below : + + .. code-block:: bash + + apt update + apt install git pkg-config dh-autoreconf ncurses-dev build-essential libssl-dev libpcap-dev libncurses5-dev libsctp-dev lksctp-tools cmake + git clone https://github.com/SIPp/sipp.git + cd sipp + git checkout v3.7.0 + git submodule init + git submodule update + ./build.sh --common + cmake . -DUSE_SSL=1 -DUSE_SCTP=0 -DUSE_PCAP=1 -DUSE_GSL=1 + make all + make install + + + + Write SIPp XML scenario named uas.xml or to your liking with the content below,this scenario will simulate calls with OpenSIPS_ . + Change "OpenSIPS_IP" in the line ** with your OpenSIPS_ IP. + + .. code-block:: XML + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Content-Length: 0 ]]> + + + 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-Length: 0 ]]> + + + + + + + + + + + + Run the SIPp with the command below: + + .. code-block:: bash + + sipp -sf uas.xml -p 5082 - opensipsctl moni @@ -281,7 +383,7 @@ Just as with the SIP Servers, we have also prepared configurations and init scri .. code-block:: bash - /usr/share/cgrates/tutorials/osips_native/cgrates/etc/init.d/cgrates start + sudo systemctl restart opensips .. note:: If you have chosen OpenSIPS_, CGRateS has to be started first since the dependency is reversed.