[sr-dev] git:master: msrp: return proper value for $msrp(code)

Daniel-Constantin Mierla miconda at gmail.com
Mon Feb 11 23:45:12 CET 2013


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Feb 11 23:40:53 2013 +0100

msrp: return proper value for $msrp(code)

- internally there is an offset of 10000 to the value in the msrp reply
- reported by Peter Dunkley

---

 modules/msrp/msrp_parser.h |    2 ++
 modules/msrp/msrp_vars.c   |    3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/msrp/msrp_parser.h b/modules/msrp/msrp_parser.h
index 187df2d..2302c46 100644
--- a/modules/msrp/msrp_parser.h
+++ b/modules/msrp/msrp_parser.h
@@ -44,6 +44,8 @@
 
 #define MSRP_REQ_RPLSTART	10000
 
+#define MSRP_RPL_CODE(n)	((n) - MSRP_REQ_RPLSTART)
+
 typedef struct msrp_fline {
 	str buf;
 	int msgtypeid;
diff --git a/modules/msrp/msrp_vars.c b/modules/msrp/msrp_vars.c
index cb1dbb9..fdc277a 100644
--- a/modules/msrp/msrp_vars.c
+++ b/modules/msrp/msrp_vars.c
@@ -152,7 +152,8 @@ int pv_get_msrp(sip_msg_t *msg,  pv_param_t *param, pv_value_t *res)
 		case 3:
 			if(mf->fline.msgtypeid==MSRP_REQUEST)
 				return pv_get_null(msg, param, res);
-			return pv_get_intstrval(msg, param, res, mf->fline.rtypeid,
+			return pv_get_intstrval(msg, param, res,
+					MSRP_RPL_CODE(mf->fline.rtypeid),
 					&mf->fline.rtype);
 		case 4:
 			if(mf->hbody.s==NULL)




More information about the sr-dev mailing list