Browse code

dialog: no-ack-extra-debug

Julien Chavanton authored on 23/09/2020 17:42:58
Showing 1 changed files
... ...
@@ -1260,6 +1260,19 @@ dlg_cell_t *dlg_get_msg_dialog(sip_msg_t *msg)
1260 1260
 	return dlg_lookup_msg_dialog(msg, NULL);
1261 1261
 }
1262 1262
 
1263
+
1264
+void extra_ack_debug_info(const char *s, struct sip_msg* req, int dir) {
1265
+	if (!req || req->first_line.u.request.method_value != METHOD_ACK)
1266
+		return;
1267
+	if (parse_headers(req,HDR_CALLID_F,0)<0 || !req->callid) {
1268
+		LM_ERR("[ACK][%d] %s >>> can not parse call-id !\n", dir, s);
1269
+	}
1270
+	if (parse_headers(req,HDR_TO_F,0)<0 || !req->to) {
1271
+		LM_ERR("[ACK][%d] %s >>> can not parse to-tag call-id[%.*s]\n", dir, s, req->callid->body.len, req->callid->body.s);
1272
+	}
1273
+	LM_INFO("[ACK][%d] %s >>> call-id[%.*s] to-tag[%.*s]\n", dir, s, req->callid->body.len, req->callid->body.s, req->to->body.len, req->to->body.s);
1274
+}
1275
+
1263 1276
 /*!
1264 1277
  * \brief Function that is registered as RR callback for dialog tracking
1265 1278
  *
... ...
@@ -1284,6 +1297,8 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1284 1297
 	dlg = dlg_get_ctx_dialog();
1285 1298
 	if (dlg!=NULL) {
1286 1299
 		dlg_release(dlg);
1300
+		if (req->first_line.u.request.method_value == METHOD_ACK)
1301
+			LM_NOTICE(" DIALOG skipping dlg!=null call-id[%.*s]\n", dlg->callid.len, dlg->callid.s);
1287 1302
 		return;
1288 1303
 	}
1289 1304
 
... ...
@@ -1302,13 +1317,17 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1302 1317
 	if ( seq_match_mode!=SEQ_MATCH_NO_ID ) {
1303 1318
 		if( d_rrb.get_route_param( req, &rr_param, &val)!=0) {
1304 1319
 			LM_DBG("Route param '%.*s' not found\n", rr_param.len,rr_param.s);
1305
-			if (seq_match_mode==SEQ_MATCH_STRICT_ID )
1320
+			if (seq_match_mode==SEQ_MATCH_STRICT_ID ) {
1321
+				extra_ack_debug_info("seq_match_mode STRICT_ID (#1)", req, dir);
1306 1322
 				return;
1323
+			}
1307 1324
 		} else {
1308 1325
 			LM_DBG("route param is '%.*s' (len=%d)\n",val.len,val.s,val.len);
1309 1326
 
1310
-			if ( parse_dlg_rr_param( val.s, val.s+val.len, &h_entry, &h_id)<0 )
1327
+			if ( parse_dlg_rr_param( val.s, val.s+val.len, &h_entry, &h_id)<0 ) {
1328
+				extra_ack_debug_info("parse_dlg_rr_param failed", req, dir);
1311 1329
 				return;
1330
+			}
1312 1331
 
1313 1332
 			dlg = dlg_lookup(h_entry, h_id);
1314 1333
 			if (dlg==0) {
... ...
@@ -1317,12 +1336,15 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1317 1336
 					req->first_line.u.request.method.len,
1318 1337
 					req->first_line.u.request.method.s,
1319 1338
 					val.len,val.s, h_entry, h_id);
1320
-				if (seq_match_mode==SEQ_MATCH_STRICT_ID )
1339
+				if (seq_match_mode==SEQ_MATCH_STRICT_ID ) {
1340
+					extra_ack_debug_info("seq_match_mode STRICT_ID (#2)", req, dir);
1321 1341
 					return;
1342
+				}
1322 1343
 			} else {
1323 1344
 				if (pre_match_parse( req, &callid, &ftag, &ttag, 1)<0) {
1324 1345
 					// lookup_dlg has incremented the ref count by 1
1325 1346
 					dlg_release(dlg);
1347
+					extra_ack_debug_info("pre_match_parse failed (#1)", req, dir);
1326 1348
 					return;
1327 1349
 				}
1328 1350
 				if (match_dialog( dlg, &callid, &ftag, &ttag, &dir )==0) {
... ...
@@ -1347,22 +1369,27 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1347 1369
 					dlg = 0;
1348 1370
 					dir = DLG_DIR_NONE;
1349 1371
 
1350
-					if (seq_match_mode==SEQ_MATCH_STRICT_ID )
1372
+					if (seq_match_mode==SEQ_MATCH_STRICT_ID ) {
1373
+						extra_ack_debug_info("seq_match_mode MATCH_STRICT_ID (#3)", req, dir);
1351 1374
 						return;
1375
+					}
1352 1376
 				}
1353 1377
 			}
1354 1378
 		}
1355 1379
 	}
1356 1380
 
1357 1381
 	if (dlg==0) {
1358
-		if (pre_match_parse(req, &callid, &ftag, &ttag, 1)<0)
1382
+		if (pre_match_parse(req, &callid, &ftag, &ttag, 1)<0) {
1383
+			extra_ack_debug_info("pre_match_parse failed (#2)", req, dir);
1359 1384
 			return;
1385
+		}
1360 1386
 		/* TODO - try to use the RR dir detection to speed up here the
1361 1387
 		 * search -bogdan */
1362 1388
 		dlg = get_dlg(&callid, &ftag, &ttag, &dir);
1363 1389
 		if (dlg==0){
1364 1390
 			LM_DBG("Callid '%.*s' not found\n",
1365 1391
 				req->callid->body.len, req->callid->body.s);
1392
+			extra_ack_debug_info("get_dlg not found", req, dir);
1366 1393
 			return;
1367 1394
 		}
1368 1395
 	}
... ...
@@ -1407,6 +1434,10 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1407 1434
 	}
1408 1435
 
1409 1436
 	next_state_dlg( dlg, event, &old_state, &new_state, &unref);
1437
+	if (new_state != DLG_STATE_CONFIRMED) {
1438
+		extra_ack_debug_info("state not changed", req, dir);
1439
+		LM_INFO("state not changed old[%d]new[%d]\n", old_state, new_state);
1440
+	}
1410 1441
 
1411 1442
 	CURR_DLG_ID = req->id;
1412 1443
 	CURR_DLG_LIFETIME = (unsigned int)(time(0))-dlg->start_ts;