Client for Asterisk

Hello,

I am trying to develope a sip client using J2ME with the package javax.microedition.sip. This client should communicate with a Trixbox virtual machine (an Asterisk implementation). I am using NetBeans 5.5.1 with Mobility Pack and phone emulator. I also tried NetBeans 6.
Has anybody ever used the microedition.sip package for communicating with an Asterisk PBX server?
I can’t get responses to my sip requests, except when I try to send a request with an inexistent user ID and get a 404 (Not Found) error. Here is a portion of my java midlet:

      scn = (SipConnectionNotifier) Connector.open("sip:5060");
    
      // build the contact URI
      String realm;
      String contact = 
	new String("sip:101@"+scn.getLocalAddress()+":"+scn.getLocalPort());
    
      // open client connection to the SIP registrar in this case "host.com"	   
      sc = (SipClientConnection) Connector.open("sip:172.17.25.110");
      // initialize REGISTER with appropriate headers
      sc.initRequest("REGISTER", scn);
      sc.setHeader("From", "sip:101@172.17.25.110");
      sc.setHeader("To", "sip:101@172.17.25.110");
      sc.setHeader("Contact", contact);
      sc.send();
      boolean handled = false;
      int scode = 0;
    
      while(!handled) {
      	SipHeader sh;
      	// wait max 30 secs for response
      	sc.receive(30000);
      	scode = sc.getStatusCode();
      	switch(scode)
      	{
          case 401:
              sh = new SipHeader("WWW-Authenticate",
                 sc.getHeader("WWW-Authenticate"));
              realm = sh.getParameter("realm");                
              // here for example, prompt user for password for this realm
              // set credentials to initiate re-REGISTER
              sc.setCredentials("101", "101", realm);
              break;
		
          case 407:
              sh = new SipHeader("Proxy-Authenticate", 
                 sc.getHeader("Proxy-Authenticate"));
              realm = sh.getParameter("realm");                
              // here for example, prompt user for password for this realm
              // set credentials to initiate re-REGISTER
              sc.setCredentials("101", "101", realm);
              break;
		
          case 200:
              // handle OK response
              handled = true;
              break;
          default:
              // handle other responses
              handled = true;
      	}  
     }
     sc.close();

Can anybody help me please?

i am working on something similar!!!
I can’t dig out much of so little code but you can try:
UDP is a default connection protocol in SIP signaling. Changing the
connection protocol to TCP when the transport=tcp parameter is added to the URI passed as an argument to the Connector.open() operation might work.

For example: sip:user@server.com:5071;transport=tcp

If you can explain your project in more detail maybe we will get to the bottom of this