Module: sip-router
Branch: master
Commit: a3db53e7a71f1676bc0e55503fb4c71771f5e9ff
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a3db53e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Dec 16 14:11:56 2010 +0100
pv: added PV $rmid - request method id
- return internal integer representation of SIP method type
---
modules_k/pv/pv.c | 3 +++
modules_k/pv/pv_core.c | 23 +++++++++++++++++++++++
modules_k/pv/pv_core.h | 3 +++
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/modules_k/pv/pv.c b/modules_k/pv/pv.c
index 3e21fc9..e690ef7 100644
--- a/modules_k/pv/pv.c
+++ b/modules_k/pv/pv.c
@@ -280,6 +280,9 @@ static pv_export_t mod_pvs[] = {
{{"rm", (sizeof("rm")-1)}, /* */
PVT_OTHER, pv_get_method, 0,
0, 0, 0, 0},
+ {{"rmid", (sizeof("rmid")-1)}, /* */
+ PVT_OTHER, pv_get_methodid, 0,
+ 0, 0, 0, 0},
{{"rp", (sizeof("rp")-1)}, /* */
PVT_OTHER, pv_get_ruri_attr, pv_set_ruri_port,
0, 0, pv_init_iname, 3},
diff --git a/modules_k/pv/pv_core.c b/modules_k/pv/pv_core.c
index 9328e52..f0b6415 100644
--- a/modules_k/pv/pv_core.c
+++ b/modules_k/pv/pv_core.c
@@ -129,6 +129,29 @@ int pv_get_method(struct sip_msg *msg, pv_param_t *param,
get_cseq(msg)->method_id);
}
+int pv_get_methodid(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_uintval(msg, param, res,
+ (unsigned int)msg->first_line.u.request.method_value);
+ }
+
+ if(msg->cseq==NULL && ((parse_headers(msg, HDR_CSEQ_F, 0)==-1)
+ || (msg->cseq==NULL)))
+ {
+ LM_ERR("no CSEQ header\n");
+ return pv_get_null(msg, param, res);
+ }
+
+ return pv_get_uintval(msg, param, res,
+ (unsigned int)(get_cseq(msg)->method_id));
+}
+
int pv_get_version(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 a3c8a60..3ee11b7 100644
--- a/modules_k/pv/pv_core.h
+++ b/modules_k/pv/pv_core.h
@@ -45,6 +45,9 @@ int pv_get_pid(struct sip_msg *msg, pv_param_t *param,
int pv_get_method(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);
+int pv_get_methodid(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res);
+
int pv_get_status(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);