Skip Agent while reporting a call

Status
Not open for further replies.

FG Admin

Customer
Joined
Jun 21, 2021
Messages
18
Reaction score
5
I am trying to integrate 3CX with Freshworks for call journaling and as most of you know currently 3CX will report calls as answered if picked up by IVR.
So I wanted to create a custom scenario to be executed after
<Scenario Id="ReportCall">
by skipping the ReportCall scenario if [Agent]==&quot;8001&quot;
and run <Scenario Id="ReportSystemCall">
This second scenario should report any call answered by the IVR as missed, but the problem is currently an inbound call whether answered by the IVR or another extension will report the call twice in the CRM:
[DateTime]: Missed call from [Number] [Name] to [Agent] [AgentEmail]
[DateTime]: Answered incoming call from [Number] [Name] to [Agent] [AgentEmail] ([Duration])
So, I was wondering if someone was willing to take a look at my template and tell me what I am doing wrong, which would be highly appreciated.
I couldn't post the whole Template in one post, so I'm posting the relevant portion and attaching the complete template.
XML:
    <Scenario Id="ReportCall">
      <Request SkipIf="[ReportCallEnabled]!=True||[IIf([EntityId]==&quot;&quot;,[Agent]==&quot;8001&quot;,False)]==True" Url="https://[Domain].myfreshworks.com/crm/sales/api/phone_calls" RequestType="Post" RequestEncoding="Json" ResponseType="Json">
        <Headers>
          <Value Key="Authorization">Token token=[ApiKey]</Value>
        </Headers>
        <PostValues>
          <Object Key="phone_call">
              <Value Key="call_direction" If="[CallType]==Inbound">true</Value>
              <Value Key="call_direction" If="[CallType]==Missed">true</Value>
              <Value Key="call_direction" If="[CallType]==Outbound">false</Value>
              <Value Key="call_direction" If="[CallType]==Notanswered">false</Value>
              <Value Key="targetable_type">[EntityType]</Value>
              <Object Key="targetable">
                  <Value Key="id">[EntityId]</Value>
              </Object>
              <Object Key="note">
                  <Value Key="description" Passes="2" If="[CallType]==Inbound">[[InboundCallText]]</Value>
                  <Value Key="description" Passes="2" If="[CallType]==Missed">[[MissedCallText]]</Value>
                  <Value Key="description" Passes="2" If="[CallType]==Outbound">[[OutboundCallText]]</Value>
                  <Value Key="description" Passes="2" If="[CallType]==Notanswered">[[NotAnsweredOutboundCallText]]</Value>
              </Object>
          </Object>
        </PostValues>
      </Request>
      <Outputs Next="ReportSystemCall" AllowEmpty="true" />
    </Scenario>
    <Scenario Id="ReportSystemCall">
      <Request SkipIf="[ReportCallEnabled]!=True||[IIf([EntityId]==&quot;&quot;,[Agent]!==&quot;8001&quot;,False)]==True" Url="https://[Domain].myfreshworks.com/crm/sales/api/phone_calls" RequestType="Post" RequestEncoding="Json" ResponseType="Json" >
        <Headers>
          <Value Key="Authorization">Token token=[ApiKey]</Value>
        </Headers>
        <PostValues>
          <Object Key="phone_call">
              <Value Key="call_direction" If="[CallType]==Inbound">true</Value>
              <Value Key="targetable_type">[EntityType]</Value>
              <Object Key="targetable">
                  <Value Key="id">[EntityId]</Value>
              </Object>
              <Object Key="note">
                  <Value Key="description" Passes="2" If="[CallType]==Inbound">[[MissedCallText]]</Value>
              </Object>
          </Object>
        </PostValues>
      </Request>
    </Scenario>
 

Attachments

Last edited:
I also tried to just skip [Agent]==&quot;8001&quot; as instructed here without any additional scenarios, but the scenario was never skipped, and the call was reported as [DateTime]: Answered incoming call from [Number] [Name] to 8001 ([Duration]).
XML:
    <Scenario Id="ReportCall">
      <Request SkipIf="[ReportCallEnabled]!=True||[IIf([EntityId]==&quot;&quot;,[Agent]==&quot;8001&quot;,False)]==True" Url="https://[Domain].myfreshworks.com/crm/sales/api/phone_calls" RequestType="Post" RequestEncoding="Json" ResponseType="Json">
        <Headers>
          <Value Key="Authorization">Token token=[ApiKey]</Value>
        </Headers>
        <PostValues>
          <Object Key="phone_call">
              <Value Key="call_direction" If="[CallType]==Inbound">true</Value>
              <Value Key="call_direction" If="[CallType]==Missed">true</Value>
              <Value Key="call_direction" If="[CallType]==Outbound">false</Value>
              <Value Key="call_direction" If="[CallType]==Notanswered">false</Value>
              <Value Key="targetable_type">[EntityType]</Value>
              <Object Key="targetable">
                  <Value Key="id">[EntityId]</Value>
              </Object>
              <Object Key="note">
                  <Value Key="description" Passes="2" If="[CallType]==Inbound">[[InboundCallText]]</Value>
                  <Value Key="description" Passes="2" If="[CallType]==Missed">[[MissedCallText]]</Value>
                  <Value Key="description" Passes="2" If="[CallType]==Outbound">[[OutboundCallText]]</Value>
                  <Value Key="description" Passes="2" If="[CallType]==Notanswered">[[NotAnsweredOutboundCallText]]</Value>
              </Object>
          </Object>
        </PostValues>
      </Request>
    </Scenario>
 

Attachments

I finally returned to this issue after so much and manage to come up with a solution.
But first I would like to mention that I no longer use the "ReportCall" scenario to report calls because of another requirement (I needed to make another lookup using the Agent's email address and pass the response to the call reporting scenario, so I used the "ReportCall" scenario for that and chained another scenario for the actual reporting), So I am not sure if this affected anything.
I used SkipIf="[ReportCallEnabled]!=True||[IIf([Agent]!=&quot;8001&quot;,[EntityId]==&quot;&quot;,True)]==True" in a new scenario chained to the "ReportCall" scenario (let's call it CreateCallActivity) to check if the Agent wasn't the IVR, if it wasn't the IVR then check if the EntityId was empty or not and proceed, but if it was the IVR then activate the skip.
Then chained another scenario "CreateSystemCallActivity" to the "CreateCallActivity" and allowed empty response on "CreateCallActivity", in "CreateSystemCallActivity" I created a failsafe skip if check SkipIf="[ReportCallEnabled]!=True||[Agent]!=&quot;8001&quot;" and edited the inbound note to use the missed call note <Value Key="description" If="[CallType]==Inbound" Passes="2" Type="String">[[MissedCallText]]</Value>.
 
Status
Not open for further replies.