I am using AVPs for distinctive ring preferences. I allows users to
store up to 5 phone numbers that can be assigned a custom ring. The
method below works fine but as you can see it requires 5 db queries.
There must be a better way to do this. Any ideas?

- Daryl

        if (avp_db_load("$ruri/username", "s:ringone")) {
                if (avp_check("s:ringone", "eq/$from/i")) {
                append_hf("Alert-Info: Bellcore-r1\r\n");
                };
        };
        if (avp_db_load("$ruri/username", "s:ringtwo")) {
                if (avp_check("s:ringtwo", "eq/$from/i")) {
                append_hf("Alert-Info: Bellcore-r2\r\n");
                };
        };
        if (avp_db_load("$ruri/username", "s:ringthree")) {
                if (avp_check("s:ringthree", "eq/$from/i")) {
                append_hf("Alert-Info: Bellcore-r3\r\n");
                };
        };
        if (avp_db_load("$ruri/username", "s:ringfour")) {
                if (avp_check("s:ringfour", "eq/$from/i")) {
                append_hf("Alert-Info: Bellcore-r4\r\n");
                };
        };
        if (avp_db_load("$ruri/username", "s:ringfive")) {
                if (avp_check("s:ringfive", "eq/$from/i")) {
                append_hf("Alert-Info: Bellcore-r5\r\n");
                };
        };

_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users

Reply via email to