static SmppClient CreateSmppClient(ISmppConfiguration config) { var client = new SmppClient(); client.Name = config.Name; //client.SmppEncodingService = new SmppEncodingService(System.Text.Encoding.UTF8); client.ConnectionStateChanged += new EventHandler <ConnectionStateChangedEventArgs>(client_ConnectionStateChanged); client.StateChanged += new EventHandler <StateChangedEventArgs>(client_StateChanged); client.MessageSent += new EventHandler <MessageEventArgs>(client_MessageSent); client.MessageDelivered += new EventHandler <MessageEventArgs>(client_MessageDelivered); client.MessageReceived += new EventHandler <MessageEventArgs>(client_MessageReceived); SmppConnectionProperties properties = client.Properties; properties.SystemID = config.SystemID; // "mysystemid"; properties.Password = config.Password; // "mypassword"; properties.Port = config.Port; // 2034; //IP port to use properties.Host = config.Host; // "196.23.3.12"; //SMSC host name or IP Address properties.SystemType = config.SystemType; // "mysystemtype"; properties.DefaultServiceType = config.DefaultServiceType; // "mydefaultservicetype"; properties.DefaultEncoding = config.Encoding; //Resume a lost connection after 30 seconds client.AutoReconnectDelay = config.AutoReconnectDelay; //Send Enquire Link PDU every 15 seconds client.KeepAliveInterval = config.KeepAliveInterval; return(client); }
private void Form1_Load(object sender, EventArgs e) { SmppConnectionProperties properties = client.Properties; /*BULK SMS*/ /*properties.SystemID = "546507"; * properties.Password = "******"; * properties.Port = 2775; //IP port to use * properties.Host = "bulksms.vsms.net"; //SMSC host name or IP Address * properties.SystemType = "SMPP"; * properties.DefaultServiceType = "SMPP"; * * /*Tedexis Pasaporte Maestro*/ /*properties.SystemID = "BSAG"; * properties.Password = "******";*/ /*Tedexis Farmatodo*/ properties.SystemID = "FARMATODO"; properties.Password = "******"; /*Tedexis Perú*/ /*properties.SystemID = "TDXTESTPER"; * properties.Password = "******";*/ properties.Port = 17631; //IP port to use properties.Host = "200.41.57.109"; //SMSC host name or IP Address properties.SystemType = "SMPP"; properties.DefaultServiceType = "SMPP"; /*MOCEAN SMS*/ /*properties.SystemID = "icomsmpp"; * properties.Password = "******"; * properties.Port = 28001; //IP port to use * properties.Host = "183.81.161.84"; //SMSC host name or IP Address * properties.SystemType = "sms"; * properties.DefaultServiceType = "SMPP";*/ //Resume a lost connection after 30 seconds client.AutoReconnectDelay = 3000; //Send Enquire Link PDU every 15 seconds client.KeepAliveInterval = 15000; client.ConnectionStateChanged += client_ConnectionStateChanged; //Start smpp client client.Start(); Button.CheckForIllegalCrossThreadCalls = false; button1.Enabled = false; }
static void Main(string[] args) { SmppConnectionProperties properties = client.Properties; properties.SystemID = "XXX"; properties.Password = "******"; properties.Port = 5050; properties.Host = "XX.XXX.X.XXX"; properties.SourceAddress = "XXXXXXXXXX"; properties.DefaultEncoding = DataCoding.UCS2; //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(); client.ConnectionStateChanged += Client_ConnectionStateChanged; client.MessageSent += Client_MessageSent; while (client.ConnectionState != SmppConnectionState.Connected) { Thread.Sleep(100); } var msg = new TextMessage(); Console.Write("Please enter your phone number: "); msg.DestinationAddress = "XXXXXXXXXXXX"; msg.SourceAddress = "XXXXXXXXXX"; msg.Text = "سلام"; msg.RegisterDeliveryNotification = true; client.SendMessage(msg); Console.ReadLine(); }
protected override void OnStart(string[] args) { Library.WriteErrorLog("Service is Started"); try { //Parameters SmppConnectionProperties properties = client.Properties; //Properties SMPP properties.SystemID = ConfigurationManager.AppSettings["SystemID"].ToString(); properties.Password = ConfigurationManager.AppSettings["Password"].ToString(); properties.Port = Convert.ToInt32(ConfigurationManager.AppSettings["Port"]); //IP port to use properties.Host = ConfigurationManager.AppSettings["Host"].ToString(); //SMSC host name or IP Address properties.SystemType = ConfigurationManager.AppSettings["SystemType"].ToString(); properties.DefaultServiceType = ConfigurationManager.AppSettings["DefaultServiceType"].ToString(); //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(); //Test Changes in conection client.ConnectionStateChanged += client_ConnectionStateChanged; //Receiving messages client.MessageReceived += client_MessageReceived; } catch (Exception ex) { Library.WriteErrorLog(ex); } }