@@ -2229,29 +2229,39 @@ void b2b_delete_record(b2b_dlg_t* dlg, b2b_table htable, unsigned int hash_index
22292229 shm_free (dlg -> logic_key .s );
22302230
22312231 if (dlg -> uas_tran ) {
2232- tmb .unref_cell (dlg -> uas_tran );
22332232
2234- pto = get_to (dlg -> uas_tran -> uas .request );
2235- if (pto == NULL || pto -> error != PARSE_OK ) {
2236- LM_ERR ("'To' header COULD NOT be parsed\n" );
2237- } else {
2238- if (run_tm_api (& tmb , t_reply_with_body , dlg -> uas_tran , 408 , & reply_text , 0 , 0 ,
2239- & pto -> tag_value ) < 0 )
2240- LM_ERR ("Failed to send 408 reply\n" );
2233+ /* if we come across an already finally replied trans,
2234+ * just release it; otherwise send 408 */
2235+ if ( dlg -> uas_tran -> uas .status < 200 ) {
2236+ pto = get_to (dlg -> uas_tran -> uas .request );
2237+ if (pto == NULL || pto -> error != PARSE_OK ) {
2238+ LM_ERR ("'To' header COULD NOT be parsed\n" );
2239+ } else {
2240+ if (run_tm_api (& tmb , t_reply_with_body , dlg -> uas_tran ,
2241+ 408 , & reply_text , 0 , 0 , & pto -> tag_value ) < 0 )
2242+ LM_ERR ("Failed to send 408 reply\n" );
2243+ }
22412244 }
2245+
2246+ tmb .unref_cell (dlg -> uas_tran );
22422247 }
22432248
22442249 if (dlg -> update_tran ) {
2245- tmb .unref_cell (dlg -> update_tran );
22462250
2247- pto = get_to (dlg -> update_tran -> uas .request );
2248- if (pto == NULL || pto -> error != PARSE_OK ) {
2249- LM_ERR ("'To' header COULD NOT be parsed\n" );
2250- } else {
2251- if (run_tm_api (& tmb , t_reply_with_body , dlg -> update_tran , 408 , & reply_text , 0 , 0 ,
2252- & pto -> tag_value ) < 0 )
2253- LM_ERR ("Failed to send 408 reply\n" );
2251+ /* if we come across an already finally replied trans,
2252+ * just release it; otherwise send 408 */
2253+ if ( dlg -> update_tran -> uas .status < 200 ) {
2254+ pto = get_to (dlg -> update_tran -> uas .request );
2255+ if (pto == NULL || pto -> error != PARSE_OK ) {
2256+ LM_ERR ("'To' header COULD NOT be parsed\n" );
2257+ } else {
2258+ if (run_tm_api (& tmb , t_reply_with_body , dlg -> update_tran ,
2259+ 408 , & reply_text , 0 , 0 , & pto -> tag_value ) < 0 )
2260+ LM_ERR ("Failed to send 408 reply\n" );
2261+ }
22542262 }
2263+
2264+ tmb .unref_cell (dlg -> update_tran );
22552265 }
22562266
22572267 if (dlg -> ack_sdp .s )
0 commit comments