Built motion from commit 82cfc5ed0.|1.0.23
[motion.git] / server / config / integrations / freshdesk.js
1 var _0xf225=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x6D\x6F\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x55\x73\x65\x72","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x69\x6E\x66\x6F","\x68\x61\x6E\x64\x6C\x65\x45\x76\x65\x6E\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x50\x61\x73\x73\x65\x64\x20\x70\x61\x72\x61\x6D\x65\x74\x65\x72\x73\x20\x61\x72\x65\x20\x6E\x6F\x74\x20\x65\x6E\x6F\x75\x67\x68\x20\x74\x6F\x20\x63\x72\x65\x61\x74\x65\x20\x61\x20\x6E\x65\x77\x20\x74\x69\x63\x6B\x65\x74\x3A\x20\x6D\x69\x73\x73\x20\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x49\x64\x20\x6F\x72\x20\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x49\x64","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x75\x72\x69","\x68\x65\x61\x64\x65\x72\x73","\x73\x65\x72\x76\x65\x72\x55\x72\x6C","\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6A\x73\x6F\x6E","\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x42\x61\x73\x69\x63\x20","\x62\x61\x73\x65\x36\x34","\x61\x70\x69\x4B\x65\x79","\x3A\x58","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x61\x67\x65\x6E\x74","\x73\x63\x6F\x70\x65","\x61\x67\x65\x6E\x74\x4E\x61\x6D\x65","\x71\x75\x65\x75\x65","\x6E\x61\x6D\x65","\x6D\x6F\x6E\x69\x74\x6F\x72\x5F\x66\x6F\x72\x6D\x61\x74","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x65\x6E\x61\x62\x6C\x65\x64\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x51\x75\x65\x75\x65\x20","\x72\x65\x63\x6F\x72\x64\x45\x6E\x61\x62\x6C\x65","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x51\x75\x65\x75\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x6F\x72\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x6E\x6F\x74\x20\x65\x6E\x61\x62\x6C\x65\x64","\x72\x6F\x75\x74\x65\x49\x64","\x69\x64","\x72\x65\x63\x6F\x72\x64","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x65\x6E\x61\x62\x6C\x65\x64\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x52\x6F\x75\x74\x65\x20\x4F\x75\x74\x62\x6F\x75\x6E\x64\x20","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x52\x6F\x75\x74\x65\x20\x4F\x75\x74\x62\x6F\x75\x6E\x64\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x6F\x72\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x6E\x6F\x74\x20\x65\x6E\x61\x62\x6C\x65\x64","\x2F\x61\x70\x69\x2F\x76\x32\x2F\x61\x67\x65\x6E\x74\x73","","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x76\x6F\x69\x63\x65","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x43\x68\x61\x6E\x6E\x65\x6C\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64\x3A\x20","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x55\x52\x4C","\x25\x73\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x73\x2F\x25\x73\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x3F\x74\x79\x70\x65\x3D\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x66\x6F\x72\x6D\x61\x74","\x72\x65\x73\x75\x6C\x74","\x6C\x65\x6E\x67\x74\x68","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x73\x20\x66\x6F\x75\x6E\x64\x20\x28","\x29\x2E\x20\x46\x69\x6E\x64\x20\x77\x69\x74\x68\x20\x6E\x61\x6D\x65\x3A\x20","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x63\x6F\x6E\x74\x61\x63\x74","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x20","\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2E\x20\x55\x73\x65\x20\x74\x68\x65\x20\x61\x64\x6D\x69\x6E\x20\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x61\x70\x69\x2F\x76\x32\x2F\x61\x67\x65\x6E\x74\x73\x2F\x6D\x65","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x43\x6F\x6E\x74\x61\x63\x74\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x20\x77\x69\x74\x68\x20\x70\x68\x6F\x6E\x65\x20","\x2F\x61\x70\x69\x2F\x76\x32\x2F\x63\x6F\x6E\x74\x61\x63\x74\x73\x3F\x70\x68\x6F\x6E\x65\x3D","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x43\x6F\x6E\x74\x61\x63\x74\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x20\x77\x69\x74\x68\x20\x6D\x6F\x62\x69\x6C\x65\x20","\x2F\x61\x70\x69\x2F\x76\x32\x2F\x63\x6F\x6E\x74\x61\x63\x74\x73\x3F\x6D\x6F\x62\x69\x6C\x65\x3D","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x43\x6F\x6E\x74\x61\x63\x74\x20\x66\x6F\x75\x6E\x64\x20\x28\x70\x68\x6F\x6E\x65\x29\x3A\x20","\x65\x6E\x64\x75\x73\x65\x72","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x43\x6F\x6E\x74\x61\x63\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x28\x70\x68\x6F\x6E\x65\x29\x3A\x20","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x43\x72\x65\x61\x74\x65\x20\x6E\x65\x77\x20\x63\x6F\x6E\x74\x61\x63\x74\x20\x77\x69\x74\x68\x20\x70\x68\x6F\x6E\x65\x20","\x64\x65\x62\x75\x67","\x50\x4F\x53\x54","\x2F\x61\x70\x69\x2F\x76\x32\x2F\x63\x6F\x6E\x74\x61\x63\x74\x73","\x43\x61\x6C\x6C\x65\x72\x20\x2D\x20\x25\x73","\x70\x68\x6F\x6E\x65","\x6D\x6F\x62\x69\x6C\x65","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x50\x68\x6F\x6E\x65\x20\x6E\x75\x6D\x62\x65\x72\x20\x25\x73\x2E\x20\x4F\x72\x69\x67\x69\x6E\x61\x74\x65\x20\x66\x72\x6F\x6D\x20\x4D\x6F\x74\x69\x6F\x6E\x2E","\x65\x6D\x61\x69\x6C","\x25\x73\x40\x63\x6F\x6D\x70\x61\x6E\x79\x2E\x63\x6F\x6D","\x43\x68\x61\x6E\x6E\x65\x6C\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64\x3A","\x3C\x75\x6E\x6B\x6E\x6F\x77\x6E\x3E","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x43\x72\x65\x61\x74\x65\x20\x74\x69\x63\x6B\x65\x74\x20\x74\x6F\x20\x63\x6F\x6E\x74\x61\x63\x74\x20\x77\x69\x74\x68\x20\x69\x64\x20\x20","\x72\x65\x73\x70\x6F\x6E\x64\x65\x72\x5F\x69\x64","\x72\x65\x71\x75\x65\x73\x74\x65\x72\x5F\x69\x64","\x73\x6F\x75\x72\x63\x65","\x70\x72\x69\x6F\x72\x69\x74\x79","\x73\x74\x61\x74\x75\x73","\x73\x75\x62\x6A\x65\x63\x74","\x50\x68\x6F\x6E\x65\x20\x6E\x75\x6D\x62\x65\x72\x20","\x76\x61\x6C\x75\x65","\x66\x6F\x72\x45\x61\x63\x68","\x63\x75\x73\x74\x6F\x6D\x5F\x66\x69\x65\x6C\x64\x73","\x74\x61\x67\x73","\x2F\x61\x70\x69\x2F\x76\x32\x2F\x74\x69\x63\x6B\x65\x74\x73","\x53\x75\x62\x6A\x65\x63\x74","\x73\x6F\x72\x74\x42\x79","\x74\x79\x70\x65","\x73\x74\x72\x69\x6E\x67","\x63\x6F\x6E\x74\x65\x6E\x74","\x70\x75\x73\x68","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x72\x69\x61\x62\x6C\x65\x4E\x61\x6D\x65","\x63\x75\x73\x74\x6F\x6D\x56\x61\x72\x69\x61\x62\x6C\x65","\x56\x61\x72\x69\x61\x62\x6C\x65","\x20","\x6A\x6F\x69\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x6B\x65\x79\x56\x61\x6C\x75\x65","\x6B\x65\x79\x54\x79\x70\x65","\x6B\x65\x79","\x25\x73\x3A\x20\x25\x73","\x6B\x65\x79\x43\x6F\x6E\x74\x65\x6E\x74","\x3C\x62\x72\x3E","\x46\x69\x65\x6C\x64","\x66\x69\x6C\x74\x65\x72","\x69\x64\x46\x69\x65\x6C\x64","\x54\x61\x67\x73","\x6D\x61\x70","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x54\x69\x63\x6B\x65\x74\x20\x63\x72\x65\x61\x74\x65\x64\x20","\x74\x69\x63\x6B\x65\x74\x49\x64","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x66\x72\x65\x73\x68\x64\x65\x73\x6B","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x65\x78\x69\x74\x53\x74\x61\x74\x75\x73","\x73\x75\x63\x63\x65\x73\x73","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x49\x64","\x73\x75\x62\x74\x79\x70\x65\x43\x68\x61\x6E\x6E\x65\x6C","\x75\x72\x6C","\x2F\x68\x65\x6C\x70\x64\x65\x73\x6B\x2F\x74\x69\x63\x6B\x65\x74\x73\x2F","\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x3A\x66\x72\x65\x73\x68\x64\x65\x73\x6B","\x65\x6D\x69\x74","\x61\x67\x65\x6E\x74\x3A\x25\x73","\x74\x6F","\x63\x72\x65\x61\x74\x65","\x54\x69\x63\x6B\x65\x74\x20\x25\x73\x20\x64\x69\x73\x70\x6C\x61\x79\x65\x64\x20\x74\x6F\x20\x61\x67\x65\x6E\x74\x20\x25\x73","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x74\x69\x63\x6B\x65\x74\x20\x63\x72\x65\x61\x74\x69\x6F\x6E","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x3A\x20","\x6D\x65\x73\x73\x61\x67\x65","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x53\x74\x61\x63\x6B\x3A\x20","\x73\x74\x61\x63\x6B","\x66\x61\x69\x6C\x65\x64","\x5B\x46\x72\x65\x73\x68\x64\x65\x73\x6B\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x52\x65\x70\x6F\x72\x74\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x63\x72\x65\x61\x74\x65","\x73\x75\x62\x73\x74\x72","\x2F","\x5E\x5C\x2F\x7C\x5C\x2F\x24","\x67","\x63\x61\x6C\x6C","\x73\x6C\x69\x63\x65","\x72\x65\x70\x6C\x61\x63\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xf225[0];var _=require(_0xf225[1]);var util=require(_0xf225[2]);var moment=require(_0xf225[3]);var rp=require(_0xf225[4]);var logger=require(_0xf225[6])(_0xf225[5]);var FreshdeskIntegration=require(_0xf225[8])[_0xf225[7]];var IntConfiguration=require(_0xf225[8])[_0xf225[9]];var ReportIntegration=require(_0xf225[8])[_0xf225[10]];var VoiceQueue=require(_0xf225[8])[_0xf225[11]];var VoiceExtension=require(_0xf225[8])[_0xf225[12]];var Agent=require(_0xf225[8])[_0xf225[13]];function Freshdesk(){logger[_0xf225[15]](_0xf225[14])}Freshdesk[_0xf225[17]][_0xf225[16]]= function(_0x6059xd,_0x6059xe,_0x6059xf,_0x6059x10,_0x6059x11,_0x6059x12,_0x6059x13){var _0x6059x14={connection:undefined,configuration:undefined,agent:undefined,enduser:undefined,ticketId:undefined,recordEnable:false,serverUrl:undefined};if(!_0x6059xd||  !_0x6059xe){logger[_0xf225[19]](_0xf225[18]);return};IntConfiguration[_0xf225[22]]({where:{id:_0x6059xe,AccountId:_0x6059xd},include:[{all:true,include:[{all:true}]}]})[_0xf225[21]](handleEntityNotFound())[_0xf225[21]](handleConnection(_0x6059x14))[_0xf225[21]](searchMotionAgent(_0x6059xf,_0x6059x11))[_0xf225[21]](handleMotionAgent(_0x6059x14))[_0xf225[21]](searchQueue(_0x6059x11))[_0xf225[21]](handleQueueRecordings(_0x6059x14,_0x6059x11))[_0xf225[21]](searchRoute(_0x6059x11))[_0xf225[21]](handleOutboundRecordings(_0x6059x14,_0x6059x11))[_0xf225[21]](searchAgent(_0x6059x14))[_0xf225[21]](handleAgent(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059x10))[_0xf225[21]](searchAdmin(_0x6059x14))[_0xf225[21]](handleAdmin(_0x6059x14))[_0xf225[21]](searchContact(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059x10))[_0xf225[21]](searchContactMobile(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059x10))[_0xf225[21]](handleContact(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059x10))[_0xf225[21]](createContact(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059x10))[_0xf225[21]](handleCreateContact(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059x10))[_0xf225[21]](ticketCreation(_0x6059x14,_0x6059x11,_0x6059x12,_0x6059xf,_0x6059x10))[_0xf225[21]](handleTicketDisplay(_0x6059x14))[_0xf225[21]](handleReportIntegration(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059xd,_0x6059x13,_0x6059x10))[_0xf225[21]](handleEnd(_0x6059x14))[_0xf225[20]](handleError(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059xd))};function handleEntityNotFound(){return function(_0x6059x16){return _0x6059x16?_0x6059x16:null}}function handleConnection(_0x6059x14){return function(_0x6059x18){var _0x6059x19=getAccountConfiguration(_0x6059x18.FreshdeskAccount);_0x6059x14[_0xf225[23]]= _0x6059x18;_0x6059x14[_0xf225[24]]= _0x6059x19[_0xf225[24]];_0x6059x14[_0xf225[25]]= _0x6059x19[_0xf225[25]];_0x6059x14[_0xf225[26]]= _0x6059x18[_0xf225[28]][_0xf225[27]][_0xf225[26]];_0x6059x14[_0xf225[29]]= _0x6059x18[_0xf225[27]][_0xf225[29]]}}function getAccountConfiguration(_0x6059x1b){var _0x6059x1c={uri:stripTrailingSlash(_0x6059x1b[_0xf225[30]]),headers:{"\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E":undefined,"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0xf225[31],"\x41\x63\x63\x65\x70\x74":_0xf225[31]}};_0x6059x1c[_0xf225[25]][_0xf225[32]]= _0xf225[33]+  new Buffer(_0x6059x1b[_0xf225[35]]+ _0xf225[36]).toString(_0xf225[34]);return _0x6059x1c}function searchMotionAgent(_0x6059xf,_0x6059x11){return function(){var _0x6059x1e=getAgentSearchPropertyFromChannel(_0x6059xf);if(_0x6059x11[_0xf225[37]](_0x6059x1e)){return Agent[_0xf225[41]](_0xf225[40])[_0xf225[39]]({where:{name:getValueFromPropertyName(_0x6059x11,_0x6059x1e)},attributes:[_0xf225[38]]})};return}}function handleMotionAgent(_0x6059x14){return function(_0x6059x20){if(_0x6059x20&& _0x6059x20[_0xf225[38]]){_0x6059x14[_0xf225[42]]= _0x6059x20[_0xf225[38]]};return}}function searchQueue(_0x6059x11){return function(){if(_0x6059x11[_0xf225[43]]){return VoiceQueue[_0xf225[39]]({where:{name:_0x6059x11[_0xf225[43]]},attributes:[_0xf225[44],_0xf225[45]]})}else {return}}}function handleQueueRecordings(_0x6059x14,_0x6059x11){return function(_0x6059x23){if(_0x6059x11[_0xf225[43]]){if(_0x6059x23&& _0x6059x23[_0xf225[45]]){logger[_0xf225[15]](_0xf225[46]+ _0x6059x23[_0xf225[44]]);_0x6059x14[_0xf225[47]]= true}else {_0x6059x14[_0xf225[47]]= false;logger[_0xf225[15]](_0xf225[48])}};return}}function searchRoute(_0x6059x11){return function(){if(_0x6059x11[_0xf225[49]]){return VoiceExtension[_0xf225[39]]({where:{id:_0x6059x11[_0xf225[49]]},attributes:[_0xf225[50],_0xf225[51]]})}else {return}}}function handleOutboundRecordings(_0x6059x14,_0x6059x11){return function(_0x6059x26){if(_0x6059x11[_0xf225[49]]){if(_0x6059x26&& _0x6059x26[_0xf225[51]]){logger[_0xf225[15]](_0xf225[52]+ _0x6059x26[_0xf225[50]]);_0x6059x14[_0xf225[47]]= true}else {_0x6059x14[_0xf225[47]]= false;logger[_0xf225[15]](_0xf225[53])}};return}}function searchAgent(_0x6059x14){return function(){if(_0x6059x14[_0xf225[42]]){return rp({uri:join_url(_0x6059x14[_0xf225[24]],_0xf225[54]),headers:_0x6059x14[_0xf225[25]],json:true})}};return}function getAgentSearchPropertyFromChannel(_0x6059xf){var _0x6059x29=_0xf225[55];if(_0x6059xf){switch(_0x6059xf){case _0xf225[57]:_0x6059x29= _0xf225[56];break;default:_0x6059x29= _0xf225[56];logger[_0xf225[19]](_0xf225[58]+ _0x6059xf)}};return _0x6059x29}function getValueFromPropertyName(_0x6059x11,_0x6059x29,_0x6059x14){if(_0x6059x29=== _0xf225[59]){if(_0x6059x14&& _0x6059x14[_0xf225[47]]&& _0x6059x14[_0xf225[26]]){return util[_0xf225[62]](_0xf225[60],stripTrailingSlash(_0x6059x14[_0xf225[26]]),_0x6059x11[_0xf225[61]])}else {return null}}else {return _[_0xf225[63]](_0x6059x11,_0x6059x29)}}function handleAgent(_0x6059x14,_0x6059xf,_0x6059x2c,_0x6059x10){return function(_0x6059x11){if(_0x6059x11&& _0x6059x11[_0xf225[64]]> 0){logger[_0xf225[15]](_0xf225[65]+ _0x6059x11[_0xf225[64]]+ _0xf225[66]+ _0x6059x14[_0xf225[42]]);_0x6059x14[_0xf225[40]]= getMatchObject(_0x6059x11,_0xf225[44],_0x6059x14[_0xf225[42]]);return _0x6059x14[_0xf225[40]]}else {logger[_0xf225[15]](_0xf225[67]);return}}}function getMatchObject(_0x6059x2e,_0x6059x29,_0x6059x2f){var _0x6059x30=_[_0xf225[22]](_0x6059x2e,function(_0x6059x31){if(_0x6059x31[_0xf225[68]][_0x6059x29]=== _0x6059x2f){return _0x6059x31}});return _0x6059x30}function searchAdmin(_0x6059x14){return function(){if(_0x6059x14[_0xf225[40]]){return};logger[_0xf225[15]](_0xf225[69]+ _0x6059x14[_0xf225[42]]+ _0xf225[70]);return rp({uri:join_url(_0x6059x14[_0xf225[24]],_0xf225[71]),headers:_0x6059x14[_0xf225[25]],json:true})}}function handleAdmin(_0x6059x14){return function(_0x6059x11){if(!_0x6059x11){return};_0x6059x14[_0xf225[40]]= _0x6059x11;return _0x6059x14[_0xf225[40]]}}function searchContact(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059x10){return function(){var _0x6059x35=getValueFromPropertyName(_0x6059x11,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10),_0x6059x14);logger[_0xf225[15]](_0xf225[72]+ _0x6059x35);return rp({uri:join_url(_0x6059x14[_0xf225[24]],_0xf225[73]+ _0x6059x35),headers:_0x6059x14[_0xf225[25]],json:true})}}function searchContactMobile(_0x6059x14,_0x6059xf,_0x6059x2c,_0x6059x10){return function(_0x6059x11){if(_0x6059x11&& _0x6059x11[_0xf225[64]]> 0){return _0x6059x11};var _0x6059x37=getValueFromPropertyName(_0x6059x2c,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10),_0x6059x14);logger[_0xf225[15]](_0xf225[74]+ _0x6059x37);return rp({uri:join_url(_0x6059x14[_0xf225[24]],_0xf225[75]+ _0x6059x37),headers:_0x6059x14[_0xf225[25]],json:true})}}function getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10){var _0x6059x29=_0xf225[55];if(_0x6059xf){switch(_0x6059xf){case _0xf225[57]:if(_0x6059x10=== _0xf225[76]){_0x6059x29= _0xf225[77]}else {if(_0x6059x10=== _0xf225[43]){_0x6059x29= _0xf225[78]}};break;default:_0x6059x29= _0xf225[78];logger[_0xf225[19]](_0xf225[58]+ _0x6059xf)}};return _0x6059x29}function getEndUserNamePropertyFromChannel(_0x6059xf,_0x6059x10){var _0x6059x29=_0xf225[55];if(_0x6059xf){switch(_0x6059xf){case _0xf225[57]:if(_0x6059x10=== _0xf225[76]){_0x6059x29= _0xf225[79]}else {if(_0x6059x10=== _0xf225[43]){_0x6059x29= _0xf225[80]}};break;default:_0x6059x29= _0xf225[80];logger[_0xf225[19]](_0xf225[58]+ _0x6059xf)}};return _0x6059x29}function handleContact(_0x6059x14,_0x6059xf,_0x6059x2c,_0x6059x10){return function(_0x6059x11){if(!_0x6059x11){return};var _0x6059x3b=getValueFromPropertyName(_0x6059x2c,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10));if(_0x6059x11[_0xf225[64]]> 0){logger[_0xf225[15]](_0xf225[81]+ _0x6059x3b);_0x6059x14[_0xf225[82]]= _0x6059x11[0];return _0x6059x14[_0xf225[82]]};logger[_0xf225[15]](_0xf225[83]+ _0x6059x3b);return}}function createContact(_0x6059x14,_0x6059xf,_0x6059x2c,_0x6059x10){return function(_0x6059x11){if(!_0x6059x11){logger[_0xf225[15]](_0xf225[84]+ getValueFromPropertyName(_0x6059x2c,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10)));logger[_0xf225[85]](getJsonForContactCreation(_0x6059xf,_0x6059x2c,_0x6059x10));var _0x6059x3d={method:_0xf225[86],uri:join_url(_0x6059x14[_0xf225[24]],_0xf225[87]),headers:_0x6059x14[_0xf225[25]],body:getJsonForContactCreation(_0x6059xf,_0x6059x2c,_0x6059x10),json:true};return rp(_0x6059x3d)};return}}function getJsonForContactCreation(_0x6059xf,_0x6059x11,_0x6059x10){var _0x6059x3f={};switch(_0x6059xf){case _0xf225[57]:if(_0x6059x10=== _0xf225[43]){if(isValidName(_0x6059x11[_0xf225[80]])){_0x6059x3f[_0xf225[44]]= getValueFromPropertyName(_0x6059x11,getEndUserNamePropertyFromChannel(_0x6059xf,_0x6059x10))}else {_0x6059x3f[_0xf225[44]]= util[_0xf225[62]](_0xf225[88],getValueFromPropertyName(_0x6059x11,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10)))}}else {if(_0x6059x10=== _0xf225[76]){if(isValidName(_0x6059x11[_0xf225[79]])){_0x6059x3f[_0xf225[44]]= getValueFromPropertyName(_0x6059x11,getEndUserNamePropertyFromChannel(_0x6059xf,_0x6059x10))}else {_0x6059x3f[_0xf225[44]]= util[_0xf225[62]](_0xf225[88],getValueFromPropertyName(_0x6059x11,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10)))}}};_0x6059x3f[_0xf225[89]]= getValueFromPropertyName(_0x6059x11,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10));_0x6059x3f[_0xf225[90]]= getValueFromPropertyName(_0x6059x11,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10));_0x6059x3f[_0xf225[91]]= util[_0xf225[62]](_0xf225[92],getValueFromPropertyName(_0x6059x11,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10)));_0x6059x3f[_0xf225[93]]= util[_0xf225[62]](_0xf225[94],getValueFromPropertyName(_0x6059x11,_0xf225[61]));break;default:console[_0xf225[19]](_0xf225[95],_0x6059xf)};return _0x6059x3f}function isValidName(_0x6059x41){return _0x6059x41&& _0x6059x41!== _0xf225[96]}function handleCreateContact(_0x6059x14,_0x6059xf,_0x6059x2c,_0x6059x10){return function(_0x6059x11){if(_0x6059x11){_0x6059x14[_0xf225[82]]= _0x6059x11};return}}function ticketCreation(_0x6059x14,_0x6059x2c,_0x6059x12,_0x6059xf,_0x6059x10){return function(){logger[_0xf225[15]](_0xf225[97]+ _0x6059x14[_0xf225[82]][_0xf225[50]]);var _0x6059x41=util[_0xf225[62]](_0xf225[88],getValueFromPropertyName(_0x6059x2c,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10)));var _0x6059x35=getValueFromPropertyName(_0x6059x2c,getEndUserSearchPropertyFromChannel(_0x6059xf,_0x6059x10));var _0x6059x44={};_0x6059x44[_0xf225[98]]= _0x6059x14[_0xf225[40]][_0xf225[50]];_0x6059x44[_0xf225[99]]= _0x6059x14[_0xf225[82]][_0xf225[50]];_0x6059x44[_0xf225[44]]= (_0x6059x41|| _0x6059x35);_0x6059x44[_0xf225[89]]= (_0x6059x35|| _0x6059x41);_0x6059x44[_0xf225[100]]= 3;_0x6059x44[_0xf225[101]]= 1;_0x6059x44[_0xf225[102]]= 2;_0x6059x44[_0xf225[103]]= createSubjectFromConfiguration(_0x6059x14,_0x6059x2c,_0x6059x12);if(!_0x6059x44[_0xf225[103]]){_0x6059x44[_0xf225[103]]= _0xf225[104]+ (_0x6059x35|| _0x6059x41)};_0x6059x44[_0xf225[91]]= createDescriptionFromConfiguration(_0x6059x14,_0x6059x2c,_0x6059x12);if(!_0x6059x44[_0xf225[91]]){_0x6059x44[_0xf225[91]]= _0xf225[104]+ (_0x6059x35|| _0x6059x41)};var _0x6059x45=createFieldsFromConfiguration(_0x6059x14,_0x6059x2c,_0x6059x12);if(_0x6059x45[_0xf225[64]]> 0){_[_0xf225[106]](_0x6059x45,function(_0x6059x46){_0x6059x44[_0x6059x46[_0xf225[50]]]= _0x6059x46[_0xf225[105]]})};var _0x6059x47=createCustomFieldsFromConfiguration(_0x6059x14,_0x6059x2c,_0x6059x12);if(_0x6059x47[_0xf225[64]]> 0){_0x6059x44[_0xf225[107]]= {};_[_0xf225[106]](_0x6059x47,function(_0x6059x46){var _0x6059x48=_0x6059x46[_0xf225[50]];_0x6059x44[_0xf225[107]][_0x6059x48]= _0x6059x46[_0xf225[105]]})};var _0x6059x49=createTagsFromConfiguration(_0x6059x14);if(_0x6059x49[_0xf225[64]]> 0){_0x6059x44[_0xf225[108]]= _0x6059x49};logger[_0xf225[85]](_0x6059x44);var _0x6059x3d={method:_0xf225[86],uri:join_url(_0x6059x14[_0xf225[24]],_0xf225[109]),headers:_0x6059x14[_0xf225[25]],body:_0x6059x44,json:true};return rp(_0x6059x3d)}}function createSubjectFromConfiguration(_0x6059x14,_0x6059x2c,_0x6059x12){var _0x6059x4b=_0xf225[55];var _0x6059x4c=[];if(_0x6059x14[_0xf225[23]][_0xf225[110]][_0xf225[64]]> 0){var _0x6059x4d=_[_0xf225[111]](_0x6059x14[_0xf225[23]].Subject,[_0xf225[50]]);_[_0xf225[106]](_0x6059x4d,function(_0x6059x4e){if(_0x6059x4e[_0xf225[112]]=== _0xf225[113]){_0x6059x4c[_0xf225[115]](_0x6059x4e[_0xf225[114]])}else {if(_0x6059x4e[_0xf225[112]]=== _0xf225[116]&& _0x6059x4e[_0xf225[117]]){var _0x6059x3b=getValueFromPropertyName(_0x6059x2c,_0x6059x4e[_0xf225[117]],_0x6059x14);if(_0x6059x3b){_0x6059x4c[_0xf225[115]](_0x6059x3b.toString())}}else {if(_0x6059x4e[_0xf225[112]]=== _0xf225[118]&& _0x6059x4e[_0xf225[119]]&& _0x6059x4e[_0xf225[119]][_0xf225[44]]){_0x6059x12[_0x6059x4e[_0xf225[119]][_0xf225[44]]]&& _0x6059x4c[_0xf225[115]](_0x6059x12[_0x6059x4e[_0xf225[119]][_0xf225[44]]].toString())}}}});_0x6059x4b= _0x6059x4c[_0xf225[121]](_0xf225[120])};return _0x6059x4b}function createDescriptionFromConfiguration(_0x6059x14,_0x6059x2c,_0x6059x12){var _0x6059x50=_0xf225[55];var _0x6059x4c=[];if(_0x6059x14[_0xf225[23]][_0xf225[122]][_0xf225[64]]> 0){var _0x6059x51=_[_0xf225[111]](_0x6059x14[_0xf225[23]].Description,[_0xf225[50]]);_[_0xf225[106]](_0x6059x51,function(_0x6059x4e){if(_0x6059x4e[_0xf225[112]]=== _0xf225[113]){_0x6059x4c[_0xf225[115]](_0x6059x4e[_0xf225[114]])}else {if(_0x6059x4e[_0xf225[112]]=== _0xf225[123]){if(_0x6059x4e[_0xf225[124]]=== _0xf225[113]&& _0x6059x4e[_0xf225[125]]){_0x6059x4c[_0xf225[115]](util[_0xf225[62]](_0xf225[126],_0x6059x4e[_0xf225[125]],_0x6059x4e[_0xf225[127]]))}else {if(_0x6059x4e[_0xf225[124]]=== _0xf225[116]&& _0x6059x4e[_0xf225[117]]&& _0x6059x4e[_0xf225[125]]){var _0x6059x3b=getValueFromPropertyName(_0x6059x2c,_0x6059x4e[_0xf225[117]],_0x6059x14);if(_0x6059x3b){_0x6059x4c[_0xf225[115]](util[_0xf225[62]](_0xf225[126],_0x6059x4e[_0xf225[125]],_0x6059x3b.toString()))}}else {if(_0x6059x4e[_0xf225[124]]=== _0xf225[118]&& _0x6059x4e[_0xf225[119]]&& _0x6059x4e[_0xf225[119]][_0xf225[44]]&& _0x6059x4e[_0xf225[125]]){_0x6059x12[_0x6059x4e[_0xf225[119]][_0xf225[44]]]&& _0x6059x4c[_0xf225[115]](util[_0xf225[62]](_0xf225[126],_0x6059x4e[_0xf225[125]],_0x6059x12[_0x6059x4e[_0xf225[119]][_0xf225[44]]]))}}}}}});_0x6059x50= _0x6059x4c[_0xf225[121]](_0xf225[128])};return _0x6059x50}function createFieldsFromConfiguration(_0x6059x14,_0x6059x2c,_0x6059x12){var _0x6059x45=[];var _0x6059x53=[];if(_0x6059x14[_0xf225[23]][_0xf225[129]][_0xf225[64]]> 0){_0x6059x45= _[_0xf225[130]](_0x6059x14[_0xf225[23]].Field,{"\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64":false});_[_0xf225[106]](_0x6059x45,function(_0x6059x46){if(_0x6059x46[_0xf225[112]]=== _0xf225[113]&& _0x6059x46[_0xf225[131]]){_0x6059x53[_0xf225[115]]({id:_0x6059x46[_0xf225[131]],value:_0x6059x46[_0xf225[114]]})}else {if(_0x6059x46[_0xf225[112]]=== _0xf225[116]&& _0x6059x46[_0xf225[117]]&& _0x6059x46[_0xf225[131]]){var _0x6059x3b=getValueFromPropertyName(_0x6059x2c,_0x6059x46[_0xf225[117]],_0x6059x14);if(_0x6059x3b){_0x6059x53[_0xf225[115]]({id:_0x6059x46[_0xf225[131]],value:_0x6059x3b.toString()})}}else {if(_0x6059x46[_0xf225[112]]=== _0xf225[118]&& _0x6059x46[_0xf225[131]]&& _0x6059x46[_0xf225[119]]&& _0x6059x46[_0xf225[119]][_0xf225[44]]){_0x6059x12[_0x6059x46[_0xf225[119]][_0xf225[44]]]&& _0x6059x53[_0xf225[115]]({id:_0x6059x46[_0xf225[131]],value:_0x6059x12[_0x6059x46[_0xf225[119]][_0xf225[44]]].toString()})}}}})};return _0x6059x53}function createCustomFieldsFromConfiguration(_0x6059x14,_0x6059x2c,_0x6059x12){var _0x6059x47=[];var _0x6059x53=[];if(_0x6059x14[_0xf225[23]][_0xf225[129]][_0xf225[64]]> 0){_0x6059x47= _[_0xf225[130]](_0x6059x14[_0xf225[23]].Field,{"\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64":true});_[_0xf225[106]](_0x6059x47,function(_0x6059x46){if(_0x6059x46[_0xf225[112]]=== _0xf225[113]&& _0x6059x46[_0xf225[131]]){_0x6059x53[_0xf225[115]]({id:_0x6059x46[_0xf225[131]],value:_0x6059x46[_0xf225[114]]})}else {if(_0x6059x46[_0xf225[112]]=== _0xf225[116]&& _0x6059x46[_0xf225[117]]&& _0x6059x46[_0xf225[131]]){var _0x6059x3b=getValueFromPropertyName(_0x6059x2c,_0x6059x46[_0xf225[117]],_0x6059x14);if(_0x6059x3b){_0x6059x53[_0xf225[115]]({id:_0x6059x46[_0xf225[131]],value:_0x6059x3b.toString()})}}else {if(_0x6059x46[_0xf225[112]]=== _0xf225[118]&& _0x6059x46[_0xf225[131]]&& _0x6059x46[_0xf225[119]]&& _0x6059x46[_0xf225[119]][_0xf225[44]]){_0x6059x12[_0x6059x46[_0xf225[119]][_0xf225[44]]]&& _0x6059x53[_0xf225[115]]({id:_0x6059x46[_0xf225[131]],value:_0x6059x12[_0x6059x46[_0xf225[119]][_0xf225[44]]].toString()})}}}})};return _0x6059x53}function createTagsFromConfiguration(_0x6059x14){var _0x6059x49=[];if(_0x6059x14[_0xf225[23]][_0xf225[132]][_0xf225[64]]> 0){_0x6059x49= _[_0xf225[133]](_0x6059x14[_0xf225[23]].Tags,_0xf225[44])};return _0x6059x49}function handleTicketDisplay(_0x6059x14){return function(_0x6059x11){if(_0x6059x11&& _0x6059x11[_0xf225[50]]){logger[_0xf225[15]](_0xf225[134]+ _0x6059x11[_0xf225[50]]);_0x6059x14[_0xf225[135]]= _0x6059x11[_0xf225[50]];return};return}}function handleReportIntegration(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059xd,_0x6059x13,_0x6059x10){return function(){delete _0x6059x11[_0xf225[50]];_0x6059x11[_0xf225[136]]= _0xf225[137];_0x6059x11[_0xf225[138]]= _0x6059xf;_0x6059x11[_0xf225[139]]= _0xf225[140];_0x6059x11[_0xf225[135]]= _0x6059x14[_0xf225[135]];_0x6059x11[_0xf225[141]]= _0x6059xd;_0x6059x11[_0xf225[142]]= _0x6059x10;_0x6059x11[_0xf225[143]]= join_url(_0x6059x14[_0xf225[24]],_0xf225[144]+ _0x6059x14[_0xf225[135]]);_0x6059x13[_0xf225[148]](util[_0xf225[62]](_0xf225[147],_0x6059x11[_0xf225[56]]))[_0xf225[146]](_0xf225[145],_0x6059x11);return ReportIntegration[_0xf225[149]](_0x6059x11)}}function handleEnd(_0x6059x14,_0x6059x11,_0x6059xf){return function(){logger[_0xf225[85]](util[_0xf225[62]](_0xf225[150],_0x6059x14[_0xf225[135]],_0x6059x14[_0xf225[40]][_0xf225[68]][_0xf225[44]]));_0x6059x14= undefined;return}}function handleDebug(_0x6059x14){return function(){logger[_0xf225[85]](_0x6059x14);return}}function handleError(_0x6059x14,_0x6059xf,_0x6059x11,_0x6059xd){return function(_0x6059x5b){logger[_0xf225[19]](_0xf225[151]);logger[_0xf225[19]](_0xf225[152]+ _0x6059x5b[_0xf225[153]]);logger[_0xf225[19]](_0xf225[154]+ _0x6059x5b[_0xf225[155]]);_0x6059x14= undefined;delete _0x6059x11[_0xf225[50]];_0x6059x11[_0xf225[136]]= _0xf225[137];_0x6059x11[_0xf225[138]]= _0x6059xf;_0x6059x11[_0xf225[139]]= _0xf225[156];_0x6059x11[_0xf225[141]]= _0x6059xd;ReportIntegration[_0xf225[149]](_0x6059x11)[_0xf225[21]](function(){return})[_0xf225[20]](function(_0x6059x5b){logger[_0xf225[19]](_0xf225[157]);return})}}function stripTrailingSlash(_0x6059x5d){if(_0x6059x5d[_0xf225[158]](-1) === _0xf225[159]){return _0x6059x5d[_0xf225[158]](0,_0x6059x5d[_0xf225[64]]- 1)};return _0x6059x5d}function join_url(){var _0x6059x5f= new RegExp(_0xf225[160],_0xf225[161]);var _0x6059x60=Array[_0xf225[17]][_0xf225[163]][_0xf225[162]](arguments);return _0x6059x60[_0xf225[133]](function(_0x6059x61){return _0x6059x61[_0xf225[164]](_0x6059x5f,_0xf225[55])})[_0xf225[121]](_0xf225[159])}module[_0xf225[165]]= Freshdesk