how to use pyserial in interaction with pci modem

1

I'm trying to create a program that dials for certain phone numbers, call twice and change to the next number.

I am using pyserial for communication with the pci modem only that the program occupies the port but the modem does not dial.

Then I installed a serial port emulator to see if the program was sending the right string to port and the emulator the string is being sent but the modem does not execute.

If someone can help me, I appreciate it. I also tested the hypertermial string that worked normally.

follow the code:

import serial
import time

#leitura da lista de tp
#Arquivo de leitura deve estar no mesmo diretorio do programa
porta ='COM3'
vel =115200
bytesize=8



arq = open("TP.txt",'r')
resul=arq.readlines()
arq.close()
ddd=input('Digite codigo DDD')
for i in range(len(resul)):
    resul[i].format(resul[0:8])
    tel=('ATDT'+ddd+resul[i]).rstrip('\t\n')
    print(tel)           
    if(i>=0):
        print('Enviando numero '+tel)
        try:
            con = serial.Serial(porta,vel,bytesize,parity='N',stopbits=1,timeout=1)
            con.write(tel.encode('utf-8'))
            time.sleep(1.8)
            con.close()
        except serial.SerialException:
             print("ERRO: Verifique se ha algum dispositivo conectado na porta!") 
    
asked by anonymous 16.07.2015 / 17:18

0 answers