public static void mergeContact(String src, Address dest) throws ServletParseException
{
NameAddr source = new NameAddr(src);
SipURI srcUri = (SipURI) source.getURI();
SipURI destUri = (SipURI) dest.getURI();
String user = srcUri.getUser();
if (user != null)
destUri.setUser(user);
Iterator<String> it = srcUri.getHeaderNames();
while (it.hasNext())
{
String name = it.next();
destUri.setHeader(name, srcUri.getHeader(name));
}
it = srcUri.getParameterNames();
while (it.hasNext())
{
String name = it.next();
if (!ContactAddress.isReservedUriParam(name))
destUri.setParameter(name, srcUri.getParameter(name));
}
String displayName = source.getDisplayName();
if (displayName != null)
dest.setDisplayName(displayName);