Skip to content

Commit

Permalink
Add initial support for using rtp.io instead of the "real"
Browse files Browse the repository at this point in the history
rtpproxy.
  • Loading branch information
sobomax committed Oct 4, 2024
1 parent 3225763 commit 3382b1d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 27 deletions.
15 changes: 8 additions & 7 deletions functions
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ fail_rc() {
}

case "${RTPPC_TYPE}" in
"udp") RTPP_SOCK_TEST="${RTPP_SOCK_UDP}";;
"udp6") RTPP_SOCK_TEST="${RTPP_SOCK_UDP6}";;
"unix") RTPP_SOCK_TEST="${RTPP_SOCK_UNIX}";;
"cunix") RTPP_SOCK_TEST="${RTPP_SOCK_CUNIX}";;
"tcp") RTPP_SOCK_TEST="${RTPP_SOCK_TCP}";;
"tcp6") RTPP_SOCK_TEST="${RTPP_SOCK_TCP6}";;
*) fail_rc 1 "Unknown socket type RTPPC_TYPE=${RTPPC_TYPE}";;
"udp") RTPP_SOCK_TEST="${RTPP_SOCK_UDP}";;
"udp6") RTPP_SOCK_TEST="${RTPP_SOCK_UDP6}";;
"unix") RTPP_SOCK_TEST="${RTPP_SOCK_UNIX}";;
"cunix") RTPP_SOCK_TEST="${RTPP_SOCK_CUNIX}";;
"tcp") RTPP_SOCK_TEST="${RTPP_SOCK_TCP}";;
"tcp6") RTPP_SOCK_TEST="${RTPP_SOCK_TCP6}";;
"rtp.io") RTPP_SOCK_TEST="${RTPP_SOCK_TCP}";;
*) fail_rc 1 "Unknown socket type RTPPC_TYPE=${RTPPC_TYPE}";;
esac

MM_INIT_DELAY=1
Expand Down
7 changes: 7 additions & 0 deletions scenarios/simple/opensips.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ loadmodule "sl/sl.so"
loadmodule "tm/tm.so"
loadmodule "rr/rr.so"
loadmodule "maxfwd/maxfwd.so"
#if RTPPC_TYPE == rtp.io
loadmodule "rtp.io/rtp.io.so"
#endif
loadmodule "rtpproxy/rtpproxy.so"
loadmodule "textops/textops.so"
#if !(OPENSIPS_VER_FULL == master || OPENSIPS_VER >= 30)
Expand All @@ -29,7 +32,11 @@ loadmodule "uri/uri.so"
#define SRC_PORT $sp
#define STATUS $rs

#if RTPPC_TYPE == rtp.io
modparam("rtp.io", "rtpproxy_args", "-s tcp:127.0.0.1:22222 -m 12000 -M 15000 -6 /:: -l 0.0.0.0")
#else
modparam("rtpproxy", "rtpproxy_sock", RTPP_SOCK_TEST)
#endif

listen=udp:127.0.0.1:5060
listen=udp:[::1]:5060
Expand Down
49 changes: 29 additions & 20 deletions test_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ start_mm() {
MM_CFG="opensips.cfg"
MM_BIN="${MM_ROOT}/opensips"
pp_file "scenarios/${MM_AUTH}/${MM_CFG}.in" -DRTPP_SOCK_TEST=\"${RTPP_SOCK_TEST}\" -DOPENSIPS_VER=${MM_VER} \
-DOPENSIPS_VER_FULL=${MM_VER_FULL} -DMM_AUTH="${MM_AUTH}" -DMM_ROOT="${MM_ROOT}"
-DOPENSIPS_VER_FULL=${MM_VER_FULL} -DMM_AUTH="${MM_AUTH}" -DMM_ROOT="${MM_ROOT}" -DRTPPC_TYPE="${RTPPC_TYPE}"
for nret in 0 1 2
do
PP_SUF=".nr${nret}" pp_file scenarios/${MM_AUTH}/rtpproxy.opensips.output.in -DOPENSIPS_VER=${MM_VER} \
Expand Down Expand Up @@ -172,22 +172,26 @@ export RTPP_LOG_TSTART
RTPP_LOG_TFORM="rel"
export RTPP_LOG_TFORM

rtpproxy_cmds_gen | ${RTPPROXY} -p "${RTPP_PIDF}" -d dbug -F -f -s stdio: -s "${RTPP_SOCK_UDP}" \
-s "${RTPP_SOCK_CUNIX}" -s "${RTPP_SOCK_UNIX}" -s "${RTPP_SOCK_UDP6}" -s "${RTPP_SOCK_TCP}" \
-s "${RTPP_SOCK_TCP6}" -m 12000 -M 15000 -6 '/::' -l '0.0.0.0' ${RTPP_NOTIFY_ARG} > rtpproxy.rout 2>rtpproxy.log &
RTPP_PID=${!}
sleep 1
i=0
while [ ! -e "${RTPP_SOCK_BARE}" ]
do
if [ ${i} -gt 4 ]
then
report_rc_log 1 "rtpproxy.rout rtpproxy.log" "Waiting for the RTPproxy to become ready"
fi
if [ "${RTPPC_TYPE}" != "rtp.io" ]
then
rtpproxy_cmds_gen | ${RTPPROXY} -p "${RTPP_PIDF}" -d dbug -F -f -s stdio: -s "${RTPP_SOCK_UDP}" \
-s "${RTPP_SOCK_CUNIX}" -s "${RTPP_SOCK_UNIX}" -s "${RTPP_SOCK_UDP6}" -s "${RTPP_SOCK_TCP}" \
-s "${RTPP_SOCK_TCP6}" -m 12000 -M 15000 -6 '/::' -l '0.0.0.0' ${RTPP_NOTIFY_ARG} > rtpproxy.rout 2>rtpproxy.log &
RTPP_PID=${!}
sleep 1
i=$((${i} + 1))
done
sleep 1
i=0
while [ ! -e "${RTPP_SOCK_BARE}" ]
do
if [ ${i} -gt 4 ]
then
report_rc_log 1 "rtpproxy.rout rtpproxy.log" "Waiting for the RTPproxy to become ready"
fi
sleep 1
i=$((${i} + 1))
done
sleep 1
fi

start_mm
MM_AUTH="${MM_AUTH}" ${PYTHON_CMD} alice.py "${ALICE_ARGS}" -t "${TEST_SET}" -l '*' -P 5061 \
-T ${ALICE_TIMEOUT} 2>alice.log &
Expand Down Expand Up @@ -219,10 +223,15 @@ then
# before we SIGHUP it
${PYTHON_CMD} -c "from time import time, sleep; tleft=${SIPLOG_TSTART} + ${RTPP_STAT_TIMEOUT} + 5 - time(); sleep(tleft) if tleft > 0 else False;"
fi
kill -HUP ${RTPP_PID}
echo "RTPP_PID: ${RTPP_PID}"
wait ${RTPP_PID}
RTPP_RC="${?}"
if [ "${RTPPC_TYPE}" != "rtp.io" ]
then
kill -HUP ${RTPP_PID}
echo "RTPP_PID: ${RTPP_PID}"
wait ${RTPP_PID}
RTPP_RC="${?}"
else
RTPP_RC=0
fi

rm -f "${ALICE_PIDF}" "${BOB_PIDF}"

Expand Down

0 comments on commit 3382b1d

Please sign in to comment.