How to reject or accept an incoming call to my GSM modem using AT commands in Python? -
i've wrote below python program wait incoming calls , accept or reject them. based on this document , this document, appropriate @ commands accept incoming call ata
or ats0
or ats0<n>
. , appropriate commands reject incoming call ath
or at h
.
i tried above commands, incoming call neither answered nor rejected!
my python program :
import time import serial phone = serial.serial("com10", 115200, timeout=5) try: time.sleep(1) while(1): x = phone.readline() print(x) if (x == b'ring\r\n'): phone.write(b'at h') # replaced 'at h' above # commands, nothing changed # incoming call. ringing. time.sleep(2) finally: phone.close()
results at h
:
>>> ================================ restart ================================ >>> b'' b'' b'\r\n' b'ring\r\n' b'at h\r\n' b'ring\r\n' b'at h\r\n' b'ring\r\n' b'at h\r\n' b'ring\r\n' b'at h\r\n' b'ring\r\n'
results ath
:
>>> ================================ restart ================================ >>> b'' b'' b'' b'\r\n' b'ring\r\n' b'ath\r\n' b'ring\r\n' b'ath\r\n' b'ring\r\n' b'ath\r\n' b'ring\r\n'
results ata
:
>>> ================================ restart ================================ >>> b'' b'' b'' b'\r\n' b'ring\r\n' b'ata\r\n' b'ring\r\n' b'ata\r\n' b'ring\r\n' b'ata\r\n' b'ring\r\n'
results ats0
:
>>> ================================ restart ================================ >>> b'' b'' b'' b'\r\n' b'ring\r\n' b'ats0\r\n' b'ring\r\n' b'ats0\r\n' b'ring\r\n'
as see above, gsm modem regardless of @ command send it, continue ringing. what's wrong program?
note modem d-link dwm-156 , can send sms or make call using in python. in advance.
add end of each at
command cr make valid at
command
Comments
Post a Comment