diff --git a/components/app/lib/call_platform/fake_client.rb b/components/app/lib/call_platform/fake_client.rb
index 1ac6e7f45..440038a7d 100644
--- a/components/app/lib/call_platform/fake_client.rb
+++ b/components/app/lib/call_platform/fake_client.rb
@@ -17,7 +17,7 @@ def twiml_response
- https://www2.cs.uic.edu/~i101/SoundFiles/taunt.wav
+ #{audio_file_url}
TWIML
end
@@ -27,6 +27,10 @@ def twiml_response
def connect_ws_server_url
ENV.fetch("CONNECT_WS_SERVER_URL", "wss://example.com")
end
+
+ def audio_file_url
+ ENV.fetch("AUDIO_FILE_URL", "https://api.twilio.com/cowbell.mp3")
+ end
end
TEST_NUMBERS = [
diff --git a/components/testing/Dockerfile b/components/testing/Dockerfile
index cf48b6b5c..6f20e581e 100644
--- a/components/testing/Dockerfile
+++ b/components/testing/Dockerfile
@@ -1,6 +1,6 @@
FROM public.ecr.aws/docker/library/alpine:latest
-RUN apk update && apk upgrade && apk add --update --no-cache sipp curl postgresql-client bind-tools nodejs npm tshark sox ffmpeg tcpdump
+RUN apk update && apk upgrade && apk add --update --no-cache python3 sipp curl postgresql-client bind-tools nodejs npm tshark sox ffmpeg tcpdump
WORKDIR /testing
diff --git a/components/testing/docker-entrypoint.sh b/components/testing/docker-entrypoint.sh
index 7b4ebcc3a..ab797ab7f 100755
--- a/components/testing/docker-entrypoint.sh
+++ b/components/testing/docker-entrypoint.sh
@@ -2,9 +2,11 @@
if [ "$1" = 'start' ]; then
WS_SERVER_PORT="${WS_SERVER_PORT:="3001"}"
+ HTTP_SERVER_PORT="${HTTP_SERVER_PORT:="8000"}"
sipp -sf ./scenarios/uas.xml -bg -trace_msg
nohup node ./support/ws_server/test_server.js --port "$WS_SERVER_PORT" > test-server.log &
+ nohup python3 -m http.server $HTTP_SERVER_PORT > http-server.log &
tail -f /dev/null
fi
diff --git a/components/testing/scenarios/uac_connect.xml b/components/testing/scenarios/uac_connect.xml
index 2782027aa..3d4716d07 100644
--- a/components/testing/scenarios/uac_connect.xml
+++ b/components/testing/scenarios/uac_connect.xml
@@ -88,6 +88,7 @@
+
@@ -97,33 +98,32 @@
+
-
-
- verb -->
+
+
- BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp ;tag=[pid]SIPpTag09[call_number]
- To: [service] [peer_tag_param]
- Call-ID: [call_id]
- CSeq: 2 BYE
- Contact: sip:+85512234567@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
+
+
+
+
+
Content-Length: 0
- [routes]
]]>
-
-
-
-
diff --git a/components/testing/tests/public_gateway/connect_stream_test.sh b/components/testing/tests/public_gateway/connect_stream_test.sh
index 69d449887..d70e78f43 100755
--- a/components/testing/tests/public_gateway/connect_stream_test.sh
+++ b/components/testing/tests/public_gateway/connect_stream_test.sh
@@ -34,23 +34,39 @@ reset_db
# kill tcpdump
kill $tcpdump_pid
-# extract audio
+# extract RTP from PCAP
tshark -n -r $artifacts_dir/uac_connect.pcap -2 -R rtp -T fields -e rtp.payload | tr -d '\n',':' | xxd -r -p > $artifacts_dir/uac_connect.rtp
+# Convert RTP to wav
sox -t al -r 8000 -c 1 $artifacts_dir/uac_connect.rtp $artifacts_dir/uac_connect_full_audio.wav
-ffmpeg -y -i $artifacts_dir/uac_connect_full_audio.wav -ss 6.3 $artifacts_dir/uac_connect_callee_audio.wav 2> /dev/null
-ffmpeg -y -i $artifacts_dir/uac_connect_callee_audio.wav -af silenceremove=1:0:-40dB,areverse,silenceremove=1:0:-50dB,areverse $artifacts_dir/uac_connect_trimmed_callee_audio.wav 2> /dev/null
-
-actual_md5=$(md5sum $artifacts_dir/uac_connect_trimmed_callee_audio.wav | head -c 32)
-expected_md5="328489d203813f6e216a1d77c41b3ad9"
-
-echo "Act MD5: $actual_md5"
-echo "Exp MD5: $expected_md5"
+# Cut the audio from the ws server
+ffmpeg -y -i $artifacts_dir/uac_connect_full_audio.wav -ss 6.3 -to 9 $artifacts_dir/uac_connect_ws_server_audio.wav 2> /dev/null
+# Remove silence
+ffmpeg -y -i $artifacts_dir/uac_connect_ws_server_audio.wav -af silenceremove=1:0:-40dB,areverse,silenceremove=1:0:-50dB,areverse $artifacts_dir/uac_connect_trimmed_ws_server_audio.wav 2> /dev/null
+# Cut the play verb audio
+ffmpeg -y -i $artifacts_dir/uac_connect_full_audio.wav -ss 9 $artifacts_dir/uac_connect_play_verb_audio.wav 2> /dev/null
+# Remove silence
+ffmpeg -y -i $artifacts_dir/uac_connect_play_verb_audio.wav -af silenceremove=1:0:-40dB,areverse,silenceremove=1:0:-50dB,areverse $artifacts_dir/uac_connect_trimmed_play_verb_audio.wav 2> /dev/null
+
+ws_server_audio_md5=$(md5sum $artifacts_dir/uac_connect_trimmed_ws_server_audio.wav | head -c 32)
+expected_ws_server_audio_md5="328489d203813f6e216a1d77c41b3ad9"
+
+play_verb_audio_md5=$(md5sum $artifacts_dir/uac_connect_trimmed_play_verb_audio.wav | head -c 32)
+expected_play_verb_audio_md5="1876af04af732feae7f5fac634314187"
+
+echo "Actual ws_server_audio_md5: $ws_server_audio_md5"
+echo "Expected ws_server_audio_md5: $expected_ws_server_audio_md5"
+echo "Actual play_verb_audio_md5: $play_verb_audio_md5"
+echo "Expected play_verb_audio_md5: $expected_play_verb_audio_md5"
+
+if [[ "$ws_server_audio_md5" != "$expected_ws_server_audio_md5" ]]; then
+ exit 1
+fi
-if [[ "$actual_md5" != "$expected_md5" ]]; then
+if [[ "$play_verb_audio_md5" != "$expected_play_verb_audio_md5" ]]; then
exit 1
fi
-# Assert correct IP in SDP
+# Assert correct IP in SDP
if ! assert_in_file $log_file "c=IN IP4 $media_server"; then
exit 1
fi
diff --git a/components/testing/tests/support/files/taunt.wav b/components/testing/tests/support/files/taunt.wav
new file mode 100644
index 000000000..794b83223
Binary files /dev/null and b/components/testing/tests/support/files/taunt.wav differ
diff --git a/docker-compose.yml b/docker-compose.yml
index be5a3ac93..76803293d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -137,6 +137,7 @@ services:
AHN_CORE_HOST: freeswitch
CALL_PLATFORM_STUB_RESPONSES: "true"
CONNECT_WS_SERVER_URL: "ws://testing:3001"
+ AUDIO_FILE_URL: "http://testing:8000/tests/support/files/taunt.wav"
AHN_CORE_HTTP_PORT: "8080"
AWS_DEFAULT_REGION: "ap-southeast-1"
REDIS_URL: "redis://redis:6379/1"
@@ -162,6 +163,7 @@ services:
DATABASE_USERNAME: postgres
FIFO_DIR: /opensips/fifo
WS_SERVER_PORT: 3001
+ HTTP_SERVER_PORT: 8000
extra_hosts:
- "host.docker.internal:host-gateway"
volumes: