Changeset 942 for pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
- Timestamp:
- Feb 13, 2007 2:52:37 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r882 r942 1397 1397 1398 1398 /* 1399 * Set the UAC absolute transaction timeout. 1400 */ 1401 PJ_DEF(pj_status_t) pjsip_tsx_set_uac_timeout(pjsip_transaction *tsx, 1402 unsigned msec_time, 1403 pjsip_tsx_timeout_policy policy) 1404 { 1405 PJ_ASSERT_RETURN(tsx && tsx->role==PJSIP_ROLE_UAC && 1406 tsx->state==PJSIP_TSX_STATE_NULL, PJ_EINVALIDOP); 1407 1408 tsx->msec_timeout = msec_time; 1409 tsx->timeout_policy = policy; 1410 1411 return PJ_SUCCESS; 1412 } 1413 1414 1415 /* 1399 1416 * Set transaction status code and reason. 1400 1417 */ … … 1897 1914 1898 1915 /* Start Timer B (or called timer F for non-INVITE) for transaction 1899 * timeout. 1916 * timeout. If user has configured the timeout value with 1917 * pjsip_tsx_set_uac_timeout(), use the timeout value there. 1900 1918 */ 1901 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1902 &timeout_timer_val); 1919 if (tsx->msec_timeout > 0) { 1920 pj_time_val timeout; 1921 1922 timeout.sec = tsx->msec_timeout / 1000; 1923 timeout.msec = tsx->msec_timeout % 1000; 1924 1925 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1926 &timeout); 1927 1928 } else { 1929 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1930 &timeout_timer_val); 1931 } 1903 1932 1904 1933 /* Start Timer A (or timer E) for retransmission only if unreliable … … 1968 1997 } else if (event->type == PJSIP_EVENT_RX_MSG) { 1969 1998 pjsip_msg *msg; 1970 //int code;1999 int code; 1971 2000 1972 2001 /* Get message instance */ … … 1985 2014 1986 2015 1987 /* Cancel timer B (transaction timeout) */ 1988 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 2016 /* Cancel timer B (transaction timeout) but look at the timeout policy 2017 * as set by pjsip_tsx_set_uac_timeout(). 2018 */ 2019 code = msg->line.status.code; 2020 if ((code==100 && tsx->timeout_policy==PJSIP_TSX_IGNORE_100) || 2021 (code<200 && tsx->timeout_policy==PJSIP_TSX_IGNORE_1xx)) 2022 { 2023 /* Don't cancel the timeout timer */ 2024 } 2025 else { 2026 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 2027 } 1989 2028 1990 2029 /* Discard retransmission message if it is not INVITE. … … 2373 2412 } 2374 2413 2414 } else if (event->type == PJSIP_EVENT_TIMER && 2415 event->body.timer.entry == &tsx->timeout_timer) { 2416 2417 /* Inform TU. */ 2418 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2419 PJSIP_EVENT_TIMER, &tsx->timeout_timer); 2420 2421 2375 2422 } else if (tsx->status_code >= 300 && tsx->status_code <= 699) { 2376 2423
Note: See TracChangeset
for help on using the changeset viewer.