MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / w_t_cancel_branch

Function w_t_cancel_branch

modules/tm/tm.c:1466–1516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1464
1465extern int _tm_branch_index;
1466static int w_t_cancel_branch(struct sip_msg *msg, void *sflags)
1467{
1468 branch_bm_t cancel_bitmap = BRANCH_BM_ZERO;
1469 struct cell *t;
1470 unsigned int flags = (unsigned long)sflags;
1471
1472 t=get_t();
1473
1474 if (t==NULL || t==T_UNDEFINED) {
1475 /* no transaction */
1476 LM_ERR("cannot cancel a reply with no transaction");
1477 return -1;
1478 }
1479 if (!is_invite(t))
1480 return -1;
1481
1482 if (flags&TM_CANCEL_BRANCH_ALL) {
1483 /* lock and get the branches to cancel */
1484 if (!onreply_avp_mode) {
1485 LOCK_REPLIES(t);
1486 which_cancel( t, cancel_bitmap );
1487 UNLOCK_REPLIES(t);
1488 } else {
1489 which_cancel( t, cancel_bitmap );
1490 }
1491 if (msg->first_line.u.reply.statuscode>=200)
1492 /* do not cancel the current branch as we got
1493 * a final response here */
1494 BRANCH_BM_RST_IDX( cancel_bitmap, _tm_branch_index);
1495 } else if (flags&TM_CANCEL_BRANCH_OTHERS) {
1496 /* lock and get the branches to cancel */
1497 if (!onreply_avp_mode) {
1498 LOCK_REPLIES(t);
1499 which_cancel( t, cancel_bitmap );
1500 UNLOCK_REPLIES(t);
1501 } else {
1502 which_cancel( t, cancel_bitmap );
1503 }
1504 /* ignore current branch */
1505 BRANCH_BM_RST_IDX( cancel_bitmap, _tm_branch_index);
1506 } else {
1507 /* cancel only local branch (only if still ongoing) */
1508 if (msg->first_line.u.reply.statuscode<200)
1509 BRANCH_BM_SET_IDX( cancel_bitmap, _tm_branch_index);
1510 }
1511
1512 /* send cancels out */
1513 cancel_uacs(t, cancel_bitmap);
1514
1515 return 1;
1516}
1517
1518
1519static int w_t_add_hdrs(struct sip_msg* msg, str *val)

Callers

nothing calls this directly

Calls 3

get_tFunction · 0.85
which_cancelFunction · 0.85
cancel_uacsFunction · 0.85

Tested by

no test coverage detected