예제 #1
0
        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;
        }
예제 #2
0
        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();
        }
예제 #3
0
        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);
            }
        }
 public SmppManager()
 {
     smppClient = new SmppClient();
     smppClient.Start();
 }
예제 #5
0
        static void Main(string[] args)
        {
            Common.Logging.LogManager.Adapter = new Common.Logging.Simple.DebugLoggerFactoryAdapter();
            var encSrv = new SmppEncodingService();

            var hexBytes  = "000000dd0000000500000000019182410001013334363439323836383039000501657669636572746961000400000000000000008569643a323533303932393134353232363637333732207375623a30303120646c7672643a303031207375626d697420646174653a3133303932393136353220646f6e6520646174653a3133303932393136353220737461743a44454c49565244206572723a3030303020746578743a1b3c657669534d531b3e0a534d532064652050727565042300030300000427000102001e001332353330393239313435323236363733373200";
            var packet    = StringToByteArray(hexBytes);
            var bodyBytes = packet.Skip(16).ToArray();

            var pdu = PDU.CreatePDU(PDUHeader.Parse(new ByteBuffer(packet), encSrv), encSrv);

            pdu.SetBodyData(new ByteBuffer(bodyBytes));

            var receiptedMessageId = pdu.GetOptionalParamString(JamaaTech.Smpp.Net.Lib.Protocol.Tlv.Tag.receipted_message_id);

            //Assert.AreEqual("253092914522667372", pdu.ReceiptedMessageId);

            _Log.Info("Start");
            //Trace.Listeners.Add(new ConsoleTraceListener());

            smppConfig = GetSmppConfiguration();

            //SMPPEncodingUtil.UCS2Encoding = Encoding.UTF8;

            client = CreateSmppClient(smppConfig);
            client.Start();

            // must wait until connected before start sending
            while (client.ConnectionState != SmppConnectionState.Connected)
            {
                Thread.Sleep(100);
            }

            // Accept command input
            bool bQuit = false;

            do
            {
                // Hit Enter in the terminal once the binds are up to see this prompt

                Console.WriteLine("Commands");
                Console.WriteLine("send 123456 hello");
                Console.WriteLine("quit");
                Console.WriteLine("");

                Console.Write("\n#>");

                string command = Console.ReadLine();
                if (command.Length == 0)
                {
                    continue;
                }

                switch (command.Split(' ')[0].ToString())
                {
                case "quit":
                case "exit":
                case "q":
                    bQuit = true;
                    break;

                default:
                    ProcessCommand(command);
                    break;
                }

                if (bQuit)
                {
                    break;
                }
            } while (true);

            if (client != null)
            {
                client.Dispose();
            }
        }
 public SmppManager(string address, int port)
 {
     smppClient = new SmppClient();
     smppClient.Start();
 }