Getting "NO CARRIER" error while tring to make a call using GSM modem in Python

I want to call using my GSM modem. So I wrote the following program:

import time import serial recipient = "+98xxxxxxxxxx" phone = serial.Serial("COM10", 115200, timeout=5) try: time.sleep(0.5) phone.write(b'ATZ\r') time.sleep(1) phone.write(b'ATD"'+recipient.encode() +b'"\r') while(1): print(phone.readline()) time.sleep(0.5) finally: phone.close() 

But when I run it, I get this output:

 >>> ================================ RESTART ================================ >>> b'ATZ\r\r\n' b'OK\r\n' b'ATDxxxxxxxxxx\r\r\n' b'NO CARRIER\r\n' 

What does this "NO CARRIER" error mean?

Please note that I can send SMS successfully.


This is the program that I use to send SMS:

 import time import serial recipient = "+98xxxxxxxxxx" message = "Test" phone = serial.Serial("COM10", 115200, timeout=5) try: time.sleep(0.5) phone.write(b'ATZ\r') time.sleep(0.5) phone.write(b'AT+CMGF=1\r') time.sleep(0.5) phone.write(b'AT+CMGS="' + recipient.encode() + b'"\r') time.sleep(0.5) phone.write(message.encode() + b"\r") time.sleep(0.5) phone.write(bytes([26])) time.sleep(0.5) finally: phone.close() 
+13
source share
2 answers

I found the source of the error:

Syntax ATD+98xxxxxxxxxx; followed by a trailing line. I forgot to put a semicolon at the end after the number.

So I replace

 phone.write(b'ATD"'+recipient.encode() +b'"\r') 

with

 phone.write(b'ATD"'+recipient.encode() +b';"\r') 

And now it works great.


Based on the brackets in these docs, I thought using ";" not required. But it seems that I was wrong. enter image description here

+22
source

I do not receive the carrier until the call is answered, why we do not receive a command called call, do not answer

0
source

All Articles