How I can to connect SMPP Server on at Transceiver.

Dec 27, 2012 at 1:59 PM
Edited Dec 27, 2012 at 2:03 PM

Hi!

I have a problem:  SMPP server work only Transceiver Mode(bmReciver and bmTransmitter is not supported). 

In SMPPclient.cs in function OpenSession making 2 connection: reading(bmReceiver) and writing (bmTransmiter).

I want to make only one connect (Transceiver).

In OpenSession blok :

//Create two separate sessions for sending and receiving

bindInfo.AllowReceive = true;           

bindInfo.AllowTransmit = true;       

//   bindInfo.AllowTransmit = false;

vTrans = vRecv = SmppClientSession.Bind(bindInfo, timeOut);

 

But then I have some errors in SendMassge( ).

 

But I cant to make connet and sand massage :( .  Help please !!!!!!!

Coordinator
Dec 27, 2012 at 5:15 PM

kren,

I can't seem to follow what you are trying to say. By default, the client will bind in a transceiver mode, unless you set interface version to v3.3

If you haven't change interface version then it should connect as transceiver as you want.

Is this what you are trying to achieve?

Ben

Dec 28, 2012 at 6:24 AM
Edited Dec 28, 2012 at 8:32 AM

Hi.

Before activate client(client.start) I set version 3.4. 

I try to make transacts massages as transceiver mode. 

In example that I found at this Forum: After client starting in proc. 

The problem is that the server smmm trimmed and defective.

But my SMTP server working only  transceiver mode :(. 

Server can only  pakages: bind_transceiver, enquire_link, submit_sm, deliver_sm_resp, unbind, unbind_resp, generic_nack.

Session closed after 90 sec.

To send messages I need use TLV 0X1401.  In Tag.cs I cant find this code.....

...

I get sorce code.

In Open_session( ) I removed the block on a connection bmRecever and bmTransmitter.

The result is the following code:

 

private void OpenSession(SessionBindInfo bindInfo, bool useSeparateConnections, int timeOut)     

  {       

    ChangeState(SmppConnectionState.Connecting);

     if (useSeparateConnections)                       

{                //Use a single session for both sending and receiving 

              bindInfo.AllowTransmit = true;     

      bindInfo.AllowReceive = true; 

              try           

    { 

                  SmppClientSession session = SmppClientSession.Bind(bindInfo, timeOut);   

                vTrans = session;   

                vRecv = session;   

                InitializeSession(session); 

                ChangeState(SmppConnectionState.Connected);               

    } 

         catch (SmppException ex)   

            {     

              if (ex.ErrorCode == SmppErrorCode.ESME_RINVCMDID)                   

{   

                    //If SMSC returns ESME_RINVCMDID (Invalid command id)     

    //the SMSC might not be supporting the BindTransceiver PDU                            //Therefore, we can try to use bind with separate connections                       

OpenSession(bindInfo, true, timeOut);           

       }         

          else                    {         

              ChangeState(SmppConnectionState.Closed);                        //Start background timer                          StartTimer();                     

      throw;                   

    }               

}   

          catch         

      {         

          ChangeState(SmppConnectionState.Closed);             

  StartTimer();                 

  throw;     

        }

  }     

  }

 

 

 

 

 

 

 

 

 

Dec 28, 2012 at 10:07 AM

But then I try send message I have  exeption with error code :(.

 

 

Can you give me some example, to recieve messages from server?

Dec 28, 2012 at 4:18 PM
Edited Dec 28, 2012 at 4:19 PM

I think that connection complite and server wait commands. 

But server recive not massage :(.

That's the message server receives and understands: (  )

//  connect and login

19:55:40: Client 10.1.2.52:57342 Binding login:password

19:55:40: Client 10.1.2.52:57342 Received  byte array from client: 00000036000000090000000000000008706f647279676b61746162657200584b213563587a007472616e736365697665720003000100

19:55:40: Client 10.1.2.52:57342 Sent byte array to client: 0000001d800000090000000000000008496e65746c61622e534d505000

 

 //  send mess

19:55:43: Client 10.1.2.52:57342 Received  byte array from client: 0000002f00000004000000000000000900000131323300010137393635313230303339300000000000000100080000

19:55:43: Client 10.1.2.52:57342 Received message Src:79651200390, Dst:123, Text:

19:55:43: Client 10.1.2.52:57342 Sent byte array to client: 0000003580000004000000000000000933646239656438622d323938312d346364622d386232372d63623236393735393462343900

 // log out

19:55:47: Client 10.1.2.52:57342 disconnected.

 

 

This massage server ressive from my client: 

//  connect and login

20:02:19: Client 10.1.2.52:57366 Binding login: password

20:02:19: Client 10.1.2.52:57366 Received  byte array from client: 00000036000000090000000000000001706f647279676b61746162657200584b213563587a007472616e736365697665720034010100

20:02:19: Client 10.1.2.52:57366 Sent byte array to client: 0000001d800000090000000000000001496e65746c61622e534d505000

 

  //  send mess

20:02:24: Client 10.1.2.52:57366 Received message Src:79261693542, Dst:12345, Text:

20:02:24: Client 10.1.2.52:57366 Received  byte array from client: 0000003200000004000000000000000200010131323334350001013739323631363933353432000000000000010001000100

20:02:24: Client 10.1.2.52:57366 Sent byte array to client: 0000003580000004000000000000000234316633633666662d376437662d343534612d626439372d37386335343932326135653900

  // log out

20:02:28: Client 10.1.2.52:57366 disconnected.

 

 

I think that problem at RED string. This message must send before blue string.

But  I do not understand where I am sending a sequence of messages :(  ? 

Maby probem in this? 

 

Coordinator
Dec 29, 2012 at 5:44 PM

kren,

Could you post the source code here?

Also, it appears that you are using the low level library. Have you tried to use the client library with that connection?

Thanks,

Ben

Jan 9, 2013 at 5:47 AM
Edited Jan 9, 2013 at 5:51 AM

Hi Ben. Thank you for your help. :)

This is my application code. You right -  I am using Low level library.  I had to change the code the main library as smpp server waning: (.

If You wright my your mail, I send you full project code . My mail - papakren5@mail.ru

 

 

using System;

using System.Collections.Generic;using System.ComponentModel;

using System.Data;using System.Drawing;using System.Linq;using System.Text;

using System.Windows.Forms;
namespace WindowsFormsApplication12

{   

public partial class Form1 : Form 

   {
         JamaaTech.Smpp.Net.Client.SmppClient mmclient = new JamaaTech.Smpp.Net.Client.SmppClient();         JamaaTech.Smpp.Net.Client.SmppConnectionProperties mmproperties; 

         JamaaTech.Smpp.Net.Client.TextMessage mymsg = new JamaaTech.Smpp.Net.Client.TextMessage();                                       

 public Form1()     

   {       

     InitializeComponent();   

     mmproperties = mmclient.Properties;   

     }

         private void button1_Click(object sender, EventArgs e)   

     {    // Connection and user init

             mmclient.Properties.SystemID = "po************r";   

    mmclient.Properties.Password = "password";         

    mmclient.Properties.Port = 2775; //IP port to use

                    mmclient.Properties.Host = "10.1.2.52";             //     SMSC host name or IP Address MY TEST sever           
         

                  //       mmclient.Properties.Host = "213.59.1.126";         //     Ip adress Sever that I must to use

    mmclient.Properties.SystemType = "transceiver";       

    mmclient.Properties.DefaultServiceType = "transceiver";         

    mmclient.Properties.AddressTon = JamaaTech.Smpp.Net.Lib.TypeOfNumber.International;         

    mmclient.Properties.AddressNpi = JamaaTech.Smpp.Net.Lib.NumberingPlanIndicator.ISDN;

            mmclient.Properties.DefaultEncoding = JamaaTech.Smpp.Net.Lib.DataCoding.ASCII ;            

    mmclient.Properties.SourceAddress = "0";                       

//mmclient.Properties.GetBindInfo();                                  

    mmclient.Properties.InterfaceVersion = JamaaTech.Smpp.Net.Lib.InterfaceVersion.v34;

                         //Resume a lost connection after 30 seconds       

                            mmclient.AutoReconnectDelay = 3000;           

//Send Enquire Link PDU every 30 seconds       

   mmclient.KeepAliveInterval = 15000;           

//Start smpp client           

   mmclient.Start();
               //Provide a handler for the SmppClient.MessageReceived event

                   mmclient.MessageReceived += new EventHandler<JamaaTech.Smpp.Net.Client.MessageEventArgs>(mmclient_MessageReceived);                          }

 

 

  public void mmclient_MessageReceived(object sender, JamaaTech.Smpp.Net.Client.MessageEventArgs e)     

  {       

             //The event argument e contains more information about the received message       

              JamaaTech.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;

          

        }



        private void button2_Click(object sender, EventArgs e)     

  {    

     //     sending the message


            mymsg.DestinationAddress = "79261693542"; //Receipient number         

            mymsg.SourceAddress = "12345"; //Originating number
            mymsg.Text = textBox1.Text;
            mymsg.RegisterDeliveryNotification = true; //I want delivery notification for this message
            //mmclient.ConnectionState;
            mmclient.SendMessage(mymsg,1000);   

    }

 

         private void button3_Click(object sender, EventArgs e)       

                {         

                  mmclient.Shutdown();   

                 }     

 

Jan 9, 2013 at 12:45 PM

I get out the error in SMPPCLIENT at    SendMessage.

 

    public void SendMessage(ShortMessage message, int timeOut)     

  {     

      if (message == null) { throw new ArgumentNullException("message"); }
                //Check if connection is open               

//********* тут выскакивает исключение состояние vState == concting!!!!!!!! 

                // if (vState == SmppConnectionState.Connecting || vState == SmppConnectionState.Connected)
              if (vState != SmppConnectionState.Connected) 

              {            

         throw new SmppClientException("Sending message operation failed because the SmppClient is not connected");                }
                 foreach (SendSmPDU pdu in message.GetMessagePDUs(vProperties.DefaultEncoding))         

  {  

                                                        
                ResponsePDU resp = vTrans.SendPdu(pdu, timeOut);                                         

        if (resp.Header.ErrorCode != SmppErrorCode.ESME_ROK)                     

                                 {  

                                   throw new SmppException(resp.Header.ErrorCode);                                                   

                                  }

                                RaiseMessageSentEvent(message);                    

                                }   

                               }

 

 

 resp.Header.ErrorCode = SmppErrorCode.ESME_RSYSERR.      -        I do not understand why this error occurs.

 I also changed the code inOpenSession -  Left-only reception - transfer.

 

private void OpenSession(SessionBindInfo bindInfo, bool useSeparateConnections, int timeOut)     

  {            ChangeState(SmppConnectionState.Connecting);           

                if (useSeparateConnections)   

               {                //Use a single session for both sending and receiving       

                                  bindInfo.AllowTransmit = true;

                                  bindInfo.AllowReceive = true; 

                                   try               

                                    {               

                                     SmppClientSession session = SmppClientSession.Bind(bindInfo, timeOut);   

                                     vTrans = session;                   

                                     vRecv = session;                   

                                     InitializeSession(session);                   

                                     ChangeState(SmppConnectionState.Connected);               

                                     }               

                                   catch (SmppException ex)               

                                  {    

                                    if (ex.ErrorCode == SmppErrorCode.ESME_RINVCMDID)                   

                                     {                       

                                            //If SMSC returns ESME_RINVCMDID (Invalid command id)                       

                                            //the SMSC might not be supporting the BindTransceiver PDU                       

                                            //Therefore, we can try to use bind with separate connections                       

                                          OpenSession(bindInfo, true, timeOut);                   

                                          }                   

                                                else                   

                                        {                       

                                            ChangeState(SmppConnectionState.Closed);                        //Start background timer       

                                           StartTimer();                       

                                           throw;   

                                            }

                                           }               

                                          catch               

                                          {                   

                                            ChangeState(SmppConnectionState.Closed);                   

                                            StartTimer();                   

                                            throw;               

                                           }           

                                          }

                                         } 

 

Jan 10, 2013 at 5:54 AM
Edited Jan 11, 2013 at 7:02 AM

Hi Ben.

It worked.There were problems with the SMPP server provider ......Messages are sent :).

I still can not get to make logging and receive messages from the server.

There was a problem with a long message. Longer than 127 characters in a message do not work: (.How can you increase the length of sent messages?

How can I use submit multy operation functional ?

Coordinator
Jan 11, 2013 at 8:16 AM
Kren,

Have you tried to use UCS2 encoding? Also, try to check in the discussion forum, there is a thread about encoding issues which should I hope could solve your problem.

Ben
Jan 11, 2013 at 8:50 AM

Hi Ben.  I solved the problem with the coding message :) . Found a solution on the forum.It's not clear how to encode the sender.

And is it possible to send messages longer than 256 bytes?

Coordinator
Jan 11, 2013 at 9:14 AM
Kren,

That is also possible. You just need to use concatenation solution which is also in the discussion forums.

Ben
Jan 11, 2013 at 9:52 AM
Edited Jan 11, 2013 at 1:26 PM

Yes, I have read and modified the  formums code:

protected override IEnumerable<SendSmPDU> GetPDUs(DataCoding defaultEncoding)

{
...
}


In the module PDUHeader.cs  must extend the definition of the method set for SequenceNumber

  public uint SequenceNumber        
	{
	  get { return vSequenceNumber; }           
	  set { vSequenceNumber = value; }        
        }       



:) Long message sending :) . 

Sometimes the messages are broken and come in pieces.