Changeset 4054 for pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
- Timestamp:
- Apr 16, 2012 7:50:01 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
- Property svn:mergeinfo changed
/pjproject/branches/1.x merged: 4045-4046
- Property svn:mergeinfo changed
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
r3999 r4054 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? */ … … 2912 2913 2913 2914 } else { 2915 struct tsx_inv_data *tsx_inv_data; 2916 2917 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 2918 if (tsx_inv_data) 2919 tsx_inv_data->retrying = PJ_TRUE; 2920 2914 2921 /* Re-send BYE. */ 2915 2922 status = pjsip_inv_send_msg(inv, tdata); … … 3024 3031 * Handle incoming response to UAC UPDATE request. 3025 3032 */ 3026 static voidinv_handle_update_response( pjsip_inv_session *inv,3027 3033 static pj_bool_t inv_handle_update_response( pjsip_inv_session *inv, 3034 pjsip_event *e) 3028 3035 { 3029 3036 pjsip_transaction *tsx = e->body.tsx_state.tsx; 3030 struct tsx_inv_data *tsx_inv_data = NULL; 3037 struct tsx_inv_data *tsx_inv_data; 3038 pj_bool_t handled = PJ_FALSE; 3031 3039 pj_status_t status = -1; 3040 3041 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 3042 pj_assert(tsx_inv_data); 3032 3043 3033 3044 /* Handle 401/407 challenge. */ … … 3036 3047 { 3037 3048 pjsip_tx_data *tdata; 3038 3049 3039 3050 status = pjsip_auth_clt_reinit_req( &inv->dlg->auth_sess, 3040 3051 e->body.tsx_state.src.rdata, … … 3054 3065 3055 3066 } else { 3067 if (tsx_inv_data) 3068 tsx_inv_data->retrying = PJ_TRUE; 3069 3056 3070 /* Re-send request. */ 3057 3071 status = pjsip_inv_send_msg(inv, tdata); 3058 3072 } 3073 3074 handled = PJ_TRUE; 3059 3075 } 3060 3076 … … 3065 3081 status = handle_timer_response(inv, e->body.tsx_state.src.rdata, 3066 3082 PJ_FALSE); 3083 handled = PJ_TRUE; 3067 3084 } 3068 3085 … … 3076 3093 status = inv_check_sdp_in_incoming_msg(inv, tsx, 3077 3094 e->body.tsx_state.src.rdata); 3095 handled = PJ_TRUE; 3078 3096 } 3079 3097 … … 3089 3107 status = handle_timer_response(inv, e->body.tsx_state.src.rdata, 3090 3108 PJ_FALSE); 3091 } 3092 3093 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 3094 if (tsx_inv_data == NULL) { 3095 tsx_inv_data=PJ_POOL_ZALLOC_T(tsx->pool, struct tsx_inv_data); 3096 tsx_inv_data->inv = inv; 3097 tsx->mod_data[mod_inv.mod.id] = tsx_inv_data; 3098 } 3099 } 3100 3101 /* Cancel the negotiation if we don't get successful negotiation by now */ 3109 handled = PJ_TRUE; 3110 } 3111 } 3112 3113 /* Cancel the negotiation if we don't get successful negotiation by now, 3114 * unless it's authentication challenge and the request is being retried. 3115 */ 3102 3116 if (pjmedia_sdp_neg_get_state(inv->neg) == 3103 3117 PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER && 3104 tsx_inv_data && tsx_inv_data->sdp_done == PJ_FALSE) 3118 tsx_inv_data && tsx_inv_data->sdp_done == PJ_FALSE && 3119 !tsx_inv_data->retrying) 3105 3120 { 3106 3121 pjmedia_sdp_neg_cancel_offer(inv->neg); … … 3109 3124 tsx_inv_data->sdp_done = PJ_TRUE; 3110 3125 } 3126 3127 return handled; 3111 3128 } 3112 3129 … … 3308 3325 tsx->status_code == PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED)) 3309 3326 { 3310 3311 3327 pjsip_tx_data *tdata; 3312 3328 pj_status_t status; … … 3330 3346 3331 3347 } else { 3348 struct tsx_inv_data *tsx_inv_data; 3349 3350 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 3351 if (tsx_inv_data) 3352 tsx_inv_data->retrying = PJ_TRUE; 3353 3332 3354 /* Re-send request. */ 3333 3355 status = pjsip_inv_send_msg(inv, tdata); … … 4006 4028 * Handle response to outgoing UPDATE request. 4007 4029 */ 4008 if ( handle_uac_tsx_response(inv, e) == PJ_FALSE)4009 inv_handle_update_response(inv, e);4030 if (inv_handle_update_response(inv, e) == PJ_FALSE) 4031 handle_uac_tsx_response(inv, e); 4010 4032 4011 4033 } else if (tsx->role == PJSIP_ROLE_UAS && … … 4363 4385 4364 4386 pjmedia_sdp_neg_state neg_state; 4387 struct tsx_inv_data *tsx_inv_data; 4388 4389 tsx_inv_data = (struct tsx_inv_data*)tsx->mod_data[mod_inv.mod.id]; 4365 4390 4366 4391 /* Outgoing INVITE transaction has failed, cancel SDP nego */ 4367 4392 neg_state = pjmedia_sdp_neg_get_state(inv->neg); 4368 if (neg_state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) { 4393 if (neg_state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER && 4394 tsx_inv_data->retrying == PJ_FALSE) 4395 { 4369 4396 pjmedia_sdp_neg_cancel_offer(inv->neg); 4370 4397 } … … 4391 4418 * Handle response to outgoing UPDATE request. 4392 4419 */ 4393 if ( handle_uac_tsx_response(inv, e) == PJ_FALSE)4394 inv_handle_update_response(inv, e);4420 if (inv_handle_update_response(inv, e) == PJ_FALSE) 4421 handle_uac_tsx_response(inv, e); 4395 4422 4396 4423 } else if (tsx->role == PJSIP_ROLE_UAS &&
Note: See TracChangeset
for help on using the changeset viewer.