Skip to content

Commit e7cf1d5

Browse files
committed
PN Support: Improve default handling for failed calls
Avoid relying on the "fr_inv_timeout" by default in order to complete the transaction when the call is rejected (wait_for_new_branches...), as the default (120s) is quite high, and can lead to stalling INVITEs. (cherry picked from commit 45dcfd7)
1 parent 163cb72 commit e7cf1d5

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

lib/reg/pn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ int pn_awake_pn_contacts(struct sip_msg *req, ucontact_t **cts, int sz)
625625
return -1;
626626
}
627627

628-
if (tmb.t_wait_for_new_branches(req) != 1)
628+
if (tmb.t_wait_for_new_branches(req, (unsigned int)sz) != 1)
629629
LM_ERR("failed to enable waiting for new branches\n");
630630

631631
for (end = cts + sz; cts < end; cts++) {

modules/tm/t_fwd.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ struct script_route_ref *get_on_branch();
5858
typedef int (*tgetbranch_f)(void);
5959
int get_branch_index(void);
6060

61-
extern int w_t_wait_for_new_branches(struct sip_msg* msg);
62-
61+
extern int w_t_wait_for_new_branches(struct sip_msg* msg, unsigned int br_to_wait);
6362
extern int w_t_inject_branches(struct sip_msg* msg, void *source,
6463
void *extra_flags);
6564
int t_inject_ul_event_branch(void);

modules/tm/tm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,9 +1711,9 @@ int w_t_inject_branches(struct sip_msg* msg, void *source, void *extra_flags)
17111711
}
17121712

17131713

1714-
int w_t_wait_for_new_branches(struct sip_msg* msg)
1714+
int w_t_wait_for_new_branches(struct sip_msg* msg, unsigned int br_to_wait)
17151715
{
1716-
return t_wait_for_new_branches(msg, 0);
1716+
return t_wait_for_new_branches(msg, &br_to_wait);
17171717
}
17181718

17191719

modules/tm/tm_load.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,15 @@ struct tm_binds {
9696
set_localT_holder_f setlocalTholder;
9797
tgetbranch_f get_branch_index;
9898

99-
/* Return: 1 on success, -1 otherwise */
100-
int (*t_wait_for_new_branches) (struct sip_msg *msg);
99+
/**
100+
* Keep the transaction in an unresolved state (no final response), even if
101+
* all pending branches are completed. The transaction will then complete
102+
* when either the specified @num_br number of branches have completed, or
103+
* if it times out.
104+
*
105+
* Return: 1 on success, -1 otherwise
106+
*/
107+
int (*t_wait_for_new_branches) (struct sip_msg *msg, unsigned int num_br);
101108

102109
/**
103110
* Injects and relays a new branch for the current transaction using the

0 commit comments

Comments
 (0)