Compare commits
2 Commits
c07cb297e3
...
9ddb54d319
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ddb54d319 | |||
| 61eb2bc895 |
BIN
baresip-test-config.tar.gz
Normal file
BIN
baresip-test-config.tar.gz
Normal file
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
<sip:yellow@probablycorey.sip.twilio.com;transport=tls>;auth_pass=zgm-kwx2bug5hwf3YGF;unregister_on_exit=yes
|
<sip:yellow@probablycorey.sip.twilio.com>;auth_pass=zgm-kwx2bug5hwf3YGF;unregister_on_exit=yes
|
||||||
|
|
@ -1,75 +1,26 @@
|
||||||
#
|
|
||||||
# baresip configuration
|
|
||||||
#
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Core
|
|
||||||
poll_method epoll # poll, select, epoll ..
|
|
||||||
|
|
||||||
# Call
|
|
||||||
call_local_timeout 120
|
|
||||||
call_max_calls 4
|
call_max_calls 4
|
||||||
|
call_local_timeout 120
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
audio_player alsa,default
|
audio_player alsa,default
|
||||||
audio_source alsa,default
|
audio_source alsa,default
|
||||||
audio_alert none
|
audio_alert alsa,default
|
||||||
audio_alert_enable no
|
|
||||||
audio_level no
|
|
||||||
ring_aufile /dev/null
|
ring_aufile /dev/null
|
||||||
ausrc_format s16 # s16, float, ..
|
|
||||||
auplay_format s16 # s16, float, ..
|
|
||||||
auenc_format s16 # s16, float, ..
|
|
||||||
audec_format s16 # s16, float, ..
|
|
||||||
audio_buffer 20-160 # ms
|
|
||||||
|
|
||||||
# AVT - Audio/Video Transport
|
|
||||||
rtp_tos 184
|
|
||||||
rtcp_mux no
|
|
||||||
jitter_buffer_delay 5-10 # frames
|
|
||||||
rtp_stats no
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# Modules
|
# Modules
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
module_path /usr/lib/baresip/modules
|
module_path /usr/lib/baresip/modules
|
||||||
|
|
||||||
# UI Modules
|
# Audio codec Modules
|
||||||
#module stdio.so
|
|
||||||
|
|
||||||
# Audio codec Modules (in order)
|
|
||||||
module g711.so
|
module g711.so
|
||||||
|
|
||||||
|
|
||||||
# Audio driver Modules
|
# Audio driver Modules
|
||||||
module alsa.so
|
module alsa.so
|
||||||
|
|
||||||
# Media NAT modules
|
|
||||||
module stun.so
|
|
||||||
module turn.so
|
|
||||||
module ice.so
|
|
||||||
|
|
||||||
# STUN Server
|
|
||||||
stun_host stun.l.google.com
|
|
||||||
stun_port 19302
|
|
||||||
|
|
||||||
module httpd.so
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# Temporary Modules (loaded then unloaded)
|
|
||||||
|
|
||||||
module uuid.so
|
|
||||||
module account.so
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# Application Modules
|
# Application Modules
|
||||||
|
module_app account.so
|
||||||
module_app contact.so
|
|
||||||
module_app debug_cmd.so
|
|
||||||
module_app menu.so
|
module_app menu.so
|
||||||
|
|
||||||
|
module httpd.so
|
||||||
http_listen 0.0.0.0:8000 # httpd - HTTP Serve
|
|
||||||
|
|
@ -73,9 +73,12 @@ export class WaitingSounds {
|
||||||
log(`🛑 Stopping waiting sounds. Has typingPlayback: ${!!this.typingPlayback}`)
|
log(`🛑 Stopping waiting sounds. Has typingPlayback: ${!!this.typingPlayback}`)
|
||||||
if (!this.typingPlayback) return
|
if (!this.typingPlayback) return
|
||||||
|
|
||||||
await Promise.all([this.typingPlayback.stop(), this.speakingPlayback?.finished()])
|
// Quicky undefine this to stop the loops
|
||||||
log("🛑 Waiting sounds stopped")
|
const typingPlayback = this.typingPlayback
|
||||||
this.typingPlayback = undefined
|
this.typingPlayback = undefined
|
||||||
|
|
||||||
|
await Promise.all([typingPlayback.stop(), this.speakingPlayback?.finished()])
|
||||||
|
log("🛑 Waiting sounds stopped")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
64
test-baresip-calls.sh
Executable file
64
test-baresip-calls.sh
Executable file
|
|
@ -0,0 +1,64 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Test script to call the Pi's baresip every 5 minutes
|
||||||
|
# This will help verify the NAT connection stays alive
|
||||||
|
|
||||||
|
ACCOUNT_SID="AC1290bf86af061f24406c6762f48fa24e"
|
||||||
|
AUTH_TOKEN="6bfac57e5e26ea52c841594ef8d99ed1"
|
||||||
|
FROM_NUMBER="+13476229543"
|
||||||
|
TO_SIP="sip:yellow@probablycorey.sip.us1.twilio.com"
|
||||||
|
LOG_FILE="baresip-test-results.log"
|
||||||
|
|
||||||
|
echo "=== Baresip Call Test Started at $(date) ===" | tee -a $LOG_FILE
|
||||||
|
echo "Will call every 5 minutes. Press Ctrl+C to stop." | tee -a $LOG_FILE
|
||||||
|
echo "" | tee -a $LOG_FILE
|
||||||
|
|
||||||
|
call_count=0
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
call_count=$((call_count + 1))
|
||||||
|
echo "[$(date)] Test call #$call_count" | tee -a $LOG_FILE
|
||||||
|
|
||||||
|
# Make the call
|
||||||
|
CALL_SID=$(curl -s -X POST "https://api.twilio.com/2010-04-01/Accounts/$ACCOUNT_SID/Calls.json" \
|
||||||
|
-u "$ACCOUNT_SID:$AUTH_TOKEN" \
|
||||||
|
--data-urlencode "Url=http://demo.twilio.com/docs/voice.xml" \
|
||||||
|
--data-urlencode "To=$TO_SIP" \
|
||||||
|
--data-urlencode "From=$FROM_NUMBER" \
|
||||||
|
| jq -r '.sid')
|
||||||
|
|
||||||
|
echo " Call SID: $CALL_SID" | tee -a $LOG_FILE
|
||||||
|
|
||||||
|
# Wait for call to complete
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
# Check status
|
||||||
|
STATUS=$(curl -s "https://api.twilio.com/2010-04-01/Accounts/$ACCOUNT_SID/Calls/$CALL_SID.json" \
|
||||||
|
-u "$ACCOUNT_SID:$AUTH_TOKEN" \
|
||||||
|
| jq -r '.status')
|
||||||
|
|
||||||
|
echo " Status: $STATUS" | tee -a $LOG_FILE
|
||||||
|
|
||||||
|
# Check for errors
|
||||||
|
ERROR=$(curl -s "https://api.twilio.com/2010-04-01/Accounts/$ACCOUNT_SID/Calls/$CALL_SID/Notifications.json" \
|
||||||
|
-u "$ACCOUNT_SID:$AUTH_TOKEN" \
|
||||||
|
| jq -r '.notifications[0].error_code // "none"')
|
||||||
|
|
||||||
|
if [ "$ERROR" != "none" ]; then
|
||||||
|
echo " ❌ ERROR: $ERROR" | tee -a $LOG_FILE
|
||||||
|
ERROR_MSG=$(curl -s "https://api.twilio.com/2010-04-01/Accounts/$ACCOUNT_SID/Calls/$CALL_SID/Notifications.json" \
|
||||||
|
-u "$ACCOUNT_SID:$AUTH_TOKEN" \
|
||||||
|
| jq -r '.notifications[0].message_text')
|
||||||
|
echo " Message: $ERROR_MSG" | tee -a $LOG_FILE
|
||||||
|
elif [ "$STATUS" = "no-answer" ] || [ "$STATUS" = "completed" ]; then
|
||||||
|
echo " ✓ Success" | tee -a $LOG_FILE
|
||||||
|
else
|
||||||
|
echo " ⚠ Unexpected status: $STATUS" | tee -a $LOG_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" | tee -a $LOG_FILE
|
||||||
|
|
||||||
|
# Wait 5 minutes (minus the 10 seconds we already waited)
|
||||||
|
echo " Waiting 5 minutes until next call..." | tee -a $LOG_FILE
|
||||||
|
sleep 290
|
||||||
|
done
|
||||||
Loading…
Reference in New Issue
Block a user