diff --git a/src/modules/ims_isc/ims_isc_mod.c b/src/modules/ims_isc/ims_isc_mod.c index e0f7b940ee4..4618ca7db15 100644 --- a/src/modules/ims_isc/ims_isc_mod.c +++ b/src/modules/ims_isc/ims_isc_mod.c @@ -224,6 +224,8 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t* d) { //sometimes s is populated by an ims_getter method cscf_get_terminating_user that alloc memory that must be free-ed at the end int free_s = 0; + //the callback from the Cx interface in case of unreg terminating initial message is a FAILURE_ROUTE. Hence we need an addl. flag + int firstflag = 0; int ret = ISC_RETURN_FALSE; isc_mark new_mark, old_mark; @@ -245,9 +247,10 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t* d) { LM_DBG("Message returned s=%d;h=%d;d=%d;a=%.*s\n", old_mark.skip, old_mark.handling, old_mark.direction, old_mark.aor.len, old_mark.aor.s); } else { LM_DBG("Starting triggering\n"); + firstflag = 1; } - if (is_route_type(FAILURE_ROUTE)) { + if (is_route_type(FAILURE_ROUTE) && !firstflag) { /* need to find the handling for the failed trigger */ if (dir == DLG_MOBILE_ORIGINATING) { k = cscf_get_originating_user(msg, &s); @@ -345,7 +348,7 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t* d) { new_mark.skip = m->index + 1; new_mark.handling = m->default_handling; new_mark.aor = s; - ret = isc_forward(msg, m, &new_mark); + ret = isc_forward(msg, m, &new_mark, firstflag); isc_free_match(m); goto done; } @@ -383,7 +386,7 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t* d) { new_mark.skip = m->index + 1; new_mark.handling = m->default_handling; new_mark.aor = s; - ret = isc_forward(msg, m, &new_mark); + ret = isc_forward(msg, m, &new_mark, firstflag); isc_free_match(m); goto done; } diff --git a/src/modules/ims_isc/isc.c b/src/modules/ims_isc/isc.c index 3d1fdf5c46b..a095e054e77 100644 --- a/src/modules/ims_isc/isc.c +++ b/src/modules/ims_isc/isc.c @@ -56,7 +56,7 @@ * @param mark - the isc_mark that should be used to mark the message * @returns #ISC_RETURN_TRUE if OK, #ISC_RETURN_ERROR if not */ -int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark) { +int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark, int firstflag) { struct cell *t; unsigned int hash, label; ticks_t fr_timeout, fr_inv_timeout; @@ -75,7 +75,7 @@ int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark) { memcpy(msg->dst_uri.s, m->server_name.s, m->server_name.len); /* append branch if last trigger failed */ - if (is_route_type(FAILURE_ROUTE)) + if (is_route_type(FAILURE_ROUTE) && !firstflag) append_branch(msg, &(msg->first_line.u.request.uri), &(msg->dst_uri), 0, Q_UNSPECIFIED, 0, 0, 0, 0, 0, 0); // Determines the tm transaction identifiers. diff --git a/src/modules/ims_isc/isc.h b/src/modules/ims_isc/isc.h index 8c3715e347d..ac012162fd3 100644 --- a/src/modules/ims_isc/isc.h +++ b/src/modules/ims_isc/isc.h @@ -66,7 +66,7 @@ extern int isc_fr_inv_timeout; /**< default ISC INVITE response timeout in ms * /** SIP Status Code to send to client on Session Termination because AS did not respond */ -int isc_forward( struct sip_msg *msg, isc_match *m,isc_mark *mark); +int isc_forward( struct sip_msg *msg, isc_match *m,isc_mark *mark, int firstflag); #endif