3CX + Autotask

Status
Not open for further replies.

exn3cxjam

Gold Partner
Joined
Feb 11, 2020
Messages
16
Reaction score
1
Hi all, we use Autotask as our PSA and would like to integrate it with 3CX. I was able to get started based on a template posted by Chris Ellsaesser (Autotask new REST API Integration | 3CX - Software Based VoIP IP PBX / PABX), but I have been running into issues with Call Journalling. No matter how I try to create the PostValues section, I always end up with this error (pasted below) on both the CRM Template Generator and SystemService logs.

Any help would be appreciated. I have uploaded my configuration to this post as well.

2021/01/17 03:44:43.487|11588|0081|Erro|Exception during call reporting: 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.ProcessRequest(ScenarioRequest request, IValueManager customManager, HttpClient client, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessMatching(ProtocolScenario scenario, MatchingPath matching, ResponseMatcher responseMatcher, IValueManager customManager, HashSet`1 distinctMatchings, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessFoundMatchings(ProtocolScenario scenario, IValueManager customManager, List`1 matchings, ResponseMatcher responseMatcher, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessMatching(ProtocolScenario scenario, MatchingPath matching, ResponseMatcher responseMatcher, IValueManager customManager, HashSet`1 distinctMatchings, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessFoundMatchings(ProtocolScenario scenario, IValueManager customManager, List`1 matchings, ResponseMatcher responseMatcher, 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.ReportCall(CallEndedEvent call, CancellationToken token)
 

Attachments

Hello @exn3cxjam,

The error you're getting is:
System.FormatException: Input string was not in a correct format.

That means that you're trying to convert a value to an integer, but that value is not a valid number. Maybe it has some letter. It would be good to know the values of the variables that you're trying to convert to integer. From the template you attached, I can see the following:
XML:
          <Value Key="ActionType" Passes="1" Type="Integer">[ATActionType]</Value>
          <Value Key="AssignedResourceID" Passes="1" Type="Integer">[IIf([ATImpersonationID]=="",4,[ATImpersonationID])]</Value>
          <Value Key="CompanyID" Passes="1" Type="Integer">[Contact::CompanyID]</Value>
          <Value Key="ContactID" Passes="1" Type="Integer">[Contact::ContactID]</Value>

So, probably, one of those fields doens't have a valid integer value. You can try commenting out all those 4 lines, and add them one by one, until you get the error. That will tell you which variable has a wrong value. Then you can check why this is happening, or change the type to string.
 
Thanks for you reply. I found that the issue was an empty ContactID field. Is there any way to check for empty fields? I tried comparing with an empty string, but that still doesn't work.

<Scenario Id="ReportCallInbound" Type="REST">
<Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Inbound||[Contact::ContactID]==^^^^" Url="[ATZone]v1.0/Companies/[Contact::CompanyID]/Notes" MessagePasses="0" Message="" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
<Headers>
<Value Key="Secret" Passes="0" Type="String">[ATSecret]</Value>
<Value Key="UserName" Passes="0" Type="String">[ATUsername]</Value>
<Value Key="ApiIntegrationCode" Passes="0" Type="String">[ATTrackerID]</Value>
<Value Key="ImpersonationResourceId" If="" Passes="0" Type="Integer">[ATImpersonationID]</Value>
</Headers>
<PostValues Key="">
<Value Key="ActionType" Passes="1" Type="Integer">[ATActionType]</Value>
<Value Key="AssignedResourceID" Passes="1" Type="Integer">[IIf([ATImpersonationID]=="",4,[ATImpersonationID])]</Value>
<Value Key="CompanyID" Passes="1" Type="Integer">[Contact::CompanyID]</Value>
<Value Key="CompletedDateTime" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
<Value Key="ContactID" Passes="1" Type="Integer">[Contact::ContactID]</Value>
<Value Key="EndDateTime" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
<Value Key="Name" Passes="2" Type="String">[Subject]</Value>
<Value Key="Note" Passes="2" Type="String">[InboundCallText]</Value>
<Value Key="StartDateTime" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
</PostValues>
</Request>
<Variables />
<Outputs Next="ReportCallInboundNoContact" AllowEmpty="true" />
</Scenario>
 
If there's no contact, the call journaling should not be executed.

Verify your lookup scenario and make sure all vars gets assigned, or none at all. Not half of them only.
 
  • Like
Reactions: edossantos
Try with:
SkipIf="[ReportCallEnabled]!=True||[CallType]!=Inbound||[Contact::ContactID]==&quot;&quot;"
 

Attachments

Last edited:
Status
Not open for further replies.

Latest Posts

Forum statistics

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