Module: kamailio
Branch: master
Commit: 893c68d5cbbab35d842aa7275c57d692770e0fff
URL:
https://github.com/kamailio/kamailio/commit/893c68d5cbbab35d842aa7275c57d69…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-08-16T09:15:03+02:00
pv: implemented {uri.scheme} transformation
- GH #592
---
Modified: src/modules/pv/pv_trans.c
Modified: src/modules/pv/pv_trans.h
---
Diff:
https://github.com/kamailio/kamailio/commit/893c68d5cbbab35d842aa7275c57d69…
Patch:
https://github.com/kamailio/kamailio/commit/893c68d5cbbab35d842aa7275c57d69…
---
diff --git a/src/modules/pv/pv_trans.c b/src/modules/pv/pv_trans.c
index 62574c46f5..eccf3b6377 100644
--- a/src/modules/pv/pv_trans.c
+++ b/src/modules/pv/pv_trans.c
@@ -1292,6 +1292,16 @@ int tr_eval_uri(struct sip_msg *msg, tr_param_t *tp, int subtype,
val->rs = (_tr_parsed_uri.r2_val.s)?
_tr_parsed_uri.r2_val:_tr_empty;
break;
+ case TR_URI_SCHEME:
+ val->rs.s = _tr_uri.s;
+ val->rs.len = 0;
+ while(val->rs.len<_tr_uri.len) {
+ if(_tr_uri.s[val->rs.len]==':') {
+ break;
+ }
+ val->rs.len++;
+ }
+ break;
default:
LM_ERR("unknown subtype %d\n",
subtype);
@@ -2529,6 +2539,9 @@ char* tr_parse_uri(str* in, trans_t *t)
} else if(name.len==2 && strncasecmp(name.s, "r2", 2)==0) {
t->subtype = TR_URI_R2;
goto done;
+ } else if(name.len==6 && strncasecmp(name.s, "scheme", 6)==0) {
+ t->subtype = TR_URI_SCHEME;
+ goto done;
}
LM_ERR("unknown transformation: %.*s/%.*s!\n", in->len,
diff --git a/src/modules/pv/pv_trans.h b/src/modules/pv/pv_trans.h
index 7b7b15fb03..764653e5e3 100644
--- a/src/modules/pv/pv_trans.h
+++ b/src/modules/pv/pv_trans.h
@@ -47,7 +47,7 @@ enum _tr_uri_subtype {
TR_URI_NONE=0, TR_URI_USER, TR_URI_HOST, TR_URI_PASSWD, TR_URI_PORT,
TR_URI_PARAMS, TR_URI_PARAM, TR_URI_HEADERS, TR_URI_TRANSPORT, TR_URI_TTL,
TR_URI_UPARAM, TR_URI_MADDR, TR_URI_METHOD, TR_URI_LR,
- TR_URI_R2
+ TR_URI_R2, TR_URI_SCHEME
};
enum _tr_param_subtype {
TR_PL_NONE=0, TR_PL_VALUE, TR_PL_VALUEAT, TR_PL_NAME, TR_PL_COUNT