]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_cid_lookup: honor skipcitystate when using whitepages (FSMOD-53)
authorMichael Jerris <mike@jerris.com>
Mon, 31 May 2010 11:25:49 +0000 (07:25 -0400)
committerMichael Jerris <mike@jerris.com>
Mon, 31 May 2010 11:25:49 +0000 (07:25 -0400)
src/mod/applications/mod_cidlookup/mod_cidlookup.c

index dec49b0c98aa4283cc8b6927e65ba8936e00c400..230c48ac8def5ab00d26f8302a8d6fcd46ae46a6 100755 (executable)
@@ -629,7 +629,17 @@ static cid_data_t *do_lookup(switch_memory_pool_t *pool, switch_event_t *event,
                cid->area = "UNKNOWN";
        }
        if (!cid->name) {
-               cid->name = cid->area;
+               if (skipcitystate) {
+                       if (strlen(number) == 11 && number[0] == '1') {
+                               int a, b, c;
+                               sscanf(number, "1%3d%3d%4d", &a, &b, &c);
+                               cid->name = switch_core_sprintf(pool, "%03d-%03d-%04d", a, b, c);
+                       } else {
+                               cid->name = number;
+                       }
+               } else {
+                       cid->name = cid->area;
+               }
        }
        if (!cid->src) {
                cid->src = "UNKNOWN";