Hello,
I am new to SMPP and I am using JamatechSMPP (an opensource .net library for SMPP) to connect to a SMSC. I am successfully able to send messages however I am unable to receive. Jamatech help documents say that an event called "client_MessageReceived" will be raised when a message is received but the receiving is failing and I am not sure how I can raise that event when a message is received. Please check my code. Any help will be highly appreciated. Thanks
public static void ReceiveSMS()
{
try
{
ConnectToSMSC();
client.MessageReceived += new EventHandler(client_MessageReceived);
}
catch (Exception ex)
{
}
}
static public void client_MessageReceived(object sender, MessageEventArgs e)
{
//The event argument e contains more information about the received message
TextMessage textMsg = e.ShortMessage as TextMessage; //This is the received text message
int res = SaveMsg(textMsg.SourceAddress.ToString(), textMsg.Text.ToString());
}
KhalidPosted Aug 22, 2016, 5:16 AM
Ajay MalikPosted Aug 22, 2016, 12:28 AM
SMPP is a peer-to-peer protocol. That should mean that SMS Gateway (your side) and SMSC (your mobile operator) need to have a proper bind/connection established. Even when there are no SMS or DLRs to send/receive, there is a continous exchange of smpp PDU (enquire_link/enquire-link_resp) that ensure that the bind is established. In detail, if you send an enquire_link PDU and you get no response (enquire_link_resp) the bind is broken. Your sms won't be delivered (will remain enqueued in your gateway store), and you won't receive MOs (incoming sms) or DLRs (delivery report). To re-establish the connection you should re-initiate the connection