|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ie.ncl.msg.impl.SimpleConnection ie.ncl.sms.smpp.SmppConnection
public class SmppConnection
The SmppConnection class is an implementation of
the SMPP 3.4 Protocol used to connect to a
SMPP compliant Short Message Service Centre,
for the purposes of sending and receiving
text and binary short messages. E.g. Logica Telepath SMSC.
IMPORTANT: Unless you are performing some SMPP specific operation
it is best to use the ie.ncl.msg.Factory class
to create instances of the SmppConnection.
This allows you to dynamically create transport independent
software applications.
The SMPP configuration properties are as follows:-
NAME | VALUE | DEFAULT |
class | The name of the implementing class - ie.ncl.sms.smpp.SmppConnection | mandatory |
id | SMPP system id authentication attribute (string) | mandatory |
pass | SMPP password authentication attribyte (string) | mandatory |
host | Host name of the SMSC (string) | mandatory |
port | IP port number of the SMPP Server (number) | mandatory |
bindType | The binding type (string). This can be 'transmitter', 'receiver' or 'transceiver' | mandatory |
emsReceiptBits or esmReceiptBits | This is a fix for broken SMPP 3.3 servers that use invalid bits (SMPP 3.4 bits) to flag delivery receipts. For broken SMPP 3.3 servers this should be set to 4. | optional - not used by default |
version | The SMPP version (number). This should be 51 (0x33) for SMPP 3.3 and 52 (0x34) for SMPP 3.4 | mandatory |
transmitterBindSourceAddressAllowed | Specifies whether a bind range address is to be used for a transmitter connection. Rarely used (true or false) | optional - defaults to false |
range | For receivers this specifies the range of numbers for which messages are to be received. This is usually a regular expression but may be server implementation dependent (string). This is specified by the SMSC administrator. | optional |
range.ton | The default type of number (TON) that should be on received messages. This is specified by the SMSC administrator. | optional |
range.npi | The default number plan indicator (TON) that should be on received messages. This is specified by the SMSC administrator. | optional |
autoAcknowledge | Received messages are acknowledged automatically once processed. If this is set to false then the application must acknowledge them specifically. Note that messages acknowledged out-of-order may not have their acknowledgements sent to the SMSC until the message responses are in a contiguous block | optional - defaults to true |
sequentialAcknowledgement | Specifies that acknowledgements sent back to the SMSC are in the same sequence as received messages. Rarely used as most SMSCs require sequential acknowledgements (true/false) | optional - defaults to true |
defaultTon | The default type of number (TON) set on out going messages addresses (number) | optional - defaults to 0 |
defaultNpi | The default number plan indicator (NPI) set on out going messages addresses (number) | optional - defaults to 0 |
sourceTon | The default type of number (TON) set on out going message source addresses (number) | optional - defaults to 0 |
sourceNpi | The default number plan indicator (NPI) set on out going message source addresses (number) | optional - defaults to 0 |
sourceNumber | The default number set on out going message source addresses (number) | optional |
sendRequestDelivery | Send a request to deliver messages on connection (true or false) | optional - defaults to false |
internationalPrefix | This specifies the international prefix. If specified and a '+' is detected on an outbound message address, then it is replaced by this prefix number. | optional -not used by default |
linkAliveIfAnyDataReceived | The link is alive if any data is received within the response timeout of sending a query link operation to the SMSC. If this is false, the query link response must be received within the timeout (true or false) | optional - defaults to true |
smscResponseTimeoutSeconds | The response timeout for which a response must be received from the SMSC upon sending a request other than a bind (number of seconds). | optional - defaults to 60 seconds. |
bindResponseTimeoutSeconds | The response timeout for which a response must be received from the SMSC upon sending the initial bind request (number of seconds). | optional - defaults to 5 seconds. |
flowControlTimerSeconds | A configurable pause between stopping transmitting messages upon receiving a throttle response and starting again (number of seconds). | optional - defaults to 5 seconds. |
throttleUseconds | A configurable pause between transmitting messages (micro seconds). | optional - defaults to 0 micro seconds. |
discardReceivedMessageAfterRetries | The application will be notified of a received (MO) message this number of times until the application returns true in the callback indicating that the message has been successfully processed by the application. If true has not been returned for any of the retries it will be discarded. If this is not specified then the normal of the toolkit is to send no response at all to the SMSC (as nacks are not supported on SMPP deliver) if the application returns false. This will cause the message to be re-delivered by the SMSC when connected again. | optional - should be one or more retries. |
unackedQueueSize | The maximum number of outstanding requests sent to the SMSC without have receive a response for any (number) | optional - defaults to 1000 |
reconnectOnDisconnect | Reconnect to the SMSC if the connection is dropped (true or false). | optional - defaults to false |
reconnectRetryAttempts | The number of re-connection retry attempts to be performed if a connection is lost (number). | optional - defaults to 60 retries |
reconnectTimerSeconds | The number of seconds between re-connection attempts (number of seconds) | optional -defaults to 60 seconds |
queryLinkEverySeconds | Query the link every so often to ensure it is up and running (number of seconds) | optional - defaults to 30 seconds |
defaultToGsmAlphabet | If the data coding scheme of binary message is default alphabet, this specifies that the bytes should be re-encoded using the GSM alphabet. (true/false) | optional - defaults to false |
defaultAlphabetEncoding | Default alphabet encoding when a data coding scheme is not specified. This can be GSM, ROMAN8, SEMA or a java encoding scheme. | optional - defaults to GSM |
useISODataCodingSchemes | If set to true, will attempt to decode bytes as ISO_8859_1,ISO_8859_5 or ISO_8859_8 when DCS is 3, 6 or 7 respectively | optional - defaults to false |
useReceiptedMessageIds | Some SMPP 3.4 implementations may return the message ID in a different part of the protocol packet called the TLV part. If the version is 3.4 or greater AND it is present in the TLV part then this will be used as the message ID (if not present, the original part will be used). This option can be forcebly turned off. | optional - defaults to true |
expectNullTerminateDeliver | Some SMPP 3.3 implementations (SIMCON Router) append a null onto the octet string of a message when delivering it to the application. In such a case, the toolkit must be informed that this is the case by setting this to true | optional - defaults to false |
use7BitEncoding | Some new SMPP implementations (mid 2003) require text data to be 7bit encoded (not backward compatible with octet encoding). Setting this flag will 7bit encode the text of messages that use the default alphabet. | optional - defaults to false |
use7BitDecoding | Same as use7BitEncoding except SMSC to Application direction. | optional - defaults to false |
retryMessagesOnQueueFull | If a subscribers queue is full, continue to attempt to deliver the message. | optional - defaults to true |
maximumNumberOfRetries |
How many times a message with a TemporaryMessageException will be retried before failing. -1 means
to try indefinitely.
|
-1 |
notifyApplicationOfTempErrors |
Set to true in order for callback's to be made for TemporaryMessageException 's. The callback listener
should check the type of Exception object passed to see if it is a temporary error (in which case the message will
be retried automatically).
|
false |
timeBetweenRetriesMseconds |
How often messages which encounter a TemporaryMessageException will be retried, in msecs.
|
1000 |
socketSoTimeout | TCP timeout setting to be made on socket (or 0 to leave default). This is in milliseconds. | 0 |
statusForReceiveException | The response status to return to SMSC if an exception is thrown while processing an incoming message or if the API callbacks - receive() or acknowledge() - returns unsuccsessful (false). Note that the SMPP message attribute RESPONSE_COMMAND_STATUS can over-ride this value. | 0 (R_OK) |
requestTimeout | After this timeout (milliseconds), unacknowledged outstanding requests will be treated as nacked. (0 means infinite) | 0 |
messageIdReturned | If true, protocol returns a '0' message id in response to a delivery short message from the SMSC. Otherwise a null is returned. | true ("0" returned) |
receiptDecoding | If specified, decodes proprietary delivery receipt formats. Set to VFUK for "Vodafone UK", SUNDAYHK for "Sunday Hong Kong" service providers, "ERICSSONIPX" for Ericsson IPX smsc service. | not set |
generateFailedReceiptIfErrorCodeIn | Typically for a delivery receipt with "stat:DELIVRD" meaning the original message has been successfully delivered. Otherwise it will contain "stat:FAILED" followed by an error code "err:XXX". However some service providers will return "stat:DELIVRD" with a non zero error code. If any of the error codes match that in the 'generateFailedReceiptIfErrorCodeIn' then a failed delivery receipt will be returned. | not set |
threadDaemon | Added for tomcat support - if true, forked SMPP threads are marked as daemon threads. | false |
notifyApplicationOfDecodingErrors | Notify application of received message decoding errors (through the received() callback or receive() API) | false |
maxLengthPdu | The maximum length of an SMPP PDU. | 16000 bytes |
socketConnectTimeout | Socket Connect Timeout. | 0 |
throttleOnMsgQueueFullError | Throttle (pause as per value specified in flow control timer property) if a message queue full error is received from the SMSC (on=true) | false |
throwExceptionOnFullQueues | Throws an exception on a call to send if the internal libraries queues are full and could cause send to block. | false |
reconstructGsm0340Pdus | Reconstruct the PDUs as would be sent by a phone OTA as per the GSM 03.40 specification. | true |
Factory
Field Summary | |
---|---|
int |
defaultNpi
|
int |
defaultTon
|
static java.lang.String |
ERICSSON_IPX_RECEIPT_DECODING
|
java.lang.String |
internationalPrefix
|
static java.lang.String |
SMPPESM
|
static java.lang.String |
SMPPSEQ
|
static java.lang.String |
SMPPSESSIONID
|
static java.lang.String |
SUNDAYHK_RECEIPT_DECODING
|
static java.lang.String |
VFUK_RECEIPT_DECODING
|
Fields inherited from interface ie.ncl.msg.Connection |
---|
CONNECTED, NOT_CONNECTED, NOT_USED, RECONNECTING |
Fields inherited from interface ie.ncl.sms.MessageAttributeNames |
---|
CC, DCS, EOT_GSM_ESCAPE_CHARACTER, PID, PRIORITY, RECEIPT, RECEIPT_BYTES, RECEIPT_STATUS, RECEIPT_TEXT, REGISTERED, REPLACE, REPLY_PATH, SCA, SCHEDULE, SUBMIT_ERROR, TIMESTAMP, UDH, UDHI, VALIDITY |
Fields inherited from interface ie.ncl.sms.AddressAttributeNames |
---|
TOA |
Constructor Summary | |
---|---|
SmppConnection()
|
|
SmppConnection(int port,
java.lang.String id,
java.lang.String type,
java.lang.String pass,
java.lang.String range)
Create a receiver connection - using outbind method (SMSC contacts application). |
|
SmppConnection(int port,
java.lang.String id,
java.lang.String type,
java.lang.String pass,
java.lang.String range,
int version)
Create a receiver connection - using outbind method (SMSC contacts application). |
|
SmppConnection(java.lang.String host,
int port,
java.lang.String id,
java.lang.String type,
java.lang.String pass)
Create a transmitter connection. |
|
SmppConnection(java.lang.String host,
int port,
java.lang.String id,
java.lang.String type,
java.lang.String pass,
int version)
Create a transmitter connection. |
|
SmppConnection(java.lang.String host,
int port,
java.lang.String id,
java.lang.String type,
java.lang.String pass,
java.lang.String range)
Create a receiver connection. |
|
SmppConnection(java.lang.String host,
int port,
java.lang.String id,
java.lang.String type,
java.lang.String pass,
java.lang.String range,
int version)
Create a receiver connection. |
|
SmppConnection(java.lang.String host,
int port,
java.lang.String id,
java.lang.String type,
java.lang.String pass,
java.lang.String range,
int version,
boolean tranceiver)
Create a receiver or tranceiver connection. |
Method Summary | |
---|---|
void |
acknowledge(Message m,
boolean success)
Acknowledge a received message. |
void |
close()
Close the connection. |
void |
connect()
Connect with the service. |
void |
connectionError(java.lang.Exception e)
implements SMPP callback API. |
Message |
convert(Message message)
|
Message |
convert(Message smppMsg,
MessageSettings settings)
|
java.lang.Exception |
convertOldApiExceptionToNewApiException(java.lang.Exception old)
|
java.lang.String |
fixIdPadding(java.lang.String oldId)
|
java.lang.String |
getAlphanumericAddressCharacterEncoding()
|
int |
getConnectionStatus()
Query the status of the link. |
java.lang.String |
getDefaultAlphabetEncoding()
Get the default alphabet encoding (GSM/ROMAN8/SEMA/ASCII). |
Smpp |
getLowerLevelInterface()
|
int |
getOutputQueueSize()
|
int |
getQueryLinkEverySeconds()
|
java.lang.String |
getReceiptDecoding()
|
int |
getRegisteredMessageBits()
|
java.lang.String |
getSmscVersion()
|
int |
getSocketConnectTimeout()
|
static java.lang.String |
getSoftwareVersion()
|
int |
getUnackedQueueSize()
|
void |
init(java.util.Properties ps)
Implements Connection API. |
boolean |
interceptReceiverApiCallToInsertSmppCommandAttributes(Message smppMsg,
java.lang.Exception ex,
Message msg,
MessageSettings settings)
|
boolean |
isMessageIdReturned()
|
boolean |
isNotifyApplicationOfDecodingErrors()
|
boolean |
isReconstructGsm0340Pdus()
|
boolean |
isServerMode()
|
boolean |
isThrottleOnMsgQueueFullError()
|
boolean |
isThrowExceptionOnFullQueues()
|
boolean |
isUseISODataCodingSchemes()
|
static void |
main(java.lang.String[] args)
|
void |
ping()
Ping. |
boolean |
receive(java.lang.Exception ex,
Message smppMsg,
MessageSettings settings)
Implements SMPP callback (asynchronous receive). |
void |
receive(ReceiverListener listener)
Receiver Interface Method. |
void |
send(Message message,
SenderListener listener)
Sender Interface Method. |
void |
sendResponse(java.lang.Exception exception,
Message m)
Implements SMPP callback (asynchronous send). |
void |
service(java.net.Socket socket)
|
void |
setAlphanumericAddressCharacterEncoding(java.lang.String alphanumericAddressCharacterEncoding)
|
void |
setDefaultAlphabetEncoding(java.lang.String s)
Set the default alphabet encoding (GSM/ROMAN8/SEMA/ASCII). |
void |
setMessageIdReturned(boolean messageIdReturned)
|
void |
setNotifyApplicationOfDecodingErrors(boolean notifyApplicationOfDecodingErrors)
|
void |
setOutputQueueSize(int outputQueueSize)
|
void |
setQueryLinkEverySeconds(int queryLinkEverySeconds)
|
void |
setReceiptDecoding(java.lang.String receiptDecoding)
|
void |
setReceiverListener(ReceiverListener listener)
Receiver Interface Method. |
void |
setReconstructGsm0340Pdus(boolean reconstructGsm0340Pdus)
|
void |
setRegisteredMessageBits(int registeredMessageBits)
|
void |
setRequestTimeout(int requestTimeout)
|
void |
setSocketConnectTimeout(int socketConnectTimeout)
|
void |
setThrottleOnMsgQueueFullError(boolean throttleOnMsgQueueFullError)
|
void |
setThrowExceptionOnFullQueues(boolean throwExceptionOnFullQueues)
|
void |
setUnackedQueueSize(int unackedQueueSize)
|
void |
setUse7BitDecoding(boolean val)
|
void |
setUse7BitDecodingOctetLength(boolean val)
|
void |
setUse7BitEncoding(boolean val)
|
void |
setUse7BitEncodingOctetLength(boolean val)
|
void |
setUseISODataCodingSchemes(boolean useISODataCodingSchemes)
|
void |
shutdown()
Shutdown the connection. |
java.util.Date |
toDate(java.lang.String d)
|
void |
transceiverMode()
Deprecated. use constuctor to specify this mode. |
void |
use7Bit()
|
Methods inherited from class ie.ncl.msg.impl.SimpleConnection |
---|
connected, getErrorListener, getName, getTypeDefaults, init, mergeDefaultAttributes, putTypeDefaults, setErrorListener, setName |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ie.ncl.msg.Connection |
---|
connected, getTypeDefaults, init, putTypeDefaults, setErrorListener |
Field Detail |
---|
public static final java.lang.String SMPPSEQ
public static final java.lang.String SMPPESM
public static final java.lang.String SMPPSESSIONID
public int defaultTon
public int defaultNpi
public java.lang.String internationalPrefix
public static final java.lang.String VFUK_RECEIPT_DECODING
public static final java.lang.String SUNDAYHK_RECEIPT_DECODING
public static final java.lang.String ERICSSON_IPX_RECEIPT_DECODING
Constructor Detail |
---|
public SmppConnection(java.lang.String host, int port, java.lang.String id, java.lang.String type, java.lang.String pass, java.lang.String range) throws java.lang.Exception
java.lang.Exception
public SmppConnection(java.lang.String host, int port, java.lang.String id, java.lang.String type, java.lang.String pass, java.lang.String range, int version) throws java.lang.Exception
java.lang.Exception
public SmppConnection(java.lang.String host, int port, java.lang.String id, java.lang.String type, java.lang.String pass, java.lang.String range, int version, boolean tranceiver) throws java.lang.Exception
java.lang.Exception
public SmppConnection(int port, java.lang.String id, java.lang.String type, java.lang.String pass, java.lang.String range) throws java.lang.Exception
java.lang.Exception
public SmppConnection(int port, java.lang.String id, java.lang.String type, java.lang.String pass, java.lang.String range, int version) throws java.lang.Exception
java.lang.Exception
public SmppConnection()
public SmppConnection(java.lang.String host, int port, java.lang.String id, java.lang.String type, java.lang.String pass) throws java.lang.Exception
java.lang.Exception
public SmppConnection(java.lang.String host, int port, java.lang.String id, java.lang.String type, java.lang.String pass, int version) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public Smpp getLowerLevelInterface()
public boolean isServerMode()
public boolean isReconstructGsm0340Pdus()
public void setReconstructGsm0340Pdus(boolean reconstructGsm0340Pdus)
public boolean isThrottleOnMsgQueueFullError()
public void setThrottleOnMsgQueueFullError(boolean throttleOnMsgQueueFullError)
public int getSocketConnectTimeout()
public void setSocketConnectTimeout(int socketConnectTimeout)
public int getRegisteredMessageBits()
public void setRegisteredMessageBits(int registeredMessageBits)
public java.lang.String getReceiptDecoding()
public void setReceiptDecoding(java.lang.String receiptDecoding)
public boolean isMessageIdReturned()
public void setMessageIdReturned(boolean messageIdReturned)
public java.lang.String getDefaultAlphabetEncoding()
public void setDefaultAlphabetEncoding(java.lang.String s)
public java.lang.String getAlphanumericAddressCharacterEncoding()
public void setAlphanumericAddressCharacterEncoding(java.lang.String alphanumericAddressCharacterEncoding)
public boolean isUseISODataCodingSchemes()
public void setUseISODataCodingSchemes(boolean useISODataCodingSchemes)
public boolean isThrowExceptionOnFullQueues()
public void setThrowExceptionOnFullQueues(boolean throwExceptionOnFullQueues)
public int getOutputQueueSize()
public void setOutputQueueSize(int outputQueueSize)
public int getUnackedQueueSize()
public void setUnackedQueueSize(int unackedQueueSize)
public boolean isNotifyApplicationOfDecodingErrors()
public void setNotifyApplicationOfDecodingErrors(boolean notifyApplicationOfDecodingErrors)
public void setUse7BitEncoding(boolean val)
public void setUse7BitDecoding(boolean val)
public void setUse7BitEncodingOctetLength(boolean val)
public void setUse7BitDecodingOctetLength(boolean val)
public void use7Bit()
public int getConnectionStatus()
Connection
getConnectionStatus
in interface Connection
getConnectionStatus
in class ie.ncl.msg.impl.SimpleConnection
Connection.CONNECTED
,
Connection.NOT_CONNECTED
,
Connection.RECONNECTING
,
Connection.setErrorListener(ie.ncl.msg.ErrorListener)
,
TemporaryConnectionException
public void connectionError(java.lang.Exception e)
connectionError
in interface ConnectionError
public void init(java.util.Properties ps) throws ConnectionException
init
in interface Connection
ConnectionException
public void ping() throws ConnectionException
ConnectionException
public void service(java.net.Socket socket) throws ConnectionException, java.io.IOException, ie.ncl.net.socks.SocksException, SMSException
ConnectionException
java.io.IOException
ie.ncl.net.socks.SocksException
SMSException
public void connect() throws ConnectionException
Connection
connect
in interface Connection
ConnectionException
public void transceiverMode()
public java.util.Date toDate(java.lang.String d)
public Message convert(Message smppMsg, MessageSettings settings) throws MessageException, ie.ncl.net.pdu.DecoderException
MessageException
ie.ncl.net.pdu.DecoderException
public boolean interceptReceiverApiCallToInsertSmppCommandAttributes(Message smppMsg, java.lang.Exception ex, Message msg, MessageSettings settings)
public java.lang.Exception convertOldApiExceptionToNewApiException(java.lang.Exception old)
public boolean receive(java.lang.Exception ex, Message smppMsg, MessageSettings settings)
receive
in interface ExtendedReceiver
public java.lang.String getSmscVersion()
public static java.lang.String getSoftwareVersion()
public void receive(ReceiverListener listener) throws ConnectionException
receive
in interface Receiver
ConnectionException
Message
public void setReceiverListener(ReceiverListener listener) throws ConnectionException
setReceiverListener
in interface Receiver
ConnectionException
Message
public void close()
close
in interface Connection
close
in class ie.ncl.msg.impl.SimpleConnection
public void shutdown()
Connection
shutdown
in interface Connection
public java.lang.String fixIdPadding(java.lang.String oldId)
public void sendResponse(java.lang.Exception exception, Message m)
sendResponse
in interface SendResponse
public void send(Message message, SenderListener listener) throws MessageException, ConnectionException
send
in interface Sender
MessageException
ConnectionException
SenderListener
,
Message
public Message convert(Message message) throws MessageException
MessageException
public void acknowledge(Message m, boolean success) throws MessageException, ConnectionException
acknowledge
in interface Receiver
MessageException
ConnectionException
public static void main(java.lang.String[] args)
public void setRequestTimeout(int requestTimeout)
public int getQueryLinkEverySeconds()
public void setQueryLinkEverySeconds(int queryLinkEverySeconds)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |