From 61eb2bc895016cc8d0affbf7235aa334f08f7623 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Sun, 23 Nov 2025 15:40:22 -0800 Subject: [PATCH] wip --- baresip-test-config.tar.gz | Bin 0 -> 1890 bytes baresip/accounts | 2 +- baresip/old-accounts | 1 + baresip/old-config | 24 ++++++++++++++ src/utils/waiting-sounds.ts | 7 ++-- test-baresip-calls.sh | 64 ++++++++++++++++++++++++++++++++++++ 6 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 baresip-test-config.tar.gz create mode 100644 baresip/old-accounts create mode 100644 baresip/old-config create mode 100755 test-baresip-calls.sh diff --git a/baresip-test-config.tar.gz b/baresip-test-config.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..ce97ecabafce77f08878bc4e38e7950e81c56e83 GIT binary patch literal 1890 zcmV-o2c7sIiwFR`IU{KR1MOVhZrjKeb_*1R*z5MTgmkyCs3AEdC2N&hal45Z@pilR z1__FS7?DGXG09=cp=BlL1N5Tzy)F7UeTKeE&yf1DWXDnfQR&9>*)qvFXMWC*XXZOc zgf*9V9xD=_AJqngkd2Tkj*e}WM`YmYSe=`yZs|J0*fDfnMY?Gse59iKhO|PFbCSVO zJeJYfBYL0~1dqroQ`F`0r-EPn=9fo5KRUV~p8Cg2^^H1*C_8Gv$AHgY;Ulj9y<3yR ztE(U8r=rF`;q$8vm7lH3f9(sXnZ1sQSZ1}&0Fgj9i_dk^Tc;fzV^wgM#F&*fRZFViVPd&}Cx(4c5mSQ>T ztMli>AI@H$zy5=EOE}N8hrD$#{L^qa!zc)S^p0Il72H!Vq0+0jk5#(k;>zcqh9`^q zcmM7FuRCaS|3|hh_y0rS>pVyv^{+?3?` z;QcsmUr%q1Q8BhA)4+WD;+uX($6>+;HtHvYr(rT-5gp8E-Y*g%$~nzkmbmmb>rN%E9se88i8 zTQmT5Aq*I>f{)c6>9*X2JV!FL*q8 zlV6)J&!fxfi&rLp&O6<~ooK4=@JVw$mIUE=Zw)?xPs;yWBK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644 --- a/baresip/accounts +++ b/baresip/accounts @@ -1 +1 @@ -;auth_pass=zgm-kwx2bug5hwf3YGF;unregister_on_exit=yes \ No newline at end of file +;auth_pass=zgm-kwx2bug5hwf3YGF;unregister_on_exit=yes \ No newline at end of file diff --git a/baresip/old-accounts b/baresip/old-accounts new file mode 100644 index 0000000..8493601 --- /dev/null +++ b/baresip/old-accounts @@ -0,0 +1 @@ +;auth_pass=zgm-kwx2bug5hwf3YGF;unregister_on_exit=yes \ No newline at end of file diff --git a/baresip/old-config b/baresip/old-config new file mode 100644 index 0000000..b5d910e --- /dev/null +++ b/baresip/old-config @@ -0,0 +1,24 @@ +call_max_calls 4 +call_local_timeout 120 + +# Audio +audio_player alsa,default +audio_source alsa,default +audio_alert alsa,default + +# Modules +#------------------------------------------------------------------------------ + +module_path /usr/lib/baresip/modules + +# Audio codec Modules +module g711.so + +# Audio driver Modules +module alsa.so + +# Application Modules +module_app account.so +module_app menu.so + +module httpd.so \ No newline at end of file diff --git a/src/utils/waiting-sounds.ts b/src/utils/waiting-sounds.ts index 4a316ec..3b0c49a 100644 --- a/src/utils/waiting-sounds.ts +++ b/src/utils/waiting-sounds.ts @@ -73,9 +73,12 @@ export class WaitingSounds { log(`🛑 Stopping waiting sounds. Has typingPlayback: ${!!this.typingPlayback}`) if (!this.typingPlayback) return - await Promise.all([this.typingPlayback.stop(), this.speakingPlayback?.finished()]) - log("🛑 Waiting sounds stopped") + // Quicky undefine this to stop the loops + const typingPlayback = this.typingPlayback this.typingPlayback = undefined + + await Promise.all([typingPlayback.stop(), this.speakingPlayback?.finished()]) + log("🛑 Waiting sounds stopped") } } diff --git a/test-baresip-calls.sh b/test-baresip-calls.sh new file mode 100755 index 0000000..adcad3e --- /dev/null +++ b/test-baresip-calls.sh @@ -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