<?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="uManageTemplate" Version="1" SupportsEmojis="true">
  <Number Prefix="AsIs" MaxLength="[MaxLength]" />
  <Connection MaxConcurrentRequests="2" />
  <Parameters>
    <Parameter Name="APIkey" Type="String" Parent="General Configuration" Editor="String" Title="API Key:" />
    <Parameter Name="ReportCallEnabled" Type="Boolean" Editor="String" Title="Enable Call Journaling" Default="False" />
    <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>[APIkey]</Value>
  </Authentication>
  <Scenarios>
    <Scenario Id="" Type="REST">
      <Request Url="https://wspbx.eunify.net/wspbx.asmx/ServerApiGetContact?number=[Number]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
      <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.company">
          <Filter />
        </Variable>
        <Variable Name="Email" Path="contact.email">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness" Path="contact.businessphone">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness2" Path="contact.businessphone2">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="contact.mobilephone">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile2" Path="contact.mobilephone2">
          <Filter />
        </Variable>
        <Variable Name="CustomValue" Path="contact.customvalue">
          <Filter />
        </Variable>
        <Variable Name="ContactUrl" Path="contact.url">
          <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="PhoneBusiness2" Passes="0" Value="[PhoneBusiness2]" />
        <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
        <Output Type="PhoneMobile2" Passes="0" Value="[PhoneMobile2]" />
        <Output Type="CustomValue" Passes="0" Value="[CustomValue]" />
        <Output Type="ContactUrl" Passes="0" Value="[ContactUrl]" />
        <Output Type="EntityId" Passes="0" Value="[ContactID]" />
        <Output Type="EntityType" Passes="0" Value="Contacts" />
      </Outputs>
    </Scenario>
    <Scenario Id="LookupByEmail" Type="REST">
      <Request Url="https://wspbx.eunify.net/wspbx.asmx/ServerApiGetContact?email=[Email]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
      <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.company">
          <Filter />
        </Variable>
        <Variable Name="Email" Path="contact.email">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness" Path="contact.businessphone">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness2" Path="contact.businessphone2">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="contact.mobilephone">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile2" Path="contact.mobilephone2">
          <Filter />
        </Variable>
        <Variable Name="CustomValue" Path="contact.customvalue">
          <Filter />
        </Variable>
        <Variable Name="ContactUrl" Path="contact.url">
          <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="PhoneBusiness2" Passes="0" Value="[PhoneBusiness2]" />
        <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
        <Output Type="PhoneMobile2" Passes="0" Value="[PhoneMobile2]" />
        <Output Type="CustomValue" Passes="0" Value="[CustomValue]" />
        <Output Type="ContactUrl" Passes="0" Value="[ContactUrl]" />
        <Output Type="EntityId" Passes="0" Value="[ContactID]" />
        <Output Type="EntityType" Passes="0" Value="Contacts" />
      </Outputs>
    </Scenario>
    <Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Inbound,True,False)])]" Url="https://wspbx.eunify.net/wspbx.asmx/ServerApiJournaling" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues Key="">
          <Value Key="Number" Passes="1" Type="String">[Number]</Value>
          <Value Key="CallType" Passes="1" Type="String">[CallType]</Value>
          <Value Key="CallDirection" Passes="1" Type="String">[CallDirection]</Value>
          <Value Key="Name" Passes="1" Type="String">[Name]</Value>
          <Value Key="EntityId" Passes="1" Type="String">[EntityId]</Value>
          <Value Key="EntityType" Passes="1" Type="String">[EntityType]</Value>
          <Value Key="Agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="AgentFirstName" Passes="1" Type="String">[AgentFirstName]</Value>
          <Value Key="AgentLastName" Passes="1" Type="String">[AgentLastName]</Value>
          <Value Key="AgentEmail" Passes="1" Type="String">[AgentEmail]</Value>
          <Value Key="Duration" Passes="1" Type="String">[Duration]</Value>
          <Value Key="DurationMinutes" Passes="1" Type="String">[[[DurationTimespan].get_TotalMinutes()].ToString("F0")]</Value>
          <Value Key="DurationSeconds" Passes="1" Type="String">[[[DurationTimespan].get_TotalSeconds()].ToString("F0")]</Value>
          <Value Key="DurationMilliseconds" Passes="1" Type="String">[[[DurationTimespan].get_TotalMilliseconds()].ToString("F0")]</Value>
          <Value Key="DateTime" Passes="1" Type="String">[DateTime]</Value>
          <Value Key="CallStartTimeUTC" Passes="1" Type="String">[CallStartTimeUTC]</Value>
          <Value Key="CallEndTimeUTC" Passes="1" Type="String">[CallEndTimeUTC]</Value>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="true" />
    </Scenario>
    <Scenario Id="ReportCallMissed" Type="REST">
      <Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Missed,True,False)])]" Url="https://wspbx.eunify.net/wspbx.asmx/ServerApiJournaling" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues Key="">
          <Value Key="Number" Passes="1" Type="String">[Number]</Value>
          <Value Key="CallType" Passes="1" Type="String">[CallType]</Value>
          <Value Key="CallDirection" Passes="1" Type="String">[CallDirection]</Value>
          <Value Key="Name" Passes="1" Type="String">[Name]</Value>
          <Value Key="EntityId" Passes="1" Type="String">[EntityId]</Value>
          <Value Key="EntityType" Passes="1" Type="String">[EntityType]</Value>
          <Value Key="Agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="AgentFirstName" Passes="1" Type="String">[AgentFirstName]</Value>
          <Value Key="AgentLastName" Passes="1" Type="String">[AgentLastName]</Value>
          <Value Key="AgentEmail" Passes="1" Type="String">[AgentEmail]</Value>
          <Value Key="Duration" Passes="1" Type="String">[Duration]</Value>
          <Value Key="DurationMinutes" Passes="1" Type="String">[[[DurationTimespan].get_TotalMinutes()].ToString("F0")]</Value>
          <Value Key="DurationSeconds" Passes="1" Type="String">[[[DurationTimespan].get_TotalSeconds()].ToString("F0")]</Value>
          <Value Key="DurationMilliseconds" Passes="1" Type="String">[[[DurationTimespan].get_TotalMilliseconds()].ToString("F0")]</Value>
          <Value Key="DateTime" Passes="1" Type="String">[DateTime]</Value>
          <Value Key="CallStartTimeUTC" Passes="1" Type="String">[CallStartTimeUTC]</Value>
          <Value Key="CallEndTimeUTC" Passes="1" Type="String">[CallEndTimeUTC]</Value>
        </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://wspbx.eunify.net/wspbx.asmx/ServerApiJournaling" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues Key="">
          <Value Key="Number" Passes="1" Type="String">[Number]</Value>
          <Value Key="CallType" Passes="1" Type="String">[CallType]</Value>
          <Value Key="CallDirection" Passes="1" Type="String">[CallDirection]</Value>
          <Value Key="Name" Passes="1" Type="String">[Name]</Value>
          <Value Key="EntityId" Passes="1" Type="String">[EntityId]</Value>
          <Value Key="EntityType" Passes="1" Type="String">[EntityType]</Value>
          <Value Key="Agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="AgentFirstName" Passes="1" Type="String">[AgentFirstName]</Value>
          <Value Key="AgentLastName" Passes="1" Type="String">[AgentLastName]</Value>
          <Value Key="AgentEmail" Passes="1" Type="String">[AgentEmail]</Value>
          <Value Key="Duration" Passes="1" Type="String">[Duration]</Value>
          <Value Key="DurationMinutes" Passes="1" Type="String">[[[DurationTimespan].get_TotalMinutes()].ToString("F0")]</Value>
          <Value Key="DurationSeconds" Passes="1" Type="String">[[[DurationTimespan].get_TotalSeconds()].ToString("F0")]</Value>
          <Value Key="DurationMilliseconds" Passes="1" Type="String">[[[DurationTimespan].get_TotalMilliseconds()].ToString("F0")]</Value>
          <Value Key="DateTime" Passes="1" Type="String">[DateTime]</Value>
          <Value Key="CallStartTimeUTC" Passes="1" Type="String">[CallStartTimeUTC]</Value>
          <Value Key="CallEndTimeUTC" Passes="1" Type="String">[CallEndTimeUTC]</Value>
        </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://wspbx.eunify.net/wspbx.asmx/ServerApiJournaling" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues Key="">
          <Value Key="Number" Passes="1" Type="String">[Number]</Value>
          <Value Key="CallType" Passes="1" Type="String">[CallType]</Value>
          <Value Key="CallDirection" Passes="1" Type="String">[CallDirection]</Value>
          <Value Key="Name" Passes="1" Type="String">[Name]</Value>
          <Value Key="EntityId" Passes="1" Type="String">[EntityId]</Value>
          <Value Key="EntityType" Passes="1" Type="String">[EntityType]</Value>
          <Value Key="Agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="AgentFirstName" Passes="1" Type="String">[AgentFirstName]</Value>
          <Value Key="AgentLastName" Passes="1" Type="String">[AgentLastName]</Value>
          <Value Key="AgentEmail" Passes="1" Type="String">[AgentEmail]</Value>
          <Value Key="Duration" Passes="1" Type="String">[Duration]</Value>
          <Value Key="DurationMinutes" Passes="1" Type="String">[[[DurationTimespan].get_TotalMinutes()].ToString("F0")]</Value>
          <Value Key="DurationSeconds" Passes="1" Type="String">[[[DurationTimespan].get_TotalSeconds()].ToString("F0")]</Value>
          <Value Key="DurationMilliseconds" Passes="1" Type="String">[[[DurationTimespan].get_TotalMilliseconds()].ToString("F0")]</Value>
          <Value Key="DateTime" Passes="1" Type="String">[DateTime]</Value>
          <Value Key="CallStartTimeUTC" Passes="1" Type="String">[CallStartTimeUTC]</Value>
          <Value Key="CallEndTimeUTC" Passes="1" Type="String">[CallEndTimeUTC]</Value>
        </PostValues>
      </Request>
      <Variables />
      <Outputs AllowEmpty="false" />
    </Scenario>
  </Scenarios>
</Crm>