Change extra button to only work during recording phase

- Extra button now only responds during actual recording
- Does not work during greeting playback or when on-hook
- Updated logic from checking off-hook status to checking recording status
- Updated README to reflect recording-only behavior

This allows guests to add sound effects to their recorded message
without interrupting the initial greeting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-24 15:41:25 +07:00
parent 3b08c5f88b
commit 4d608555cc
2 changed files with 11 additions and 10 deletions

View File

@@ -189,13 +189,14 @@ The web interface provides four main sections:
### Extra Button Operation (Optional) ### Extra Button Operation (Optional)
If enabled in `config.json`: If enabled in `config.json`:
1. **Guest picks up phone**: Phone goes off-hook 1. **Guest picks up phone**: Phone goes off-hook, greeting plays
2. **Guest presses button**: System detects GPIO signal (only works when off-hook) 2. **Recording starts**: After greeting finishes
3. **Sound plays**: Configured button sound plays through speaker 3. **Guest presses button**: System detects GPIO signal (only works during recording)
4. **Can be pressed multiple times**: Works during greeting or recording 4. **Sound plays**: Configured button sound plays through speaker
5. **Debounced**: 0.5s delay prevents accidental double-presses 5. **Can be pressed multiple times**: Works throughout the recording phase
6. **Debounced**: 0.5s delay prevents accidental double-presses
**Note:** Button only responds when handset is off-hook (during active call) **Note:** Button only responds during the recording phase (not during greeting or when on-hook)
### Greeting Delay (Optional) ### Greeting Delay (Optional)

View File

@@ -319,13 +319,13 @@ class RotaryPhone:
} }
def play_extra_button_sound(self): def play_extra_button_sound(self):
"""Play sound when extra button is pressed (only when off-hook/in call)""" """Play sound when extra button is pressed (only during recording)"""
if not EXTRA_BUTTON_ENABLED: if not EXTRA_BUTTON_ENABLED:
return return
# Only play if phone is OFF hook (during a call) # Only play if currently recording
if self.phone_status != "off_hook": if not self.recording:
print("Extra button ignored - phone is on hook") print("Extra button ignored - not recording")
return return
button_sound = self.get_extra_button_sound_path() button_sound = self.get_extra_button_sound_path()