org.jsmpp.extra.NegativeResponseException Java Examples

The following examples show how to use org.jsmpp.extra.NegativeResponseException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultSMPPClientOperation.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
public String submitSm(String serviceType, TypeOfNumber sourceAddrTon,
        NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
        TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi,
        String destinationAddr, ESMClass esmClass, byte protocolId,
        byte priorityFlag, String scheduleDeliveryTime,
        String validityPeriod, RegisteredDelivery registeredDelivery,
        byte replaceIfPresentFlag, DataCoding dataCoding,
        byte smDefaultMsgId, byte[] shortMessage,
        OptionalParameter... optionalParameters) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {

    SubmitSmCommandTask submitSmTask = new SubmitSmCommandTask(
            pduSender(), serviceType, sourceAddrTon, sourceAddrNpi,
            sourceAddr, destAddrTon, destAddrNpi, destinationAddr,
            esmClass, protocolId, priorityFlag, scheduleDeliveryTime,
            validityPeriod, registeredDelivery, replaceIfPresentFlag,
            dataCoding, smDefaultMsgId, shortMessage, optionalParameters);

    SubmitSmResp resp = (SubmitSmResp)executeSendCommand(submitSmTask,
            getTransactionTimer());
    return resp.getMessageId();
}
 
Example #2
Source File: AbstractSMPPOperation.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
public DataSmResult dataSm(String serviceType, TypeOfNumber sourceAddrTon,
        NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
        TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi,
        String destinationAddr, ESMClass esmClass,
        RegisteredDelivery registeredDelivery, DataCoding dataCoding,
        OptionalParameter... optionalParameters) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {

    DataSmCommandTask task = new DataSmCommandTask(pduSender,
            serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr,
            destAddrTon, destAddrNpi, destinationAddr, esmClass,
            registeredDelivery, dataCoding, optionalParameters);

    DataSmResp resp = (DataSmResp)executeSendCommand(task, getTransactionTimer());

    return new DataSmResult(resp.getMessageId(), resp.getOptionalParameters());
}
 
Example #3
Source File: SMPPOutboundServerSession.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
/**
 * Sending bind.
 *
 * @param bindType         is the bind type.
 * @param systemId         is the system id.
 * @param password         is the password.
 * @param systemType       is the system type.
 * @param interfaceVersion is the interface version.
 * @param addrTon          is the address TON.
 * @param addrNpi          is the address NPI.
 * @param addressRange     is the address range.
 * @param timeout          is the max time waiting for bind response.
 * @return SMSC system id.
 * @throws PDUException              if we enter invalid bind parameter(s).
 * @throws ResponseTimeoutException  if there is no valid response after defined millisecond.
 * @throws InvalidResponseException  if there is invalid response found.
 * @throws NegativeResponseException if we receive negative response.
 * @throws IOException               if there is an IO error occur.
 */
private String sendBind(BindType bindType, String systemId,
                        String password, String systemType,
                        InterfaceVersion interfaceVersion, TypeOfNumber addrTon,
                        NumberingPlanIndicator addrNpi, String addressRange, long timeout)
    throws PDUException, ResponseTimeoutException,
    InvalidResponseException, NegativeResponseException, IOException {

  BindCommandTask task = new BindCommandTask(pduSender(), bindType,
      systemId, password, systemType, interfaceVersion, addrTon,
      addrNpi, addressRange);

  BindResp resp = (BindResp) executeSendCommand(task, timeout);
  OptionalParameter.Sc_interface_version scVersion = resp.getOptionalParameter(Sc_interface_version.class);
  if (scVersion != null) {
    logger.debug("Other side reports SMPP interface version {}", scVersion);
  }

  logger.info("Bind response systemId '{}'", resp.getSystemId());
  return resp.getSystemId();
}
 
Example #4
Source File: DefaultSMPPServerOperation.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
public void deliverSm(String serviceType, TypeOfNumber sourceAddrTon,
        NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
        TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi,
        String destinationAddr, ESMClass esmClass, byte protocoId,
        byte priorityFlag, RegisteredDelivery registeredDelivery,
        DataCoding dataCoding, byte[] shortMessage,
        OptionalParameter... optionalParameters) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {

    DeliverSmCommandTask task = new DeliverSmCommandTask(pduSender(),
            serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr,
            destAddrTon, destAddrNpi, destinationAddr, esmClass, protocoId,
            protocoId, registeredDelivery, dataCoding, shortMessage,
            optionalParameters);

    executeSendCommand(task, getTransactionTimer());
}
 
Example #5
Source File: SMPPServerSession.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
@Override
public void deliverShortMessage(String serviceType,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, TypeOfNumber destAddrTon,
        NumberingPlanIndicator destAddrNpi, String destinationAddr,
        ESMClass esmClass, byte protocoId, byte priorityFlag,
        RegisteredDelivery registeredDelivery, DataCoding dataCoding,
        byte[] shortMessage, OptionalParameter... optionalParameters)
        throws PDUException, ResponseTimeoutException,
        InvalidResponseException, NegativeResponseException, IOException {
    
    ensureReceivable("deliverShortMessage");
    
    DeliverSmCommandTask task = new DeliverSmCommandTask(pduSender(),
            serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr,
            destAddrTon, destAddrNpi, destinationAddr, esmClass, protocoId,
            protocoId, registeredDelivery, dataCoding, shortMessage,
            optionalParameters);
    
    executeSendCommand(task, getTransactionTimer());
}
 
Example #6
Source File: DefaultSMPPClientOperation.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
public QuerySmResult querySm(String messageId, TypeOfNumber sourceAddrTon,
        NumberingPlanIndicator sourceAddrNpi, String sourceAddr)
        throws PDUException, ResponseTimeoutException,
        InvalidResponseException, NegativeResponseException, IOException {

    QuerySmCommandTask task = new QuerySmCommandTask(pduSender(),
            messageId, sourceAddrTon, sourceAddrNpi, sourceAddr);

    QuerySmResp resp = (QuerySmResp)executeSendCommand(task,
            getTransactionTimer());

    if (resp.getMessageId().equals(messageId)) {
        return new QuerySmResult(resp.getFinalDate(), resp
                .getMessageState(), resp.getErrorCode());
    } else {
        // message id requested not same as the returned
        throw new InvalidResponseException(
                "Requested message_id doesn't match with the result");
    }
}
 
Example #7
Source File: DefaultSMPPClientOperation.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
public SubmitMultiResult submitMulti(String serviceType,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, Address[] destinationAddresses,
        ESMClass esmClass, byte protocolId, byte priorityFlag,
        String scheduleDeliveryTime, String validityPeriod,
        RegisteredDelivery registeredDelivery,
        ReplaceIfPresentFlag replaceIfPresentFlag, DataCoding dataCoding,
        byte smDefaultMsgId, byte[] shortMessage,
        OptionalParameter[] optionalParameters) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {

    SubmitMultiCommandTask task = new SubmitMultiCommandTask(pduSender(),
            serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr,
            destinationAddresses, esmClass, protocolId, priorityFlag,
            scheduleDeliveryTime, validityPeriod, registeredDelivery,
            replaceIfPresentFlag, dataCoding, smDefaultMsgId, shortMessage,
            optionalParameters);

    SubmitMultiResp resp = (SubmitMultiResp)executeSendCommand(task,
            getTransactionTimer());

    return new SubmitMultiResult(resp.getMessageId(), resp
            .getUnsuccessSmes());
}
 
Example #8
Source File: AutoReconnectGateway.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
public String submitShortMessage(String serviceType,
                                 TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
                                 String sourceAddr, TypeOfNumber destAddrTon,
                                 NumberingPlanIndicator destAddrNpi, String destinationAddr,
                                 ESMClass esmClass, byte protocolId, byte priorityFlag,
                                 String scheduleDeliveryTime, String validityPeriod,
                                 RegisteredDelivery registeredDelivery, byte replaceIfPresentFlag,
                                 DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage,
                                 OptionalParameter... optionalParameters) throws PDUException,
    ResponseTimeoutException, InvalidResponseException,
    NegativeResponseException, IOException {

  return getSession().submitShortMessage(serviceType, sourceAddrTon,
      sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi,
      destinationAddr, esmClass, protocolId, priorityFlag,
      scheduleDeliveryTime, validityPeriod, registeredDelivery,
      replaceIfPresentFlag, dataCoding, smDefaultMsgId, shortMessage,
      optionalParameters);
}
 
Example #9
Source File: SMPPOutboundSession.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
@Override
public void deliverShortMessage(String serviceType,
                                TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
                                String sourceAddr, TypeOfNumber destAddrTon,
                                NumberingPlanIndicator destAddrNpi, String destinationAddr,
                                ESMClass esmClass, byte protocoId, byte priorityFlag,
                                RegisteredDelivery registeredDelivery, DataCoding dataCoding,
                                byte[] shortMessage, OptionalParameter... optionalParameters)
    throws PDUException, ResponseTimeoutException,
    InvalidResponseException, NegativeResponseException, IOException {

  ensureReceivable("deliverShortMessage");

  DeliverSmCommandTask task = new DeliverSmCommandTask(pduSender(),
      serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr,
      destAddrTon, destAddrNpi, destinationAddr, esmClass, protocoId,
      protocoId, registeredDelivery, dataCoding, shortMessage,
      optionalParameters);

  executeSendCommand(task, getTransactionTimer());
}
 
Example #10
Source File: SMPPSession.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
@Override
public String submitShortMessage(String serviceType,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, TypeOfNumber destAddrTon,
        NumberingPlanIndicator destAddrNpi, String destinationAddr,
        ESMClass esmClass, byte protocolId, byte priorityFlag,
        String scheduleDeliveryTime, String validityPeriod,
        RegisteredDelivery registeredDelivery, byte replaceIfPresentFlag,
        DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage,
        OptionalParameter... optionalParameters) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {
	
    ensureTransmittable("submitShortMessage");
	
    SubmitSmCommandTask submitSmTask = new SubmitSmCommandTask(
            pduSender(), serviceType, sourceAddrTon, sourceAddrNpi,
            sourceAddr, destAddrTon, destAddrNpi, destinationAddr,
            esmClass, protocolId, priorityFlag, scheduleDeliveryTime,
            validityPeriod, registeredDelivery, replaceIfPresentFlag,
            dataCoding, smDefaultMsgId, shortMessage, optionalParameters);
	
    SubmitSmResp resp = (SubmitSmResp)executeSendCommand(submitSmTask, getTransactionTimer());
	return resp.getMessageId();
}
 
Example #11
Source File: SMPPSession.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
/**
 * Sending bind.
 * 
 * @param bindType is the bind type.
 * @param systemId is the system id.
 * @param password is the password.
 * @param systemType is the system type.
 * @param interfaceVersion is the interface version.
 * @param addrTon is the address TON.
 * @param addrNpi is the address NPI.
 * @param addressRange is the address range.
 * @param timeout is the max time waiting for bind response. 
 * @return SMSC system id.
 * @throws PDUException if we enter invalid bind parameter(s).
 * @throws ResponseTimeoutException if there is no valid response after defined millisecond.
 * @throws InvalidResponseException if there is invalid response found.
 * @throws NegativeResponseException if we receive negative response.
 * @throws IOException if there is an IO error occur.
 */
private String sendBind(BindType bindType, String systemId,
		String password, String systemType,
		InterfaceVersion interfaceVersion, TypeOfNumber addrTon,
		NumberingPlanIndicator addrNpi, String addressRange, long timeout)
		throws PDUException, ResponseTimeoutException,
		InvalidResponseException, NegativeResponseException, IOException {
    
    BindCommandTask task = new BindCommandTask(pduSender(), bindType,
               systemId, password, systemType, interfaceVersion, addrTon,
               addrNpi, addressRange);
    
    BindResp resp = (BindResp)executeSendCommand(task, timeout);
    OptionalParameter.Sc_interface_version scVersion = resp.getOptionalParameter(Sc_interface_version.class);
    if(scVersion != null) {
	    logger.info("Other side reports SMPP interface version {}", scVersion);
    }

		sessionContext.bound(bindType);
       
	return resp.getSystemId();
}
 
Example #12
Source File: SMPPSession.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
@Override
public QuerySmResult queryShortMessage(String messageId,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr) throws PDUException, ResponseTimeoutException,
        InvalidResponseException, NegativeResponseException, IOException {
    
    ensureTransmittable("queryShortMessage");
    
    QuerySmCommandTask task = new QuerySmCommandTask(pduSender(),
            messageId, sourceAddrTon, sourceAddrNpi, sourceAddr);
    
    QuerySmResp resp = (QuerySmResp)executeSendCommand(task,
            getTransactionTimer());

    if (resp.getMessageId().equals(messageId)) {
        return new QuerySmResult(resp.getFinalDate(), resp
                .getMessageState(), resp.getErrorCode());
    } else {
        // message id requested not same as the returned
        throw new InvalidResponseException(
                "Requested message_id doesn't match with the result");
    }
}
 
Example #13
Source File: SMPPSession.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
@Override
public void replaceShortMessage(String messageId,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, String scheduleDeliveryTime,
        String validityPeriod, RegisteredDelivery registeredDelivery,
        byte smDefaultMsgId, byte[] shortMessage) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {
    
    ensureTransmittable("replaceShortMessage");
    
    ReplaceSmCommandTask replaceSmTask = new ReplaceSmCommandTask(
            pduSender(), messageId, sourceAddrTon, sourceAddrNpi,
            sourceAddr, scheduleDeliveryTime, validityPeriod,
            registeredDelivery, smDefaultMsgId, shortMessage);

    executeSendCommand(replaceSmTask, getTransactionTimer());
}
 
Example #14
Source File: SMPPSession.java    From jsmpp with Apache License 2.0 6 votes vote down vote up
@Override
public void cancelShortMessage(String serviceType, String messageId,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, TypeOfNumber destAddrTon,
        NumberingPlanIndicator destAddrNpi, String destinationAddress)
        throws PDUException, ResponseTimeoutException,
        InvalidResponseException, NegativeResponseException, IOException {
    
    ensureTransmittable("cancelShortMessage");
    
    CancelSmCommandTask task = new CancelSmCommandTask(pduSender(),
            serviceType, messageId, sourceAddrTon, sourceAddrNpi,
            sourceAddr, destAddrTon, destAddrNpi, destinationAddress);
    
    executeSendCommand(task, getTransactionTimer());
}
 
Example #15
Source File: SMPPServerOperation.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
void deliverSm(String serviceType, TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi,
String destinationAddr, ESMClass esmClass, byte protocoId,
byte priorityFlag, RegisteredDelivery registeredDelivery,
DataCoding dataCoding, byte[] shortMessage,
OptionalParameter... optionalParameters) throws PDUException,
ResponseTimeoutException, InvalidResponseException,
NegativeResponseException, IOException;
 
Example #16
Source File: SMPPSession.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
@Override
public SubmitMultiResult submitMultiple(String serviceType,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, Address[] destinationAddresses,
        ESMClass esmClass, byte protocolId, byte priorityFlag,
        String scheduleDeliveryTime, String validityPeriod,
        RegisteredDelivery registeredDelivery,
        ReplaceIfPresentFlag replaceIfPresentFlag, DataCoding dataCoding,
        byte smDefaultMsgId, byte[] shortMessage,
        OptionalParameter... optionalParameters) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {
    
    ensureTransmittable("submitMultiple");
    
    SubmitMultiCommandTask task = new SubmitMultiCommandTask(pduSender(),
            serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr,
            destinationAddresses, esmClass, protocolId, priorityFlag,
            scheduleDeliveryTime, validityPeriod, registeredDelivery,
            replaceIfPresentFlag, dataCoding, smDefaultMsgId, shortMessage,
            optionalParameters);

    SubmitMultiResp resp = (SubmitMultiResp)executeSendCommand(task,
            getTransactionTimer());

    return new SubmitMultiResult(resp.getMessageId(), resp
            .getUnsuccessSmes());
}
 
Example #17
Source File: SMPPOperation.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
DataSmResult dataSm(String serviceType, TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi,
String destinationAddr, ESMClass esmClass,
RegisteredDelivery registeredDelivery, DataCoding dataCoding,
OptionalParameter... optionalParameters) throws PDUException,
ResponseTimeoutException, InvalidResponseException,
NegativeResponseException, IOException;
 
Example #18
Source File: SMPPClientOperation.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
String submitSm(String serviceType, TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi,
String destinationAddr, ESMClass esmClass, byte protocolId,
byte priorityFlag, String scheduleDeliveryTime,
String validityPeriod, RegisteredDelivery registeredDelivery,
byte replaceIfPresentFlag, DataCoding dataCoding,
byte smDefaultMsgId, byte[] shortMessage,
OptionalParameter... optionalParameters) throws PDUException,
ResponseTimeoutException, InvalidResponseException,
NegativeResponseException, IOException;
 
Example #19
Source File: SMPPClientOperation.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
SubmitMultiResult submitMulti(String serviceType,
TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
String sourceAddr, Address[] destinationAddresses,
ESMClass esmClass, byte protocolId, byte priorityFlag,
String scheduleDeliveryTime, String validityPeriod,
RegisteredDelivery registeredDelivery,
ReplaceIfPresentFlag replaceIfPresentFlag, DataCoding dataCoding,
byte smDefaultMsgId, byte[] shortMessage,
OptionalParameter[] optionalParameters) throws PDUException,
ResponseTimeoutException, InvalidResponseException,
NegativeResponseException, IOException;
 
Example #20
Source File: DefaultSMPPClientOperation.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
public void replaceSm(String messageId, TypeOfNumber sourceAddrTon,
        NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
        String scheduleDeliveryTime, String validityPeriod,
        RegisteredDelivery registeredDelivery, byte smDefaultMsgId,
        byte[] shortMessage) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {
    
    ReplaceSmCommandTask replaceSmTask = new ReplaceSmCommandTask(
            pduSender(), messageId, sourceAddrTon, sourceAddrNpi,
            sourceAddr, scheduleDeliveryTime, validityPeriod,
            registeredDelivery, smDefaultMsgId, shortMessage);

    executeSendCommand(replaceSmTask, getTransactionTimer());
}
 
Example #21
Source File: DefaultSMPPClientOperation.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
public void cancelSm(String serviceType, String messageId,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, TypeOfNumber destAddrTon,
        NumberingPlanIndicator destAddrNpi, String destinationAddress)
        throws PDUException, ResponseTimeoutException,
        InvalidResponseException, NegativeResponseException, IOException {
    
    CancelSmCommandTask task = new CancelSmCommandTask(pduSender(),
            serviceType, messageId, sourceAddrTon, sourceAddrNpi,
            sourceAddr, destAddrTon, destAddrNpi, destinationAddress);

    executeSendCommand(task, getTransactionTimer());
}
 
Example #22
Source File: OutboundClientSession.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
void deliverShortMessage(String serviceType,
                     TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
                     String sourceAddr, TypeOfNumber destAddrTon,
                     NumberingPlanIndicator destAddrNpi, String destinationAddr,
                     ESMClass esmClass, byte protocoId, byte priorityFlag,
                     RegisteredDelivery registeredDelivery, DataCoding dataCoding,
                     byte[] shortMessage, OptionalParameter... optionalParameters)
throws PDUException, ResponseTimeoutException,
InvalidResponseException, NegativeResponseException, IOException;
 
Example #23
Source File: DefaultSMPPClientOperation.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
public BindResult bind(BindType bindType, String systemId, String password,
        String systemType, InterfaceVersion interfaceVersion,
        TypeOfNumber addrTon, NumberingPlanIndicator addrNpi,
        String addressRange, long timeout) throws PDUException,
        ResponseTimeoutException, InvalidResponseException,
        NegativeResponseException, IOException {

    BindCommandTask task = new BindCommandTask(pduSender(), bindType,
            systemId, password, systemType, interfaceVersion, addrTon,
            addrNpi, addressRange);

    BindResp resp = (BindResp)executeSendCommand(task, timeout);
    return new BindResult(resp.getSystemId(), resp.getOptionalParameters());
}
 
Example #24
Source File: SmsSMPPDefaultsTest.java    From ogham with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException, IllegalArgumentException, PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException {
	oghamService = MessagingBuilder.standard()
			.environment()
				.properties("/application.properties")
				.properties()
					.set("ogham.sms.smpp.host", "127.0.0.1")
					.set("ogham.sms.smpp.port", smppServer.getPort())
					.and()
				.and()
			.build();
   }
 
Example #25
Source File: SmsSMPPGsm7bitTest.java    From ogham with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException, IllegalArgumentException, PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException {
	oghamService = MessagingBuilder.standard()
			.environment()
				.properties("/application.properties")
				.properties()
					.set("ogham.sms.smpp.host", "127.0.0.1")
					.set("ogham.sms.smpp.port", smppServer.getPort())
					.set("ogham.sms.cloudhopper.encoder.gsm7bit-packed.priority", 100000)
					.and()
				.and()
			.build();
   }
 
Example #26
Source File: FluentSmsTest.java    From ogham with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException, IllegalArgumentException, PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException {
	oghamService = MessagingBuilder.standard()
			.environment()
				.properties("/application.properties")
				.properties()
					.set("ogham.sms.smpp.host", "127.0.0.1")
					.set("ogham.sms.smpp.port", smppServer.getPort())
					.and()
				.and()
			.build();
   }
 
Example #27
Source File: SMPPClientOperation.java    From jsmpp with Apache License 2.0 4 votes vote down vote up
void replaceSm(String messageId, TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
String scheduleDeliveryTime, String validityPeriod,
RegisteredDelivery registeredDelivery, byte smDefaultMsgId,
byte[] shortMessage) throws PDUException, ResponseTimeoutException,
InvalidResponseException, NegativeResponseException, IOException;
 
Example #28
Source File: SMPPClientOperation.java    From jsmpp with Apache License 2.0 4 votes vote down vote up
void cancelSm(String serviceType, String messageId,
TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
String sourceAddr, TypeOfNumber destAddrTon,
NumberingPlanIndicator destAddrNpi, String destinationAddress)
throws PDUException, ResponseTimeoutException,
InvalidResponseException, NegativeResponseException, IOException;
 
Example #29
Source File: SMPPClientOperation.java    From jsmpp with Apache License 2.0 4 votes vote down vote up
QuerySmResult querySm(String messageId, TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi, String sourceAddr)
throws PDUException, ResponseTimeoutException,
InvalidResponseException, NegativeResponseException, IOException;
 
Example #30
Source File: SmsService.java    From Openfire with Apache License 2.0 4 votes vote down vote up
/**
 * Checks if an exception in the chain of the provided throwable contains a 'command status' that can be
 * translated in a somewhat more helpful error message.
 *
 * The list of error messages was taken from http://www.smssolutions.net/tutorials/smpp/smpperrorcodes/
 *
 * @param ex The exception in which to search for a command status.
 * @return a human readable error message.
 */
public static String getDescriptiveMessage( Throwable ex )
{
    if ( ex instanceof NegativeResponseException )
    {
        final Map<Integer, String> errors = new HashMap<>();
        errors.put( 0x00000000, "No Error" );
        errors.put( 0x00000001, "Message too long" );
        errors.put( 0x00000002, "Command length is invalid" );
        errors.put( 0x00000003, "Command ID is invalid or not supported" );
        errors.put( 0x00000004, "Incorrect bind status for given command" );
        errors.put( 0x00000005, "Already bound" );
        errors.put( 0x00000006, "Invalid Priority Flag" );
        errors.put( 0x00000007, "Invalid registered delivery flag" );
        errors.put( 0x00000008, "System error" );
        errors.put( 0x0000000A, "Invalid source address" );
        errors.put( 0x0000000B, "Invalid destination address" );
        errors.put( 0x0000000C, "Message ID is invalid" );
        errors.put( 0x0000000D, "Bind failed" );
        errors.put( 0x0000000E, "Invalid password" );
        errors.put( 0x0000000F, "Invalid System ID" );
        errors.put( 0x00000011, "Cancelling message failed" );
        errors.put( 0x00000013, "Message recplacement failed" );
        errors.put( 0x00000014, "Message queue full" );
        errors.put( 0x00000015, "Invalid service type" );
        errors.put( 0x00000033, "Invalid number of destinations" );
        errors.put( 0x00000034, "Invalid distribution list name" );
        errors.put( 0x00000040, "Invalid destination flag" );
        errors.put( 0x00000042, "Invalid submit with replace request" );
        errors.put( 0x00000043, "Invalid esm class set" );
        errors.put( 0x00000044, "Invalid submit to ditribution list" );
        errors.put( 0x00000045, "Submitting message has failed" );
        errors.put( 0x00000048, "Invalid source address type of number ( TON )" );
        errors.put( 0x00000049, "Invalid source address numbering plan ( NPI )" );
        errors.put( 0x00000050, "Invalid destination address type of number ( TON )" );
        errors.put( 0x00000051, "Invalid destination address numbering plan ( NPI )" );
        errors.put( 0x00000053, "Invalid system type" );
        errors.put( 0x00000054, "Invalid replace_if_present flag" );
        errors.put( 0x00000055, "Invalid number of messages" );
        errors.put( 0x00000058, "Throttling error" );
        errors.put( 0x00000061, "Invalid scheduled delivery time" );
        errors.put( 0x00000062, "Invalid Validty Period value" );
        errors.put( 0x00000063, "Predefined message not found" );
        errors.put( 0x00000064, "ESME Receiver temporary error" );
        errors.put( 0x00000065, "ESME Receiver permanent error" );
        errors.put( 0x00000066, "ESME Receiver reject message error" );
        errors.put( 0x00000067, "Message query request failed" );
        errors.put( 0x000000C0, "Error in the optional part of the PDU body" );
        errors.put( 0x000000C1, "TLV not allowed" );
        errors.put( 0x000000C2, "Invalid parameter length" );
        errors.put( 0x000000C3, "Expected TLV missing" );
        errors.put( 0x000000C4, "Invalid TLV value" );
        errors.put( 0x000000FE, "Transaction delivery failure" );
        errors.put( 0x000000FF, "Unknown error" );
        errors.put( 0x00000100, "ESME not authorised to use specified servicetype" );
        errors.put( 0x00000101, "ESME prohibited from using specified operation" );
        errors.put( 0x00000102, "Specified servicetype is unavailable" );
        errors.put( 0x00000103, "Specified servicetype is denied" );
        errors.put( 0x00000104, "Invalid data coding scheme" );
        errors.put( 0x00000105, "Invalid source address subunit" );
        errors.put( 0x00000106, "Invalid destination address subunit" );
        errors.put( 0x0000040B, "Insufficient credits to send message" );
        errors.put( 0x0000040C, "Destination address blocked by the ActiveXperts SMPP Demo Server" );

        String error = errors.get( ( (NegativeResponseException) ex ).getCommandStatus() );
        if ( ex.getMessage() != null && !ex.getMessage().isEmpty() )
        {
            error += " (exception message: '" + ex.getMessage() + "')";
        }
        return error;
    }
    else if ( ex.getCause() != null )
    {
        return getDescriptiveMessage( ex.getCause() );
    }

    return ex.getMessage();
}