Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-12291

Better matching for inbound SMS when number is stored in CiviCRM in national format and number from provider comes back in international format

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0
    • Fix Version/s: Unscheduled
    • Component/s: None
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Problem: I had a number in my database stored as 07817 802299. I sent this to clickatell. Clickatell adds a default international code (based on my clickatell settings). When it came back to CiviCRM, we couldn't match it back up with the contact because we weren't clever enough to work out that 07817 802299 is the same as 447817802299.

      I added code to CRM_SMS_Provider::inbound() to perform an extra search for the contact before deciding to add a new contact. The extra search basically checks to see if the number that this is coming from is in the same country as the default country. If it is, it removes the country code so that it can try and match with any phone numbers in the DB that are in national format.

      A couple of other improvements: it doesn't match for deleted contacts and it uses the new phone_numeric field rather than the old phone field.

      Since we need to know phone number country codes for all countries to do this, these need to be added to the upgrade script.

        Attachments

        1. Provider.php
          13 kB
          John Kirk
        2. updateCiviCRMCountryCodes.php
          0.5 kB
          Michael McAndrew
        3. updateCiviCRMCountryCodes.sql
          16 kB
          Michael McAndrew

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                michaelmcandrew Michael McAndrew
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: