SMPP bind problem and checking existing connection with SMSC

2,088 views
Skip to first unread message

vram...@gmail.com

unread,
Jul 20, 2009, 9:23:48 AM7/20/09
to jsmpp
Hello,
Thanks for the reply.
I am facing one problem.
SMSC binding failure when i try to connect and bind to SMSC.
I am using the exact bind parameters provided by the SMSC vendor.
But the binding is failed.
I am not able to find out the error.
When i contacted the SMSC Vendor they say that a application is
already connected to the particular login(SysID) account.
Actually 1 month ago i tried and i think the java program connected
and binded to the SMSC.
Do you think that the connection and binding to SMSC which was
successful 1 month still exists today.
If it exists how can i disconnect and unbind from the SMSC,so that i
can bind again.
Could you please guide me.
Also could you please guide me how can i find if there is any problem
with the particular bind parameter and this is the program i am
using.
SMPP 3.4.

Thanks,
Vijay.


/*
* Java implementation of the SMPP v3.3 API
* Copyright (C) 1998 - 2000 by Oran Kelly
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*
* A copy of the LGPL can be viewed at http://www.gnu.org/copyleft/lesser.html
* Java SMPP API author: or...@users.sf.net
* $Id: SyncTransceiver.java,v 1.4 2004/10/09 22:02:43 orank Exp $
*/
package com.mfs.cmdtransmit;


import ie.omk.smpp.Address;
import ie.omk.smpp.Connection;
import ie.omk.smpp.message.BindResp;
import ie.omk.smpp.message.SMPPPacket;
import ie.omk.smpp.message.SubmitSM;
import ie.omk.smpp.message.SubmitSMResp;
import ie.omk.smpp.message.UnbindResp;
import ie.omk.smpp.version.SMPPVersion;


import java.util.HashMap;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


/** A synchronous transceiver example. Using sync mode for either a
transceiver
* or receiver connection is less useful than using async mode as
your
* application must now poll the connection continuously for incoming
delivery
* messages from the SMSC.
*
* @see ie.omk.smpp.examples.ParseArgs ParseArgs for details on
running
* this class.
*/
public class SyncTransceiver {


private HashMap myArgs = new HashMap();


private Connection myConnection = null;


private Log logger = LogFactory.getLog(SyncTransceiver.class);


public SyncTransceiver() {
}


private void init(String[] args) {
try {
myArgs = ParseArgs.parse(args);


int port = Integer.parseInt((String)myArgs.get
(ParseArgs.PORT));


myConnection = new
Connection((String)myArgs.get(ParseArgs.HOSTNAME), port);
myConnection.setVersion(SMPPVersion.V34);
myConnection.autoAckLink(false);
myConnection.autoAckMessages(true);


} catch (Exception x) {
logger.info("Bad command line arguments.");
}
}


private void run() {
try {
logger.info("Binding to the SMSC");
// Bind the short way:
BindResp resp = myConnection.bind(Connection.TRANSCEIVER,
(String)myArgs.get(ParseArgs.SYSTEM_ID),
(String)myArgs.get(ParseArgs.PASSWORD),
(String)myArgs.get(ParseArgs.SYSTEM_TYPE),
Integer.parseInt((String)myArgs.get
(ParseArgs.ADDRESS_TON)),
Integer.parseInt((String)myArgs.get
(ParseArgs.ADDRESS_NPI)),
(String)myArgs.get(ParseArgs.ADDRESS_RANGE));


if (resp.getCommandStatus() != 0) {
logger.info("SMSC bind failed.");
System.exit(1);
}


logger.info("Bind successful...submitting a message.");


// Submit a simple message
SubmitSM sm = (SubmitSM)myConnection.newInstance
(SMPPPacket.SUBMIT_SM);
sm.setDestination(new Address(0, 0, "3188332314"));
sm.setMessageText("This is an example short message.");
SubmitSMResp smr = (SubmitSMResp)myConnection.sendRequest
(sm);


logger.info("Submitted message ID: " + smr.getMessageId
());


try {
// Wait a while, see if the SMSC delivers anything to
us...
SMPPPacket p = myConnection.readNextPacket();
logger.info("Received a packet!");
logger.info(p.toString());


// API should be automatically acking deliver_sm and
// enquire_link packets...
} catch (java.net.SocketTimeoutException x) {
// ah well...
}


// Unbind.
UnbindResp ubr = myConnection.unbind();


if (ubr.getCommandStatus() == 0) {
logger.info("Successfully unbound from the SMSC");
} else {
logger.info("There was an error unbinding.");
}
} catch (Exception x) {
logger.info("An exception occurred.");
x.printStackTrace(System.err);
}
}


public static final void main(String[] args) {
SyncTransceiver t = new SyncTransceiver();
t.init(args);
t.run();
}



}

Manoj

unread,
Jul 21, 2009, 7:00:49 AM7/21/09
to jsmpp
Hi,

May be possible.
But When ever your application stops the session is expired and SMSC
must closed the Session.
As SMSC doesn't have any valid session it must be closed via there
end.

There may be two cases :-
1. SMSC is not closing the invalid sessions. They have to do it.
2. Some one othere application is running which uses the same ID
provided to you.

Regards
Manoj

Muhammad Imran

unread,
Oct 14, 2013, 12:15:24 PM10/14/13
to js...@googlegroups.com
I am looking for a professional who can setup a SMSC for me.
Reply all
Reply to author
Forward
0 new messages