[sr-dev] Enum PV lookup

Jasmin Schnatterbeck js at data-cmr.net
Fri Apr 2 16:21:28 CEST 2010


Hello list,

currently I am trying to use the enum_pv_query function of the enum
module but I always get an error: the R-Uri-User is not an e164-Number.

That's true, but not important (and must not result in a failed lookup),
because the function should use a pv for the lookup, not the R-Uri-User.

In enum.c I discovered in function enum_pv_query_3 :

        /*
         *  Get R-URI user to tostring
         */
        if (parse_sip_msg_uri(_msg) < 0) {
                LM_ERR("R-URI parsing failed\n");
                return -1;
        }

        if (is_e164(&(_msg->parsed_uri.user)) == -1) {
                LM_ERR("R-URI user is not an E164 number\n");
                return -1;
        }

        user_s = _msg->parsed_uri.user.s;
        user_len = _msg->parsed_uri.user.len;

        memcpy(&(tostring[0]), user_s, user_len);
        tostring[user_len] = (char)0;

        /*
         * Get E.164 number from pseudo variable
         */
        if (sp && (pv_get_spec_value(_msg, sp, &pv_val) == 0)) {
            if (pv_val.flags & PV_VAL_STR) {
                if (pv_val.rs.len == 0 || pv_val.rs.s == NULL) {
                    LM_DBG("Missing E.164 number\n");
                    return -1;
                }
            } else {
                LM_DBG("Pseudo variable value is not string\n");
                return -1;
        }
        } else {
            LM_DBG("Cannot get pseudo variable value\n");
            return -1;
        }
        if (is_e164(&(pv_val.rs)) == -1) {
            LM_ERR("pseudo variable does not contain an E164 number\n");
            return -1;
        }

        user_s = pv_val.rs.s;
        user_len = pv_val.rs.len;

        memcpy(&(string[0]), user_s, user_len);
        string[user_len] = (char)0;


As you can see, the function always tries to read the uri for lookup
from the R-Uri, whether "sp" (which is needed to be true for using pv)
is defined or not. Why do you need sp? I recognized, that enum_query()
(without pv) uses a separate function anyway...
I would suggest to remove the lines in this function, which try to use
the R-URI for enum lookup...

Thanks
Jasmin





More information about the sr-dev mailing list