Search in sources :

Example 1 with TelephoneNumber

use of gov.nist.javax.sip.address.TelephoneNumber in project XobotOS by xamarin.

the class URLParser method local_phone_number.

private TelephoneNumber local_phone_number(boolean inBrackets) 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:
                    {
                        if (inBrackets) {
                            this.lexer.consume(1);
                            nv = tel_parameters();
                            tn.setParameters(nv);
                        }
                        break;
                    }
                default:
                    {
                        break;
                    }
            }
        }
    } finally {
        if (debug)
            dbg_leave("local_phone_number");
    }
    return tn;
}
Also used : NameValueList(gov.nist.core.NameValueList) Token(gov.nist.core.Token) TelephoneNumber(gov.nist.javax.sip.address.TelephoneNumber)

Example 2 with TelephoneNumber

use of gov.nist.javax.sip.address.TelephoneNumber in project XobotOS by xamarin.

the class URLParser method parseTelephoneNumber.

/**
     * Parser for telephone subscriber.
     *
     * @return the parsed telephone number.
     */
public final TelephoneNumber parseTelephoneNumber(boolean inBrackets) throws ParseException {
    TelephoneNumber tn;
    if (debug)
        dbg_enter("telephone_subscriber");
    lexer.selectLexer("charLexer");
    try {
        char c = lexer.lookAhead(0);
        if (c == '+')
            tn = global_phone_number(inBrackets);
        else if (// see RFC3966
        Lexer.isHexDigit(c) || c == '#' || c == '*' || c == '-' || c == '.' || c == '(' || c == ')') {
            tn = local_phone_number(inBrackets);
        } else
            throw createParseException("unexpected char " + c);
        return tn;
    } finally {
        if (debug)
            dbg_leave("telephone_subscriber");
    }
}
Also used : TelephoneNumber(gov.nist.javax.sip.address.TelephoneNumber)

Example 3 with TelephoneNumber

use of gov.nist.javax.sip.address.TelephoneNumber in project XobotOS by xamarin.

the class URLParser method global_phone_number.

private final TelephoneNumber global_phone_number(boolean inBrackets) throws ParseException {
    if (debug)
        dbg_enter("global_phone_number");
    try {
        TelephoneNumber tn = new TelephoneNumber();
        tn.setGlobal(true);
        NameValueList nv = null;
        this.lexer.match(PLUS);
        String b = base_phone_number();
        tn.setPhoneNumber(b);
        if (lexer.hasMoreChars()) {
            char tok = lexer.lookAhead(0);
            if (tok == ';' && inBrackets) {
                this.lexer.consume(1);
                nv = tel_parameters();
                tn.setParameters(nv);
            }
        }
        return tn;
    } finally {
        if (debug)
            dbg_leave("global_phone_number");
    }
}
Also used : NameValueList(gov.nist.core.NameValueList) TelephoneNumber(gov.nist.javax.sip.address.TelephoneNumber)

Example 4 with TelephoneNumber

use of gov.nist.javax.sip.address.TelephoneNumber in project XobotOS by xamarin.

the class URLParser method telURL.

/**
     * Parse and return a structure for a Tel URL.
     * @return a parsed tel url structure.
     */
public TelURLImpl telURL(boolean inBrackets) throws ParseException {
    lexer.match(TokenTypes.TEL);
    lexer.match(':');
    TelephoneNumber tn = this.parseTelephoneNumber(inBrackets);
    TelURLImpl telUrl = new TelURLImpl();
    telUrl.setTelephoneNumber(tn);
    return telUrl;
}
Also used : TelephoneNumber(gov.nist.javax.sip.address.TelephoneNumber) TelURLImpl(gov.nist.javax.sip.address.TelURLImpl)

Aggregations

TelephoneNumber (gov.nist.javax.sip.address.TelephoneNumber)4 NameValueList (gov.nist.core.NameValueList)2 Token (gov.nist.core.Token)1 TelURLImpl (gov.nist.javax.sip.address.TelURLImpl)1