Module: sip-router
Branch: master
Commit: c90ecffaea4e9b47e33de521fbce5f86a896b67a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c90ecff…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Thu Apr 8 16:54:53 2010 +0300
modules/carrierroute In case of incorrect avp value (unknown carrier id), print the name
of the avp accordinly to its type
(cherry picked from commit 5604e51eb8fd6502495a37c26f9c549bcd63ca8a)
---
modules/carrierroute/cr_func.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules/carrierroute/cr_func.c b/modules/carrierroute/cr_func.c
index 382df16..207562d 100644
--- a/modules/carrierroute/cr_func.c
+++ b/modules/carrierroute/cr_func.c
@@ -89,8 +89,12 @@ static inline int cr_gp2id(struct sip_msg *_msg, gparam_t *gp, struct
name_map_t
avp = search_first_avp(gp->v.pve->spec.pvp.pvn.u.isname.type,
gp->v.pve->spec.pvp.pvn.u.isname.name, &avp_val, 0);
if (!avp) {
- LM_ERR("cannot find AVP '%.*s'\n",
gp->v.pve->spec.pvp.pvn.u.isname.name.s.len,
+ if(gp->v.pve->spec.pvp.pvn.u.isname.type & AVP_NAME_STR)
+ LM_ERR("cannot find AVP '%.*s'\n",
gp->v.pve->spec.pvp.pvn.u.isname.name.s.len,
gp->v.pve->spec.pvp.pvn.u.isname.name.s.s);
+ else if(gp->v.pve->spec.pvp.pvn.u.isname.type & AVP_NAME_RE)
+ LM_ERR("cannot find AVP regex\n");
+ else LM_ERR("cannot find AVP '%d'\n",
gp->v.pve->spec.pvp.pvn.u.isname.name.n);
return -1;
}
if ((avp->flags&AVP_VAL_STR)==0) {
@@ -98,9 +102,13 @@ static inline int cr_gp2id(struct sip_msg *_msg, gparam_t *gp, struct
name_map_t
} else {
id = map_name2id(map, size, &avp_val.s);
if (id < 0) {
- LM_ERR("could not find id '%.*s' from AVP\n",
+ if(gp->v.pve->spec.pvp.pvn.u.isname.type & AVP_NAME_STR)
+ LM_ERR("could not find id '%.*s' from AVP\n",
gp->v.pve->spec.pvp.pvn.u.isname.name.s.len,
gp->v.pve->spec.pvp.pvn.u.isname.name.s.s);
+ else if(gp->v.pve->spec.pvp.pvn.u.isname.type & AVP_NAME_RE)
+ LM_ERR("could not find id regex\n");
+ else LM_ERR("could not find id '%d'\n",
gp->v.pve->spec.pvp.pvn.u.isname.name.n);
return -1;
}
return id;