next up previous
Next: 11. Developing H.350-enabled Call Up: 10.2 SIP Previous: 10.2.9 Fetch SIP Attributes

10.2.10 An Example that Implements Login Process using Above Functions

The following code illustrates an example of how the above functions can be utilized to provide registration process based on H.350.

public static int login()

{

    try

    {

        /* Public Variable

        vLDAPHost - Host name of the LDAP server e.g. videnet.unc.edu

        vUsrID - User ID e.g. uid=bob or cn=bob

        vBaseDN - Base DN of LDAP server e.g. dc=vide,dc=net

        vUsrPassword - Password at the time of login

        In CGIsipClientv1.1.2 client this is a GUI implementation

        */

        try

        {

            /* Binding Anonymously and returning the UserDN */

            String fnResult;

            fnResult = BindAnonymous(vLDAPHost,vUsrID,vBaseDN);

            /*Sip URI search*/

            Hashtable resultsStr;

            vUsrDN=fnResult; /* Will store the User DN in vUsrDN */

            /* This will fetch SIPURIs for a UserDN */

            resultsStr = GetSIPURIs(vLDAPHost, vUsrID, vBaseDN, vUsrDN,

                vUsrPassword);

            int dummyi=0;

            /* Store the indexes on how many results have been fetched */

            for (int i = 0; i < resultsStr.size(); i++)

            {

                String index="SIPURI"+i;

            }

            /* If there is only one SIPURI in the list do not display

                the options for selecting the SIPURI from the list. */

            if (cntCommURIs==1)

            {

                try

                {

                    publicSIPURI = resultsStr.get("SIPURI0").toString());

                }

                catch(Exception e)

                {

                    System.out.println("VcLdap--Failed to call getstring");

                }

            }

            /* If there are more than one SIPURI then display a list so

                that the user can select the SIPURI he would like to

                register with */

            else if (cntCommURIs>1)

            {

            try

            {

                /* In CGUsipClient v1.1.2 a dropdown list is displayed from

                    which the user selects the SIPURI. This is

                    implemented in function showSipDropDown in user

                    interface module of the application */

                sipURIkey = VcSipDropDown.showSipDropDown(htblsipURIs);

                Thread.sleep(10000);

            }

            catch (InterruptedException e)

            {

                System.out.println("VcLdap-sleep exception: "+e);

            }

        }

        return 0; // If successful

    }

    catch (NamingException e)

    {

        System.out.println("Error in login - "+e.getMessage());

        return 1; // If failed

    }

}


next up previous
Next: 11. Developing H.350-enabled Call Up: 10.2 SIP Previous: 10.2.9 Fetch SIP Attributes

Video Middleware Cookbook
Questions and Comments : Cookbook Editors