from flask import Flask, request
from sms.reciever import receive_question, Sms_Answers
import sys
import smpplib.gsm
import smpplib.client
import smpplib.consts
import smpplib
import json, requests, datetime
from models.create.model import Survey, Section, Section_Item, Question, Variant
app = Flask(__name__)
client = smpplib.client.Client('ip', port)
client.set_message_received_handler(
lambda pdu: receive_question(pdu))
if client.state == smpplib.consts.SMPP_CLIENT_STATE_CLOSED:
client.connect()
client.bind_transceiver(system_id='system', password='pass', allow_unknown_opt_params=True)
@app.route("/", methods = ['POST'])
def send():
who = request.json.get('who', -1)
text = request.json.get('text', -1)
if who == -1 or text == -1:
return "Not accepted", 400
parts, encoding_flag, msg_type_flag = smpplib.gsm.make_parts(text)
for i in who:
for part in parts:
pdu = client.send_message(
source_addr_ton=0,
source_addr_npi=1,
source_addr='source',
dest_addr_ton=1,
dest_addr_npi=1,
destination_addr=i,
short_message=part,
registered_delivery=True,
data_coding=encoding_flag,
esm_class=msg_type_flag,
)
return "Done", 200If sending:
But when I change |
Answered by
eigenein
Dec 6, 2021
Replies: 1 comment
This is perhaps a vendor-specific code, #105 is created to handle that. For now you'd better check with your SMSC provider to find out what it means.
There's nothing we can do about that. Again, it's better to check with the provider and find out what's going on with the lost messages. |
0 replies
Answer selected by
eigenein
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is perhaps a vendor-specific code, #105 is created to handle that. For now you'd better check with your SMSC provider to find out what it means.
There's nothing we can do about that. Again, it's better to check with the provider and find out what's going on with the lost messages.