New Phone Book Entry after Query

Status
Not open for further replies.

smart-IT-up

Forum User
Joined
Oct 29, 2019
Messages
7
Reaction score
2
Hi,
I created a Template for querying incoming calls against an online phonebook. The online phone book provides json as response, which works great. But the only purpose is to show the user agent the name and address of the incoming call. It is not necessary to create a contact in a CRM or call journaling. So I have the problem that I have to open a website each time a call comes in, which is annoying for the user to close or the 3CX-phone book gets filled with the query-results. What's more, 3CX creates a new contact each time someone calls, even if the exact contact exists in the 3CX phone book. It seems that the option "Query CRM: Only if contact is not found in 3CX Phonebook" does not work:
1600072221071.png

This is the xml-Template:
XML:
<?xml version="1.0"?>
<Crm xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Country="AT" Name="Herold" Version="1">
  <Number Prefix="Plus" MaxLength="" />
  <Connection MaxConcurrentRequests="2" />
  <Parameters />
  <Authentication Type="Basic">
    <Value>XXXXXXXXXX:XXXXXXXXXX</Value>
  </Authentication>
  <Scenarios>
    <Scenario Id="" Type="REST">
      <Request SkipIf="" Url="https://cnam.herold.at/v1/phone/[Number]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
      <Rules>
        <Rule Type="Any">name</Rule>
      </Rules>
      <Variables>
        <Variable Name="CallerName" Path="name">
          <Filter />
        </Variable>
        <Variable Name="CallerStreet" Path="street">
          <Filter />
        </Variable>
        <Variable Name="CallerHousenumber" Path="housenumber">
          <Filter />
        </Variable>
        <Variable Name="CallerPostalcode" Path="postalcode">
          <Filter />
        </Variable>
        <Variable Name="CallerCity" Path="city">
          <Filter />
        </Variable>
        <Variable Name="CallerPhone" Path="phone">
          <Filter />
        </Variable>
      </Variables>
      <Outputs Next="" AllowEmpty="false">
        <Output Type="CompanyName" Passes="0" Value="[CallerName], [CallerStreet] [CallerHousenumber], [CallerPostalcode] [CallerCity]" />
        <Output Type="PhoneOther" Passes="0" Value="[CallerPhone]" />
        <Output Type="PhoneBusiness" Passes="0" Value="[Number]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>

This is an exemplary response:
JSON:
[
   {
      "source":"wp",
      "name":"smart IT up e.U.",
      "street":"Laurenz Moser G",
      "housenumber":"7",
      "postalcode":"3495",
      "city":"Rohrendorf bei Krems",
      "phone":[
         "+43273290660"
      ]
   }
]

The final question: Is it possible to not create duplicate 3CX phone book entries, when I don't provide a "Contact-URL Output" in the XML-Template or is it somehow possible to delete duplicates in the 3CX phonebook?
 
CRM templates work adding the contact's details to the global phonebook. This can't be avoided. If you don't want this, maybe you can use the "launch URL" feature of the Web Client, so when you receive an inbound call you get a new browser tab with the selected URL, where you can concatenate the caller's number. You can configure the URL from the Web Client > Settings > Integration > Auto launch a Custom Contact URL using variables.

If you decide to use the CRM template, you can avoid the popup by selecting Web Client > Settings > Integration > Off. This will cause that the Web Client shows the contact name, but it will not popup any record.

When using the CRM template it's important that you always return a Contact URL, even if you're not going to use it. This is because that's considered the "primary key" of CRM contacts in 3CX, so if you don't provide it, all the contacts will override the first CRM contact created, because the Contact URL will always be the same (empty). This is the behaviour that you described, so you can get this fixed by returning a different URL for each contact. For example, you can concatenate a static text with the caller number: https://example.com/[Number]. This way you will have a different URL for each number.

The option Query CRM: Only if contact is not found in 3CX Phonebook applies when the matched contact in the 3CX phonebook is not a CRM contact. In that case, that contact will be used. However, when the matched contact is a CRM contact, the lookup is always performed, because we need to check for updates in the contact details.
 
  • Like
Reactions: Evolute IT
Thank you very much for your detailed explanation. This is exactly how I understand how the CRM-Lookup works.

But as I described this logic doesn't apply well in every situation. I cannot understand why there is no mechanism to avoid duplicate phonebook entries. I can't imagine that anybody finds duplicates useful...

Also I cannot understand why the Query CRM: Only if contact is not found in 3CX Phonebook is limited to non-CRM-contacts.

Is there a chance that this behaviour will change or at least be configurable in the future?

Best Regards
Andreas
 
But as I described this logic doesn't apply well in every situation. I cannot understand why there is no mechanism to avoid duplicate phonebook entries. I can't imagine that anybody finds duplicates useful...
In some cases you might have more than 1 contact with the same phone number, for example different people working in the same company. We consider the "Contact URL" as the unique identifier of the contact in the 3CX global phonebook, so as long as you return a different Contact URL, these will be different contacts, even if they have the same phone number. If you need to refer to the same contact, return the same Contact URL, and the contact details will be updated, instead of creating a new contact with the same number.

Also I cannot understand why the Query CRM: Only if contact is not found in 3CX Phonebook is limited to non-CRM-contacts.
This is because once we retrieve the contact details from the CRM, we need to check if something has changed, so we're in sync. So for CRM contacts, we always get the contact details from the CRM, and update the contact in 3CX if anything has changed.

Is there a chance that this behaviour will change or at least be configurable in the future?
This is how it is for now, and I'm not aware of changes being done in this area.
 
We consider the "Contact URL" as the unique identifier of the contact in the 3CX global phonebook
Wow! Now that is a valuable information. Thank you very much!!!
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,324
Messages
591,897
Members
165,476
Latest member
awan05