Created
July 24, 2024 12:19
-
-
Save denalena/b043b2f46fe9475c37c01a16c923efc3 to your computer and use it in GitHub Desktop.
some sketches for a SIP doorbell prototype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect -f | |
# Set the SIP account details | |
set sip_account "cuteUsername" | |
set sip_password "superSecretPassword" | |
set sip_domain "fritz.box" | |
set destination "sip:**9@fritz.box" | |
# **9 is a call group for every phone in my fritzbox | |
# not sure if this is a common thing | |
# Start linphonec | |
spawn linphonec | |
# Wait for linphonec prompt | |
expect "linphonec>" | |
# Register the SIP client | |
send "register sip:$sip_account@$sip_domain $sip_password\n" | |
expect "linphonec>" | |
# Make the call | |
send "call $destination\n" | |
expect "linphonec>" | |
# Wait for 10 seconds to keep the call active | |
sleep 10 | |
# Hang up the call | |
send "terminate\n" | |
expect "linphonec>" | |
# Exit linphonec | |
send "quit\n" | |
expect eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from gpiozero import Button | |
import subprocess | |
import signal | |
import sys | |
# Set up GPIO 21 as an input | |
button = Button(21) | |
# Define the function to run the bash script | |
def run_script(): | |
subprocess.run(["/path/to/call.sh"]) | |
# Attach the function to the button press event | |
button.when_pressed = run_script | |
# Keep the script running | |
def signal_handler(sig, frame): | |
sys.exit(0) | |
signal.signal(signal.SIGINT, signal_handler) | |
signal.pause() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment