diff --git a/str.h b/str.h index 10f5cde67ab..e343c1058d5 100644 --- a/str.h +++ b/str.h @@ -69,6 +69,8 @@ typedef struct __str_const str_const; /* str initialization */ #define STR_NULL ((str){NULL, 0}) #define STR_NULL_const ((str_const){NULL, 0}) +#define STR_EMPTY ((str){"", 0}) +#define STR_EMPTY_const ((str_const){"", 0}) #define str_init(_string) ((str){_string, sizeof(_string) - 1}) #define str_const_init(_string) ((str_const){_string, sizeof(_string) - 1}) diff --git a/transformations.c b/transformations.c index 7b37300ee09..3c7dad652e1 100644 --- a/transformations.c +++ b/transformations.c @@ -1204,7 +1204,10 @@ int tr_eval_uri(struct sip_msg *msg, tr_param_t *tp, int subtype, if (pit->name.len==sv.len && strncasecmp(pit->name.s, sv.s, sv.len)==0) { - val->rs = pit->body; + if (ZSTR(pit->body)) + val->rs = STR_EMPTY; + else + val->rs = pit->body; goto done; } } @@ -2226,7 +2229,10 @@ int tr_eval_paramlist(struct sip_msg *msg, tr_param_t *tp, int subtype, if (pit->name.len==sv.len && strncasecmp(pit->name.s, sv.s, sv.len)==0) { - val->rs = pit->body; + if (ZSTR(pit->body)) + val->rs = STR_EMPTY; + else + val->rs = pit->body; goto done; } }