Custom crm integration

Status
Not open for further replies.

pauldurst

New User
Joined
Jul 7, 2019
Messages
6
Reaction score
0
Hey :)

I created a custom crm integration but it looks like it is not working correctly...

issues:
- Outbound calls do not get reported


I tried now different scenarios with my phone number

But it seems like they only get reported if the number is found in our crm.

I would like to report every call, is that possible?

cheers :)





current xml template

XML:
<?xml version="1.0"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="AT" Name="selionnew24" Version="1">
  <Number Prefix="Plus" MaxLength="[MaxLength]" />
  <Connection MaxConcurrentRequests="2" />
  <Parameters>
    <Parameter Name="ReportCallEnabled" Type="Boolean" Editor="String" Title="Enable Call Journaling" Default="True" />
    <Parameter Name="apiToken" Type="String" Parent="General Configuration" Editor="String" Title="API Token" Default="APIKEY" />
  </Parameters>
  <Authentication Type="No" />
  <Scenarios>
    <Scenario Id="" Type="REST">
      <Request Url="https://DOMAIN/dev/3cx/contacts/search?number=[Number]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json">
        <Headers>
          <Value Key="Authorization" Passes="0" Type="String"> Token [apiToken]</Value>
        </Headers>
      </Request>
      <Rules>
        <Rule Type="Any">contacts.id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="contacts.id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="contacts.firstName">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="contacts.lastName">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness" Path="contacts.businessPhone">
          <Filter />
        </Variable>
        <Variable Name="ContactUrl" Path="contacts.url">
          <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>
    <Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[ReportCallEnabled]!=True" Url="https://DOMAIN/dev/3cx/calls/report" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <Headers>
          <Value Key="Authorization" Passes="0" Type="String"> Token [apiToken]</Value>
        </Headers>
        <PostValues Key="">
          <Value Key="phone" Passes="1" Type="String">[Number]</Value>
          <Value Key="callType" Passes="1" Type="String">[CallType]</Value>
          <Value Key="agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="duration" Passes="1" Type="String">[[[DurationTimespan].get_TotalSeconds()].ToString("F0")]</Value>
          <Value Key="start" Passes="2" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
          <Value Key="end" Passes="2" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
        </PostValues>
      </Request>
      <Variables />
      <Outputs AllowEmpty="false" />
    </Scenario>
  </Scenarios>
</Crm>
 
Last edited:
Only calls from / to numbers matched in the CRM are reported. If the contact is not found, you can create the contact, and then always have a match.
 
hmm okay.

And why is no outbound call reported? Is there a setting for that or is something missing in the crm template?
 
And why is no outbound call reported? Is there a setting for that or is something missing in the crm template?
In order to troubleshoot this, enable verbose logs from the 3CX Console > Dashboard > Activity Log > Settings. Then make a test call and check the 3cxSystemService.log file which you can download from the 3CX Console > Dashboard > Activity Log > Logs button > Instance folder.
 
Ah thanks now I see an error!

Inbound calls are prefixed with a digit based on the number that is called this digit is also passed for the contact search

for Outbound calls I do enter this prefix but it is not passed to contact search -> but it is needed so I know in which database I have to search.

Can I add that prefix to contact search? or pass the number I'm calling with?

also https://www.3cx.com/docs/server-side-crm-template-xml-description/#h.ccbm9ljgwo6m says that
  • Number (string) - Phone number to search modified according to the Number element.

and my number element is

XML:
<Number Prefix="Plus" MaxLength="[MaxLength]" />

but the lookup is /dev/3cx/contacts/search?number=06<123123123123>

so it is not formated with a plus but passed as is...
 
Last edited:
For outbound calls you're dialing a digit but this digit is removed by the outbound rule? Please note that the number sent to the CRM is the number that is dialed out, after applying the outbound rule.
 
Okay.

Yeah so the first digit does not belong to the phone number. So it gets stripped by an outbound rule. But with which number we are calling is based on this first digit.

Is there any way I get that info to the crm?
 
No, the CRM will consider the number sent to the external line. If your outbound rule removes a prefix, then it will not be included in the lookup.
 
Is it possible to pass the number we are calling with? Somehow I need that information
 
You will not get that from the CRM template. Maybe an option is that you check the generated CDRs, and run a script or program (that you need to create), to parse these CDRs and send the information you need to your CRM.
 
Any chance to make that a feature request? :)

cdr probably works meanwhile, thanks for the hint
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,324
Messages
591,897
Members
165,475
Latest member
lastshadow