[sr-dev] git:treimann/acc-cdr: Adjust several modules to modified dialog callback signature

Timo Reimann timo.reimann at 1und1.de
Wed Aug 3 16:48:19 CEST 2011


Module: sip-router
Branch: treimann/acc-cdr
Commit: f1853abaeb51f8b7de77115479ead6929109b009
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f1853abaeb51f8b7de77115479ead6929109b009

Author: Timo Reimann <timo.reimann at 1und1.de>
Committer: Timo Reimann <timo.reimann at 1und1.de>
Date:   Tue Aug  2 19:39:13 2011 +0200

Adjust several modules to modified dialog callback signature
(request and response messages given instead of just request; see
commit 5d4473297 for rationale).

Full credits to Sven Knoblich, sven.knoblich at 1und1.de .

---

 modules/mediaproxy/mediaproxy.c         |    6 +++---
 modules_k/call_control/call_control.c   |    9 ++++++---
 modules_k/nat_traversal/nat_traversal.c |    6 +++---
 modules_k/qos/qos_handlers.c            |    8 ++++----
 modules_k/sst/sst_handlers.c            |    6 +++---
 5 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c
index c17971f..614c7a4 100644
--- a/modules/mediaproxy/mediaproxy.c
+++ b/modules/mediaproxy/mediaproxy.c
@@ -1903,14 +1903,14 @@ __free_dialog_data(void *data)
 static void
 __dialog_requests(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 {
-    use_media_proxy(_params->msg, get_dialog_id(dlg), (ice_candidate_data*)*_params->param);
+    use_media_proxy(_params->req, get_dialog_id(dlg), (ice_candidate_data*)*_params->param);
 }
 
 
 static void
 __dialog_replies(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 {
-    struct sip_msg *reply = _params->msg;
+    struct sip_msg *reply = _params->rpl;
 
     if (reply == FAKED_REPLY)
         return;
@@ -1934,7 +1934,7 @@ __dialog_ended(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 static void
 __dialog_created(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 {
-    struct sip_msg *request = _params->msg;
+    struct sip_msg *request = _params->req;
     ice_candidate_data *ice_data;
 
     if (request->REQ_METHOD != METHOD_INVITE)
diff --git a/modules_k/call_control/call_control.c b/modules_k/call_control/call_control.c
index 6d9dad8..fc3b0fc 100644
--- a/modules_k/call_control/call_control.c
+++ b/modules_k/call_control/call_control.c
@@ -946,7 +946,7 @@ typedef enum {
 static void
 __dialog_replies(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 {
-    struct sip_msg *reply = _params->msg;
+    struct sip_msg *reply = _params->rpl;
 
     if (reply!=FAKED_REPLY && reply->REPLY_STATUS==200) {
         call_control_start(reply, dlg);
@@ -958,7 +958,10 @@ static void
 __dialog_ended(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 {
     if ((int)(long)*_params->param == CCActive) {
-        call_control_stop(_params->msg, dlg->callid);
+        struct sip_msg* msg = _params->rpl;
+        if( !msg || msg == FAKED_REPLY)
+            msg = _params->req;
+        call_control_stop(msg, dlg->callid);
         *_params->param = CCInactive;
     }
 }
@@ -967,7 +970,7 @@ __dialog_ended(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 static void
 __dialog_created(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 {
-    struct sip_msg *request = _params->msg;
+    struct sip_msg *request = _params->req;
 
     if (request->REQ_METHOD != METHOD_INVITE)
         return;
diff --git a/modules_k/nat_traversal/nat_traversal.c b/modules_k/nat_traversal/nat_traversal.c
index 791488d..cc65354 100644
--- a/modules_k/nat_traversal/nat_traversal.c
+++ b/modules_k/nat_traversal/nat_traversal.c
@@ -1035,7 +1035,7 @@ __dialog_early(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
         return;
     }
 
-    uri = get_source_uri(_params->msg);
+    uri = get_source_uri(_params->rpl);
     if (!Dialog_Param_has_candidate(param, uri)) {
         if (!Dialog_Param_add_candidate(param, uri)) {
             LM_ERR("cannot add callee candidate uri to the list\n");
@@ -1079,7 +1079,7 @@ __dialog_confirmed(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params
 
     param->confirmed = True;
 
-    callee_uri = get_source_uri(_params->msg);
+    callee_uri = get_source_uri(_params->rpl);
 
     // remove all keepalives on unanswered branches
     for (i=0; i<param->callee_candidates.count; i++) {
@@ -1224,7 +1224,7 @@ __dialog_destroy(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 static void
 __dialog_created(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 {
-    struct sip_msg *request = _params->msg;
+    struct sip_msg *request = _params->req;
     NAT_Contact *contact;
     SIP_Dialog *dialog;
     Dialog_Param *param;
diff --git a/modules_k/qos/qos_handlers.c b/modules_k/qos/qos_handlers.c
index b832cd9..ea6686c 100644
--- a/modules_k/qos/qos_handlers.c
+++ b/modules_k/qos/qos_handlers.c
@@ -116,7 +116,7 @@ static void setup_dialog_callbacks(struct dlg_cell *did, qos_ctx_t *ctx)
 void qos_dialog_created_CB(struct dlg_cell *did, int type, struct dlg_cb_params * params)
 {
 	qos_ctx_t *qos_ctx = NULL;
-	struct sip_msg* msg = params->msg;
+	struct sip_msg* msg = params->req;
 	unsigned int dir = params->direction, role, other_role;
 
 	if (dir == DLG_DIR_UPSTREAM) {
@@ -173,7 +173,7 @@ void qos_dialog_created_CB(struct dlg_cell *did, int type, struct dlg_cb_params
  */
 static void qos_dialog_destroy_CB(struct dlg_cell* did, int type, struct dlg_cb_params * params)
 {
-	struct sip_msg* msg = params->msg;
+	struct sip_msg* msg = params->req;
 	qos_ctx_t* qos_ctx = (qos_ctx_t*)*(params->param);
 
 	/* run the QOSCB_TERMINATED callback */
@@ -196,7 +196,7 @@ static void qos_dialog_destroy_CB(struct dlg_cell* did, int type, struct dlg_cb_
  */
 static void qos_dialog_request_CB(struct dlg_cell* did, int type, struct dlg_cb_params * params)
 {
-	struct sip_msg* msg = params->msg;
+	struct sip_msg* msg = params->req;
 	unsigned int dir = params->direction, role, other_role;
 	qos_ctx_t* qos_ctx = (qos_ctx_t*)*(params->param);
 
@@ -245,7 +245,7 @@ static void qos_dialog_request_CB(struct dlg_cell* did, int type, struct dlg_cb_
  */
 static void qos_dialog_response_CB(struct dlg_cell* did, int type, struct dlg_cb_params * params)
 {
-	struct sip_msg* msg = params->msg;
+	struct sip_msg* msg = params->rpl;
 	unsigned int dir = params->direction, role, other_role;
 	qos_ctx_t* qos_ctx = (qos_ctx_t*)*(params->param);
 
diff --git a/modules_k/sst/sst_handlers.c b/modules_k/sst/sst_handlers.c
index 6a17c37..fb3351f 100644
--- a/modules_k/sst/sst_handlers.c
+++ b/modules_k/sst/sst_handlers.c
@@ -252,7 +252,7 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type,
 {
 	sst_info_t *info = NULL;
 	sst_msg_info_t minfo;
-	struct sip_msg* msg = params->msg;
+	struct sip_msg* msg = params->req;
 
 	memset(&minfo, 0, sizeof(sst_msg_info_t));
 	/*
@@ -431,7 +431,7 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type,
 {
 	sst_info_t *info = (sst_info_t *)*(params->param);
 	sst_msg_info_t minfo = {0,0,0,0};
-	struct sip_msg* msg = params->msg;
+	struct sip_msg* msg = params->req;
 
 	if (msg->first_line.type == SIP_REQUEST) {
 		if ((msg->first_line.u.request.method_value == METHOD_INVITE ||
@@ -497,7 +497,7 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type,
 static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type,
 		struct dlg_cb_params * params) 
 {
-	struct sip_msg* msg = params->msg;
+	struct sip_msg* msg = params->rpl;
 
 	/*
 	 * This test to see if the message is a response sould ALWAYS be




More information about the sr-dev mailing list