forked from Mancy/Zammad_3CX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzammad.xml
121 lines (121 loc) · 7.19 KB
/
zammad.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?xml version="1.0"?>
<Crm xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Country="TR" Name="Zammad" Version="1">
<Number Prefix="Off" MaxLength="[MaxLength]" />
<Connection MaxConcurrentRequests="16" />
<Parameters>
<Parameter Name="ctiUrl" Type="String" Parent="General Configuration" Editor="String" Title="Zammad CTI Endpoint URL:" Default="Your Zammad CTI Generic Endpoint full URL" />
<Parameter Name="zammadUrl" Type="String" Parent="General Configuration" Editor="String" Title="Zammad URL:" Default="https://zammad.url.com" />
<Parameter Name="apiToken" Type="String" Parent="General Configuration" Editor="String" Title="Zammad API Token:" Default="User API Token Access (HTTP Token Authentication)" />
<Parameter Name="ReportCallEnabled" Type="Boolean" Editor="String" Title="Enable Call Journaling" Default="True" />
<Parameter Name="tofield" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Queue Name" Default="Customer Service" />
<Parameter Name="CreateContactEnabled" Type="Boolean" Editor="String" Title="Enable Contact Creation" Default="True" />
<Parameter Name="CreateContactFirstName" Type="String" Parent="CreateContactEnabled" Editor="String" Title="New Contact First Name:" Default="[Number]" />
<Parameter Name="CreateContactLastName" Type="String" Parent="CreateContactEnabled" Editor="String" Title="New Contact Last Name:" Default="3CX" />
</Parameters>
<Authentication Type="No" />
<Scenarios>
<Scenario Type="REST">
<Request SkipIf="[ReportCallEnabled]!=True" Url="http://worldclockapi.com/api/json/utc/now" RequestType="Get" ResponseType="Json"/>
<Rules>
<Rule Type="Any">currentDateTime</Rule>
</Rules>
<Variables>
<Variable Name="Calldate" Path="currentDateTime" />
</Variables>
<Outputs Next="newCall" AllowEmpty="false">
<Output Type="Calldate" Passes="0" Value="[Calldate]" />
</Outputs>
</Scenario>
<Scenario Id="newCall" Type="REST">
<Request SkipIf="[ReportCallEnabled]!=True" Url="[ctiUrl]" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json">
<PostValues>
<Value Key="event" Passes="0" Type="String">newCall</Value>
<Value Key="callId" Passes="0" Type="String">[Number][Calldate]</Value>
<Value Key="to" Passes="0" Type="String">[tofield]</Value>
<Value Key="from" Passes="0" Type="String">[Number]</Value>
<Value Key="direction" Passes="0" Type="String">in</Value>
</PostValues>
</Request>
</Scenario>
<Scenario Type="REST">
<Request SkipIf="[IIf([FoundRecordCount]>0,True,False)]" Url="[zammadUrl]/api/v1/users/search?query=mobile:[Number]&limit=1" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json">
<Headers>
<Value Key="Authorization">Token token=[apiToken]</Value>
</Headers>
</Request>
<Rules>
<Rule Type="Any">id</Rule>
</Rules>
<Variables>
<Variable Name="Id" Path="id"/>
<Variable Name="FirstName" Path="firstname"/>
<Variable Name="LastName" Path="lastname"/>
<Variable Name="Email" Path="email"/>
<Variable Name="PhoneMobile" Path="mobile"/>
<Variable Name="PhoneMobile2" Path="phone"/>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="ContactUrl" Passes="0" Value="[zammadUrl]/#user/profile/[Id]" />
<Output Type="FirstName" Passes="0" Value="[FirstName]" />
<Output Type="LastName" Passes="0" Value="[LastName]" />
<Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
<Output Type="PhoneMobile2" Passes="0" Value="[PhoneMobile2]" />
<Output Type="FullName" Passes="0" Value="[FirstName] [LastName]" />
</Outputs>
</Scenario>
<Scenario Id="ReportCall" Type="REST">
<Request SkipIf="[ReportCallEnabled]!=True" Url="[ctiUrl]" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json">
<PostValues>
<Value Key="event" Passes="0" Type="String">hangup</Value>
<Value Key="callId" Passes="2" Type="String">[Number][[CallStartTimeUTC].ToString("yyyy-MM-ddTHH:mmZ")]</Value>
<Value Key="to" Passes="0" Type="String">[Agent]</Value>
<Value Key="from" Passes="0" Type="String">[Number]</Value>
<Value Key="direction" Passes="2" Type="String">[IIf([CallType]==Inbound||[CallType]==Missed,in,out)]</Value>
<Value Key="cause" Passes="2" Type="String">[IIf([CallType]==Notanswered||[CallType]==Missed,noAnswer,normalClearing)]</Value>
<Value Key="CallType" Passes="0" Type="String">[CallType]</Value>
<Value Key="Number" Passes="0" Type="String">[Number]</Value>
<Value Key="Agent" Passes="0" Type="String">[Agent]</Value>
<Value Key="Duration" Passes="0" Type="String">[Duration]</Value>
<Value Key="DurationTimespan" Passes="4" Type="String">[[[DurationTimespan].get_TotalMinutes()].ToString("F0")]</Value>
<Value Key="DateTime" Passes="0" Type="String">[DateTime]</Value>
<Value Key="CallStartTimeLocal" Passes="2" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
<Value Key="CallStartTimeUTC" Passes="2" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-ddTHH:mmZ")]</Value>
<Value Key="CallEndTimeLocal" Passes="2" Type="String">[[CallEndTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
<Value Key="CallEndTimeUTC" Passes="2" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
</PostValues>
</Request>
</Scenario>
<Scenario Id="CreateContactRecord" Type="REST">
<Request SkipIf="[CreateContactEnabled]!=True" Url="[zammadUrl]/api/v1/users" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
<Headers>
<Value Key="Authorization">Token token=[apiToken]</Value>
</Headers>
<PostValues>
<Value Key="firstname" Passes="2" Type="String">[[CreateContactFirstName]]</Value>
<Value Key="lastname" Passes="2" Type="String">[[CreateContactLastName]]</Value>
<Value Key="mobile" Passes="0" Type="String">[Number]</Value>
<Value Key="phone" Passes="0" Type="String">[Number]</Value>
</PostValues>
</Request>
<Rules>
<Rule Type="Any">id</Rule>
</Rules>
<Variables>
<Variable Name="Id" Path="id"/>
<Variable Name="FirstName" Path="firstname"/>
<Variable Name="LastName" Path="lastname"/>
<Variable Name="Email" Path="email"/>
<Variable Name="PhoneMobile" Path="mobile"/>
<Variable Name="PhoneMobile2" Path="phone"/>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="ContactUrl" Passes="0" Value="[zammadUrl]/#user/profile/[Id]" />
<Output Type="FirstName" Passes="0" Value="[FirstName]" />
<Output Type="LastName" Passes="0" Value="[LastName]" />
<Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
<Output Type="PhoneMobile2" Passes="0" Value="[PhoneMobile2]" />
<Output Type="FullName" Passes="0" Value="[FirstName] [LastName]" />
</Outputs>
</Scenario>
</Scenarios>
</Crm>