diff --git a/README.md b/README.md index ab59066..c36a7fb 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,21 @@ The __callattendant__ uses the following hardware: - A 56K V.92 Data + Fax modem compatible with the **U.S. Robotics USR5637** or any device using a **Conexant CX930xx** modem have been proven effective. - [Optional] A GPIO based indicator board or an MQTT server. +**Note:** Dell Conexant modems such as RD02-D400 are not compatible with the __callattendant__ without a firmware patch. +A patch may be applied by adding a modem init string in the config file OPTIONAL_MODEM_INIT. +Multiple commands may be specified by separating them with a semicolon. For example: `AT!4886=00;AT!4892=FF` + +ref: https://en.wikipedia.org/wiki/Network_Caller_ID (Note G) +``` +CallerID can be reenabled in any CX93001-based modem by one of the following: +AT!4886=00 for Bell FSK countries +AT!4886=01 for V23 FSK (Japan) +AT!4886=02 for ETSI FSK (France, Italy, Spain) +AT!4886=03 for SIN227 (UK) +AT!4886=05 for ETSI DTMF +Sometimes additionally AT!4892=FF may be required.` +``` + --- ## Software setup diff --git a/callattendant/app.cfg.example b/callattendant/app.cfg.example index 48efe63..16357c2 100644 --- a/callattendant/app.cfg.example +++ b/callattendant/app.cfg.example @@ -20,6 +20,12 @@ DEBUG = False # TESTING: If True function tests are executed in lieu of normal operation TESTING = False +# Optional modem initialization string: (AT commands) to be sent to the modem +# Additional modem options can be set when necessary. +# See README.md notes regarding caller-id enable for Dell RD02-D400 modems. + +OPTIONAL_MODEM_INIT = "" + # Web UI options: HOST can be set to a specific IP address or "::" to include IPv6 HOST = "0.0.0.0" PORT = 5000 diff --git a/callattendant/config.py b/callattendant/config.py index 138b838..5e12a5a 100644 --- a/callattendant/config.py +++ b/callattendant/config.py @@ -19,7 +19,7 @@ # and screened callers through to the home phone. # default_config = { - "VERSION": '1.6.2', + "VERSION": '1.6.3', "ENV": 'production', "DEBUG": False, @@ -28,6 +28,8 @@ "HOST": "0.0.0.0", "PORT": 5000, + "OPTIONAL_MODEM_INIT": "", + "DATABASE": "callattendant.db", "NOTIFICATIONS_FOLDER": "notifications", "SCREENING_MODE": ("whitelist", "blacklist"), diff --git a/callattendant/hardware/modem.py b/callattendant/hardware/modem.py index 5a059ad..e529a01 100644 --- a/callattendant/hardware/modem.py +++ b/callattendant/hardware/modem.py @@ -59,6 +59,8 @@ RESET_PROFILE = "ATZ0" GET_MODEM_PRODUCT_CODE = "ATI0" GET_MODEM_SETTINGS = "AT&V" +GET_MODEM_FIRMWARE_ID = "ATI3" +GET_MODEM_PATCH_LEVEL_CONEXANT = "AT-PV" DISABLE_ECHO_COMMANDS = "ATE0" ENABLE_ECHO_COMMANDS = "ATE1" ENABLE_FORMATTED_CID = "AT+VCID=1" @@ -585,7 +587,7 @@ def record_audio(self, audio_file_name, detect_silence=True): success = False finally: # Clear input buffer before sending commands else its - # contents may interpreted as the cmd's return code + # contents may be interpreted as the cmd's return code self._serial.reset_input_buffer() # Send End of Recieve Data state by passing "!" @@ -859,12 +861,13 @@ def _detect_modem(self): (success, result) = self._send_and_read(GET_MODEM_PRODUCT_CODE) if success: + # Query firmware ID + self._send_and_read(GET_MODEM_FIRMWARE_ID) if USR_5637_PRODUCT_CODE in result: - print("******* US Robotics Model 5637 detected **********") + print("*** US Robotics modem detected ***") self.model = "USR" elif CONEXANT_PROODUCT_CODE in result: - print("******* Conextant-based modem detected **********") self.model = "CONEXANT" # Define the settings for the Zoom3905 where they differ from the USR5637 SET_VOICE_COMPRESSION = SET_VOICE_COMPRESSION_CONEXANT @@ -872,6 +875,9 @@ def _detect_modem(self): ENABLE_SILENCE_DETECTION_5_SECS = ENABLE_SILENCE_DETECTION_5_SECS_CONEXANT ENABLE_SILENCE_DETECTION_10_SECS = ENABLE_SILENCE_DETECTION_10_SECS_CONEXANT ENABLE_FORMATTED_CID = ENABLE_FORMATTED_CID_CONEXANT + # Query firmware patch level + self._send_and_read(GET_MODEM_PATCH_LEVEL_CONEXANT) + print("*** Conextant modem detected ***") else: print("******* Unknown modem detected **********") # We'll try to use the modem with the predefined USR AT commands if it supports VOICE mode. @@ -896,6 +902,8 @@ def _init_modem(self): try: if not self._send(RESET): print("Error: Unable reset to factory default") + if self.config["OPTIONAL_MODEM_INIT"]: + self._send(self.config["OPTIONAL_MODEM_INIT"]) if not self._send(ENABLE_VERBOSE_CODES): print("Error: Unable set response in verbose form") if not self._send(DISABLE_ECHO_COMMANDS): diff --git a/setup.py b/setup.py index 8a28b98..4ba680a 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setuptools.setup( name="callattendant", # Add user name when uploading to TestPyPI - version="1.6.2", # Ensure this is in-sync with VERSION in config.py + version="1.6.3", # Ensure this is in-sync with VERSION in config.py author="Ted Hess", author_email="thess@kitschensync.net", description="An automated call attendant and call blocker using a USR5637 or CX930xx modem",