[SIPForum-discussion] SIpStack

pankaj parashar pankaj_parashar84 at yahoo.co.in
Thu Jan 18 05:22:05 UTC 2007


hi all,
      
  I have some problem in creating sipstack.code is so
   
   
   
   
  import gov.nist.javax.sip.header.*;
  import gov.nist.javax.sip.header.*;
  import java.util.*;
  import javax.naming.ServiceUnavailableException;
  import javax.sip.ListeningPoint;
  import javax.sip.PeerUnavailableException;
  import javax.sip.RequestEvent;
  import javax.sip.ResponseEvent;
  import javax.sip.SipException;
  import javax.sip.SipFactory;
  import javax.sip.SipListener;
  import javax.sip.SipProvider;
  import javax.sip.SipStack;
  import javax.sip.TimeoutEvent;
  import javax.sip.address.AddressFactory;
  import javax.sip.header.HeaderFactory;
  import javax.sip.message.MessageFactory;
  import sun.security.krb5.internal.crypto.e;
   
  public class Example implements SipListener{
  private SipFactory sipFactory = null;
  private AddressFactory addressFactory = null;
  private HeaderFactory headerFactory = null;
  private MessageFactory messageFactory = null;
  private SipStack sipStack = null;
  private SipProvider sipProvider = null;
  private Iterator listeningPoints = null;
  public void processRequest(RequestEvent arg0) {
  // TODO Auto-generated method stub
  
  }
  public void processResponse(ResponseEvent arg0) {
  // TODO Auto-generated method stub
  
  }
  public void processTimeout(TimeoutEvent arg0) {
  // TODO Auto-generated method stub
  
  }
  // Main
  public static void main(String[] args) {
  Example example = new Example();
  //example.sendMessages();
  }
  public Example() {
  setup();
  }
  private void setup() {
  // Obtain an instance of the singleton SipFactory
  sipFactory = SipFactory.getInstance();
  // Set name of SipStack
  //** SipStack.setStackName("Reference Implementation SIP stack");
  // Set path name of SipFactory to reference implementation
  // (not needed - default path name)
  sipFactory.setPathName("gov.nist"); 
  try {
  
  // Create SipStack object
  Properties properties = new Properties();
  properties.setProperty("javax.sip.IP_ADDRESS","192.168.5.7");
  properties.setProperty("javax.sip.STACK_NAME","NISTv1.2");
  properties.setProperty("javax.sip.OUTBOUND_PROXY","192.168.5.190/5060/UDP");
  
  
  sipStack = (SipStack)sipFactory.createSipStack(properties);
  
  //sipStack = new SipStackImpl(properties);
  System.out.println(sipFactory.getPathName());
  
  } catch(PeerUnavailableException e) {
  // could not find com.dynamicsoft.ri.jain.protocol.ip.sip.SipStackImpl
  // in the classpath
  System.err.println(e.getMessage());
  System.exit(-1);
  } catch(SipException e) {
  // could not create SipStack for some other reason
  System.err.println(e.getMessage());
  System.exit(-1); 
  }
  
  
  try {
  // Get SipStack's ListeningPoints
  listeningPoints = sipStack.getListeningPoints();
   
  // Create SipProvider based on the first ListeningPoint
  sipProvider = sipStack.createSipProvider((ListeningPoint)listeningPoints.next());
  } catch(NullPointerException e) {
  System.err.println("Stack has no ListeningPoints");
  System.exit(-1);
  } catch(SipException e) {
  System.err.println(e.getMessage());
  System.exit(-1);
  }
  // Register this application as a SipListener of the SipProvider
  try {
  sipProvider.addSipListener(this);
  } catch(TooManyListenersException e) {
  // A limit has been reached on the number of Listeners allowed per provider
  System.err.println(e.getMessage());
  System.exit(-1);
  } 
  
  }
  }
   
   
   
  this is not the whole code but sufficient to creating sipstack.
  I m getting  a message when I run it
   
   
   
  The Peer SIP Stack: gov.nist.javax.sip.SipStackImpl could not be instantiated. Ensure the Path Name has been set.
   
   
  could u help me
   
   
   
  thanx in advance


Pankaj Parashar

 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sipforum.org/pipermail/discussion/attachments/20070118/722259d9/attachment-0002.html>


More information about the discussion mailing list