Skip to content

Just like Google "Hold for Me". Maybe useful if original is not available for you.

License

Notifications You must be signed in to change notification settings

predkambrij/Hold-for-Me-using-ADB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hold For Me using ADB

A script that monitors your phone call and alerts you when someone picks up, so you don't have to listen on hold music. Uses Android's Live Caption feature + OpenAI to detect when a human answers.

Requirements

  • Live Caption enabled on your phone
  • USB debugging on your phone
  • OpenAI API key
  • xmllint, jq, spd-say, adb, curl (or using Docker)

Setup

Copy the sample config and add your OpenAI API key:

cp config.sample.sh config.sh
# Edit config.sh with your OPENAI_API_KEY

Connect your phone via ADB:

adb devices  # Verify connection

Run the script:

./run_live.sh

Setup using Docker

docker compose build
docker compose run --rm -it app adb devices
docker compose run --rm -it app /app/run_live.sh

Example output (no answer)

$ ./run_live.sh 
[20:48:14] Saved: dump1/20251224_204814_1.xml (md5: 4b3a9d95369e3bc9a0b82295be4b2a76)
XXX
All of our representatives are currently busy.
(Music)
(Music)
Representatives are currently busy.
(Music)
All of our representatives are currently busy.
(Music)
XXX
HOLD
[20:48:23] No change (md5: 4b3a9d95369e3bc9a0b82295be4b2a76)    
[20:48:28] Saved: dump1/20251224_204828_2.xml (md5: ef17731a6e401ffd88c767cf18649f8c)
XXX
(Music)
Representatives are currently busy.
(Music)
All of our representatives are currently busy.
(Music)
All that representatives are currently busy.
XXX
HOLD
^C

Example output (simulated answer)

$ ./run_live.sh 
[20:49:46] Saved: dump1/20251224_204946_1.xml (md5: f4374a50e8aee4c26d01f8a5353b8461)
XXX
All that representatives are currently busy.
(Music)
Of a representatives are currently busy.
(Music)
All the representatives are currently busy.
(Music)
XXX
HOLD
!!! CHECK CALL !!!
Press 'c' to continue monitoring, Ctrl+C to stop the script
cContinuing...
[20:49:58] No change (md5: f4374a50e8aee4c26d01f8a5353b8461)    ^C

Example output (using Docker)

$ docker compose run --rm -it app /app/run_live.sh
[02:00:18] Saved: dump1/20251226_020018_1.xml (md5: 771e176bf22c95ea7e991bb0ef13ff23)
XXX
[Call started. Captions will appear here.]
…
(Music)
(Music)
Representatives are currently busy.
(Music)
XXX
HOLD
[02:00:29] No change (md5: 771e176bf22c95ea7e991bb0ef13ff23)    ^C

Example Call With Live Captions

Example Call With Live Captions

Troubleshooting

Make sure that you tab on Live Caption, so it's focused, otherwise adb will read other things.

Run the following to see what's captured.

Dialer in focus:

$ adb exec-out uiautomator dump /dev/tty 2>/dev/null | sed 's|UI hierchary dumped to: /dev/tty||' | xmllint --format - | grep -oP '(?<=text=")[^"]*'
03:45
<redacted>
Add call
Video call
Bluetooth
Speaker
Mute
Keypad

Live Caption in focus:

$ adb exec-out uiautomator dump /dev/tty 2>/dev/null | sed 's|UI hierchary dumped to: /dev/tty||' | xmllint --format - | grep -oP '(?<=text=")[^"]*'
(Music)
Representatives are currently busy.
(Music)
All of our representatives are currently busy.
(Music)
All of our representatives are currently busy.
(Music)

About

Just like Google "Hold for Me". Maybe useful if original is not available for you.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages