Browse code

dialog: no-ack-extra-debug

Julien Chavanton authored on 23/09/2020 17:42:58
Showing 1 changed files
... ...
@@ -1260,6 +1260,21 @@ 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) {
1265
+	if (!req) {
1266
+		LM_ERR("[ACK] %s >>> req is null\n", s);
1267
+		return;
1268
+	}
1269
+	if (parse_headers(req,HDR_CALLID_F,0)<0 || !req->callid) {
1270
+		LM_ERR("[ACK] %s >>> can not parse call-id !\n", s);
1271
+	}
1272
+	if (parse_headers(req,HDR_TO_F,0)<0 || !req->to) {
1273
+		LM_ERR("[ACK] %s >>> can not parse to-tag call-id[%.*s]\n", s, req->callid->body.len, req->callid->body.s);
1274
+	}
1275
+	LM_INFO("[ACK] %s >>> call-id[%.*s]\n", s, req->callid->body.len, req->callid->body.s);
1276
+}
1277
+
1263 1278
 /*!
1264 1279
  * \brief Function that is registered as RR callback for dialog tracking
1265 1280
  *
... ...
@@ -1280,10 +1295,16 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1280 1295
 	int unref=0, event=0, timeout=0, reset=0;
1281 1296
 	unsigned int dir=0;
1282 1297
 	int ret=0;
1298
+	int extra_ack_debug=0;
1299
+
1300
+	if (req->first_line.u.request.method_value == METHOD_ACK)
1301
+		extra_ack_debug=1;
1283 1302
 
1284 1303
 	dlg = dlg_get_ctx_dialog();
1285 1304
 	if (dlg!=NULL) {
1286 1305
 		dlg_release(dlg);
1306
+		if (extra_ack_debug)
1307
+			LM_NOTICE(" DIALOG skipping dlg!=null call-id[%.*s]\n", dlg->callid.len, dlg->callid.s);
1287 1308
 		return;
1288 1309
 	}
1289 1310
 
... ...
@@ -1302,13 +1323,19 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1302 1323
 	if ( seq_match_mode!=SEQ_MATCH_NO_ID ) {
1303 1324
 		if( d_rrb.get_route_param( req, &rr_param, &val)!=0) {
1304 1325
 			LM_DBG("Route param '%.*s' not found\n", rr_param.len,rr_param.s);
1305
-			if (seq_match_mode==SEQ_MATCH_STRICT_ID )
1326
+			if (seq_match_mode==SEQ_MATCH_STRICT_ID ) {
1327
+				if (extra_ack_debug)
1328
+					extra_ack_debug_info("seq_match_mode is now SEQ_MATCH_STRICT_ID (#1)", req);
1306 1329
 				return;
1330
+			}
1307 1331
 		} else {
1308 1332
 			LM_DBG("route param is '%.*s' (len=%d)\n",val.len,val.s,val.len);
1309 1333
 
1310
-			if ( parse_dlg_rr_param( val.s, val.s+val.len, &h_entry, &h_id)<0 )
1334
+			if ( parse_dlg_rr_param( val.s, val.s+val.len, &h_entry, &h_id)<0 ) {
1335
+				if (extra_ack_debug)
1336
+					extra_ack_debug_info("parse_dlg_rr_param failed", req);
1311 1337
 				return;
1338
+			}
1312 1339
 
1313 1340
 			dlg = dlg_lookup(h_entry, h_id);
1314 1341
 			if (dlg==0) {
... ...
@@ -1317,12 +1344,17 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1317 1344
 					req->first_line.u.request.method.len,
1318 1345
 					req->first_line.u.request.method.s,
1319 1346
 					val.len,val.s, h_entry, h_id);
1320
-				if (seq_match_mode==SEQ_MATCH_STRICT_ID )
1347
+				if (seq_match_mode==SEQ_MATCH_STRICT_ID ) {
1348
+					if (extra_ack_debug)
1349
+						extra_ack_debug_info("seq_match_mode is now STRICT_ID (#2)", req);
1321 1350
 					return;
1351
+				}
1322 1352
 			} else {
1323 1353
 				if (pre_match_parse( req, &callid, &ftag, &ttag, 1)<0) {
1324 1354
 					// lookup_dlg has incremented the ref count by 1
1325 1355
 					dlg_release(dlg);
1356
+					if (extra_ack_debug)
1357
+						extra_ack_debug_info("pre_match_parse failed (#1)", req);
1326 1358
 					return;
1327 1359
 				}
1328 1360
 				if (match_dialog( dlg, &callid, &ftag, &ttag, &dir )==0) {
... ...
@@ -1347,22 +1379,30 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
1347 1379
 					dlg = 0;
1348 1380
 					dir = DLG_DIR_NONE;
1349 1381
 
1350
-					if (seq_match_mode==SEQ_MATCH_STRICT_ID )
1382
+					if (seq_match_mode==SEQ_MATCH_STRICT_ID ) {
1383
+						if (extra_ack_debug)
1384
+							extra_ack_debug_info("seq_match_mode is now SEQ_MATCH_STRICT_ID (#3)", req);
1351 1385
 						return;
1386
+					}
1352 1387
 				}
1353 1388
 			}
1354 1389
 		}
1355 1390
 	}
1356 1391
 
1357 1392
 	if (dlg==0) {
1358
-		if (pre_match_parse(req, &callid, &ftag, &ttag, 1)<0)
1393
+		if (pre_match_parse(req, &callid, &ftag, &ttag, 1)<0) {
1394
+			if (extra_ack_debug)
1395
+				extra_ack_debug_info("pre_match_parse failed (#2)", req);
1359 1396
 			return;
1397
+		}
1360 1398
 		/* TODO - try to use the RR dir detection to speed up here the
1361 1399
 		 * search -bogdan */
1362 1400
 		dlg = get_dlg(&callid, &ftag, &ttag, &dir);
1363 1401
 		if (dlg==0){
1364 1402
 			LM_DBG("Callid '%.*s' not found\n",
1365 1403
 				req->callid->body.len, req->callid->body.s);
1404
+			if (extra_ack_debug)
1405
+				extra_ack_debug_info("get_dlg not fount", req);
1366 1406
 			return;
1367 1407
 		}
1368 1408
 	}