org.jsmpp.PDUException Java Examples

The following examples show how to use org.jsmpp.PDUException. 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: 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 #2
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 #3
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 #4
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 #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: 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 #7
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 #8
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 #9
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 #10
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 #11
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 #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
/**
 * 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 #14
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 #15
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 #16
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 #17
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 #18
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 #19
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 #20
Source File: DefaultSMPPServerOperation.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
public void alertNotification(int sequenceNumber,
        TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
        String sourceAddr, TypeOfNumber esmeAddrTon,
        NumberingPlanIndicator esmeAddrNpi, String esmeAddr,
        OptionalParameter... optionalParameters) throws PDUException,
        IOException {
    pduSender().sendAlertNotification(connection().getOutputStream(),
            sequenceNumber, sourceAddrTon.value(), sourceAddrNpi.value(),
            sourceAddr, esmeAddrTon.value(), esmeAddrNpi.value(), esmeAddr,
            optionalParameters);
}
 
Example #21
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 #22
Source File: SubmitMultiCommandTask.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
public void executeTask(OutputStream out, int sequenceNumber)
        throws PDUException, IOException {
    pduSender.sendSubmiMulti(out, sequenceNumber, serviceType,
            sourceAddrTon, sourceAddrNpi, sourceAddr, destinationAddresses,
            esmClass, protocolId, priorityFlag, scheduleDeliveryTime,
            validityPeriod, registeredDelivery, replaceIfPresentFlag,
            dataCoding, smDefaultMsgId, shortMessage, optionalParameters);
}
 
Example #23
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 #24
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 #25
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 #26
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 #27
Source File: AbstractSession.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
/**
 * Execute send command command task.
 *
 * @param task is the task.
 * @throws PDUException if there is invalid PDU parameter found.
 * @throws IOException if there is an IO error found.
 */
protected void executeSendCommandWithNoResponse(SendCommandTask task)
    throws PDUException, IOException {

    int seqNum = sequence.nextValue();
    try {
        task.executeTask(connection().getOutputStream(), seqNum);
    } catch (IOException e) {
        logger.error("Failed sending {} command", task.getCommandName(), e);
        close();
        throw e;
    }
}
 
Example #28
Source File: AbstractSession.java    From jsmpp with Apache License 2.0 5 votes vote down vote up
public void sendOutbind(String systemId, String password) throws IOException {
    if (sessionContext().getSessionState().equals(SessionState.CLOSED)) {
        throw new IOException("Session " + sessionId + " is closed");
    }

    OutbindCommandTask task = new OutbindCommandTask(pduSender, systemId, password);

    try {
        executeSendCommandWithNoResponse(task);
    } catch (PDUException e) {
        // exception should be never caught since we didn't send any string parameter.
        logger.warn("PDU String should be always valid", e);
    }
}
 
Example #29
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 #30
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());
}