CRM Integration answers with entry, 3CX doesn't detect it.

Status
Not open for further replies.

platinum

Silver Partner
Advanced Certified
Joined
Jan 24, 2020
Messages
16
Reaction score
2
So I'm trying to implement tel.search.ch (Swiss Phonebook) on a 3CX.
API: https://tel.search.ch/api/help.en.html

Testing the CRM integrations results in the following notification:
CRM Integration is working OK but contact number does not exist. Check log for more info or try a different number.

The response is, as far as i can see, correct and shows the entry.
Tests with international prefix have the same outcome.
Somehow it isn't acceppting the delivered Data.

I censored out the api key, without the api key you will only get the following as a response:
XML:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:tel="http://tel.search.ch/api/spec/result/1.0/" xml:lang="de">
<id>...</id>
<title type="text">tel.search.ch API Search Results</title>
<generator version="1.0" uri="https://tel.search.ch">tel.search.ch</generator>
<updated>2020-05-08T02:00:00Z</updated>
<link href="https://tel.search.ch/result.html?was=0564186677" rel="alternate" type="text/html"/>
<link href="http://tel.search.ch/api/?was=0564186677&key=3c6a2869745c2fd83a3efe7e4597a4dc" type="application/atom+xml" rel="self"/>
<openSearch:totalResults>1</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>10</openSearch:itemsPerPage>
<openSearch:Query role="request" searchTerms="0564186677 " startPage="1"/>
<openSearch:Image height="1" width="1" type="image/gif">https://www.search.ch/audit/CP/tel/de/api</openSearch:Image>
<entry>
<id>urn:uuid:097f83647dc935d5</id>
<updated>2020-05-08T02:00:00Z</updated>
<published>2020-05-08T02:00:00Z</published>
<title type="text">Bouygues E&S InTec Schweiz AG</title>
<content type="text">
Bouygues E&S InTec Schweiz AG Elektro, Schaltanlagen , IT + Telcom Industriestrasse 163 8957 Spreitenbach AG 056 418 66 11
</content>
<author>
<name>tel.search.ch</name>
</author>
<link href="https://tel.search.ch/spreitenbach/industriestrasse-163/bouygues-e-s-intec-schweiz-ag" title="Details" rel="alternate" type="text/html"/>
<link href="https://tel.search.ch/vcard/Bouygues-ES-InTec-Schweiz-AG.vcf?key=097f83647dc935d5" type="text/x-vcard" title="VCard Download" rel="alternate"/>
<link href="https://tel.search.ch/edit/?id=097f83647dc935d5" rel="edit" type="text/html"/>
<tel:pos>1</tel:pos>
<tel:id>097f83647dc935d5</tel:id>
<tel:type>Organisation</tel:type>
<tel:name>Bouygues E&S InTec Schweiz AG</tel:name>
<tel:subname>Elektro, Schaltanlagen , IT + Telcom</tel:subname>
<tel:street>Industriestrasse</tel:street>
<tel:streetno>163</tel:streetno>
<tel:zip>8957</tel:zip>
<tel:city>Spreitenbach</tel:city>
<tel:canton>AG</tel:canton>
<tel:country>ch</tel:country>
<tel:phone>+41564186611</tel:phone>
<tel:extra type="Fax">+41564186622</tel:extra>
<tel:extra type="email">[email protected]*</tel:extra>
<tel:copyright>Daten: Swisscom Directories AG</tel:copyright>
</entry>
</feed>

3CX Log Output Live Test:
XML:
06|Verb|Not processed. Number=0564186611, connection=1728, state=Dialing
2020/05/08 10:12:54.263|56724|0006|Verb|Add to processing. Number=0564186611, connection=1728, state=Dialing
2020/05/08 10:12:54.263|56724|0006|Info|CRM ProcessActiveConnections(). Attached entries to connection:
2020/05/08 10:12:54.263|56724|0006|Verb|CRM: LocalMatches=. Number=0564186611, connection=1728, state=Dialing
2020/05/08 10:12:54.263|56724|0006|Info|CRM: Synchronize(...) called
2020/05/08 10:12:54.263|56724|0005|Verb|Dequeue Inserted.CONNECTION.1728
2020/05/08 10:12:54.263|56724|0047|Info|CRM: maxConcurrency=2
2020/05/08 10:12:54.263|56724|0047|Info|CRM: making request to CRM. Number=0564186611
2020/05/08 10:12:54.263|56724|0047|Trac|Obtaining scenario entity order for entity ''
2020/05/08 10:12:54.263|56724|0047|Trac|Ordering configuration not found, using scenario entity order 0 for entity ''
2020/05/08 10:12:54.264|56724|0047|Verb|Processing scenario 'Default'.
2020/05/08 10:12:54.264|56724|0047|Verb|Creating new HttpClient for Basic authentication
2020/05/08 10:12:54.264|56724|0047|Verb|Performing GET request 'https://tel.search.ch/api/?was=0564186611&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'.
2020/05/08 10:12:54.298|56724|0006|Verb|Enqueue Updated.REGISTRATION.59
2020/05/08 10:12:54.298|56724|0005|Verb|Dequeue Updated.REGISTRATION.59
2020/05/08 10:12:54.373|56724|0006|Verb|Enqueue Updated.REGISTRATION.59
2020/05/08 10:12:54.374|56724|0005|Verb|Dequeue Updated.REGISTRATION.59
2020/05/08 10:12:54.462|56724|0047|Verb|The response is: '<?xml version="1.0" encoding="utf-8" ?>
<feed xml:lang="de" xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:tel="http://tel.search.ch/api/spec/result/1.0/">
  <id>https://tel.search.ch/api/XXXXXXXXXXXXXXXXXXXXXXXXXX/d613d231138a0b1538c0ddce4bf81042</id>
  <title type="text">tel.search.ch API Search Results</title>
  <generator version="1.0" uri="https://tel.search.ch">tel.search.ch</generator>
  <updated>2020-05-08T02:00:00Z</updated>
  <link href="https://tel.search.ch/result.html?was=0564186611" rel="alternate" type="text/html" />
  <link href="http://tel.search.ch/api/?was=0564186611&amp;key=XXXXXXXXXXXXXXXXXXXXXXXm+xml" rel="self" />
  <openSearch:totalResults>1</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>10</openSearch:itemsPerPage>
  <openSearch:Query role="request" searchTerms="0564186611 " startPage="1"></openSearch:Query>
  <openSearch:Image height="1" width="1" type="image/gif">https://www.search.ch/audit/CP/tel/de/api</openSearch:Image>
  <entry>
    <id>urn:uuid:097f83647dc935d5</id>
    <updated>2020-05-08T02:00:00Z</updated>
    <published>2020-05-08T02:00:00Z</published>
    <title type="text">Bouygues E&amp;S InTec Schweiz AG</title>
    <content type="text">Bouygues E&amp;S InTec Schweiz AG
    Elektro, Schaltanlagen , IT + Telcom
    Industriestrasse 163
    8957 Spreitenbach AG
    056 418 66 11</content>
    <author>
      <name>tel.search.ch</name>
    </author>
    <link href="https://tel.search.ch/spreitenbach/industriestrasse-163/bouygues-e-s-intec-schweiz-ag" title="Details" rel="alternate" type="text/html" />
    <link href="https://tel.search.ch/vcard/Bouygues-ES-InTec-Schweiz-AG.vcf?key=097f83647dc935d5" type="text/x-vcard" title="VCard Download" rel="alternate" />
    <link href="https://tel.search.ch/edit/?id=097f83647dc935d5" rel="edit" type="text/html" />
    <tel:pos>1</tel:pos>
    <tel:id>097f83647dc935d5</tel:id>
    <tel:type>Organisation</tel:type>
    <tel:name>Bouygues E&amp;S InTec Schweiz AG</tel:name>
    <tel:subname>Elektro, Schaltanlagen , IT + Telcom</tel:subname>
    <tel:street>Industriestrasse</tel:street>
    <tel:streetno>163</tel:streetno>
    <tel:zip>8957</tel:zip>
    <tel:city>Spreitenbach</tel:city>
    <tel:canton>AG</tel:canton>
    <tel:country>ch</tel:country>
    <tel:phone>+41564186611</tel:phone>
    <tel:extra type="Fax">+41564186622</tel:extra>
    <tel:extra type="email">[email protected]*</tel:extra>
    <tel:copyright>Daten: Swisscom Directories AG</tel:copyright>
  </entry>
</feed>
'
2020/05/08 10:12:54.462|56724|0047|Verb|No matchings found.
2020/05/08 10:12:54.463|56724|0047|Verb|Removed from processing. Number=0564186611
2020/05/08 10:12:54.463|56724|0047|Info|CRM: processing of 0564186611 has been finished

CRM Template Live Test:
XML:
<?xml version="1.0"?>
<Crm xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Country="US" Name="telsearch" Version="1">
  <Number Prefix="AsIs" MaxLength="[MaxLength]" />
  <Connection MaxConcurrentRequests="2" />
  <Parameters>
    <Parameter Name="APIkey" Type="String" Parent="General Configuration" Editor="String" Title="API Key:" />
  </Parameters>
  <Authentication Type="Basic">
    <Value>[APIkey]:X</Value>
  </Authentication>
  <Scenarios>
    <Scenario Id="" Type="REST">
      <Request Url="https://tel.search.ch/api/?was=[Number]&amp;key=XXXXXXXXXXXXXXXXXXXXX" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Xml" />
      <Rules>
        <Rule Type="Any">/feed/entry/id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="/feed/entry/id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="/feed/entry/tel:firstname">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="/feed/entry/tel:subname">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness" Path="/feed/entry/tel:phone">
          <Filter />
        </Variable>
        <Variable Name="ContactUrl" Path="/feed/entry/link/@rel='alternate'">
          <Filter />
        </Variable>
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="ContactID" Passes="0" Value="[ContactID]" />
        <Output Type="FirstName" Passes="0" Value="[FirstName]" />
        <Output Type="LastName" Passes="0" Value="[LastName]" />
        <Output Type="PhoneBusiness" Passes="0" Value="[PhoneBusiness]" />
        <Output Type="ContactUrl" Passes="0" Value="[ContactUrl]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>

I can't seem to find the problem, in my eyes it should work like this.

Does anyone have an idea where i went wrong?

Greetings
 
Hello @platinum,

Please find attached a prototype of a "working" template using your API which you may use as reference if you wish.

We made a few changes:
1) When specifying the path to the nodes, these need to be separated by dots, and not slashes.
2) In XML responses, the first element name (in this case "feed") must not be included.
3) There are some issues with namespaces in the XML processing. So it's not possible to identify separately <id> and <tel:id>. This causes problems, as some nodes can't be identified. This is a known issue with XML responses. It's better to deal with JSON whenever possible (not sure if your web service accepts a parameter to request the response in JSON format).
4) When the response has more than 1 "phone" element, it's not possible to identify them:
XML:
<tel:phone>+41564186611</tel:phone>
<tel:phone>+41564186622</tel:phone>

Then, I had to set the output "PhoneBusiness" to the number being searched: [Number]

With this template, we can get a valid response from the console, but only returns partial data, as some fields can't be identified due to what we explained above.
 

Attachments

Hello @edossanos

Thanks for your effort.

With the template you provided this works like a charm.
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Forum statistics

Threads
112,326
Messages
591,899
Members
165,479
Latest member
Senergia