|
@@ -336,8 +336,9 @@ int select_via(str* res, select_t* s, struct sip_msg* msg)
|
|
{
|
|
{
|
|
struct via_body *p = NULL;
|
|
struct via_body *p = NULL;
|
|
|
|
|
|
- if (((s->n == 1) || (s->params[1].type == SEL_PARAM_STR)) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if ((s->n == 1) || (s->params[1].type == SEL_PARAM_STR)) {
|
|
|
|
+ if (parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
res->s=p->name.s;
|
|
res->s=p->name.s;
|
|
res->len=p->bsize;
|
|
res->len=p->bsize;
|
|
@@ -350,8 +351,9 @@ int select_via_name(str* res, select_t* s, struct sip_msg* msg)
|
|
struct via_body *p = NULL;
|
|
struct via_body *p = NULL;
|
|
|
|
|
|
// it's not neccessary to test if (s->n > 1)
|
|
// it's not neccessary to test if (s->n > 1)
|
|
- if ((s->params[1].type == SEL_PARAM_STR) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if (s->params[1].type == SEL_PARAM_STR) {
|
|
|
|
+ if(parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
RETURN0_res(p->name);
|
|
RETURN0_res(p->name);
|
|
}
|
|
}
|
|
@@ -361,8 +363,9 @@ int select_via_version(str* res, select_t* s, struct sip_msg* msg)
|
|
struct via_body *p = NULL;
|
|
struct via_body *p = NULL;
|
|
|
|
|
|
// it's not neccessary to test if (s->n > 1)
|
|
// it's not neccessary to test if (s->n > 1)
|
|
- if ((s->params[1].type == SEL_PARAM_STR) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if (s->params[1].type == SEL_PARAM_STR) {
|
|
|
|
+ if (parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
RETURN0_res(p->version);
|
|
RETURN0_res(p->version);
|
|
}
|
|
}
|
|
@@ -372,8 +375,9 @@ int select_via_transport(str* res, select_t* s, struct sip_msg* msg)
|
|
struct via_body *p = NULL;
|
|
struct via_body *p = NULL;
|
|
|
|
|
|
// it's not neccessary to test if (s->n > 1)
|
|
// it's not neccessary to test if (s->n > 1)
|
|
- if ((s->params[1].type == SEL_PARAM_STR) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if (s->params[1].type == SEL_PARAM_STR) {
|
|
|
|
+ if(parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
RETURN0_res(p->transport);
|
|
RETURN0_res(p->transport);
|
|
}
|
|
}
|
|
@@ -383,8 +387,9 @@ int select_via_host(str* res, select_t* s, struct sip_msg* msg)
|
|
struct via_body *p = NULL;
|
|
struct via_body *p = NULL;
|
|
|
|
|
|
// it's not neccessary to test if (s->n > 1)
|
|
// it's not neccessary to test if (s->n > 1)
|
|
- if ((s->params[1].type == SEL_PARAM_STR) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if (s->params[1].type == SEL_PARAM_STR) {
|
|
|
|
+ if (parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
RETURN0_res(p->host);
|
|
RETURN0_res(p->host);
|
|
}
|
|
}
|
|
@@ -394,8 +399,9 @@ int select_via_port(str* res, select_t* s, struct sip_msg* msg)
|
|
struct via_body *p = NULL;
|
|
struct via_body *p = NULL;
|
|
|
|
|
|
// it's not neccessary to test if (s->n > 1)
|
|
// it's not neccessary to test if (s->n > 1)
|
|
- if ((s->params[1].type == SEL_PARAM_STR) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if (s->params[1].type == SEL_PARAM_STR) {
|
|
|
|
+ if (parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
RETURN0_res(p->port_str);
|
|
RETURN0_res(p->port_str);
|
|
}
|
|
}
|
|
@@ -405,8 +411,9 @@ int select_via_comment(str* res, select_t* s, struct sip_msg* msg)
|
|
struct via_body *p = NULL;
|
|
struct via_body *p = NULL;
|
|
|
|
|
|
// it's not neccessary to test if (s->n > 1)
|
|
// it's not neccessary to test if (s->n > 1)
|
|
- if ((s->params[1].type == SEL_PARAM_STR) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if (s->params[1].type == SEL_PARAM_STR) {
|
|
|
|
+ if(parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
RETURN0_res(p->comment);
|
|
RETURN0_res(p->comment);
|
|
}
|
|
}
|
|
@@ -417,8 +424,9 @@ int select_via_params(str* res, select_t* s, struct sip_msg* msg)
|
|
struct via_param *q;
|
|
struct via_param *q;
|
|
|
|
|
|
// it's not neccessary to test if (s->n > 1)
|
|
// it's not neccessary to test if (s->n > 1)
|
|
- if ((s->params[1].type == SEL_PARAM_STR) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if (s->params[1].type == SEL_PARAM_STR) {
|
|
|
|
+ if (parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
|
|
|
|
for (q = p->param_lst;q;q=q->next) {
|
|
for (q = p->param_lst;q;q=q->next) {
|
|
@@ -440,8 +448,9 @@ int select_via_params_spec(str* res, select_t* s, struct sip_msg* msg)
|
|
}
|
|
}
|
|
|
|
|
|
// it's not neccessary to test if (s->n > 1)
|
|
// it's not neccessary to test if (s->n > 1)
|
|
- if ((s->params[1].type == SEL_PARAM_STR) && (parse_via_header(msg, 1, &p)<0)) return -1;
|
|
|
|
- else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
|
|
|
|
+ if (s->params[1].type != SEL_PARAM_INT) {
|
|
|
|
+ if(parse_via_header(msg, 1, &p)<0) return -1;
|
|
|
|
+ } else if (parse_via_header(msg, s->params[1].v.i, &p)<0) return -1;
|
|
if (!p) return -1;
|
|
if (!p) return -1;
|
|
|
|
|
|
switch (s->params[s->n-1].v.i) {
|
|
switch (s->params[s->n-1].v.i) {
|