[freeside-commits] branch master updated. cbb6450c25690e5b3fccc6cfddd497de45f062d5

Mitch Jackson mitch at freeside.biz
Fri Feb 2 14:53:33 PST 2018


The branch, master has been updated
       via  cbb6450c25690e5b3fccc6cfddd497de45f062d5 (commit)
      from  42b6338522f6dc66771f49b38191b4201462fd82 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit cbb6450c25690e5b3fccc6cfddd497de45f062d5
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Fri Feb 2 03:47:41 2018 -0600

    RT# 78952 CDR Import for Acme Packet Improved caller-id parsing

diff --git a/FS/FS/cdr/acmepacket.pm b/FS/FS/cdr/acmepacket.pm
index e0e80cdd6..1f00e4086 100644
--- a/FS/FS/cdr/acmepacket.pm
+++ b/FS/FS/cdr/acmepacket.pm
@@ -130,17 +130,28 @@ our %info = (
     # clid, dst, src CDR field formatted as one of the following:
     #   'WIRELESS CALLER'<sip:12513001300 at 4.2.2.2:5060;user=phone>;tag=SDepng302
     #   <sip:12513001300 at 4.2.2.2:5060;user=phone>;tag=SDepng302
+    #   '12513001300'<sip:4.2.2.2:5060;user=phone>;tag=SDepng302
 
     # clid
     $out[0] = $out[0] =~ /^\'(.+)\'/ ? $1 : "";
 
     # src, dst
-    # All of the sample data given shows sip connections.  In case the same
-    # switch is hooked into another circuit type in the future, we'll just
-    # tease out a length 7+ number not contained in the caller-id-text field
+    # Use the 7+ digit number as the src/dst phone number.
+    # Prefer using the number within <sip> label.  If there is not one,
+    # allow using number from caller-id text field.
     for (1,2) {
+      my $f = $out[$_];
       $out[$_] =~ s/^\'.+\'//g; # strip caller id label portion
-      $out[$_] = $out[$_] =~ /(\d{7,})/ ? $1 : undef;
+      if ($out[$_] =~ /(\d{7,})/) {
+        # Using number from <sip>
+        $out[$_] = $1;
+      } elsif ($f =~ /(\d{7,})/) {
+        # Using number from caller-id text
+        $out[$_] = $1;
+      } else {
+        # No phone number, perhaps an IP only call
+        $out[$_] = undef;
+      }
     }
 
     if ($DEBUG) {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cdr/acmepacket.pm | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list