powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / Рассылка СМС, исползуя com.logica.smpp (источник в виде 1-номер, 2-любая строка)
2 сообщений из 2, страница 1 из 1
Рассылка СМС, исползуя com.logica.smpp (источник в виде 1-номер, 2-любая строка)
    #34371371
Фотография Ihor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
 package  ...;

 import  com.logica.smpp.pdu.*;
 import  com.logica.smpp.Data;
 import  com.dcc.util.queue.FifoProperties;
 import  com.dcc.util.file.ledger.LedgerProperties;
 import  com.dcc.util.log.LogPluginProperties;
 import  com.dcc.util.log.LogPlugin;
 import  com.dcc.mtserver.resourcemanager.resourceproperty.specialvalue.AbstractRpObjValueObject;
 import  com.dcc.smpp.shell.*;

 public   class  TesterSend
{
     private   static  LogPlugin logPlugin;
     private   static  SmppClient client =  null ;
     public   static   void  main(String[] args)
    {
         try 
        {
            SmppConfiguration cfg =  new  SmppConfiguration("tester",
                    "хх.х.хх.хх",ххххх,( long ) 10 ,"хххххххх","хххххххх",false,( long ) 10000 ,"Logica",
                    SmppConfiguration.BIND_TYPE_TRANSCEIVER,
                     80 ,( long )( 1000  *  5 ),"tester application");

            logPlugin =  new  LogPlugin( new  LogPluginProperties("lp","#","data","error","smpp",true));
            SmppMessageListener messageListener =
                     new  SmppMessageListener()
      {/*определеие функций public void handleConfMessage,handleMoMessage, handleMtMessage,
handleNotfMessage, handleGNackMessage, public boolean processMoMessage, public Object clone(),
public boolean equals*/

                         public  AbstractRpObjValueObject createByTextValue(String pResourcePropertyTextValue)  throws  Exception
                        {
                             throw   new  Exception("This method [createByTextValue] is not supported for this class [" +  this .getClass().getName() + "]");
                        }
                    };
            SmppStatusListener smppStatusListener =
                     new  SmppStatusListener()
      {
                         public   void  handleStatus(AbstractSmppStatusEvent pEvent)  throws  Exception{
                            logPlugin.writeDataLog("STATUS EVENT : " + pEvent.toString());
                        }
                         public  Object clone() {
                             return   this ;
                        }
                         public   boolean  equals(AbstractRpObjValueObject pRpObjValueObject)    {
                             return  true;
                        }
                         public  AbstractRpObjValueObject createByTextValue(String pResourcePropertyTextValue)  throws  Exception
                        {
                             throw   new  Exception("This method [createByTextValue] is not supported for this class [" +  this .getClass().getName() + "]");
                        }
                    };
            FifoProperties moFifoProperties =
                     new  FifoProperties("rcvMoFifo", 4000 , 1000 , 1000 , 100 );

            LedgerProperties moLedgerProperties =
                     new  LedgerProperties("rcvMoLdg","#","rcvMoLdg", 1000  *  60  *  5 , LedgerProperties.LIFE_TIME_FOREVER,
                             5000 ,true);

            FifoProperties confFifoProperties =
                     new  FifoProperties("rcvConfFifo", 4000 , 1000 , 1000 , 100 );

            LedgerProperties confLedgerProperties =
                     new  LedgerProperties("rcvConfLdg","#","rcvConfLdg", 1000  *  60  *  5 ,
                            LedgerProperties.LIFE_TIME_FOREVER,
                             5000 ,true);

            FifoProperties notfFifoProperties =
                     new  FifoProperties("rcvNotfFifo", 4000 , 1000 , 1000 , 100 );

            LedgerProperties notfLedgerProperties =
                     new  LedgerProperties("rcvNotfLdg","#","rcvNotfLdg", 1000  *  60  *  5 ,
                            LedgerProperties.LIFE_TIME_FOREVER,
                             5000 ,true);
            FifoProperties gnackFifoProperties =
                     new  FifoProperties("rcvGNackFifo", 4000 , 1000 , 1000 , 100 );
            LedgerProperties gnackLedgerProperties =
                     new  LedgerProperties("rcvGNackLdg","#","rcvGNackLdg", 1000  *  60  *  5 ,
                            LedgerProperties.LIFE_TIME_FOREVER, 5000 ,true);

            FifoProperties mtFifoProperties =
                     new  FifoProperties("sendMtFifo", 4000 , 1000 , 1000 , 100 );
            LedgerProperties mtLedgerProperties =
                     new  LedgerProperties("sendMtLdg","#","sendMtLdg", 1000  *  60  *  5 ,
                            LedgerProperties.LIFE_TIME_FOREVER, 5000 ,true);

            client =  new  SmppClient(cfg, messageListener,     smppStatusListener,     1 ,
                                         moFifoProperties,    moLedgerProperties,     1 ,
                                         confFifoProperties,  confLedgerProperties,   1 ,
                                         notfFifoProperties,  notfLedgerProperties,   1 ,
                                         gnackFifoProperties, gnackLedgerProperties,  1 ,
                                         mtFifoProperties,    mtLedgerProperties,    logPlugin);
            client.start();
//***********************************************************
            SubmitSM request =  new  SubmitSM();
            Address src =  new  Address("1076");
            src.setTon(( byte )Data.GSM_TON_UNKNOWN);
                        //src.setTon((byte)Data.GSM_TON_ALPHANUMERIC);

            src.setNpi(( byte )Data.GSM_NPI_E164);
            request.setSourceAddr(src);
            System.out.println(request.getSourceAddr().toString());

            Address dst =  new  Address("38хххххххххх");
            dst.setTon(( byte )Data.GSM_TON_INTERNATIONAL);
            dst.setNpi(( byte )Data.GSM_NPI_E164);

            request.setDestAddr(dst);
            request.setShortMessage("1");
            request.setRegisteredDelivery(Data.SM_SMSC_RECEIPT_NOT_REQUESTED);
            request.assignSequenceNumber(true);

            client.sendRequest(request);
            logPlugin.writeDataLog("Waiting For Tester terminate..");
            Thread.sleep( 1000  *  60  *  10 );
        }      catch  (Exception e)        { e.printStackTrace();}
         finally    {
             try    {
                 if  (client !=  null ) client.stop();
                logPlugin.writeDataLog("Tester is stoped.");
            }       catch  (Exception e)  {e.printStackTrace(); }
        }
    }
}

В таком виде отсылается СМС корректо: источник представлен в виде цифры 1076 .
Когда источник представлен в виде строки:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
            SubmitSM request =  new  SubmitSM();
            Address src =  new  Address(<любая_строка>);
            src.setTon(( byte )Data.GSM_TON_UNKNOWN);
                        //src.setTon((byte)Data.GSM_TON_ALPHANUMERIC);

            src.setNpi(( byte )Data.GSM_NPI_E164);
            request.setSourceAddr(src);
сообщение не отправляется. Для этого меняю строку Data.GSM_TON_UNKNOWN на
Data.GSM_TON_ALPHANUMERIC :
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
            SubmitSM request =  new  SubmitSM();
            Address src =  new  Address(<любая_строка>);
            //src.setTon((byte)Data.GSM_TON_UNKNOWN);
                        src.setTon(( byte )Data.GSM_TON_ALPHANUMERIC);

            src.setNpi(( byte )Data.GSM_NPI_E164);
            request.setSourceAddr(src);

сообщение все равно не отправляется((. (И даже если вместо источника опять поставить число.



ВОПРОС: как можно отправить сообщение, а источник указать в виде строки?
(по заданию, он может быть представлен как числом, так и строкой. С помощью какой настройки (универсальной, подходящей для обеих случаев)можно указать, чтобы отрпавлялось во всех случаях?)


С уважение, Ihor
...
Рейтинг: 0 / 0
Рассылка СМС, исползуя com.logica.smpp (источник в виде 1-номер, 2-любая строка)
    #34372216
Фотография Ihor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Фух)) Проблема решена:

Код: plaintext
1.
2.
3.
4.
5.
6.
            String st = "любая_строка/число";
            //Address src = new Address(st,30);
            Address src= new  Address();
            src.setTon(( byte )0x05);
            src.setNpi(( byte )0x00);
            src.setAddress(st,Data.SM_ADDR_LEN);

Надеюсь, это кому-то поможет. Спасибо всем за внимание )
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / Рассылка СМС, исползуя com.logica.smpp (источник в виде 1-номер, 2-любая строка)
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]