[sr-dev] git:master: mqueue: use received sip msg if availabe instead of faked one

Daniel-Constantin Mierla miconda at gmail.com
Fri Jun 8 22:57:43 CEST 2012


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Jun  8 22:32:00 2012 +0200

mqueue: use received sip msg if availabe instead of faked one

- fake msg has meaningless attributes which may give different results
  to PVs than people expect when processing a real sip message

---

 modules/mqueue/mqueue_api.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/mqueue/mqueue_api.c b/modules/mqueue/mqueue_api.c
index efa6290..7f856f4 100644
--- a/modules/mqueue/mqueue_api.c
+++ b/modules/mqueue/mqueue_api.c
@@ -362,7 +362,7 @@ int pv_parse_mq_name(pv_spec_t *sp, str *in)
 	return 0;
 }
 
-str *pv_get_mq_name(str *in)
+str *pv_get_mq_name(sip_msg_t *msg, str *in)
 {
 	str *queue;
 
@@ -385,12 +385,12 @@ str *pv_get_mq_name(str *in)
 		}
 
 		memset(&pvv, 0, sizeof(pv_value_t));
-		if (faked_msg_init() < 0)
+		if (msg==NULL && faked_msg_init() < 0)
 		{
 			LM_ERR("faked_msg_init() failed\n");
 			return NULL;
 		}
-		if (pv_get_spec_value(faked_msg_next(), pvs, &pvv) != 0)
+		if (pv_get_spec_value((msg)?msg:faked_msg_next(), pvs, &pvv) != 0)
 		{
 			LM_ERR("failed to get pv value for [%.*s]\n", in->len, in->s);
 			return NULL;
@@ -409,7 +409,7 @@ int pv_get_mqk(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res)
 {
 	mq_pv_t *mp = NULL;
-	str *in = pv_get_mq_name(&param->pvn.u.isname.name.s);
+	str *in = pv_get_mq_name(msg, &param->pvn.u.isname.name.s);
 
 	if (in == NULL)
 	{
@@ -436,7 +436,7 @@ int pv_get_mqv(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res)
 {
 	mq_pv_t *mp = NULL;
-	str *in = pv_get_mq_name(&param->pvn.u.isname.name.s);
+	str *in = pv_get_mq_name(msg, &param->pvn.u.isname.name.s);
 
 	if (in == NULL)
 	{




More information about the sr-dev mailing list