Ejemplo n.º 1
0
 private TelephoneNumber local_phone_number() throws ParseException {
   if (debug) dbg_enter("local_phone_number");
   TelephoneNumber tn = new TelephoneNumber();
   tn.setGlobal(false);
   NameValueList nv = null;
   String b = null;
   try {
     b = local_number();
     tn.setPhoneNumber(b);
     if (lexer.hasMoreChars()) {
       Token tok = this.lexer.peekNextToken();
       switch (tok.getTokenType()) {
         case SEMICOLON:
           {
             this.lexer.consume(1);
             nv = tel_parameters();
             tn.setParameters(nv);
             break;
           }
         default:
           {
             break;
           }
       }
     }
   } finally {
     if (debug) dbg_leave("local_phone_number");
   }
   return tn;
 }
Ejemplo n.º 2
0
  /**
   * Parse and return a structure for a generic URL. Note that non SIP URLs are just stored as a
   * string (not parsed).
   *
   * @return URI is a URL structure for a SIP url.
   * @throws ParsException if there was a problem parsing.
   */
  public GenericURI uriReference() throws ParseException {
    if (debug) dbg_enter("uriReference");
    GenericURI retval = null;
    Vector<?> vect = lexer.peekNextToken(2);
    Token t1 = (Token) vect.elementAt(0);
    Token t2 = (Token) vect.elementAt(1);
    try {

      // System.out.println("token = "  + t1.getTokenValue());
      // System.out.println("tokenval = " + t1.getTokenType());

      if (t1.getTokenType() == TokenTypes.SIP) {
        if (t2.getTokenType() == ':') retval = sipURL();
        else throw createParseException("Expecting \':\'");
      } else if (t1.getTokenType() == TokenTypes.TEL) {
        if (t2.getTokenType() == ':') {
          retval = telURL();
        } else throw createParseException("Expecting \':\'");
      } else {
        String urlString = uricString();
        try {
          retval = new GenericURI(urlString);
        } catch (ParseException ex) {
          throw createParseException(ex.getMessage());
        }
      }
    } finally {
      if (debug) dbg_leave("uriReference");
    }
    return retval;
  }