|
Next: 10.2.9 Fetch SIP Attributes Up: 10.2 SIP Previous: 10.2.7 Accumulate commURIs from
|
The following code illustrates how to fetch SIPIdentitySIPURI,
located in commObject by providing a commURI, located in enterprise
directory. This is executed in Step 8 in Figure
.
public static String getSipUri(String vcommURI)
{
String[] sipAttrs = {"SIPIdentitySIPURI"};
String retStr = new String();
try
{
/*create directory context */
DirContext ctxCommObj = new InitialDirContext();
/* Search for commURI */
NamingEnumeration vcCommObjResult=
ctxCommObj.search(vcommURI,"",null);
SearchResult srchSIPURI = (SearchResult)
vcCommObjResult.next();
/* Store only SIPIdentitySIPURI */
String dn = srchSIPURI.getName();
Attributes SIPURIAttr = srchSIPURI.getAttributes();
Attribute retAttr = SIPURIAttr.get("SIPIdentitySIPURI");
retStr = retAttr.toString();
}
catch( NamingException e)
{
System.out.println("Error in getSipUri - "+e.getMessage());
}
return retStr.toString();
}