Gammu Timeout on identifying modem - gammu

I setup gammu on OSX and has a configuration as below:
[gammu]
port = /dev/tty.usbmodem24127
model =
connection = at115200
synchronizetime = yes
logfile =
logformat = nothing
use_locking =
gammuloc =
I got this error "No response in specified timeout. Probably phone not connected." when I do gammu identify.
However if I restart my modem and do gammu identify immediately, gammu identified the modem without any problem. But then if I try to do gammu identify again it won't work.
Any idea what is going on? Can I increase the time out?
*Update :
Not only gamma can't establish a connection but even using a screen command like "screen /dev/tty.usbmodem24127" won't work.
The port is always busy even nothing is connected.
Thanks in advance.

Related

SMS Delivery Reports not received by gammu on Teltonika TRM250 / Quectel BG96

I have a Teltonika TRM250 USB cellular modem connected to Linux computer running gammu-smsd 1.42. SMS sending and receiving are working fine, but I can't get SMS delivery reports to work. I have set DeliveryReport = log in my configuration file, the sent items have status "DeliveryOK" and even my Telco confirms they see delivery report requested.
However, after sending the SMS, nothing in the log indicates anything is received.
How should I proceed debugging this?
I suspect the modem might need some additional initialization commands, but have not been able to find anything.
As I understand, it's basically a Quectel BG96 with a USB - serial converter, here's the AT commands manual:
https://wiki.teltonika-networks.com/wikibase/images/4/48/Quectel_BG96_AT_Commands_Manual_V2.3.pdf
My config file:
[gammu]
device = /dev/ttyUSB2
connection = at115200
synchronizetime = no
logformat = nothing
[smsd]
Service = sql
Driver = native_mysql
LogFile = syslog
DebugLevel = 255
DeliveryReport = log
SMSC = +xxxxxx
StatusFrequency = 300
ReceiveFrequency = 60
User = xxx
Password = xxx
Host = localhost
Database = xxx
It seems the TRM250 just does not support delivery reports (although Teltonika has not confirmed this).
After upgrading the firmware to BG96MAR02A07M1G_01.007.01.007 and RMA-ing the modem with no results, I exchanged for TRM240 (firmware EC21ECGAR06A04M1G_01.004.01.004), which is based on a different chip (Quectel EC21) and works.
Here are the AT commands (provided by Teltonika) to send an SMS in text mode and request delivery report:
AT+CNMI=2,1,2,1,0
OK
AT+CSMP=49,167,0,0
OK
AT+CMGF=1
OK
AT+CMGS="+xxxxxxxxx"
> testtest
>
+CMGS: 72
OK
+CDS: 6,72,"+xxxxxxxxx",145,"22/02/23,18:11:00+08","22/02/23,18:11:00+08",0
The +CDS line is the report - received correctly on TRM240, but nothing on TRM250.

Windows/Python UDP Broadcast Blocked No Firewall

OS: Windows 10
I use an Ethernet switch to send UDP packets to two other systems (connected directly to that same switch) simultaneously via Python 3.4.4. The same code works on two other dev/testing PC's so I know it's not the Python code, but for some reason it doesn't work on the PC that I want the system to be utilized by.
When I use Wireshark to view the UDP traffic at 169.254.255.255 (the target IP for sending the UDP packets to), nothing appears. However, sending packets to 169.X.X.1 works. On the other hand, packets sent to 169.X.X.255 are sent, but I receive time-to-live exceeded messages in return. I am restricted to that target IP, so changing the IP is not a solution. I also have it sending on port 6000 (arbitrary), I have tried changing the port number to no avail. Also won't let me send to 169.254.255.1
I have the firewalls turned off.
Thanks for your help.
same problem here,
solution is bind socket to adapter which is sending multicast
example:
msg = \
'M-SEARCH * HTTP/1.1\r\n' \
'HOST:239.255.255.250:1900\r\n' \
'ST:upnp:rootdevice\r\n' \
'MX:2\r\n' \
'MAN:"ssdp:discover"\r\n' \
'USER-AGENT:Python\r\n\r\n'
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
s.bind(('ip of interface',1901))
s.settimeout(10)
print msg,len(msg)
print s.sendto(msg, ('239.255.255.250', 1900) )
resp, (addr, port) = s.recvfrom(1024)
print resp
s.close()
solution from this post Can't send multicast over non-default NIC
The strange thing about my problem, was that this exact code worked on the computer in question (and two development computers) previously, but wasn't working at the time that I posted this question.
Wireshark wasn't leading me to my answer (only showing me that the UDP packets were not sent), so I decided to ping the IP via the command prompt. I received one of two errors (destination host unreachable, or request timed out). These errors led me to adding my desired target IP (169.254.255.255) to the ARP cache, which my problem was solved.
I'd like to thank you for suggesting a possible solution.

Multicast packet seen in Wireshark, but not received by user program (Windows and Linux)

I'm trying to detect a network connected device using multicast from a Ruby program. I've sniffed the network traffic from the official detection program and found that the computer sends out a packet to 225.0.0.37:12345 and the device responds on 225.0.0.38:12346. The device is connected to a local network consisting of a Netgear switch, a Windows computer and a Linux computer. I've made my program to send out an identical packet as the official program does.
The problem I have is that the response is never received, neither by my program nor the official detection program. Using Wireshark I can clearly see the device responding without fail and the packet clearly makes it to my Linux computer which I run Wireshark on, but neither the official program running on the Windows computer, nor my own Ruby program running on the Linux computer gets the response.
Both my computers have two network adapters, one connected to the same local switch and one connected to another switch which is then connected up to a large LAN with internet access. I've tried using a different brand switch between the computers, but it made no difference.
I've searched far and wide on Internet and haven't found anything to solve my issue. I appreciate any help I can get.
Here are the relevant packets captured with tcpdump, the first is sent from my program and the second is the response from the device:
13:30:25.773019 IP 192.168.0.1.12345 > 225.0.0.37.12345: UDP, length 15
13:30:25.773770 IP 192.168.0.125.39129 > 225.0.0.38.12346: UDP, length 228
Here is a (simplified) snippet from my program:
MULTICAST_SEND_ADDRESS = '225.0.0.37'
MULTICAST_SEND_PORT = 12345
MULTICAST_RESPONSE_ADDRESS = '225.0.0.38'
MULTICAST_RESPONSE_PORT = 12346
BIND_ADDRESS = '0.0.0.0'
# Transmit packet on all adapters - this part works fine
packet = [ID_STRING].pack("Z*")
addresses = Socket.ip_address_list
addresses.each do |addr|
next unless addr.pfamily == Socket::PF_INET
socket = UDPSocket.new
socket.bind(addr.ip_address, MULTICAST_SEND_PORT)
socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true)
socket.send(packet, 0, MULTICAST_SEND_ADDRESS, MULTICAST_SEND_PORT)
socket.close
end
# Receive packet - this should work, but doesn't
membership = IPAddr.new(MULTICAST_SEND_ADDRESS).hton + IPAddr.new(BIND_ADDRESS).hton
listen_socket = UDPSocket.new
listen_socket.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, membership)
listen_socket.bind(BIND_ADDRESS, MULTICAST_RESPONSE_PORT)
packet, addr = listen_socket.recvfrom(1024)
# We never get to this line since there's nothing received
puts packet
I figured out the problem in the end. In spite of what all the code examples I've seen say, it seems you can't bind to address '0.0.0.0' to get all interfaces on a multihomed machine. I don't know if this used to work and has been changed or all examples I've found have only been tested on singlehomed machines, but when I bound the socket to the actual ip of the correct interface it started working.

Microsoft Windows 7 PPP initialization sends "CLIENT" expects "SERVER" response

In Windows 7 I'm trying to set up a PPP connection over a direct serial port connection to a remote device. The documentation of the remote device (as well as the documentation I've found for the Windows PPP) indicates that the process should start with a Link Control Protocol packet, but I've discovered (by sniffing the serial line) that the PC, before doing anything else, is transmitting the string "CLIENT" once per second for up to 5 seconds. Only if the PC receives the response "SERVER" will it continue with the LCP initialization.
Does anyone know what level of system functionality is sending this CLIENT string, and how I can disable it. My remote device does not recognize this and refuses to connect based on this.
Update: I have discovered that this string is being initiated by the modem driver mdmhayes.inf as a "DialPrefix", but I have no idea how to update this driver file to eliminate this dial prefix. Thoughts?
Update: I've figured out how to get Windows to stop spitting out the "CLIENT" string (it has to do with changing the DIALPREFIX setting in the mdmhayes.inf file) but I still can't figure out how to make Windows realize it is connected and just move on with establishing the PPP connection. The modem diagnostics keep indicating that unknown strings are received so it doesn't know how to proceed. There should be some setting in the mdmhayes.inf file that tells the system not to wait for anything; it's connected to a wire and that's all that is needed. I just can't figure out what setting to use to make the modem initialization get out of the way to allow the PPP stack to take over.
in options.ttyS0 add:
debug
#19200
115200
192.168.111.1:192.168.111.2
netmask 255.255.255.0
lock
auth
nodefaultroute
nocrtscts
connect /etc/ppp/msclient.sh
msclient.sh :
#!/bin/sh
read -n 5 i
echo "SERVER"

Oracle connection problem on Mac OSX: "Status : Failure -Test failed: Io exception: The Network Adapter could not establish the connection"

I'm trying this with Oracle SQL Developer and am on an Intel MacBook Pro. But I believe this same error happens with other clients. I can ping the server hosting the database fine so it appears not to be an actual network problem.
Also, I believe I'm filling in the connection info correctly. It's something like this:
host = foo1.com
port = 1530
server = DEDICATED
service_name = FOO
type = session
method = basic
That's the message you get when you don't have the right connection parameters. The SID, in particular, tends to trip up newcomers.
If you want to connect to database on other host then you need to know
hostname
port number (by default 1521)
SID name
if you get the connection error that you mentioned in your question then you have not specified correctly either hostname or port number. Try
telnet hostname portnumber
from Terminal to verify if you can connect to portnumber (by default 1521) - if not then probably port number is incorrect.
My problem turned out to be some kind of ACL problem. I needed to SSH tunnel in through a "blessed host". I put the following in my .ssh/config
Host=blessedhost
HostName=blessedhost.whatever.com
User=alice
Compression=yes
Protocol=2
LocalForward=2202 oraclemachine.whatever.com:1521
Host=foo
HostName=localhost
Port=2202
User=alice
Compression=yes
Protocol=2
(I don't think the second block is really necessary.) Then I change the host and port in the oracle connection info to localhost:2202.

Resources