Skip to content

Instantly share code, notes, and snippets.

@denalena
Created July 24, 2024 12:19
Show Gist options
  • Save denalena/b043b2f46fe9475c37c01a16c923efc3 to your computer and use it in GitHub Desktop.
Save denalena/b043b2f46fe9475c37c01a16c923efc3 to your computer and use it in GitHub Desktop.
some sketches for a SIP doorbell prototype
#!/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
#!/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