Inbound calls not sent to CRM

Status
Not open for further replies.

drenda

Forum User
Joined
May 3, 2020
Messages
30
Reaction score
10
Hi,
I loaded my .xml configuration in 3CX. This is the configuration:

Code:
<?xml version="1.0"?>
<Crm Country="IT" Name="Test" Version="1">
    <Number Prefix="AsIs" MaxLength="[MaxLength]"/>
    <Connection MaxConcurrentRequests="10"/>
    <Parameters>
        <Parameter Name="ReportCallEnabled" Type="Boolean" Editor="String" Title="Enable Call Journaling" Default="True"/>
        <Parameter Name="ApiKey" Type="String" Parent="General Configuration" Editor="String" Title="ApiKey" Default="mytoken"/>
        <Parameter Name="Client" Type="String" Parent="General Configuration" Editor="String" Title="Test client URL" Default="http://xx.xx.xx.xx:4200"/>
        <Parameter Name="Server" Type="String" Parent="General Configuration" Editor="String" Title="Test server url" Default="http://xx.xx.xx.xx:8082"/>
    </Parameters>
    <Authentication Type="No"/>
    <Scenarios>
        <Scenario Id="" Type="REST">
            <Request Url="[Server]/api/v1/integrations/3cx/contacts?phoneNumber=[Number]" MessagePasses="0" RequestEncoding="UrlEncoded"
                     RequestType="Get" ResponseType="Json">
                <Headers>
                    <Value Key="Authorization" Passes="0" Type="String">Bearer [APIkey]</Value>
                </Headers>
            </Request>
            <Rules>
                <Rule Type="Any">contact.id</Rule>
            </Rules>
            <Variables>
                <Variable Name="ContactID" Path="contact.id">
                    <Filter/>
                </Variable>
                <Variable Name="FirstName" Path="contact.firstName">
                    <Filter/>
                </Variable>
                <Variable Name="LastName" Path="contact.lastName">
                    <Filter/>
                </Variable>
                <Variable Name="CompanyName" Path="contact.lastName">
                    <Filter/>
                </Variable>
                <Variable Name="Email" Path="contact.email">
                    <Filter/>
                </Variable>
                <Variable Name="PhoneBusiness" Path="contact.landlinePhone">
                    <Filter/>
                </Variable>
                <Variable Name="PhoneMobile" Path="contact.mobilePhone">
                    <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="CompanyName" Passes="0" Value="[CompanyName]"/>
                <Output Type="Email" Passes="0" Value="[Email]"/>
                <Output Type="PhoneBusiness" Passes="0" Value="[PhoneBusiness]"/>
                <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]"/>
                <Output Type="ContactUrl" Passes="0" Value="[Client]/contacts/[ContactID]/dashboard"/>
            </Outputs>
        </Scenario>
        <Scenario Id="ReportCall" Type="REST">
            <Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Inbound" Url="[Server]/api/v1/integrations/3cx/cdr" MessagePasses="0"
                     RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
                <Headers>
                    <Value Key="Authorization" Passes="0" Type="String">Bearer [APIkey]</Value>
                </Headers>
                <PostValues Key="">
                    <Value Key="from" Passes="1" Type="String">[Number]</Value>
                    <Value Key="to" Passes="1" Type="String">[Agent]</Value>
                    <Value Key="type" Passes="1" Type="String">[CallType]</Value>
                    <Value Key="startDate" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="endDate" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="contactId" Passes="1" Type="String">[Contact::ContactID]</Value>
                </PostValues>
            </Request>
            <Variables/>
            <Outputs Next="ReportCallMissed" AllowEmpty="true"/>
        </Scenario>
        <Scenario Id="ReportCallMissed" Type="REST">
            <Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Missed" Url="[Server]/api/v1/integrations/3cx/cdr" MessagePasses="0"
                     RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
                <Headers>
                    <Value Key="Authorization" Passes="0" Type="String">Bearer [APIkey]</Value>
                </Headers>
                <PostValues Key="">
                    <Value Key="from" Passes="1" Type="String">[Number]</Value>
                    <Value Key="to" Passes="1" Type="String">[Agent]</Value>
                    <Value Key="type" Passes="1" Type="String">[CallType]</Value>
                    <Value Key="startDate" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="endDate" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="contactId" Passes="1" Type="String">[Contact::ContactID]</Value>
                </PostValues>
            </Request>
            <Variables/>
            <Outputs Next="ReportCallOutbound" AllowEmpty="true"/>
        </Scenario>
        <Scenario Id="ReportCallOutbound" Type="REST">
            <Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Outbound" Url="[Server]/api/v1/integrations/3cx/cdr" MessagePasses="0"
                     RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
                <Headers>
                    <Value Key="Authorization" Passes="0" Type="String">Bearer [APIkey]</Value>
                </Headers>
                <PostValues Key="">
                    <Value Key="from" Passes="1" Type="String">[Agent]</Value>
                    <Value Key="to" Passes="1" Type="String">[Number]</Value>
                    <Value Key="type" Passes="1" Type="String">[CallType]</Value>
                    <Value Key="startDate" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="endDate" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="contactId" Passes="1" Type="String">[Contact::ContactID]</Value>
                </PostValues>
            </Request>
            <Variables/>
            <Outputs Next="ReportCallNotanswered" AllowEmpty="true"/>
        </Scenario>
        <Scenario Id="ReportCallNotanswered" Type="REST">
            <Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Notanswered" Url="[Server]/api/v1/integrations/3cx/cdr" MessagePasses="0"
                     RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
                <Headers>
                    <Value Key="Authorization" Passes="0" Type="String">Bearer [APIkey]</Value>
                </Headers>
                <PostValues Key="">
                    <Value Key="from" Passes="1" Type="String">[Agent]</Value>
                    <Value Key="to" Passes="1" Type="String">[Number]</Value>
                    <Value Key="type" Passes="1" Type="String">[CallType]</Value>
                    <Value Key="startDate" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="endDate" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="contactId" Passes="1" Type="String">[Contact::ContactID]</Value>
                </PostValues>
            </Request>
            <Variables/>
            <Outputs Next="ReportCallUnknown" AllowEmpty="true"/>
        </Scenario>
        <Scenario Id="ReportCallUnknown" Type="REST">
            <Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Unknown" Url="[Server]/api/v1/integrations/3cx/cdr" MessagePasses="0"
                     RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
                <Headers>
                    <Value Key="Authorization" Passes="0" Type="String">Bearer [APIkey]</Value>
                </Headers>
                <PostValues Key="">
                    <Value Key="from" Passes="1" Type="String">[Agent]</Value>
                    <Value Key="to" Passes="1" Type="String">[Number]</Value>
                    <Value Key="type" Passes="1" Type="String">[CallType]</Value>
                    <Value Key="startDate" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="endDate" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="contactId" Passes="1" Type="String">[Contact::ContactID]</Value>
                </PostValues>
            </Request>
            <Variables/>
            <Outputs AllowEmpty="false"/>
        </Scenario>
    </Scenarios>
</Crm>

Everything work but incoming calls journaling. Outbound calls are sent to the CRM, also inbound missed calls, but I don't see any call for incoming answered calls.

Am I doind something wrong in this xml file?

Thanks
 
Hi,
I loaded my .xml configuration in 3CX. This is the configuration:

Everything work but incoming calls journaling. Outbound calls are sent to the CRM, also inbound missed calls, but I don't see any call for incoming answered calls.

Am I doind something wrong in this xml file?

Thanks
You used the wizard right? For some reason, it generates a scenario for each type of calls. However, you could use only one (delete the other 3), change the value of the call type for the variable [CallType] in the ReportCall request, then also, remove the second part of this: `SkipIf="[ReportCallEnabled]!=True||[CallType]!=Inbound"` where it filters if calls are not inbound. Just keep the ReportCallEnabled part.

This should help. We do a lot of those integrations.
 
  • Like
Reactions: edossantos
Yes, you are right. I used the template generator. Of course what you suggested makes much more sense. I'll go for it.

Thanks!
 
I just did the change and I tried the configuration in the template software. I got this excetion when I simulate the scenarios:

Code:
System.NullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto.
   in CrmIntegration.ResultVariableScenarioProcessor.ProcessFinalResult(ProtocolScenario scenario, IValueManager valueManager)
   in CrmIntegration.ScenarioProcessorBase.<ProcessMatching>d__11.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
   in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   in CrmIntegration.ScenarioProcessorBase.<ProcessFoundMatchings>d__10.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
   in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   in CrmIntegration.ScenarioProcessorBase.<ProcessScenario>d__8.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
   in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   in CrmIntegration.ScenarioProcessorBase.<Execute>d__7.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
   in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   in CrmIntegration.CrmProcessor.<ExecuteScenarioByName>d__15.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
   in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   in CrmIntegration.CrmProcessor.<ReportCall>d__16.MoveNext()

Maybe I am missing something. For example it's not clear what you mean for "change the value of the call type for the variable [CallType] in the ReportCall request,".

Thanks
 
Can you share your updated XML template so we take a look?
 
Sure:

Code:
<?xml version="1.0"?>
<Crm Country="IT" Name="Test" Version="1">
    <Number Prefix="AsIs" MaxLength="[MaxLength]"/>
    <Connection MaxConcurrentRequests="10"/>
    <Parameters>
        <Parameter Name="ReportCallEnabled" Type="Boolean" Editor="String" Title="Enable Call Journaling" Default="True"/>
        <Parameter Name="ApiKey" Type="String" Parent="General Configuration" Editor="String" Title="ApiKey" Default="mytoken"/>
        <Parameter Name="TestClient" Type="String" Parent="General Configuration" Editor="String" Title="Test client URL" Default="http://xx.xx.xx.xx:4200"/>
        <Parameter Name="TestServer" Type="String" Parent="General Configuration" Editor="String" Title="Test server url" Default="http://xx.xx.xx.xx:8082"/>
    </Parameters>
    <Authentication Type="No"/>
    <Scenarios>
        <Scenario Id="" Type="REST">
            <Request Url="[TestServer]/api/v1/integrations/3cx/contacts?phoneNumber=[Number]" MessagePasses="0" RequestEncoding="UrlEncoded"
                     RequestType="Get" ResponseType="Json">
                <Headers>
                    <Value Key="Authorization" Passes="0" Type="String">Bearer [APIkey]</Value>
                </Headers>
            </Request>
            <Rules>
                <Rule Type="Any">contact.id</Rule>
            </Rules>
            <Variables>
                <Variable Name="ContactID" Path="contact.id">
                    <Filter/>
                </Variable>
                <Variable Name="FirstName" Path="contact.firstName">
                    <Filter/>
                </Variable>
                <Variable Name="LastName" Path="contact.lastName">
                    <Filter/>
                </Variable>
                <Variable Name="CompanyName" Path="contact.lastName">
                    <Filter/>
                </Variable>
                <Variable Name="Email" Path="contact.email">
                    <Filter/>
                </Variable>
                <Variable Name="PhoneBusiness" Path="contact.landlinePhone">
                    <Filter/>
                </Variable>
                <Variable Name="PhoneMobile" Path="contact.mobilePhone">
                    <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="CompanyName" Passes="0" Value="[CompanyName]"/>
                <Output Type="Email" Passes="0" Value="[Email]"/>
                <Output Type="PhoneBusiness" Passes="0" Value="[PhoneBusiness]"/>
                <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]"/>
                <Output Type="ContactUrl" Passes="0" Value="[TestClient]/contacts/[ContactID]/dashboard"/>
            </Outputs>
        </Scenario>
        <Scenario Id="ReportCall" Type="REST">
            <Request SkipIf="[ReportCallEnabled]!=True" Url="[TestServer]/api/v1/integrations/3cx/cdr" MessagePasses="0"
                     RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
                <Headers>
                    <Value Key="Authorization" Passes="0" Type="String">Bearer [APIkey]</Value>
                </Headers>
                <PostValues Key="">
                    <Value Key="from" Passes="1" Type="String">[Number]</Value>
                    <Value Key="to" Passes="1" Type="String">[Agent]</Value>
                    <Value Key="type" Passes="1" Type="String">[CallType]</Value>
                    <Value Key="startDate" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z
                    </Value>
                    <Value Key="endDate" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-dd")]T[[CallStartTimeUTC].ToString("HH:mm:ss")]Z</Value>
                    <Value Key="contactId" Passes="1" Type="String">[Contact::ContactID]</Value>
                </PostValues>
            </Request>
            <Variables/>
            <Outputs AllowEmpty="true"/>
        </Scenario>
    </Scenarios>
</Crm>

Thanks
 
Try removing the following from the ReportCall scenario:
XML:
<Variables/>
<Outputs AllowEmpty="true"/>

Just put the Request element inside this scenario.
 
  • Like
Reactions: Evolute IT
It works! Thanks very much!
 
Status
Not open for further replies.

Forum statistics

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