Package org.zoolu.sip.provider

Examples of org.zoolu.sip.provider.SipParser


   public int getExpires()
   {  int secs=-1;
      String exp_param=getParameter("expires");
      if (exp_param!=null)
      {  if (exp_param.indexOf("GMT")>=0)
         {  Date date=(new SipParser((new Parser(exp_param)).getStringUnquoted())).getDate();
            secs=(int)((date.getTime()-System.currentTimeMillis())/1000);
            if (secs<0) secs=0;
         }
         else secs=(new SipParser(exp_param)).getInt();
      }
      return secs;
   }
View Full Code Here


   public Date getExpiresDate()
   {  Date date=null;
      String exp_param=getParameter("expires");
      if (exp_param!=null)
      {  if (exp_param.indexOf("GMT")>=0)
         {  date=(new SipParser((new Parser(exp_param)).getStringUnquoted())).getDate();
         }
         else
         long secs=(new SipParser(exp_param)).getInt();
            if (secs>=0) date=new Date(System.currentTimeMillis()+secs*1000);
         }
      }
      return date;
   }
View Full Code Here

   super(SipHeaders.CSeq,String.valueOf(seq)+" "+method);
   }

   /** Gets method of CSeqHeader */
   public String getMethod()
   {  SipParser par=new SipParser(value);
      par.skipString(); // skip sequence number
      return par.getString();
   }
View Full Code Here

      return par.getString();
   }

   /** Gets sequence number of CSeqHeader */
   public long getSequenceNumber()
   {  return (new SipParser(value)).getInt();
   }
View Full Code Here

   }
  
   /** Whether has parameter <i>param_name</i> */
   public boolean hasParameter(String param_name)
   {  char[] name_separators={'='' ', '\t', '\r', '\n'};
      SipParser par=new SipParser(value);
      //par.skipString(); // skip the auth_scheme
      par.skipWSPCRLF();
      while (par.hasMore())
      {  String name=par.getWord(name_separators);
         if (name.equals(param_name)) return true;
         par.goToCommaHeaderSeparator().skipChar().skipWSPCRLF();
      }
      return false;
   }
View Full Code Here

   }
   /** Returns the parameter <i>param_name</i>, in case removing quotes. */
   public String getParameter(String param_name)
   {  char[] name_separators={'=', ' ', '\t'};
      SipParser par=new SipParser(value);
      //par.skipString(); // skip the auth_scheme
      par.skipWSPCRLF();
      while (par.hasMore())
      {  String name=par.getWord(name_separators);
         if (name.equals(param_name))
         {  par.goTo('=').skipChar().skipWSP();
            int comma=par.indexOfCommaHeaderSeparator();
            if (comma>=0)
               par=new SipParser(par.getString(comma-par.getPos()));
            return par.getStringUnquoted();
         }
         else par.goToCommaHeaderSeparator().skipChar().skipWSPCRLF();
      }
      return null;
   }
View Full Code Here

  
   /** Gets a String Vector of parameter names.
     * @returns a Vector of String. */
   public Vector getParameters()
   {  char[] name_separators={'=', ' ', '\t'};
      SipParser par=new SipParser(value);
      //par.skipString(); // skip the auth_scheme
      par.skipWSPCRLF();
      Vector names=new Vector();
      while (par.hasMore())
      {  String name=par.getWord(name_separators);
         names.addElement(name);
         par.goToCommaHeaderSeparator().skipChar().skipWSPCRLF();
      }
      return names;
   }
View Full Code Here

     * <br> It extends the NameAddressHeader.getNameAddress() method, by removing
     * eventual EndPointHeader field parameters (e.g. 'tag' param) from the returnerd NameAddress.
     * @return the end point NameAddress or null if NameAddress does not exist
     * (that leads to the wildcard in case of ContactHeader) */
   public NameAddress getNameAddress()
   {  NameAddress naddr=(new SipParser(value)).getNameAddress();
      // patch for removing eventual 'tag' or other EndPointHeader parameters from NameAddress
      SipURL url=naddr.getAddress();
      for (int i=0; i< ENDPOINT_PARAMS.length; i++)
      {  if (url.hasParameter(ENDPOINT_PARAMS[i]))
         {  url.removeParameter(ENDPOINT_PARAMS[i]);
View Full Code Here

   super(hd);
   }

   /** Gets NameAddress of NameAddressHeader (Returns null if NameAddress does not exist - i.e. wildcard ContactHeader) */
   public NameAddress getNameAddress()
   {  NameAddress naddr=(new SipParser(value)).getNameAddress();
      return naddr;
   }
View Full Code Here

     name = name_address.getDisplayName();
       url = name_address.getAddress();
   }

   public NameAddress(String naddr) { 
     SipParser par = new SipParser(naddr);
       NameAddress na = par.getNameAddress();
      //DEBUG
      //if (na==null)
      //{  System.out.println("DEBUG: NameAddress: par:\r\n"+par.getWholeString());
      //   System.exit(0);
      //}
View Full Code Here

TOP

Related Classes of org.zoolu.sip.provider.SipParser

Copyright © 2018 www.massapicom. 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.