Package org.zoolu.sip.header

Examples of org.zoolu.sip.header.MultipleHeader


      sb.append(msg.getToHeader().getTag());
      sb.append(msg.getFromHeader().getTag());
      sb.append(msg.getCallIdHeader().getCallId());
      sb.append(msg.getRequestLine().getAddress().toString());
      sb.append(msg.getCSeqHeader().getSequenceNumber());
      MultipleHeader rr=msg.getRoutes();
      if (rr!=null) sb.append(rr.size());
      return (new SimpleDigest(7,sb.toString())).asHex();
   }
View Full Code Here


      sb.append(msg.getToHeader().getTag());
      sb.append(msg.getFromHeader().getTag());
      sb.append(msg.getCallIdHeader().getCallId());
      sb.append(msg.getRequestLine().getAddress().toString());
      sb.append(msg.getCSeqHeader().getSequenceNumber());
      MultipleHeader rr=msg.getRoutes();
      if (rr!=null) sb.append(rr.size());
      return (new SimpleDigest(7,sb.toString())).asHex();
   }
View Full Code Here

         return;
      }
               
      printLog("message will be redirect to all user's contacts",LogLevel.MEDIUM);        
      // create the response with all contact urls, and send it
      MultipleHeader mc=new MultipleHeader(SipHeaders.Contact,contacts);
      mc.setCommaSeparated(true);
      Message resp=MessageFactory.createResponse(msg,302,SipResponses.reasonOf(302),null);
      resp.setContacts(mc);
      sip_provider.sendMessage(resp);     
   }
View Full Code Here

               ContactHeader ch=new ContactHeader(location_service.getUserContactNameAddress(user,url));
               ch.setExpires(expires);
               v.addElement(ch);
            }
         }
         if (v.size()>0) resp.setContacts(new MultipleHeader(v));
         return resp;
      }
      // else    

      Vector contacts=msg.getContacts().getHeaders();
      int result=200;
      Message resp=MessageFactory.createResponse(msg,result,SipResponses.reasonOf(result),null)

      ContactHeader contact_0=new ContactHeader((Header)contacts.elementAt(0));
      if (contact_0.isStar())
      {  printLog("DEBUG: ContactHeader is star",LogLevel.LOW);
         Vector resp_contacts=new Vector();
         for (Enumeration e=location_service.getUserContactURLs(user); e.hasMoreElements();)
         {  String url=(String)(e.nextElement());
            NameAddress name_address=location_service.getUserContactNameAddress(user,url);
            // update db
            location_service.removeUserContact(user,url);
            printLog("contact removed: "+url,LogLevel.LOW);
            if (exp_secs>0)
            {  Date exp_date=new Date(System.currentTimeMillis()+((long)exp_secs)*1000);
               location_service.addUserContact(user,name_address,exp_date);
               //DateFormat df=new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss 'GMT'",Locale.ITALIAN);
               //printLog("contact added: "+url+"; expire: "+df.format(location_service.getUserContactExpire(user,url)),LogLevel.LOW);
               printLog("contact added: "+url+"; expire: "+DateFormat.formatEEEddMMM(location_service.getUserContactExpirationDate(user,url)),LogLevel.LOW);
            }
            ContactHeader contact_i=new ContactHeader(name_address.getAddress());
            contact_i.setExpires(exp_secs);
            resp_contacts.addElement(contact_i);
         }
         if (resp_contacts.size()>0) resp.setContacts(new MultipleHeader(resp_contacts));
      }
      else
      Vector resp_contacts=new Vector();
         for (int i=0; i<contacts.size(); i++)    
         {  ContactHeader contact_i=new ContactHeader((Header)contacts.elementAt(i));
            NameAddress name_address=contact_i.getNameAddress();    
            String url=name_address.getAddress().toString();    
            int exp_secs_i=exp_secs;
            if (contact_i.hasExpires())
            {  exp_secs_i=contact_i.getExpires();
            }
            // limit the expire value
            if (exp_secs_i<0) exp_secs_i=0;
            else
            if (exp_secs_i>server_profile.expires) exp_secs_i=server_profile.expires;
                       
            // update db
            location_service.removeUserContact(user,url);
            if (exp_secs_i>0)
            {  Date exp_date=new Date(System.currentTimeMillis()+((long)exp_secs)*1000);
               location_service.addUserContact(user,name_address,exp_date);
               printLog("registration of user "+user+" updated",LogLevel.HIGH);
            }          
            contact_i.setExpires(exp_secs_i);
            resp_contacts.addElement(contact_i);
         }
         if (resp_contacts.size()>0) resp.setContacts(new MultipleHeader(resp_contacts));
      }

      location_service.sync()
      return resp;
   }
View Full Code Here

   printLog("inside updateProxingRequest(msg)",LogLevel.LOW);

      // remove Route if present
      boolean is_on_route=false
      if (msg.hasRouteHeader())
      {  MultipleHeader mr=msg.getRoutes();
         SipURL route=(new RouteHeader(mr.getTop())).getNameAddress().getAddress();
         if (isResponsibleFor(route.getHost(),route.getPort()))
         {  mr.removeTop();
            if (mr.size()>0) msg.setRoutes(mr);
            else msg.removeRoutes();
            is_on_route=true;
         }
      }
      // add Record-Route?
View Full Code Here

TOP

Related Classes of org.zoolu.sip.header.MultipleHeader

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.