emxsys/callattendant

+VSD Silence Detection command not working on Conextant-based modems

emxsys opened this issue · 2 comments

Problem: The modem, after answering a call, does not detect/report the silence after the caller hangs up. Upon investigation, I note the modem accepts, but does not apply, the provided silence detection settings.

Test details: I opened up a terminal session with the modem (using minicom on Linux) and attempted to set a silence detection of 5 seconds in voice mode. The modem accepts the +VSD=128,50 command, but the silence detection remains disabled (0 seconds), as reported by the modem. This can be seen in the following minicom log, annotated with my comments.


Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyACM0, 13:33:04

Press CTRL-A Z for help on special keys

I entered atz to reset the modem
OK

I entered ate1 to echo my commands to the screen
OK

at
OK

at+vsd? # query silence detection settings before entering voice mode
ERROR # returned expected error: not in voice mode

at+fclass=8 # enter voice mode
OK

at+vsd? # query silence detection settings
128,0 # returned silence detection disabled: 0 secs
OK

at+vsd=? # query silence detection accepted parameter values
(0-255),(0-255)
OK

at+vsd=128,50 # set silence detection to 5 seconds
OK

at+vsd # query silence detection settings
128,0 # silence detection is still disabled. Expected 128,50
OK

Hello,
Same result here:

Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyACM0, 14:56:17

Press CTRL-A Z for help on special keys

atz
OK
ate1
OK
at
OK
at+vsd?
ERROR
at+fclass=8
OK
at+vsd?
128,0
OK
at+vsd=?
(0-255),(0-255)

OK
at+vsd128,50
ERROR
at+vsd=128,50
OK
at+vsd?
128,0
OK

Event if you try another numbers, the result is the same:

at+vsd=127,70
OK
at+vsd?
128,0
OK

Maybe a kind of "commit" command needs to be type after the "at+vsd=xxx,xxx" or maybe this command is unsupported as the returned values are 0-255,0-255 for both sds and sdi?

@J0hnMatrix I'm testing the following block of code in Modem.record_audio. Seems to work in bench tests. Will test and refine on a live phone system.

 # Test for silence on Zoom modems (Conextant). The +VSD doesnt work on these modems.
 if self.model == "ZOOM":
     # Silent frames are made of a mix of \x80 and \x79 bytes, with 90% or more == \x80.
     count = audio_data.count(b'\x80')
     if count >= (CHUNK * 0.90):
         silent_frame_count += 1
     else:
         silent_frame_count = 0
     if silent_frame_count > 40: # 40 frames is ~5 secs
         print(">> Silent frames detected... Stop recording.")
         break