/**
  * Creates a new INVITE request out of any pre-existing dialogs.
  *
  * @see
  *     #createRequest(String,SipURL,NameAddress,NameAddress,NameAddress,String,String,int,boolean,String,long,String,String,String,String)
  */
 public static Message createInviteRequest(
     SipProvider sip_provider,
     SipURL request_uri,
     NameAddress to,
     NameAddress from,
     NameAddress contact,
     String body,
     String icsi) { // modified by mandrajg
   String call_id = sip_provider.pickCallId();
   int cseq = SipProvider.pickInitialCSeq();
   String local_tag = SipProvider.pickTag();
   // String branch=SipStack.pickBranch();
   if (contact == null) contact = from;
   return createRequest(
       sip_provider,
       SipMethods.INVITE,
       request_uri,
       to,
       from,
       contact,
       call_id,
       cseq,
       local_tag,
       null,
       null,
       body,
       icsi); // modified by mandrajg
 }
 /**
  * Creates a SIP request message. Where
  *
  * <UL>
  *   <LI>request-uri equals the To sip url
  *   <LI>via address and port are taken from SipProvider
  *   <LI>transport protocol is taken from request-uri (if transport parameter is present) or the
  *       default transport for the SipProvider is used.
  *   <LI>call_id is picked random
  *   <LI>cseq is picked random
  *   <LI>local_tag is picked random
  *   <LI>branch is picked random
  * </UL>
  *
  * @see
  *     #createRequest(String,SipURL,NameAddress,NameAddress,NameAddress,String,String,int,String,long,String,String,String,String)
  */
 public static Message createRequest(
     SipProvider sip_provider,
     String method,
     SipURL request_uri,
     NameAddress to,
     NameAddress from,
     NameAddress contact,
     String body) { // SipURL
   // request_uri=to.getAddress();
   String call_id = sip_provider.pickCallId();
   int cseq = SipProvider.pickInitialCSeq();
   String local_tag = SipProvider.pickTag();
   // String branch=SipStack.pickBranch();
   return createRequest(
       sip_provider,
       method,
       request_uri,
       to,
       from,
       contact,
       call_id,
       cseq,
       local_tag,
       null,
       null,
       body,
       null); // modified by mandrajg
 }
 /**
  * Creates a new REGISTER request.
  *
  * <p>If contact is null, set contact as star * (register all)
  */
 public static Message createRegisterRequest(
     SipProvider sip_provider,
     NameAddress to,
     NameAddress from,
     NameAddress contact,
     String qvalue,
     String icsi) { // modified by mandrajg
   SipURL to_url = to.getAddress();
   SipURL registrar = new SipURL(to_url.getHost(), to_url.getPort());
   String via_addr = sip_provider.getViaAddress();
   int host_port = sip_provider.getPort();
   boolean rport = sip_provider.isRportSet();
   String proto;
   if (to_url.hasTransport()) proto = to_url.getTransport();
   else proto = sip_provider.getDefaultTransport();
   String call_id = sip_provider.pickCallId();
   int cseq = SipProvider.pickInitialCSeq();
   String local_tag = SipProvider.pickTag();
   // String branch=SipStack.pickBranch();
   Message req =
       createRequest(
           SipMethods.REGISTER,
           registrar,
           to,
           from,
           contact,
           proto,
           via_addr,
           host_port,
           rport,
           call_id,
           cseq,
           local_tag,
           null,
           null,
           null,
           qvalue,
           icsi); // modified by mandrajg
   // if no contact, deregister all
   if (contact == null) {
     ContactHeader star = new ContactHeader(); // contact is *
     req.setContactHeader(star);
     req.setExpiresHeader(new ExpiresHeader(String.valueOf(SipStack.default_expires)));
   }
   return req;
 }