- Timestamp:
- Jun 19, 2018 10:00:33 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_timer.c
r5701 r5806 69 69 pj_timer_entry expire_timer; /**< Timer entry for expire 70 70 refresher */ 71 pj_int32_t last_422_cseq; /**< Last 422 resp CSeq. */ 71 72 }; 72 73 … … 786 787 } 787 788 789 /* Avoid 422 retry loop. Ignore it and stop retrying if dialog is 790 * established, otherwise, just return error to disconnect the call. 791 */ 792 if (rdata->msg_info.cseq->cseq == inv->timer->last_422_cseq + 1) { 793 if (inv->state == PJSIP_INV_STATE_CONFIRMED) { 794 inv->invite_tsx = NULL; 795 return PJ_SUCCESS; 796 } else { 797 return PJSIP_ERRNO_FROM_SIP_STATUS( 798 PJSIP_SC_SESSION_TIMER_TOO_SMALL); 799 } 800 } 801 inv->timer->last_422_cseq = rdata->msg_info.cseq->cseq; 802 788 803 /* Session Timers should have been initialized here */ 789 804 pj_assert(inv->timer); … … 799 814 /* Prepare to restart the request */ 800 815 801 /* Get the original INVITE request. */802 tdata = inv->invite_req;816 /* Get the original INVITE/UPDATE request. */ 817 tdata = pjsip_rdata_get_tsx((pjsip_rx_data*)rdata)->last_tx; 803 818 804 819 /* Remove branch param in Via header. */ … … 828 843 add_timer_headers(inv, tdata, PJ_TRUE, PJ_TRUE); 829 844 830 /* Restart UAC */ 831 pjsip_inv_uac_restart(inv, PJ_FALSE); 845 /* Restart UAC if this is initial INVITE, or simply reset tsx for 846 * subsequent INVITE. 847 */ 848 if (inv->state < PJSIP_INV_STATE_CONFIRMED) 849 pjsip_inv_uac_restart(inv, PJ_FALSE); 850 else if (tdata->msg->line.req.method.id == PJSIP_INVITE_METHOD) 851 inv->invite_tsx = NULL; 852 853 /* Resend the updated request */ 832 854 pjsip_inv_send_msg(inv, tdata); 833 855 … … 1042 1064 } 1043 1065 1066 /* Make sure Session Timers is initialized */ 1067 if (inv->timer == NULL) 1068 pjsip_timer_init_session(inv, NULL); 1069 1044 1070 /* Find Session-Expires header */ 1045 1071 se_hdr = (pjsip_sess_expires_hdr*) pjsip_msg_find_hdr_by_names( 1046 1072 msg, &STR_SE, &STR_SHORT_SE, NULL); 1047 if (se_hdr == NULL) {1048 /* Remote doesn't support/want Session Timers, check if local1049 * require or force to use Session Timers. Note that Supported and1050 * Require headers negotiation should have been verified by invite1051 * session.1052 */1053 if ((inv->options &1054 (PJSIP_INV_REQUIRE_TIMER | PJSIP_INV_ALWAYS_USE_TIMER)) == 0)1055 {1056 /* Session Timers not forced/required */1057 pjsip_timer_end_session(inv);1058 return PJ_SUCCESS;1059 }1060 }1061 1062 /* Make sure Session Timers is initialized */1063 if (inv->timer == NULL)1064 pjsip_timer_init_session(inv, NULL);1065 1066 1073 /* Find Min-SE header */ 1067 1074 min_se_hdr = (pjsip_min_se_hdr*) pjsip_msg_find_hdr_by_name(msg, … … 1094 1101 */ 1095 1102 inv->timer->setting.sess_expires = min_se; 1103 } 1104 1105 /* If incoming request has no SE header, it means remote doesn't 1106 * support/want Session Timers. So let's check if local require or 1107 * force to use Session Timers. Note that Supported and Require headers 1108 * negotiation should have been verified by invite session. 1109 */ 1110 if (se_hdr == NULL) { 1111 if ((inv->options & 1112 (PJSIP_INV_REQUIRE_TIMER | PJSIP_INV_ALWAYS_USE_TIMER)) == 0) 1113 { 1114 /* Session Timers not forced/required */ 1115 pjsip_timer_end_session(inv); 1116 return PJ_SUCCESS; 1117 } 1096 1118 } 1097 1119
Note: See TracChangeset
for help on using the changeset viewer.