Changeset 4046
- Timestamp:
- Apr 13, 2012 4:28:26 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_inv.c
r3964 r4046 156 156 pjsip_inv_session *inv; /* The invite session */ 157 157 pj_bool_t sdp_done; /* SDP negotiation done for this tsx? */ 158 pj_bool_t retrying; /* Resend (e.g. due to 401/407) */ 158 159 pj_str_t done_tag; /* To tag in RX response with answer */ 159 160 pj_bool_t done_early;/* Negotiation was done for early med? */ … … 2809 2810 2810 2811 } else { 2812 struct tsx_inv_data *tsx_inv_data; 2813 2814 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 2815 if (tsx_inv_data) 2816 tsx_inv_data->retrying = PJ_TRUE; 2817 2811 2818 /* Re-send BYE. */ 2812 2819 status = pjsip_inv_send_msg(inv, tdata); … … 2921 2928 * Handle incoming response to UAC UPDATE request. 2922 2929 */ 2923 static voidinv_handle_update_response( pjsip_inv_session *inv,2924 2930 static pj_bool_t inv_handle_update_response( pjsip_inv_session *inv, 2931 pjsip_event *e) 2925 2932 { 2926 2933 pjsip_transaction *tsx = e->body.tsx_state.tsx; 2927 struct tsx_inv_data *tsx_inv_data = NULL; 2934 struct tsx_inv_data *tsx_inv_data; 2935 pj_bool_t handled = PJ_FALSE; 2928 2936 pj_status_t status = -1; 2937 2938 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 2939 pj_assert(tsx_inv_data); 2929 2940 2930 2941 /* Handle 401/407 challenge. */ … … 2933 2944 { 2934 2945 pjsip_tx_data *tdata; 2935 2946 2936 2947 status = pjsip_auth_clt_reinit_req( &inv->dlg->auth_sess, 2937 2948 e->body.tsx_state.src.rdata, … … 2951 2962 2952 2963 } else { 2964 if (tsx_inv_data) 2965 tsx_inv_data->retrying = PJ_TRUE; 2966 2953 2967 /* Re-send request. */ 2954 2968 status = pjsip_inv_send_msg(inv, tdata); 2955 2969 } 2970 2971 handled = PJ_TRUE; 2956 2972 } 2957 2973 … … 2962 2978 status = handle_timer_response(inv, e->body.tsx_state.src.rdata, 2963 2979 PJ_FALSE); 2980 handled = PJ_TRUE; 2964 2981 } 2965 2982 … … 2973 2990 status = inv_check_sdp_in_incoming_msg(inv, tsx, 2974 2991 e->body.tsx_state.src.rdata); 2992 handled = PJ_TRUE; 2975 2993 } 2976 2994 … … 2986 3004 status = handle_timer_response(inv, e->body.tsx_state.src.rdata, 2987 3005 PJ_FALSE); 2988 } 2989 2990 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 2991 if (tsx_inv_data == NULL) { 2992 tsx_inv_data=PJ_POOL_ZALLOC_T(tsx->pool, struct tsx_inv_data); 2993 tsx_inv_data->inv = inv; 2994 tsx->mod_data[mod_inv.mod.id] = tsx_inv_data; 2995 } 2996 } 2997 2998 /* Cancel the negotiation if we don't get successful negotiation by now */ 3006 handled = PJ_TRUE; 3007 } 3008 } 3009 3010 /* Cancel the negotiation if we don't get successful negotiation by now, 3011 * unless it's authentication challenge and the request is being retried. 3012 */ 2999 3013 if (pjmedia_sdp_neg_get_state(inv->neg) == 3000 3014 PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER && 3001 tsx_inv_data && tsx_inv_data->sdp_done == PJ_FALSE) 3015 tsx_inv_data && tsx_inv_data->sdp_done == PJ_FALSE && 3016 !tsx_inv_data->retrying) 3002 3017 { 3003 3018 pjmedia_sdp_neg_cancel_offer(inv->neg); … … 3006 3021 tsx_inv_data->sdp_done = PJ_TRUE; 3007 3022 } 3023 3024 return handled; 3008 3025 } 3009 3026 … … 3205 3222 tsx->status_code == PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED)) 3206 3223 { 3207 3208 3224 pjsip_tx_data *tdata; 3209 3225 pj_status_t status; … … 3227 3243 3228 3244 } else { 3245 struct tsx_inv_data *tsx_inv_data; 3246 3247 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 3248 if (tsx_inv_data) 3249 tsx_inv_data->retrying = PJ_TRUE; 3250 3229 3251 /* Re-send request. */ 3230 3252 status = pjsip_inv_send_msg(inv, tdata); … … 3903 3925 * Handle response to outgoing UPDATE request. 3904 3926 */ 3905 if ( handle_uac_tsx_response(inv, e) == PJ_FALSE)3906 inv_handle_update_response(inv, e);3927 if (inv_handle_update_response(inv, e) == PJ_FALSE) 3928 handle_uac_tsx_response(inv, e); 3907 3929 3908 3930 } else if (tsx->role == PJSIP_ROLE_UAS && … … 4260 4282 4261 4283 pjmedia_sdp_neg_state neg_state; 4284 struct tsx_inv_data *tsx_inv_data; 4285 4286 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 4262 4287 4263 4288 /* Outgoing INVITE transaction has failed, cancel SDP nego */ 4264 4289 neg_state = pjmedia_sdp_neg_get_state(inv->neg); 4265 if (neg_state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) { 4290 if (neg_state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER && 4291 tsx_inv_data->retrying == PJ_FALSE) 4292 { 4266 4293 pjmedia_sdp_neg_cancel_offer(inv->neg); 4267 4294 } … … 4288 4315 * Handle response to outgoing UPDATE request. 4289 4316 */ 4290 if ( handle_uac_tsx_response(inv, e) == PJ_FALSE)4291 inv_handle_update_response(inv, e);4317 if (inv_handle_update_response(inv, e) == PJ_FALSE) 4318 handle_uac_tsx_response(inv, e); 4292 4319 4293 4320 } else if (tsx->role == PJSIP_ROLE_UAS &&
Note: See TracChangeset
for help on using the changeset viewer.