Call Journaling test fails in CRM Integration application

Status
Not open for further replies.

hoth

Free User
Joined
Mar 17, 2022
Messages
21
Reaction score
3
I currently have the following XML file, which is set up to do call journaling and do a look up on a contact based on their number and email address.
XML:
<?xml version="1.0"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="US" Name="Debug-3CX" Version="1" SupportsEmojis="true">
  <Number Prefix="AsIs" MaxLength="[MaxLength]" />
  <Connection MaxConcurrentRequests="2" />
  <Parameters>
    <Parameter Name="UserName" Type="String" Parent="General Configuration" Editor="String" Title="Username:" />
    <Parameter Name="Password" Type="Password" Parent="General Configuration" Editor="String" Title="Password:" />
    <Parameter Name="ReportCallEnabled" Type="Boolean" Editor="String" Title="Enable Call Journaling" Default="True" />
    <Parameter Name="Subject" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Call Subject:" Default="3CX PhoneSystem Call" />
    <Parameter Name="InboundCallText" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Answered Inbound Call:" Default="[DateTime]: Answered incoming call from [Number] to [Agent] ([Duration])" />
    <Parameter Name="MissedCallText" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Missed Call:" Default="[DateTime]: Missed call from [Number] to [Agent]" />
    <Parameter Name="OutboundCallText" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Answered Outbound Call:" Default="[DateTime]: Answered outgoing call from [Agent] to [Number] ([Duration])" />
    <Parameter Name="NotAnsweredOutboundCallText" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Unanswered Outbound Call:" Default="[DateTime]: Unanswered outgoing call from [Agent] to [Number]" />
  </Parameters>
  <Authentication Type="Basic">
    <Value>[UserName]:[Password]</Value>
  </Authentication>
  <Scenarios>
    <Scenario Id="ReportCall" Type="REST" EntityId="Contacts" EntityOrder="[LookupOrder]">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Inbound,True,False)])]" Url="https://5623-2a01-4b00-e208-dd00-980f-da75-1287-c64d.ngrok-free.app?A=HttpApiSuppdeskWebHook" MessagePasses="0" Message="" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="webhookEvent" Passes="1" Type="String">suppdesk</Value>
          <Object Key="call">
            <Value Key="reference" Passes="1" Type="String">001234</Value>
            <Value Key="folderno" Passes="1" Type="String">1</Value>
            <Value Key="email" Passes="1" Type="Integer">[AgentEmail]</Value>
            <Value Key="phone" Passes="1" Type="Integer">[CallNumber]</Value>
            <Value Key="status" Passes="1" Type="String">open</Value>
            <Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>
            <Value Key="description" Passes="1" Type="String">test desc</Value>
          </Object>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="false" />
    </Scenario>
    <Scenario Id="ReportCallMissed" Type="REST">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Missed,True,False)])]" Url="https://login:password@5623-2a01-4b00-e208-dd00-980f-da75-1287-c64d.ngrok-free.app?A=HttpApiSuppdeskWebHook" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="webhookEvent" Passes="1" Type="String">suppdesk</Value>
          <Object Key="call">
            <Value Key="reference" Passes="1" Type="String">001234</Value>
            <Value Key="folderno" Passes="1" Type="String">1</Value>
            <Value Key="email" Passes="1" Type="Integer">[AgentEmail]</Value>
            <Value Key="phone" Passes="1" Type="Integer">[CallNumber]</Value>
            <Value Key="status" Passes="1" Type="String">open</Value>
            <Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>
            <Value Key="description" Passes="1" Type="String">test desc</Value>
          </Object>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallOutbound" AllowEmpty="true" />
    </Scenario>
    <Scenario Id="ReportCallOutbound" Type="REST">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Outbound,True,False)])]" Url="https://login:password@5623-2a01-4b00-e208-dd00-980f-da75-1287-c64d.ngrok-free.app?A=HttpApiSuppdeskWebHook" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="webhookEvent" Passes="1" Type="String">suppdesk</Value>
          <Object Key="call">
            <Value Key="reference" Passes="1" Type="String">001234</Value>
            <Value Key="folderno" Passes="1" Type="String">1</Value>
            <Value Key="email" Passes="1" Type="Integer">[AgentEmail]</Value>
            <Value Key="phone" Passes="1" Type="Integer">[CallNumber]</Value>
            <Value Key="status" Passes="1" Type="String">open</Value>
            <Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>
            <Value Key="description" Passes="1" Type="String">test desc</Value>
          </Object>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallNotanswered" AllowEmpty="true" />
    </Scenario>
    <Scenario Id="ReportCallNotanswered" Type="REST">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Notanswered,True,False)])]" Url="https://login:password@5623-2a01-4b00-e208-dd00-980f-da75-1287-c64d.ngrok-free.app?A=HttpApiSuppdeskWebHook" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="webhookEvent" Passes="1" Type="String">suppdesk</Value>
          <Object Key="call">
            <Value Key="reference" Passes="1" Type="String">001234</Value>
            <Value Key="folderno" Passes="1" Type="String">1</Value>
            <Value Key="email" Passes="1" Type="Integer">[AgentEmail]</Value>
            <Value Key="phone" Passes="1" Type="Integer">[CallNumber]</Value>
            <Value Key="status" Passes="1" Type="String">open</Value>
            <Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>
            <Value Key="description" Passes="1" Type="String">test desc</Value>
          </Object>
        </PostValues>
      </Request>
      <Variables />
      <Outputs AllowEmpty="false" />
    </Scenario>
  </Scenarios>
</Crm>
I have set up values in "Parameter Values" for "Call Journaling" and have also got "ReportCallEnabled" set to True. Now when I run a test by clicking on "Call Journaling" after right clicking on "Parameter Values" I get the following exception,
System.FormatException: Input string was not in a correct format.
at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
at CrmIntegration.ScenarioProcessorBase.CreateJsonFromPostValues(RequestItem requestItem, IValueManager customManager)
at CrmIntegration.ScenarioProcessorBase.CreateJsonFromPostValues(RequestItem requestItem, IValueManager customManager)
at CrmIntegration.ScenarioProcessorBase.ProcessRequest(ScenarioRequest request, IValueManager customManager, HttpClient client, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.Execute(ProtocolScenario scenario, CancellationToken token)
at CrmIntegration.CrmProcessor.ExecuteScenarioByName(String scenarioName, IEnumerable`1 parameters, Boolean useNoAuthProvider, CancellationToken token)
at CrmIntegration.CrmProcessor.ExecuteScenarioWithRetries(String scenarioId, Dictionary`2 parameters, CancellationToken token)
at CrmIntegration.CrmProcessor.ReportCall(CallEndedEvent callEndedEvent, CancellationToken token)

Now the values set for "Call Journaling" under "Parameter Values" is as follows,
1694690225302.png
Have I missed something obviously wrong with this? I have no idea where I have gone wrong so would appreciate any help on this please.
 
The ReportCall scenario shouldn't have EntityType and EntityOrder attributes.

Also, it's [Number] and not [CallNumber].
 
The ReportCall scenario shouldn't have EntityType and EntityOrder attributes.

Also, it's [Number] and not [CallNumber].
I have removed the "EntityId" (I assume you meant this and not "EntityType") and "EntityOrder" from the "Scenario" tag and have replaced all "[CallNumber]" with "[Number]". In doing this would I also need to amend the "SkipIf" condition on the "Request" tab by removing "||[EntityId]==&quot;&quot;"?
 
You don't need to modify the request portion. Only the scenario.
 
  • Like
Reactions: edossantos
I have removed the "EntityId" (I assume you meant this and not "EntityType") and "EntityOrder" from the "Scenario" tag and have replaced all "[CallNumber]" with "[Number]". In doing this would I also need to amend the "SkipIf" condition on the "Request" tab by removing "||[EntityId]==&quot;&quot;"?
FYI

Removing the condition has now resulted in no error message but I now get a blank response,

1694693001704.png

This is currently what the "ReportCall" scenario looks like now,

XML:
<Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True,True,[IIf([CallType]!=Inbound,True,False)])]" Url="https://login:password@5623-2a01-4b00-e208-dd00-980f-da75-1287-c64d.ngrok-free.app?A=HttpApiSuppdeskWebHook" MessagePasses="0" Message="" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="webhookEvent" Passes="1" Type="String">suppdesk</Value>
          <Object Key="call">
            <Value Key="reference" Passes="1" Type="String">001234</Value>
            <Value Key="folderno" Passes="1" Type="String">1</Value>
            <Value Key="email" Passes="1" Type="Integer">[AgentEmail]</Value>
            <Value Key="phone" Passes="1" Type="Integer">[Number]</Value>
            <Value Key="status" Passes="1" Type="String">open</Value>
            <Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>
            <Value Key="description" Passes="1" Type="String">test desc</Value>
          </Object>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="false" />
    </Scenario>
 
FYI

Removing the condition has now resulted in no error message but I now get a blank response,

View attachment 37277

This is currently what the "ReportCall" scenario looks like now,

XML:
<Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True,True,[IIf([CallType]!=Inbound,True,False)])]" Url="https://login:password@5623-2a01-4b00-e208-dd00-980f-da75-1287-c64d.ngrok-free.app?A=HttpApiSuppdeskWebHook" MessagePasses="0" Message="" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="webhookEvent" Passes="1" Type="String">suppdesk</Value>
          <Object Key="call">
            <Value Key="reference" Passes="1" Type="String">001234</Value>
            <Value Key="folderno" Passes="1" Type="String">1</Value>
            <Value Key="email" Passes="1" Type="Integer">[AgentEmail]</Value>
            <Value Key="phone" Passes="1" Type="Integer">[Number]</Value>
            <Value Key="status" Passes="1" Type="String">open</Value>
            <Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>
            <Value Key="description" Passes="1" Type="String">test desc</Value>
          </Object>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="false" />
    </Scenario>
I'm not sure you can use login:password in the URL. However, you'll wanna check your API side and see if requests are coming in.
 
  • Like
Reactions: edossantos
The ReportCall scenario will not return any response. It's just to report a call, i.e. log the call in your CRM. You need another scenario to do the contact lookup, and that one will return the contact details.
 
  • Like
Reactions: Evolute IT
So the CRM application is actually one I have locally running in debug mode in Visual Studio. The problem I have is that when there is no exception thrown, which suggests that maybe the POST was run by 3CX, there is no incoming request in my CRM application.I have a breakpoint, which I would expect to get hit, which doesn't. As a test I have now removed the "Skip if" condition but it now returns the "System.FormatException: Input string was not in a correct format" exception like before.
 
What @ConceptsWeb mentioned about sending the user & password in the URL will not work in this case. Did you change that? That's something that the browser interprets as basic authentication, but 3CX will not do that. In this case you need to specify the actual URL and the credentials as headers.
 
  • Like
Reactions: Evolute IT
What @ConceptsWeb mentioned about sending the user & password in the URL will not work in this case. Did you change that? That's something that the browser interprets as basic authentication, but 3CX will not do that. In this case you need to specify the actual URL and the credentials as headers.
Yes, so I have removed the "login:password@" bit from the URL but have still had no luck. This is currently what I have,
XML:
<Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True,True,[IIf([CallType]!=Inbound,True,False)])]" Url="https://5623-2a01-4b00-e208-dd00-980f-da75-1287-c64d.ngrok-free.app?A=HttpApiSuppdeskWebHook" MessagePasses="0" Message="" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="webhookEvent" Passes="1" Type="String">suppdesk</Value>
          <Object Key="call">
            <Value Key="reference" Passes="1" Type="String">001234</Value>
            <Value Key="folderno" Passes="1" Type="String">1</Value>
            <Value Key="email" Passes="1" Type="Integer">[AgentEmail]</Value>
            <Value Key="phone" Passes="1" Type="Integer">[Number]</Value>
            <Value Key="status" Passes="1" Type="String">open</Value>
            <Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>
            <Value Key="description" Passes="1" Type="String">test desc</Value>
          </Object>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="false" />
    </Scenario>
With or without any headers for the credentials, I would expect my CRM application to at least receive the incoming request from 3CX, which is what is not happening for some odd reason.
 
Regarding this:
<Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>

[Subject] is a parameter that you have defined, and the default value is "3CX PhoneSystem Call", which is a string, and not an integer. That will cause the error you described previously:
System.FormatException: Input string was not in a correct format

If you're not seeing that error, that means that the scenario is not being executed, probably skipped. That will depend on the values you set in the Properties window when you debug this from the CRM Tool.
 
  • Like
Reactions: hoth
Regarding this:
<Value Key="subject" Passes="2" Type="Integer">[Subject]</Value>

[Subject] is a parameter that you have defined, and the default value is "3CX PhoneSystem Call", which is a string, and not an integer. That will cause the error you described previously:


If you're not seeing that error, that means that the scenario is not being executed, probably skipped. That will depend on the values you set in the Properties window when you debug this from the CRM Tool.
Thank you so much! This along with email was set to the incorrect type! Having corrected this I'am now receiving requests in my CRM application!
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,973
Messages
590,074
Members
164,893
Latest member
jbergeon