Skip to content

Commit 21d0e77

Browse files
committed
Patch for B2BUAHelper when forwarding responses add User part in the Contact header of the cloned response, only if exists in the linkedResponse
This close #2288
1 parent de954ab commit 21d0e77

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

  • restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util

restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util/B2BUAHelper.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,16 +497,15 @@ public static void forwardResponse(final SipServletResponse response, final bool
497497
SipServletRequest linkedRequest = (SipServletRequest) getLinkedSession(response).getAttribute(B2BUA_LAST_REQUEST);
498498
SipServletResponse clonedResponse = linkedRequest.createResponse(response.getStatus());
499499
SipURI originalURI = null;
500-
Address contact = null;
501500
try {
502501
originalURI = (SipURI) response.getAddressHeader("Contact").getURI();
503-
((SipURI) clonedResponse.getAddressHeader("Contact").getURI()).setUser(originalURI.getUser());
504-
contact = clonedResponse.getAddressHeader("Contact");
505-
} catch (ServletParseException e1) {}
506-
catch (NullPointerException e2) {}
507-
if(logger.isInfoEnabled()) {
508-
logger.info("Contact: " + contact);
502+
if (originalURI.getUser() != null && !originalURI.getUser().isEmpty()) {
503+
((SipURI) clonedResponse.getAddressHeader("Contact").getURI()).setUser(originalURI.getUser());
504+
}
505+
} catch (ServletParseException | NullPointerException e) {
506+
logger.error("Problem while trying to set User part on a clones response for a P2P call, "+e);
509507
}
508+
510509
CallDetailRecord callRecord = records.getCallDetailRecord((Sid) linkedRequest.getSession().getAttribute(CDR_SID));
511510

512511
if (response.getRawContent() != null && response.getRawContent().length > 0 ) {

0 commit comments

Comments
 (0)