Sfoglia il codice sorgente

modules_k/dialog: Provider helper get_valid_msg() to retrieve
valid SIP message from given dialog callback parameter structure.
(Useful due to interface change committed in c02155941.)

Timo Reimann 14 anni fa
parent
commit
a5498b52e9
2 ha cambiato i file con 28 aggiunte e 0 eliminazioni
  1. 21 0
      modules_k/dialog/dlg_cb.c
  2. 7 0
      modules_k/dialog/dlg_cb.h

+ 21 - 0
modules_k/dialog/dlg_cb.c

@@ -260,3 +260,24 @@ void run_dlg_callbacks( int type ,
 	}
 	return;
 }
+
+
+struct sip_msg *get_valid_msg(struct dlg_cb_params *cb_params)
+{
+	struct sip_msg *msg;
+
+	if (cb_params == NULL) {
+		LM_ERR("no dialog parameters given\n");
+		return NULL;
+	}
+
+	msg = cb_params->req;
+	if (msg == NULL) {
+		msg = cb_params->rpl;
+		if (msg == NULL || msg == FAKED_REPLY) {
+			return NULL;
+		}
+	}
+
+	return msg;
+}

+ 7 - 0
modules_k/dialog/dlg_cb.h

@@ -111,4 +111,11 @@ void run_dlg_callbacks( int type ,
 void run_load_callbacks( void );
 
 
+/*!
+ * \brief Function that returns valid SIP message from given dialog callback parameter struct
+ * \param cb_params dialog callback parameter struct
+ * \return pointer to valid SIP message if existent, NULL otherwise
+ */
+struct sip_msg *get_valid_msg(struct dlg_cb_params *cb_params);
+
 #endif