Skip to content

Commit

Permalink
Fix media port for testing connect
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Mar 12, 2024
1 parent a08f4f6 commit 7fec19e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion components/app/app/models/execute_twiml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def execute_connect(verb)
url:,
mix_type: "mono",
sampling_rate: "16k",
metadata: {foo: "bar"}.to_json
# metadata: {foo: "bar"}.to_json
)

logger.info("-----ABOUT TO EXECUTE AUDIO FORK---------")
Expand Down
7 changes: 3 additions & 4 deletions components/freeswitch/conf/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<X-PRE-PROCESS cmd="set" data="log_directory=/var/log/freeswitch"/>

<!-- IP Addresses -->
<X-PRE-PROCESS cmd="set" data="external_rtp_ip=0.0.0.0"/>
<X-PRE-PROCESS cmd="set" data="alternative_rtp_ip=0.0.0.0"/>
<X-PRE-PROCESS cmd="set" data="alternative_sip_outbound_ip=0.0.0.0"/>
<X-PRE-PROCESS cmd="exec-set" data="external_rtp_ip=hostname -i"/>
<X-PRE-PROCESS cmd="exec-set" data="alternative_rtp_ip=hostname -i"/>
<X-PRE-PROCESS cmd="exec-set" data="alternative_sip_outbound_ip=hostname -i"/>
<X-PRE-PROCESS cmd="set" data="sip_port=5060"/>
<X-PRE-PROCESS cmd="set" data="sip_alternative_port=5080"/>

Expand All @@ -30,4 +30,3 @@
<X-PRE-PROCESS cmd="set" data="recordings_bucket_secret_access_key=secret"/>
<X-PRE-PROCESS cmd="set" data="recordings_bucket_name=recording"/>
<X-PRE-PROCESS cmd="set" data="recordings_bucket_region=ap-southeast-1"/>

12 changes: 6 additions & 6 deletions components/testing/scenarios/uac_pcap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
<recv response="100" optional="true">
</recv>

<recv response="180" optional="true">
<recv response="183" optional="true">
</recv>

<!-- By adding rrs="true" (Record Route Sets), the route sets -->
<!-- are saved and used for following messages sent. Useful to test -->
<!-- against stateful SIP proxies/B2BUAs. -->
<recv response="200" rtd="true" crlf="true">
<recv response="200" rtd="true" rrs="true">
</recv>

<!-- Packet lost can be simulated in any send/recv message by -->
Expand All @@ -77,14 +77,14 @@
Max-Forwards: 70
Subject: Performance Test
Content-Length: 0
[routes]
]]>
</send>

<!-- Play a pre-recorded PCAP file (RTP stream) -->
<nop>
<action>
<exec play_pcap_audio="pcap/g711a.pcap"/>
<exec play_pcap_audio="/usr/share/sipp/g711a.pcap"/>
</action>
</nop>

Expand All @@ -95,7 +95,7 @@
<!-- Play an out of band DTMF '1' -->
<nop>
<action>
<exec play_pcap_audio="pcap/dtmf_2833_1.pcap"/>
<exec play_pcap_audio="/usr/share/sipp/dtmf_2833_1.pcap"/>
</action>
</nop>

Expand All @@ -115,7 +115,7 @@
Max-Forwards: 70
Subject: Performance Test
Content-Length: 0
[routes]
]]>
</send>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ source $current_dir/../support/test_helpers.sh

scenario=$current_dir/../../scenarios/uac_pcap.xml

log_file="uac_pcap_*_messages.log"
rm -f $log_file

media_server="$(dig +short freeswitch)"

reset_db
create_load_balancer_entry "gw" "5060"
create_address_entry $(hostname -i)
reload_opensips_tables

rm -f uac_*_messages.log
sipp -sf $scenario public_gateway:5060 -key username "+855715100850" -s 2222 -m 1 -trace_msg > /dev/null

reset_db

# Assert correct IP in SDP
if ! assert_in_file "uac_*_messages.log" "c=IN IP4 13.250.230.15"; then
if ! assert_in_file $log_file "c=IN IP4 $media_server"; then
exit 1
fi
8 changes: 6 additions & 2 deletions components/testing/tests/public_gateway/inbound_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ source $current_dir/../support/test_helpers.sh

scenario=$current_dir/../../scenarios/smart_inbound.xml

log_file="smart_inbound_*_messages.log"
rm -f $log_file

media_server="$(dig +short freeswitch)"

reset_db
create_load_balancer_entry "gw" "5060"
create_address_entry $(hostname -i)
reload_opensips_tables

rm -f smart_inbound_*_messages.log
sipp -sf $scenario public_gateway:5060 -s 1234 -m 1 -trace_msg > /dev/null

reset_db

# Assert correct IP in SDP
if ! assert_in_file "smart_inbound_*_messages.log" "c=IN IP4 13.250.230.15"; then
if ! assert_in_file $log_file "c=IN IP4 $media_server"; then
exit 1
fi
3 changes: 2 additions & 1 deletion components/testing/tests/public_gateway/outbound_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ log_file=$(find . -type f -iname "uas_*_messages.log")
cat /dev/null > $log_file

uas="$(dig +short testing)"
media_server="$(dig +short freeswitch)"

curl -s -o /dev/null -XPOST -u "adhearsion:password" http://switch-app:8080/calls \
-H 'Content-Type: application/json; charset=utf-8' \
Expand Down Expand Up @@ -42,7 +43,7 @@ EOF

sleep 10

if ! assert_in_file $log_file "c=IN IP4 13.250.230.15"; then
if ! assert_in_file $log_file "c=IN IP4 $media_server"; then
exit 1
fi

Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
FS_EXTERNAL_RTP_IP: "13.250.230.15"
FS_ALTERNATIVE_RTP_IP: "18.141.245.230"
expose:
- "5060/udp"
Expand All @@ -115,7 +114,7 @@ services:
AHN_CORE_HOST: freeswitch
CALL_PLATFORM_STUB_RESPONSES: "true"
# CALL_PLATFORM_WS_SERVER_URL: "ws://host.docker.internal:9292/cable"
CALL_PLATFORM_WS_SERVER_URL: "ws://host.docker.internal:3001"
CALL_PLATFORM_WS_SERVER_URL: "ws://testing:3001"
AHN_CORE_HTTP_PORT: "8080"
AWS_DEFAULT_REGION: "ap-southeast-1"
healthcheck:
Expand Down

0 comments on commit 7fec19e

Please sign in to comment.