Initially, a REGISTER message is sent without any user name and password. If the server returns an OK, this method returns a true value.
If any challenge is received in response to sending the REGISTER message (response code UNAUTHORIZED or PROXY_AUTHENTICATION_REQUIRED), the SipPhone's credentials list is checked first for the corresponding realm entry. If found, the credentials list entry username and password are used to form the required authorization header for resending the REGISTER message to the server, and the authorization header is saved for later re-use. You can clear out saved authorization headers by calling the unregister() method.
If the challenging realm is not found in the SipPhone credentials list, the user parameter passed to this method is examined. If it is null, this method returns false. If it is not null, the user and password values passed in to this method are used to respond to the challenge. The credentials list is not modified by this scenario (no entry is automatically added with this user, password). Also, the authorization created for this registration is not saved for re-use on a later registration. IE, the user/password parameters are for a one-time, single-shot use only.
After responding to the challenge(s) by resending the REGISTER message, this method returns a true or false value depending on the outcome as indicated by the server.
If the contact parameter is null, user@hostname is used where hostname is the SipStack's IP address property which defaults to InetAddress.getLocalHost().getHostAddress(), and other SipStack properties also apply. Otherwise, the contact parameter given is used in the Registration message sent to the server.
If the expiry parameter is 0, the registration request never expires. Otherwise, the duration, given in seconds, is sent to server.
This method can be called repeatedly to update the expiry or to add new contacts.
This method determines the contact information for this user agent, whether the registration was successful or not. If successful, the contact information may have been updated by the server (such as the expiry time, if not specified to this method by the caller). Once this method has been called, the test program can get information about the contact for this agent by calling the *MyContact*() getter methods. @param user Optional - user name for authenticating with the server. Required if the server issues an authentication challenge. @param password Optional - used only if the server issues an authentication challenge. @param contact An URI string (ex: sip:bob@192.0.2.4), or null to use the default contact for this user agent. @param expiry Expiry time in seconds, or 0 if no registration expiry. @throws InvalidArgumentException @throws ParseException
|
|
|
|
|
|
|
|
|
|