Asterisk popup phone number is appended incorrectly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gfoxjr
    Junior Member
    • Jun 2018
    • 15

    Asterisk popup phone number is appended incorrectly

    On the popup, some number are coming in with a prefix.

    985-400-XXXX will present as R0/985-400-XXXX

    Any idea what the R0/ might be or how to remove it?

    Thanks bunches.
  • tarasm
    Super Moderator
    • Mar 2014
    • 573

    #2
    When a telephony server returns a phone number in a wrong format e.g. R0/985-400-XXXX. To get this number in a normal format, create/edit a file "custom/Espo/Custom/Resources/metadata/app/voip.json" and add the code:
    Code:
    {    
      "phoneNumberReplacement": {
            "Asterisk": {            
                    "^R0\\/": ""        
            }    
      }
    }
    where
    • "Asterisk" - a connector ID;
    • "^R0\\/" - regular expression to find unnecessary characters;
    • "" - a string for replacing.
    Then go to Administrator panel > Clear cache.
    Last edited by tarasm; 06-20-2018, 09:24 AM.
    Job Offers and Requests

    Comment

    • gfoxjr
      Junior Member
      • Jun 2018
      • 15

      #3
      OK. This didn't work. Are you saying "Asterisk" should be replaced by a connector ID that's specific to our system?
      Last edited by gfoxjr; 06-20-2018, 04:22 PM.

      Comment

      • tarasm
        Super Moderator
        • Mar 2014
        • 573

        #4
        By default a connector ID is "Asterisk". The above code should work fine, just copy/paste.
        Job Offers and Requests

        Comment

        • gfoxjr
          Junior Member
          • Jun 2018
          • 15

          #5
          OK. It's not working, for what ever reason, I don't know.

          Here's where we placed the regex edit:

          public_html/custom/Espo/Custom/Resources/metadata/app

          Here the contents of the voip.json file (permissions are 664):

          {
          "options": {
          "Asterisk": {
          "autoOpenCallerInfo": "yes"
          }
          },
          "phoneNumberReplacement": {
          "Asterisk": {
          "^R0\/": ""
          }
          },

          "phoneNumberReplacement": {
          "Asterisk": {
          "^FMGL-([0-9]+)@from-internal": "$1"
          }
          },
          "phoneNumberReplacement": {
          "Asterisk": {
          "^FMPR-([0-9]+)@from-internal": "$1"
          }
          }

          }

          In the voip_event database, the entries are not corrected.

          id deleted uniqueid destuniqueid type status user_extension phone_number entities date_start date_end connector line original_phone_number channel is_queue queue_number processed hidden data ready system created_at modified_at assigned_user_id call_id
          5b2c1d8e07709862a 0 1529157806.1976 1524617809.1977 outgoingCall active 1002 R0/19854055095 {"Contact":{},"Lead":{},"Account":{}} 2018-06-21 21:51:27 NULL Asterisk NULL R0/19854055095 SIP/1002-00000413 0 NULL 0 0 NULL 1 0 2018-06-21 21:50:06 2018-06-21 21:52:07 d1de42b8-e635-54f7-6618- NULL
          Any suggestions?

          Comment

          • tarasm
            Super Moderator
            • Mar 2014
            • 573

            #6
            No, it's not correct. It should be:
            Code:
            {
            "options": {
            "Asterisk": {
            "autoOpenCallerInfo": "yes"
            }
            },
            "phoneNumberReplacement": {
            "Asterisk": {
            "^R0\/": "",
            "^FMGL-([0-9]+)@from-internal": "$1"
            }
            }
            
            }
            Job Offers and Requests

            Comment

            • gfoxjr
              Junior Member
              • Jun 2018
              • 15

              #7
              The final "working" file....

              Code:
              {
                  "options": {
                  "Asterisk": {
                      "autoOpenCallerInfo": "yes"
                  }
                  },
                  "phoneNumberReplacement": {
                  "Asterisk": {
                      "^R0\\/": "",
                          "^FMGL-([0-9]+)@from-internal": "$1",
                          "^FMPR-([0-9]+)@from-internal": "$1"
                  }
                  }
              }

              Thanks for your help!

              Comment

              Working...