From de45c413ae804a4a2e4e47ad5cacaa51d3796995 Mon Sep 17 00:00:00 2001 From: NicknineTheEagle Date: Thu, 19 Mar 2020 20:15:18 +0300 Subject: [PATCH] Fix auto-answer (S0) behavior in modem --- src/hardware/serialport/softmodem.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hardware/serialport/softmodem.cpp b/src/hardware/serialport/softmodem.cpp index 82f8c531..665c99bf 100644 --- a/src/hardware/serialport/softmodem.cpp +++ b/src/hardware/serialport/softmodem.cpp @@ -328,7 +328,7 @@ void CSerialModem::DoCommand() { LOG_MSG("Command sent to modem: ->%s<-\n", cmdbuf); /* Check for empty line, stops dialing and autoanswer */ if (!cmdbuf[0]) { - reg[0] = 0; // autoanswer off + reg[MREG_AUTOANSWER_COUNT] = 0; // autoanswer off return; } //else { @@ -795,14 +795,15 @@ void CSerialModem::Timer2(void) { CSerial::setRI(!CSerial::getRI()); //MIXER_Enable(mhd.chan,true); ringtimer = 3000; - reg[1] = 0; //Reset ring counter reg + reg[MREG_RING_COUNT] = 0; //Reset ring counter reg } } } if (ringing) { if (ringtimer <= 0) { - reg[1]++; - if ((reg[0] > 0) && (reg[0] >= reg[1])) { + reg[MREG_RING_COUNT]++; + if ((reg[MREG_AUTOANSWER_COUNT] > 0) && + (reg[MREG_RING_COUNT] >= reg[MREG_AUTOANSWER_COUNT])) { AcceptIncomingCall(); return; }