Skip to content

Instantly share code, notes, and snippets.

@av1d
Last active August 20, 2021 19:29
Show Gist options
  • Save av1d/910033e08bdee0601644b8bb0a9669de to your computer and use it in GitHub Desktop.
Save av1d/910033e08bdee0601644b8bb0a9669de to your computer and use it in GitHub Desktop.
Control FCEUX NES emulator via VoIP or landline/DTMF phone using Asterisk PBX
; requires FCEUX and xdotool. Map keys in FCEUX according to the letters below.
; Start - d, up - i, left - j, right -k, down - m, B - b, A - a
[NESTERIX]
exten => s,1,Answer(500)
same => n(loop),Background(press)
same => n,WaitExten()
exten => 0,1,NoOp("Dialed 0 - Pressed START on NES")
same => n,System(xxx=$(xdotool search --name "Fceux 2.2.2") && xdotool windowactivate "$xxx" && xdotool key --delay 250 --clearmodifiers --window "$xxx" "d")
same => n,Goto(s,loop)
exten => 2,1,NoOp("Dialed 2 - Pressed UP on NES")
same => n,System(xxx=$(xdotool search --name "Fceux 2.2.2") && xdotool windowactivate "$xxx" && xdotool key --delay 250 --clearmodifiers --window "$xxx" "i")
same => n,Goto(s,loop)
exten => 4,1,NoOp("Dialed 4 - Pressed LEFT on NES")
same => n,System(xxx=$(xdotool search --name "Fceux 2.2.2") && xdotool windowactivate "$xxx" && xdotool key --delay 250 --clearmodifiers --window "$xxx" "j")
same => n,Goto(s,loop)
exten => 6,1,NoOp("Dialed 6 - Pressed RIGHT on NES")
same => n,System(xxx=$(xdotool search --name "Fceux 2.2.2") && xdotool windowactivate "$xxx" && xdotool key --delay 250 --clearmodifiers --window "$xxx" "k")
same => n,Goto(s,loop)
exten => 8,1,NoOp("Dialed 8 - Pressed DOWN on NES")
same => n,System(xxx=$(xdotool search --name "Fceux 2.2.2") && xdotool windowactivate "$xxx" && xdotool key --delay 250 --clearmodifiers --window "$xxx" "m")
same => n,Goto(s,loop)
exten => #,1,NoOp("Dialed # - Pressed B on NES")
same => n,System(xxx=$(xdotool search --name "Fceux 2.2.2") && xdotool windowactivate "$xxx" && xdotool key --delay 250 --clearmodifiers --window "$xxx" "b")
same => n,Goto(s,loop)
exten => *,1,NoOp("Dialed * - Pressed A on NES")
same => n,System(xxx=$(xdotool search --name "Fceux 2.2.2") && xdotool windowactivate "$xxx" && xdotool key --delay 250 --clearmodifiers --window "$xxx" "a")
same => n,Goto(s,loop)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment