[sr-dev] git:master: modules_k/dialog: Provider helper get_valid_msg() to retrieve

Timo Reimann timo.reimann at 1und1.de
Wed Aug 17 13:15:13 CEST 2011


Module: sip-router
Branch: master
Commit: a5498b52e9a3bbef63e4ce4212cc05124f428cd2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a5498b52e9a3bbef63e4ce4212cc05124f428cd2

Author: Timo Reimann <timo.reimann at 1und1.de>
Committer: Timo Reimann <timo.reimann at 1und1.de>
Date:   Wed Aug 17 13:12:24 2011 +0200

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.)

---

 modules_k/dialog/dlg_cb.c |   21 +++++++++++++++++++++
 modules_k/dialog/dlg_cb.h |    7 +++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/modules_k/dialog/dlg_cb.c b/modules_k/dialog/dlg_cb.c
index 3f2f2cd..df8c3cb 100644
--- a/modules_k/dialog/dlg_cb.c
+++ b/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;
+}
diff --git a/modules_k/dialog/dlg_cb.h b/modules_k/dialog/dlg_cb.h
index 80eae7b..f8bcadc 100644
--- a/modules_k/dialog/dlg_cb.h
+++ b/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




More information about the sr-dev mailing list