hharte / mm_manager

Manager for the Nortel Millennium series of payphones.
Other
54 stars 10 forks source link

Latest version causes an immediate disconnect when terminal calls in #16

Closed Ilikemining1 closed 11 months ago

Ilikemining1 commented 1 year ago

Hi,

I recompiled mm_manager for a different machine the other day after the commit on the 13th. Whenever the terminal calls in, it immediately errors out and gives up, before the "Connected!" message would be displayed. Unfortunately I don't have the logs handy at the moment, but can confirm using the previous commit works fine. I can reproduce the issue if necessary!

Thanks,

IlikeTech

hharte commented 1 year ago

Hello @Ilikemining1,

Thank you for the bug report. The latest commit monitors the modem DTR status in order to gracefully handle a disconnect from the far end. Can you please provide more details about what operating system you are using, what kind of modem you are using and whether you are using a real serial port, USB serial port, or USB modem?

Thanks, Howard

Ilikemining1 commented 1 year ago

Hi,

This setup was running on an Optiplex 790 running the latest version of Debian 11. I tried both the physical serial port and a USB adapter, and the same issue occurred. The modem itself is a 56K USR 5686 model. Reverting back to the previous commit seems to work fine with both the physical serial port and the USB adapter.

Thanks!

hharte commented 1 year ago

Thanks for the information, @Ilikemining1 .

Can you please let me know the modem init string you are using and exactly which revision of the USR 5686 you have? The label on the bottom of the modem should have a numbered suffix after the 5686 that indicates the revision. Can you please also describe how the DIP switches on the modem are set?

Thanks, Howard

Ilikemining1 commented 1 year ago

Hi,

The modem is an 03 revision, and my init string is AT &A0 &D2 E1 B1, which seems to work fine. The switches are Up Up Down Up Up Up Down, which seems to indicate Normal DTR, Verbal Result Codes, Display Result Codes, Echo Offline, Auto Answer, Normal Carrier Detect, Load NVRAM Defaults, and Smart Mode.

I've run into some issues that seem to be caused by buggy modem firmware before so I'm going to try updating it to resolve those issues. It's had issues not wanting to stay in B212 modulation mode before and switching back even when the option was specified, so hopefully an update will resolve that.

Thanks!

Ilikemining1 commented 1 year ago

Alright, I was able to get the modem firmware updated to a version from 2004, which will hopefully correct some of the firmware bugs I ran into. However, the same issue still occurs. I fired up the latest mm_manager to capture the issue:

Waiting for call from terminal...
2022-12-24 10:41:56: Connected!

receive_mm_packet: Carrier lost, bailing.

T-->M RX: flags=00 [ --- | OK  | REQ |  ---  | Seq:0], len=  0 (datalen=  0), crc=f0b0.
        *** CRC Error, calculated: 0000 ***
        *** Framing Error, expected STOP=0x03, got STOP=00 ***
Error: Received an ACK without expecting it!

2022-12-24 10:41:56: Terminal : Disconnected.

Waiting for call from terminal...

Once it disconnects, the modem is still connected, and the phone eventually fails out after retrying several times.

Thanks,

IlikeTech

hharte commented 1 year ago

I tried two USR 5686 modems on Linux via a USB serial port: one 5686E (-05) version, and one 5686G (-06) version with the init string ATS0=1 &D2 &N2 and they both seem to work fine.

Unfortunately, I don't have the -03 version.

Can you please try mm_manager with the -i "ATS0=1 &D2 &N2" option, and if your modem doesn't like &N2, can you please try with -i "ATS0=1 &D2 B1"

Thanks, Howard

Ilikemining1 commented 1 year ago

Hi,

I gave both of those a try and they have the exact same results as before, unfortunately.

IlikeTech

hharte commented 1 year ago

Hello @Ilikemining1 ,

Can you please try with the following modem init string: ATE=1 S0=1 &D2 &N2 &C1 ?

The key to the carrier detect is the &C1

Please make sure you are using a modem cable with all of the hardware flow control signals wired (not just the data lines.)

Take care, Howard

Ilikemining1 commented 1 year ago

Sorry for the delay in replying. I tried that as well with no improvement unfortunately. The cable I'm using looks to be a standard DB9 to DB25-style modem cable, so I'm pretty sure that it's got all of the flow control signals wired, though I'll double-check tomorrow.

hharte commented 1 year ago

Hello @Ilikemining1 , I added a -w command line option to use the modem "without" monitoring the carrier detect.

Take care, Howard

Ilikemining1 commented 1 year ago

Well, just recompiled it and gave that a shot and it does appear to work. No idea why that fixes it, but it does seem to work fine. I never got around to testing my serial cable, so maybe that is the issue?

Thanks!

hharte commented 1 year ago

Hello @Ilikemining1 ,

Glad to hear that the -w option works for you.

It’s still worth checking the cable. Monitoring the modem’s carrier detect requires the DCD pin from your PC serial port to be connected to the modem. DCD is on pin 1 of the 9-pin serial cable.

For data communication, only RxD, TxD, and Ground (pins 2,3,5) are needed, but DCD (pin 1) and DTR (pin 4) are used by mm_manager for handshaking with the modem.

-Howard

hharte commented 11 months ago

Closing this old issue. Please re-open if you still have issues with this modem.