| 1530 | } |
| 1531 | |
| 1532 | void process_reply_and_timer(struct cell *t,int branch,int msg_status, |
| 1533 | struct sip_msg *p_msg,int last_uac_status, struct ua_client *uac) |
| 1534 | { |
| 1535 | int reply_status; |
| 1536 | branch_bm_t cancel_bitmap = BRANCH_BM_ZERO; |
| 1537 | utime_t timer; |
| 1538 | |
| 1539 | /* we fire a cancel on spot if (a) branch is marked "to be canceled" or (b) |
| 1540 | * the whole transaction was canceled (received cancel) and no cancel sent |
| 1541 | * yet on this branch; and of course, only if a provisional reply :) */ |
| 1542 | if (TM_BRANCH(t,branch).flags&T_UAC_TO_CANCEL_FLAG || |
| 1543 | ((t->flags&T_WAS_CANCELLED_FLAG) && !TM_BRANCH(t,branch).local_cancel.buffer.s)) { |
| 1544 | if ( msg_status < 200 ) |
| 1545 | /* reply for an UAC with a pending cancel -> do cancel now */ |
| 1546 | cancel_branch(t, branch); |
| 1547 | /* reset flag */ |
| 1548 | TM_BRANCH(t,branch).flags &= ~(T_UAC_TO_CANCEL_FLAG); |
| 1549 | } |
| 1550 | |
| 1551 | if (is_local(t)) { |
| 1552 | reply_status = local_reply(t,p_msg, branch,msg_status, cancel_bitmap); |
| 1553 | if (reply_status == RPS_COMPLETED) { |
| 1554 | cleanup_uac_timers(t); |
| 1555 | if (is_invite(t)) cancel_uacs(t, cancel_bitmap); |
| 1556 | /* There is no need to call set_final_timer because we know |
| 1557 | * that the transaction is local */ |
| 1558 | put_on_wait(t); |
| 1559 | } |
| 1560 | } else { |
| 1561 | reply_status = relay_reply(t,p_msg,branch,msg_status, cancel_bitmap); |
| 1562 | /* clean-up the transaction when transaction completed */ |
| 1563 | if (reply_status == RPS_COMPLETED) { |
| 1564 | /* no more UAC FR/RETR (if I received a 2xx, there may |
| 1565 | * be still pending branches ... |
| 1566 | */ |
| 1567 | cleanup_uac_timers(t); |
| 1568 | if (is_invite(t)) cancel_uacs(t, cancel_bitmap); |
| 1569 | /* FR for negative INVITES, WAIT anything else */ |
| 1570 | /* set_final_timer(t); */ |
| 1571 | } |
| 1572 | } |
| 1573 | |
| 1574 | if (reply_status!=RPS_PROVISIONAL) |
| 1575 | return; |
| 1576 | |
| 1577 | /* update FR/RETR timers on provisional replies */ |
| 1578 | if (msg_status < 200 && (restart_fr_on_each_reply || |
| 1579 | ((last_uac_status<msg_status) && |
| 1580 | ((msg_status >= 180) || (last_uac_status == 0))) |
| 1581 | ) ) { /* provisional now */ |
| 1582 | if (is_invite(t)) { |
| 1583 | /* invite: change FR to longer FR_INV, do not |
| 1584 | * attempt to restart retransmission any more |
| 1585 | */ |
| 1586 | timer = is_timeout_set(t->fr_inv_timeout) ? |
| 1587 | t->fr_inv_timeout : |
| 1588 | timer_id2timeout[FR_INV_TIMER_LIST]; |
| 1589 |
no test coverage detected