"Fossies" - the Fresh Open Source Software Archive

Member "opensips-3.0.1/test/35.sh" (16 Apr 2019, 2559 Bytes) of package /linux/misc/opensips-3.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "35.sh": 2.4.5_vs_3.0.0.

    1 #!/bin/bash
    2 # check permissions module functionality
    3 
    4 # Copyright (C) 2008 1&1 Internet AG
    5 #
    6 # This file is part of opensips, a free SIP server.
    7 #
    8 # opensips is free software; you can redistribute it and/or modify
    9 # it under the terms of the GNU General Public License as published by
   10 # the Free Software Foundation; either version 2 of the License, or
   11 # (at your option) any later version
   12 #
   13 # opensips is distributed in the hope that it will be useful,
   14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16 # GNU General Public License for more details.
   17 #
   18 # You should have received a copy of the GNU General Public License
   19 # along with this program; if not, write to the Free Software
   20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   21 
   22 source include/require
   23 
   24 if ! (check_sipp && check_opensips); then
   25     exit 0
   26 fi ;
   27 
   28 CFG=35.cfg
   29 SRV=5060
   30 UAS=5070
   31 UAC=5080
   32 IP="127.0.0.31"
   33 MASK=27
   34 
   35 # add an registrar entry to the db;
   36 mysql --show-warnings -B -u opensips --password=opensipsrw -D opensips -e "INSERT INTO location (username,contact,socket,user_agent,cseq,q) VALUES (\"foo\",\"sip:foo@localhost:$UAS\",\"udp:127.0.0.1:$UAS\",\"ser_test\",1,-1);"
   37 
   38 mysql --show-warnings -B -u opensips --password=opensipsrw -D opensips -e "INSERT INTO address (ip_addr, mask) VALUES ('$IP', '$MASK');"
   39 
   40 ../opensips -w . -f $CFG &> /dev/null
   41 sipp -sn uas -bg -i localhost -m 10 -f 2 -p $UAS &> /dev/null
   42 sipp -sn uac -s foo 127.0.0.1:$SRV -i localhost -m 10 -f 2 -p $UAC &> /dev/null
   43 ret=$?
   44 mysql --show-warnings -B -u opensips --password=opensipsrw -D opensips -e "DELETE FROM address WHERE (ip_addr='$IP' AND mask='$MASK');"
   45 
   46 if [ "$ret" -eq 0 ] ; then
   47     killall sipp
   48     IP="127.47.6.254"
   49     MASK=10
   50     mysql --show-warnings -B -u opensips --password=opensipsrw -D opensips -e "INSERT INTO address (ip_addr, mask) VALUES ('$IP', '$MASK');"
   51     
   52     opensips-cli -x mi address_reload
   53     #opensips-cli -x mi address_dump
   54 
   55     sipp -sn uas -bg -i localhost -m 10 -f 2 -p $UAS &> /dev/null
   56     sipp -sn uac -s foo 127.0.0.1:$SRV -i localhost -m 10 -f 2 -p $UAC &> /dev/null
   57     ret=$?
   58     mysql --show-warnings -B -u opensips --password=opensipsrw -D opensips -e "DELETE FROM address WHERE (ip_addr='$IP' AND mask='$MASK');"
   59 fi;
   60 
   61 
   62 # cleanup
   63 killall -9 sipp > /dev/null 2>&1
   64 killall -9 opensips > /dev/null 2>&1
   65 
   66 mysql  --show-warnings -B -u opensips --password=opensipsrw -D opensips -e "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"ser_test\"));"
   67 
   68 exit $ret;