Really nice :)

El 06/07/2011 22:20, "Daniel-Constantin Mierla" <miconda@gmail.com> escribió:

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

Author: Daniel-Constantin Mierla <miconda@gmail.com>
Committer: Daniel-Constantin Mierla <miconda@gmail.com>
Date:   Wed Jul  6 23:17:30 2011 +0200

pv: new pv $rz returns r-uri scheme

- possible values: sip, sips, tel and tels
- r-uri scheme parsing error should be reflected by value: none

---

 modules_k/pv/pv.c      |    3 +++
 modules_k/pv/pv_core.c |   11 +++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/modules_k/pv/pv.c b/modules_k/pv/pv.c
index 8009be7..3beb7bc 100644
--- a/modules_k/pv/pv.c
+++ b/modules_k/pv/pv.c
@@ -316,6 +316,9 @@ static pv_export_t mod_pvs[] = {
       {{"rv", (sizeof("rv")-1)}, /* */
               PVT_OTHER, pv_get_version, 0,
               0, 0, 0, 0},
+       {{"rz", (sizeof("rz")-1)}, /* */
+               PVT_OTHER, pv_get_ruri_attr, 0,
+               0, 0, pv_init_iname, 5},
       {{"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 698bda0..7c45e73 100644
--- a/modules_k/pv/pv_core.c
+++ b/modules_k/pv/pv_core.c
@@ -52,6 +52,14 @@
 static str str_udp    = { "UDP", 3 };
 static str str_5060   = { "5060", 4 };
 static str pv_str_1   = { "1", 1 };
+static str pv_uri_scheme[] = {
+               { "none", 4 },
+               { "sip",  3 },
+               { "sips", 4 },
+               { "tel",  3 },
+               { "tels", 4 },
+               { 0, 0 }
+       };

 int _pv_pid = 0;

@@ -271,6 +279,9 @@ int pv_get_xuri_attr(struct sip_msg *msg, struct sip_uri *parsed_uri,
                       return pv_get_udp(msg, param, res);
               return pv_get_strintval(msg, param, res, &parsed_uri->transport_val,
                               (int)parsed_uri->proto);
+       } else if(param->pvn.u.isname.name.n==5) /* uri scheme */ {
+               return pv_get_strintval(msg, param, res, &pv_uri_scheme[parsed_uri->type],
+                               (int)parsed_uri->type);
       }
       LM_ERR("unknown specifier\n");
       return pv_get_null(msg, param, res);


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev