I've got a simple code for user registration. Of course, it doesn't work, because I'm new at Jain SIP stack, and I don't understand many things. I tried to imitate the Android SIP API, but unsuccessfully.
import javax.sip.SipFactory;
import javax.sip.address.Address;
import javax.sip.address.AddressFactory;
import javax.sip.address.SipURI;
public class SimpleUser {
SipURI sipURI;
Address address;
AddressFactory addressFactory;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new SimpleUser().init();
}
public void init() {
try {
addressFactory = SipFactory.getInstance().createAddressFactory();
//sipURI = (SipURI) address.getURI();
sipURI = addressFactory.createSipURI("user", "domain");
sipURI.setUserPassword("pass");
//SipURI uri = (SipURI) addressFactory.createURI("sip:user@host");
sipURI.setTransportParam("UDP");
sipURI.setPort(5060);
address = addressFactory.createAddress("user", sipURI);
Thread.sleep(10000);
} catch(Exception e) {
e.printStackTrace();
}
}
}
Could someone direct me what I need to improve in order to properly connect to the SIP server.
PS. How can I check if the user has registered? I need something like a method isRegistered()
Best regards.