Python Forum
Dialup Modem using pyserial - Need it to show response from the other end.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialup Modem using pyserial - Need it to show response from the other end.
#1
Ok so I'm able to open the com port and dial out to my phone number but I can't seem to get a response once the dialup handshake is complete.

after that I'll need to be able to put in a password and then some basic S for system commands but that'll be easy after I can get the python code to show the ( that comes up once the handshake is done.

Normally in hyperterminal you'll see

connect/2400 come up on the screen and then you press the spacebar a bunch of times and then

Enter Keyword

I can't get it show the above so I know when to put in another input.

Here's the code I'm using.

import serial

port = "COM1"
baud = 2400
bytesize=serial.SEVENBITS,
parity=serial.PARITY_EVEN,
stopbits=serial.STOPBITS_ONE

ser = serial.Serial(port, baud, timeout=5)
# open the serial port
if ser.isOpen():
print(ser.name + ' is open type dialit to connect')

while True:
cmd = input("Enter command or 'exit':")
# for Python 2
# cmd = input("Enter command or 'exit':")
# for Python 3
if cmd == 'exit':
ser.close()
exit()
if cmd == 'dialit':
ser.write(b'ATDT6045245320\r\n')
Reply
#2
Hello, I would like to ask you why do you have to use at the end of the last code line this: \r\n
Could you help me to introduce a variable phone number instead a fix number?
thank you in advance
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PIL Image im.show() no show! Pedroski55 2 969 Sep-12-2022, 10:19 PM
Last Post: Pedroski55
  PIL Image im.show() no show! Pedroski55 6 4,928 Feb-08-2022, 06:32 AM
Last Post: Pedroski55
Question SMS sending using USRobotics modem Jacobus 2 2,470 Mar-11-2021, 09:59 PM
Last Post: nilamo
  Send SMS with gsm modem mariolopes 3 4,836 Oct-15-2019, 08:22 PM
Last Post: micseydel
  get and reuse the token value with huawei modem Reims 1 4,584 Oct-02-2019, 04:29 AM
Last Post: Reims
  Read data of Wireless Modem in Byte Format barry76 2 2,643 Jan-31-2019, 11:26 AM
Last Post: barry76
  How to detect wireless modem connected serially to my laptop in python barry76 3 3,557 Jan-08-2019, 06:18 AM
Last Post: Gribouillis
  Help to activate the "USB Modem" with Python karlo123 4 4,876 Sep-17-2017, 08:40 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020