I am trying to send an MMS message using this code and it is not working. I've used some code to send the SMS and that works, it's just the MMS.
The APN settings are fine, I've checked. Maybe adding some output would help me figure out the problem but i don't know how and where to add that.
I've search the internet but I have found nothing.
Here's my code:
import binascii
import serial
import RPi.GPIO as GPIO
import time
def img_to_hex():
with open("/home/pi/Desktop/imagee.jpg", 'rb') as f:
content = f.read()
img_hex = binascii.hexlify(content)
return img_hex
def send_mms():
phone = serial.Serial("/dev/ttyS0", baudrate=9600, timeout=1)
dataphoto = img_to_hex()
phone.write('AT\r\n')
time.sleep(1)
phone.write('AT+CMMSINIT\r\n')
time.sleep(2)
phone.write('AT+CMMSCURL=\"mmsdebitel\"\r')
time.sleep(1)
phone.write('AT+CMMSCID=1\r')
time.sleep(1)
phone.write('AT+CMMSPROTO=\"10.143.156.003\",8080\r')
time.sleep(1)
phone.write('AT+CMMSSENDCFG=6,3,0,0,2,4,1,0\r')
time.sleep(1)
phone.write('AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\r')
time.sleep(1)
phone.write('AT+SAPBR=3,1,\"APN\",\"mmsdebitel\"\r')
time.sleep(1)
phone.write('AT+SAPBR=1,1\r')
time.sleep(4)
phone.write('AT+SAPBR=2,1\r')
time.sleep(1)
phone.write('AT+CMMSEDIT=1\r')
time.sleep(1)
phone.write('AT+CMMSDOWN=\"PIC\",6307,20000,\"imagee.jpg\"\r')
time.sleep(1)
phone.write(dataphoto)
time.sleep(1)
phone.write('AT+CMMSRECP=\"+mynumber\"\r')
time.sleep(1)
phone.write('AT+CMMSVIEW\r')
time.sleep(1)
phone.write('AT+CMMSSEND\r')
time.sleep(1)
phone.write('AT+CMMSEDIT=0\r')
time.sleep(1)
phone.write('AT+CMMSTERM\r')
time.sleep(1)
send_mms()