Module: sip-router
Branch: master
Commit: 871c77702ae7aef9efdc8cf24e2367abc4a6429c
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=871c777…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed May 26 11:57:54 2010 +0200
pv: added $rv returning protocol version
- return the string representing the protocol version in first line of
request/reply
---
modules_k/pv/pv.c | 3 +++
modules_k/pv/pv_core.c | 16 ++++++++++++++++
modules_k/pv/pv_core.h | 3 +++
3 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/modules_k/pv/pv.c b/modules_k/pv/pv.c
index 76e590c..feb0f72 100644
--- a/modules_k/pv/pv.c
+++ b/modules_k/pv/pv.c
@@ -303,6 +303,9 @@ static pv_export_t mod_pvs[] = {
{{"ruri.user", (sizeof("ruri.user")-1)}, /* */
PVT_RURI_USERNAME, pv_get_ruri_attr, pv_set_ruri_user,
0, 0, pv_init_iname, 1},
+ {{"rv", (sizeof("rv")-1)}, /* */
+ PVT_OTHER, pv_get_version, 0,
+ 0, 0, 0, 0},
{{"Ri", (sizeof("Ri")-1)}, /* */
PVT_OTHER, pv_get_rcvip, 0,
0, 0, 0, 0},
diff --git a/modules_k/pv/pv_core.c b/modules_k/pv/pv_core.c
index 10d378f..ccc41dc 100644
--- a/modules_k/pv/pv_core.c
+++ b/modules_k/pv/pv_core.c
@@ -127,6 +127,22 @@ int pv_get_method(struct sip_msg *msg, pv_param_t *param,
get_cseq(msg)->method_id);
}
+int pv_get_version(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res)
+{
+ if(msg==NULL)
+ return -1;
+
+ if(msg->first_line.type == SIP_REQUEST)
+ {
+ return pv_get_strval(msg, param, res,
+ &msg->first_line.u.request.version);
+ }
+
+ return pv_get_strval(msg, param, res,
+ &msg->first_line.u.reply.version);
+}
+
int pv_get_status(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res)
{
diff --git a/modules_k/pv/pv_core.h b/modules_k/pv/pv_core.h
index 32b6b37..e9b490d 100644
--- a/modules_k/pv/pv_core.h
+++ b/modules_k/pv/pv_core.h
@@ -190,6 +190,9 @@ int pv_get_scriptvar(struct sip_msg *msg, pv_param_t *param,
int pv_get_true(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);
+int pv_get_version(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res);
+
/********* end PV get functions *********/
/********* start PV set functions *********/