Examples of GatewayException


Examples of org.smslib.GatewayException

            else if (m.group(1).equals("CMS"))
            {
              int code = Integer.parseInt(m.group(2));
              setLastError(6000 + code);
            }
            else throw new GatewayException("Invalid error response: " + m.group(1));
          }
          catch (NumberFormatException e)
          {
            Logger.getInstance().logDebug("Error on number conversion while interpreting response: ", null, getGateway().getGatewayId());
            throw new GatewayException("Cannot convert error code number.");
          }
        }
        else throw new GatewayException("Cannot match error code. Should never happen!");
      }
      else if (response.matches(rxPlainError)) setLastError(9000);
      else if (response.indexOf("OK") >= 0) setLastError(0);
      else setLastError(10000);
      Logger.getInstance().logDebug("RECV :" + formatLog(buffer.toString()), null, getGateway().getGatewayId());
View Full Code Here

Examples of org.smslib.GatewayException

      }
      switch (answer)
      {
        case 0:
          Logger.getInstance().logError("GSM: Auto-registration disabled!", null, getGateway().getGatewayId());
          throw new GatewayException("GSM Network Auto-Registration disabled!");
        case 1:
          Logger.getInstance().logInfo("GSM: Registered to home network.", null, getGateway().getGatewayId());
          return true;
        case 2:
          Logger.getInstance().logWarn("GSM: Not registered, searching for network...", null, getGateway().getGatewayId());
          if (++retries == 6) throw new GatewayException("GSM Network Registration failed, give up trying!");
          break;
        case 3:
          Logger.getInstance().logError("GSM: Network registration denied!", null, getGateway().getGatewayId());
          throw new GatewayException("GSM Network Registration denied!");
        case 4:
          Logger.getInstance().logError("GSM: Unknown registration error!", null, getGateway().getGatewayId());
          throw new GatewayException("GSM Network Registration error!");
        case 5:
          Logger.getInstance().logInfo("GSM: Registered to foreign network (roaming).", null, getGateway().getGatewayId());
          return true;
        case -1:
          Logger.getInstance().logInfo("GSM: Invalid CREG response.", null, getGateway().getGatewayId());
          throw new GatewayException("GSM: Invalid CREG response.");
      }
      Thread.sleep(Service.getInstance().getSettings().AT_WAIT_NETWORK);
    }
  }
View Full Code Here

Examples of org.smslib.GatewayException

      this.out = this.tc.getOutputStream();
      this.peeker = new Peeker();
    }
    catch (InvalidTelnetOptionException e)
    {
      throw new GatewayException("Unsupported telnet option for the selected IP connection.");
    }
  }
View Full Code Here

Examples of org.smslib.GatewayException

  public float queryBalance() throws TimeoutException, GatewayException, IOException, InterruptedException
  {
    URL url;
    List<HttpHeader> request = new ArrayList<HttpHeader>();
    List<String> response;
    if (this.sessionId == null) throw new GatewayException("Internal Clickatell Gateway error.");
    url = new URL((this.secure ? this.HTTPS : this.HTTP) + this.URL_BALANCE);
    request.add(new HttpHeader("session_id", this.sessionId, false));
    synchronized (this.SYNC_Commander)
    {
      response = HttpPost(url, request);
View Full Code Here

Examples of org.smslib.GatewayException

  public boolean queryCoverage(OutboundMessage msg) throws TimeoutException, GatewayException, IOException, InterruptedException
  {
    URL url;
    List<HttpHeader> request = new ArrayList<HttpHeader>();
    List<String> response;
    if (this.sessionId == null) throw new GatewayException("Internal Clickatell Gateway error.");
    url = new URL((this.secure ? this.HTTPS : this.HTTP) + this.URL_COVERAGE);
    request.add(new HttpHeader("session_id", this.sessionId, false));
    if (msg.getRecipient().charAt(0) == '+') request.add(new HttpHeader("msisdn", msg.getRecipient().substring(1), false));
    else request.add(new HttpHeader("msisdn", msg.getRecipient(), false));
    synchronized (this.SYNC_Commander)
View Full Code Here

Examples of org.smslib.GatewayException

  {
    URL url;
    List<HttpHeader> request = new ArrayList<HttpHeader>();
    List<String> response;
    int pos;
    if (this.sessionId == null) throw new GatewayException("Internal Clickatell Gateway error.");
    url = new URL((this.secure ? this.HTTPS : this.HTTP) + this.URL_QUERYMSG);
    request.add(new HttpHeader("session_id", this.sessionId, false));
    request.add(new HttpHeader("apimsgid", refNo, false));
    synchronized (this.SYNC_Commander)
    {
View Full Code Here

Examples of org.smslib.GatewayException

  void connect() throws GatewayException, IOException
  {
    try
    {
      if (!authenticate()) throw new GatewayException("Cannot authenticate to Clickatell.");
    }
    catch (MalformedURLException e)
    {
      throw new GatewayException("Internal Clickatell Gateway error.");
    }
  }
View Full Code Here

Examples of org.smslib.GatewayException

        setPortReader(new PortReader("PortReader() [" + getComPort() + "]", Service.getInstance().getSettings().SERIAL_POLLING_INTERVAL));
      }
    }
    catch (Exception e)
    {
      throw new GatewayException("Comm library exception: " + e.getMessage());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.