diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c index c9df0926e23..4b9329589fb 100644 --- a/src/modules/pv/pv.c +++ b/src/modules/pv/pv.c @@ -199,6 +199,14 @@ static pv_export_t mod_pvs[] = { PVT_OTHER, pv_get_errinfo_attr, 0, 0, 0, pv_init_iname, 3}, {{"err.rreason", (sizeof("err.rreason") - 1)}, /* */ PVT_OTHER, pv_get_errinfo_attr, 0, 0, 0, pv_init_iname, 4}, + {{"En", (sizeof("En") - 1)}, /* */ + PVT_OTHER, pv_get_escstr, 0, 0, 0, pv_init_iname, 1}, + {{"Er", (sizeof("Er") - 1)}, /* */ + PVT_OTHER, pv_get_escstr, 0, 0, 0, pv_init_iname, 2}, + {{"Es", (sizeof("Es") - 1)}, /* */ + PVT_OTHER, pv_get_escstr, 0, 0, 0, pv_init_iname, 4}, + {{"Et", (sizeof("Et") - 1)}, /* */ + PVT_OTHER, pv_get_escstr, 0, 0, 0, pv_init_iname, 3}, {{"fd", (sizeof("fd") - 1)}, /* */ PVT_OTHER, pv_get_from_attr, pv_set_from_domain, 0, 0, pv_init_iname, 3}, diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c index 87345490af1..261322e97e6 100644 --- a/src/modules/pv/pv_core.c +++ b/src/modules/pv/pv_core.c @@ -1488,6 +1488,39 @@ int pv_get_body_size(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) } +#define PV_ESCSTR_SIZE 16 +int pv_get_escstr(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) +{ + static char _pv_escstr[PV_ESCSTR_SIZE]; + int i; + str s; + + if(param->pvn.u.isname.name.n < 0) { + return pv_get_null(msg, param, res); + } + + i = (2 * param->pvn.u.isname.name.n) % PV_ESCSTR_SIZE; + switch(param->pvn.u.isname.name.n) { + case 2: + _pv_escstr[i] = '\r'; + break; + case 3: + _pv_escstr[i] = '\t'; + break; + case 4: + _pv_escstr[i] = ' '; + break; + default: + _pv_escstr[i] = '\n'; + break; + } + _pv_escstr[i + 1] = '\0'; + s.s = &_pv_escstr[i]; + s.len = 1; + return pv_get_strval(msg, param, res, &s); +} + + int pv_get_authattr(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) { struct hdr_field *hdr; diff --git a/src/modules/pv/pv_core.h b/src/modules/pv/pv_core.h index 53951340db1..9e4ea449c41 100644 --- a/src/modules/pv/pv_core.h +++ b/src/modules/pv/pv_core.h @@ -187,6 +187,8 @@ int pv_get_msg_body(struct sip_msg *msg, pv_param_t *param, pv_value_t *res); int pv_get_body_size(struct sip_msg *msg, pv_param_t *param, pv_value_t *res); +int pv_get_escstr(struct sip_msg *msg, pv_param_t *param, pv_value_t *res); + int pv_get_authattr(struct sip_msg *msg, pv_param_t *param, pv_value_t *res); int pv_get_acc_user(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);