asterisk-Softmodem
asterisk-Softmodem copied to clipboard
Strange bytes on connect
My setup is: 56k modem --> SIP ATA --> asterisk with softphone --> BBS via telnet. When I dial into the softmodem, it always sends a couple of bytes to the telnet server (hexdump output):
0000000 9111 9111 9111 9111 9111 9111 9111 9111
0000010 9111 9111 9111 9111 9111 9111 9111 9111
0000020 9111 9111 9111 9111 9111 9111 9111 9111
0000030 9111 9111 9111 9111 9111 9111 9111 9111
0000040 9111 9111 9111 9111 9111 9111 9111 9111
0000050 9111 9111 9111 9111 9111 9111 9111 9111
0000060 9111 9111 9111 9111 9111 9111 9111 9111
0000070 9111 9111 9111 9111 9111 9111 9111 9111
0000080 9111 9111 9111 9111 9111 9111 9111 9111
0000090 9111 9111 9111 9111 9111 9111 1016 1a02
00000a0 0201 0601 0001 0000 ff00 0102 0303 0801
00000b0 0204 0040 0108 0903 1d01 0310 caf2
~~I have no idea if that is my modem trying to "convince" the softmodem to connect with a faster speed or if~~ it's just some garbage caused by the handshake. After these bytes the transmission is perfectly fine. Is there anything possible to get rid of these bytes? Since they're getting sent to the login prompt, login instantly fails and the connection gets terminated.
Edit: The "garbage characters" stop as soon as the calling modem shows "CONNECT", so it's definitely a bit of the handshake. Have tried with a couple more modems, most of the bytes are the same, only a few differ:
Elsa Microlink 56k i
0000000 9111 9111 9111 9111 9111 9111 9111 9111
0000010 9111 9111 9111 9111 9111 9111 9111 9111
0000020 9111 9111 9111 9111 9111 9111 9111 9111
0000030 9111 9111 9111 9111 9111 9111 9111 9111
0000040 9111 9111 9111 9111 9111 9111 9111 9111
0000050 9111 9111 9111 9111 9111 9111 9111 9111
0000060 9111 9111 9111 9111 9111 9111 9111 9111
0000070 9111 9111 9111 9111 9111 9111 9111 9111
0000080 9111 9111 9111 9111 9111 9111 9111 9111
0000090 9111 9111 9111 9111 9111 9111 9111 9111
00000a0 9111 9111 9111 9111 9111 9111 9111 1016
00000b0 1a02 0201 0601 0001 0000 ff00 0102 0303
00000c0 0801 0204 0040 0108 0903 0101 0310 0afa
Lucent WinModem
0000000 9111 9111 9111 9111 9111 9111 9111 9111
0000010 9111 9111 9111 9111 9111 9111 9111 9111
0000020 9111 9111 9111 9111 9111 9111 9111 9111
0000030 9111 9111 9111 9111 9111 9111 9111 9111
0000040 9111 9111 9111 9111 9111 9111 9111 9111
0000050 9111 9111 9111 9111 9111 9111 9111 9111
0000060 9111 9111 1016 1a02 0201 0601 0001 0000
0000070 ff00 0102 0303 0801 0204 0040 0108 0903
0000080 0101 0310 0afa 1016 1a02 0201 0601 0001
0000090 0000 ff00 0102 0303 0801 0204 0040 0108
00000a0 0903 0101 0310 0afa
How did you get it work at all? Are you using with BTX? I was trying to connect to a BBS through Telnet, too, and every time I try with a regular Telnet connection, I get garbage characters on all of the baud settings. I think there is something slightly off with this application that makes it not work by default. What settings are you using?
Well, that's exactly what I'm talking about. For testing purposes, I had it connect to a netcat socket to be able to see the exact transmission. After these garbage characters are transmitted, the connection seems to work flawlessly, I can send and receive characters from either direction. It should work with any telnet server if we somehow could get the softmodem to suppress the characters generated by the handshake. The softmodem seems to accept the handshake as finished a few seconds before the calling modem does.
I've never been able to get it to work at all, I just see garbage characters on the screen appearing forever until I disconnect or carrier drops.
Does what you described happen with all modes/options?
I suspect maybe that is the BTX-specific handshake or something - do you see anything that looks like that in the code? If we knew which part it was, we could comment that out and maybe it would work as it's supposed to then for regular (non-BTX) connections.
You have to use the "l" parameter: BTX uses most significant bit first, anything else uses least significant bit first. Yes, it happens in all modes. When connecting, the softmodem outputs these garbage characters after a few seconds and stops as soon as the calling modem displays "CONNECT", so I guess the softmodem falsely "accepts" the handshake before it has finished and outputs the last bytes of it as garbage characters.
You have to use the "l" parameter: BTX uses most significant bit first, anything else uses least significant bit first.
Well that's part of my problem then, thanks! I don't think I'd tried that.
Here's what I got a minute into my last connection from HyperTerminal: Ýkþö³«ÏþÉŸûèD Cu ûØìe7+ò»ô Y„#Ó$uòîøÝ²ûkMùA«½»vZ÷»³2õ§9»ø”Èþ˜S±à‚á³þš úÏ m½K³tŽi $øº²F MSòV4j$týƒ:WŸø g3Í nâ »8 Ýœýý¬ ¬Ôû#ѳ‰øëÜeº‹¼Ô dÄsMaÒ[ú‰ [Ѱ “SŸâ±ÉŒåŽFp ]g,Û&Ut»I Yòtæâ"Ž} ŽY0õaÛ š>ÍÝ;hpþ¿Þ]׌‹`ûÁª$Ub
I'm calling it as Softmodem(127.0.0.1,23,lv(V22)).
V23 never works for me - my calling modem never detects it as answered for some reason. The other modes all answer and send garbage.
Yes, it happens in all modes. When connecting, the softmodem outputs these garbage characters after a few seconds and stops as soon as the calling modem displays "CONNECT", so I guess the softmodem falsely "accepts" the handshake before it has finished and outputs the last bytes of it as garbage characters.
Since the author has seemingly abandoned this, I've been maintaining this out of tree here: https://github.com/InterLinked1/phreakscript/blob/master/apps/app_softmodem.c
For legal reasons, obviously, it can never be included in Asterisk.
I am having the same garbage characters issue you describe. Did you ever find a solution?
I believe it's spewing garbage because Softmodem is intended for raw TCP, not something like Telnet. There needs to be something inbetween like socat to translate.