the following code working for SMPP request using jamaa smpp library.
download dss from the following link
https://jamaasmpp.codeplex.com/releases/view/65964
then create new windows application or console application and paste the following code and change you SMSC provider data
download dss from the following link
https://jamaasmpp.codeplex.com/releases/view/65964
then create new windows application or console application and paste the following code and change you SMSC provider data
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using JamaaTech.Smpp.Net.Client;using JamaaTech.Smpp.Net.Lib;using JamaaTech.Smpp.Net.Lib.Protocol;namespace SMPP_Test{public partial class Form1 : Form{SmppClient mmclient = new SmppClient();SmppConnectionProperties mmproperties;TextMessage mymsg = new TextMessage();public Form1(){InitializeComponent();mmproperties = mmclient.Properties;}private void button1_Click(object sender, EventArgs e){mmproperties.SystemID = "YourSystemID";mmproperties.Password = "YourPassword";mmproperties.Port = 23651; //IP port to usemmproperties.Host = "xxx.net"; //SMSC host name or IP Addressmmproperties.SystemType = "";//Resume a lost connection after 30 secondsmmclient.AutoReconnectDelay = 3000;//Send Enquire Link PDU every 30 secondsmmclient.KeepAliveInterval = 30000;//Start smpp client// mmclient.Connectmmclient.Properties.InterfaceVersion = InterfaceVersion.v34;mmclient.Properties.DefaultEncoding = DataCoding.SMSCDefault;mmclient.Properties.SourceAddress = "MadinaWater";mmclient.Properties.AddressNpi = NumberingPlanIndicator.Unknown;mmclient.Properties.AddressTon = TypeOfNumber.Unknown;mmclient.Properties.SystemType = "transceiver";mmclient.Properties.DefaultServiceType = ServiceType.DEFAULT;// "transceiver";mmclient.MessageReceived += mmclient_MessageReceived;mmclient.MessageDelivered += mmclient_MessageDelivered;mmclient.MessageSent += mmclient_MessageSent;mymsg.DestinationAddress = "+966562824865"; //Receipient numbermymsg.SourceAddress = "ShortCodeRelated Your Provider"; //Originating numbermymsg.Text = "Hello, this is my simple client test message!";mymsg.RegisterDeliveryNotification = true; //I want delivery notification for this messagemmclient.Start();if(mmclient.ConnectionState != SmppConnectionState.Connected )mmclient.ForceConnect(5000);mmclient.SendMessage(mymsg,1000);//Provide a handler for the SmppClient.MessageReceived eventmmclient.Shutdown();////Resume a lost connection after 30 seconds//client.AutoReconnectDelay = 3000;////Send Enquire Link PDU every 15 seconds//client.KeepAliveInterval = 15000;////Start smpp client//client.Start();//TextMessage msg = new TextMessage();//msg.DestinationAddress = "+966562824865";//msg.Text = "تجربة الإرسال من ال SMPP";//msg.SourceAddress = "MWater";//client.SendMessage(msg,3000);}void mmclient_MessageSent(object sender, MessageEventArgs e){JamaaTech.Smpp.Net.Client.TextMessage textMsg = e.ShortMessage as JamaaTech.Smpp.Net.Client.TextMessage;MessageBox.Show(textMsg.Text);TextMessage msg = e.ShortMessage as TextMessage;string SegID = msg.SegmentID.ToString(); //Gives the message ID from the SMPP on Sendstring Seg = msg.SequenceNumber.ToString(); //Give the status of the message - EnrouteMessageBox.Show(msg.Text); //Display message}void mmclient_MessageDelivered(object sender, MessageEventArgs e){JamaaTech.Smpp.Net.Client.TextMessage textMsg = e.ShortMessage as JamaaTech.Smpp.Net.Client.TextMessage;MessageBox.Show(textMsg.Text);}void mmclient_MessageReceived(object sender, MessageEventArgs e){//The event argument e contains more information about the received messageJamaaTech.Smpp.Net.Client.TextMessage textMsg = e.ShortMessage as JamaaTech.Smpp.Net.Client.TextMessage; //This is the received text message//richTextBox1.Text = richTextBox1.Text + textMsg + " Step 1";string msgInfo = string.Format("Sender: {0}, Receiver: {1}, Message content: {2}", textMsg.SourceAddress, textMsg.DestinationAddress, textMsg.Text);//Display message MessageBox.Show(msgInfo);// richTextBox1.Text = richTextBox1.Text + msgInfo;}}}
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteSir,
ReplyDeleteI am getting an exception on the following line:
"mmclient.SendMessage(mymsg,1000);"
An SMPP exception is thrown with the error code 148.
Kindly help ASAP.
Regards,
M. Jawad
Sir,
ReplyDeleteI resolved the exception and error code 148 issue. It was due to the number format given in the destination address line, which is the following one:
mymsg.DestinationAddress = "+92333-------";
After removing the '+' sign, and entering the number as follows: "92333-------", the application started working properly.
Thank you for your support.
Regards,
M. Jawad Saleem
Hi, A long-term and Experienced SMPP gateway provider yields a positive impact on the company or organization. SMPP Client Panel
ReplyDeleteMany time I am receiving ESME_TimeOut exception and then it disconnect client till retry connection time given. Have you ever receve this type of exception? If yes then have you found any solution for that.
ReplyDeletePlease guide me.