Search in sources :

Example 1 with AlertInfoList

use of gov.nist.javax.sip.header.AlertInfoList in project XobotOS by xamarin.

the class AlertInfoParser method parse.

/**
     * parse the AlertInfo  String header
     * @return SIPHeader (AlertInfoList  object)
     * @throws SIPParseException if the message does not respect the spec.
     */
public SIPHeader parse() throws ParseException {
    if (debug)
        dbg_enter("AlertInfoParser.parse");
    AlertInfoList list = new AlertInfoList();
    try {
        headerName(TokenTypes.ALERT_INFO);
        while (lexer.lookAhead(0) != '\n') {
            AlertInfo alertInfo = new AlertInfo();
            alertInfo.setHeaderName(SIPHeaderNames.ALERT_INFO);
            URLParser urlParser;
            GenericURI uri;
            do {
                this.lexer.SPorHT();
                if (this.lexer.lookAhead(0) == '<') {
                    this.lexer.match('<');
                    urlParser = new URLParser((Lexer) this.lexer);
                    uri = urlParser.uriReference(true);
                    alertInfo.setAlertInfo(uri);
                    this.lexer.match('>');
                } else {
                    /* This is non standard for Polycom support. 
	                	 * I know it is bad grammar but please do not remove. mranga 
	                	 */
                    String alertInfoStr = this.lexer.byteStringNoSemicolon();
                    alertInfo.setAlertInfo(alertInfoStr);
                }
                this.lexer.SPorHT();
                super.parse(alertInfo);
                list.add(alertInfo);
                if (lexer.lookAhead(0) == ',') {
                    this.lexer.match(',');
                } else
                    break;
            } while (true);
        }
        return list;
    } finally {
        if (debug)
            dbg_leave("AlertInfoParser.parse");
    }
}
Also used : AlertInfoList(gov.nist.javax.sip.header.AlertInfoList) GenericURI(gov.nist.javax.sip.address.GenericURI) AlertInfo(gov.nist.javax.sip.header.AlertInfo)

Aggregations

GenericURI (gov.nist.javax.sip.address.GenericURI)1 AlertInfo (gov.nist.javax.sip.header.AlertInfo)1 AlertInfoList (gov.nist.javax.sip.header.AlertInfoList)1