* (containingDialog.hashCode())
*/
public void attachToTag(Response response, Dialog containingDialog) {
ToHeader to = (ToHeader) response.getHeader(ToHeader.NAME);
if (to == null) {
fireCommunicationsError(new CommunicationsException(
"No TO header found in, attaching a to tag is therefore impossible"));
}
try {
if (to.getTag() == null || to.getTag().trim().length() == 0) {
int toTag = containingDialog != null ? containingDialog
.hashCode() : (int) System.currentTimeMillis();
to.setTag(Integer.toString(toTag));
}
}
catch (ParseException ex) {
fireCommunicationsError(new CommunicationsException(
"Failed to attach a TO tag to an outgoing response"));
}
}