How to interpret a CRM: Exception during call reporting error

artooro

Customer
Joined
Jan 19, 2023
Messages
26
Reaction score
8
I'm trying to modify the Zendesk integration to post the call transcript as either an internal comment or a voice_comment. So I added another scenario that is called as Next by the previous, and the syntax all looks good, yet I get this error:

Code:
|0040|Erro| [Integration.Crm.Engine.CrmProcessor] CRM: Exception during call reporting
   at Integration.Crm.Engine.ScenarioProcessorBase.ProcessRequest(Boolean authScenario, ScenarioRequest request, IValueManager customManager, HttpClient client, Boolean retry, CancellationToken token)
   at Integration.Crm.Engine.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
   at Integration.Crm.Engine.ScenarioProcessorBase.ProcessMatching(ProtocolScenario scenario, MatchingPath matching, ResponseMatcher responseMatcher, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, HashSet`1 distinctMatchings, CancellationToken token)
   at Integration.Crm.Engine.ScenarioProcessorBase.ProcessFoundMatchings(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, List`1 matchings, ResponseMatcher responseMatcher, CancellationToken token)
   at Integration.Crm.Engine.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
   at Integration.Crm.Engine.ScenarioProcessorBase.ProcessMatching(ProtocolScenario scenario, MatchingPath matching, ResponseMatcher responseMatcher, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, HashSet`1 distinctMatchings, CancellationToken token)
   at Integration.Crm.Engine.ScenarioProcessorBase.ProcessFoundMatchings(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, List`1 matchings, ResponseMatcher responseMatcher, CancellationToken token)
   at Integration.Crm.Engine.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
   at Integration.Crm.Engine.ScenarioProcessorBase.Execute(ProtocolScenario scenario, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
   at Integration.Crm.Engine.CrmProcessor.ExecuteScenarioByName(String scenarioName, IEnumerable`1 parameters, Boolean useNoAuthProvider, CancellationToken token)
   at Integration.Crm.Engine.CrmProcessor.ExecuteScenarioWithRetries(String scenarioId, Dictionary`2 parameters, CancellationToken token)
   at Integration.Crm.Engine.CrmProcessor.ReportCall(CallEndedEvent callEndedEvent, CancellationToken token)

I just don't know how to interpret this to figure out what is actually going wrong. All I know is that the error comes after a "CRM: Performing POST request" log message. But at least in the past I'm pretty sure I remember 3CX logging the POST request response and response code in the case of API errors.
 
Seems you may have a loop in your scenarios. Check your Outputs elements. Also, if you just need to post as internal note, simply add a PostValues/Value "private" = true
 
OK interesting, I guess I'm not understanding something with how the scenarios are executed then. This is my modified template, the PostValues is minimal for testing purposes.
I understood that Next="CreateVoiceComment" would execute the next scenario, and because it has no outputs defined it would stop there.

XML:
    <Scenario Id="CreateCallActivity" Type="REST" EntityId="" EntityOrder="">
      <Request SkipIf="[ReportCallEnabled]!=True||[EntityId]==&quot;&quot;" Url="[Domain]/api/v2/tickets.json" MessagePasses="0" Message="" RequestContentType="" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <Headers>
          <Value Key="Authorization" If="" SkipIf="" Passes="0" Type="String">Bearer [RefreshToken]</Value>
        </Headers>
        <PostValues Key="" If="" SkipIf="">
          <Object Key="ticket" If="" SkipIf="">
            <Value Key="requester_id" If="" SkipIf="" Passes="0" Type="String">[EntityId]</Value>
            <Value Key="assignee_id" If="[AssigneeId]!=&quot;&quot;" SkipIf="" Passes="0" Type="String">[AssigneeId]</Value>
            <Value Key="created_at" If="" SkipIf="" Passes="0" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
            <Value Key="priority" If="" SkipIf="" Passes="0" Type="String">normal</Value>
            <Value Key="status" If="" SkipIf="" Passes="0" Type="String">open</Value>
            <Value Key="subject" If="" SkipIf="" Passes="2" Type="String">[[Subject]]</Value>
            <Object Key="comment" If="" SkipIf="">
                <Value Key="body" If="[CallType]==Inbound" SkipIf="" Passes="2" Type="String">[[InboundCallText]]</Value>
                <Value Key="body" If="[CallType]==Missed" SkipIf="" Passes="2" Type="String">[[MissedCallText]]</Value>
                <Value Key="body" If="[CallType]==Outbound" SkipIf="" Passes="2" Type="String">[[OutboundCallText]]</Value>
                <Value Key="body" If="[CallType]==Notanswered" SkipIf="" Passes="2" Type="String">[[NotAnsweredOutboundCallText]]</Value>
            </Object>
            <Array Key="tags" If="" SkipIf="">
              <Value Key="" If="" SkipIf="" Passes="0" Type="String">[CallType]</Value>
              <Value Key="" If="" SkipIf="" Passes="0" Type="String">Call</Value>
              <Value Key="" If="" SkipIf="" Passes="0" Type="String">[Agent]</Value>
            </Array>
          </Object>
        </PostValues>
      </Request>
      <Rules>
        <Rule Type="Any">ticket.id</Rule>
      </Rules>
      <Variables>
        <Variable Name="TicketId" Path="ticket.id"></Variable>
      </Variables>
      <Outputs Next="CreateVoiceComment" AllowEmpty="false" />
    </Scenario>
    <Scenario Id="CreateVoiceComment" Type="REST" EntityId="" EntityOrder="">
      <Request SkipIf="[ReportCallEnabled]!=True||[EntityId]==&quot;&quot;" Url="[Domain]/api/v2/tickets/[TicketId].json" MessagePasses="0" Message="" RequestContentType="" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <Headers>
          <Value Key="Authorization" If="" SkipIf="" Passes="0" Type="String">Bearer [RefreshToken]</Value>
        </Headers>
        <PostValues Key="" If="" SkipIf="">
          <Object Key="ticket" If="" SkipIf="">
            <Object Key="comment" If="" SkipIf="">
                <Value Key="body" If="" SkipIf="">Testing</Value>
                <Value Key="public" If="" SkipIf="">false</Value>
            </Object>
          </Object>
        </PostValues>
      </Request>
      <Variables />
      <Outputs AllowEmpty="false" />
    </Scenario>
 
If you need more details about what's being done by 3CX, enable verbose logging before making your test call.

In this case, the scenario named CreateVoiceComment will only be executed if the scenario named CreateCallActivity returns a JSON having a property named ticket, and a child property named id. Is that your case?
 
  • Like
Reactions: Evolute IT
For sure, I have verbose logging turned on. And yes the ticket creation returns ticket.id which is stored in a variable to be used in the CreateVoiceComment scenario.

Sorry I didn't include the higher up log messages but prior to the exception, there is a log entry of CRM: Processing scenario 'CreateVoiceComment'. so I know that it's executing.
 
In that case the error happens when trying to invoke that URL. I would change the attribute:
RequestContentType=""

to:
RequestContentType="application/json"

Not sure if that will make any difference, but it's worth trying, as you're sending JSON.
 
  • Like
Reactions: Evolute IT
I think the type for "public" just needed to be set to Boolean and then it worked. A little frustrating to get an exception instead of the actual error from the Zendesk API, but got it figured out.
But then I ran into a another problem, the Zendesk API returned a 404, so I guess from creation to updating it with the voice comment was too quick. So I ended up just making the ticket creation a voice comment from the get go, and it's working. I'll share it in a new thread post for anyone interested.
 

Members Online Now

Forum statistics

Threads
111,832
Messages
589,285
Members
164,662
Latest member
DejanMDS