2
0
Эх сурвалжийг харах

dialog(k): match on callid and ftag for no ACK'ed dialogs

- some of the TM callbacks look for the dialog with initial INVITE that
  has no to-tag yet, even that the callback is run on 200ok and dialog was
  updated with this field
- reported by Jon Bergli Heier
(cherry picked from commit 390383e2d0dff755ff9f0eb6a6b1fe627dc29949)
Daniel-Constantin Mierla 13 жил өмнө
parent
commit
08782d29cc

+ 10 - 0
modules_k/dialog/dlg_hash.h

@@ -458,6 +458,16 @@ static inline int match_dialog(dlg_cell_t *dlg, str *callid,
 				*dir = DLG_DIR_DOWNSTREAM;
 				return 1;
 			}
+			/* if no ACK yet, might be a lookup of dlg from a TM callback that
+			 * runs on 200ok but with initial INVITE that has no to-tag */
+			if(ttag->len==0 && dlg->state==DLG_STATE_CONFIRMED_NA
+					&& dlg->tag[DLG_CALLER_LEG].len == ftag->len &&
+					   strncmp(dlg->tag[DLG_CALLER_LEG].s, ftag->s, ftag->len)==0 &&
+					   strncmp(dlg->callid.s, callid->s, callid->len)==0) {
+
+				*dir = DLG_DIR_DOWNSTREAM;
+				return 1;
+			}
 		}
 	}