cb3af5d1188fe67711f508146924cba675620aaf
[motion.git] / server / utils / voice_extension.js
1 var _0x7968=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x41\x70\x70\x73","\x72\x6F\x75\x74\x65\x55\x70\x64\x61\x74\x65","\x69\x64","\x62\x6F\x64\x79","\x74\x68\x65\x6E","\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x69\x73\x41\x72\x72\x61\x79","\x6C\x65\x6E\x67\x74\x68","\x70\x61\x72\x61\x6D\x73","\x64\x65\x73\x74\x72\x6F\x79","\x75\x70\x64\x61\x74\x65","\x61\x6C\x6C","\x65\x78\x74\x65\x6E","\x74\x79\x70\x65","\x63\x6F\x6E\x74\x65\x78\x74","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x6D\x65\x72\x67\x65","\x70\x75\x73\x68","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x43\x44\x52\x28\x74\x61\x67\x29\x3D\x25\x73","\x74\x61\x67","\x2D\x2D","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x61\x70\x70","\x61\x67\x69","\x66\x69\x6E\x64","\x56\x4F\x4C\x55\x4D\x45\x28\x52\x58\x29\x3D\x30","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x66\x69\x6C\x74\x65\x72","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x6D\x61\x70","\x2A\x2C\x2A\x2C\x2A\x2C\x2A","\x6E\x61\x6D\x65","\x4E\x6F\x4F\x50","\x20\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x20\x53\x74\x61\x72\x74","\x47\x6F\x74\x6F\x49\x66\x54\x69\x6D\x65","\x25\x73\x3F\x25\x73\x2C\x24\x7B\x45\x58\x54\x45\x4E\x7D\x2C\x25\x73\x3A\x25\x73\x2C\x24\x7B\x45\x58\x54\x45\x4E\x7D\x2C\x25\x73","\x66\x6F\x72\x45\x61\x63\x68","\x64\x69\x61\x6C","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x72\x6F\x75\x74\x65\x69\x64\x3D\x25\x64","","\x53\x6B\x69\x70\x70\x65\x64\x20\x4F\x75\x74\x62\x6F\x75\x6E\x64\x20\x52\x6F\x75\x74\x65\x20\x49\x64\x20\x53\x65\x74","\x61\x70\x70\x64\x61\x74\x61","\x43\x41\x4C\x4C\x45\x52\x49\x44\x28\x61\x6C\x6C\x29\x3D\x25\x73","\x53\x6B\x69\x70\x70\x65\x64\x20\x43\x61\x6C\x6C\x65\x72\x49\x44\x20\x53\x65\x74","\x72\x65\x63\x6F\x72\x64","\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D\x2E","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x46\x6F\x72\x6D\x61\x74","\x77\x61\x76","\x2C\x61\x62","\x53\x6B\x69\x70\x70\x65\x64\x20\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x71\x75\x65\x75\x65","\x61\x70\x70\x54\x79\x70\x65","\x63\x75\x73\x74\x6F\x6D","\x61\x6E\x73\x77\x65\x72","\x50\x72\x6F\x67\x72\x65\x73\x73","\x53\x6B\x69\x70\x70\x65\x64\x20\x50\x72\x6F\x67\x72\x65\x73\x73","\x70\x6C\x61\x79\x62\x61\x63\x6B","\x41\x6E\x73\x77\x65\x72","\x53\x6B\x69\x70\x70\x65\x64\x20\x41\x6E\x73\x77\x65\x72","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x44\x69\x61\x6C","\x78","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x58","\x53\x49\x50\x2F\x25\x73\x2F\x25\x73\x24\x7B\x45\x58\x54\x45\x4E\x3A\x25\x73\x7D\x2C\x25\x73\x2C\x25\x73\x2C\x25\x73","\x63\x75\x74\x64\x69\x67\x69\x74\x73","\x65\x78\x74\x65\x72\x6E\x61\x6C\x44\x69\x61\x6C","\x53\x49\x50\x2F\x25\x73\x2F\x25\x73\x2C\x25\x73\x2C\x25\x73\x2C\x25\x73","\x69\x6E\x74\x65\x72\x6E\x61\x6C\x44\x69\x61\x6C","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73\x2C\x25\x73\x2C\x25\x73","\x2C","\x6A\x6F\x69\x6E","\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x53\x6B\x69\x70\x70\x65\x64\x20\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x20\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x20\x45\x6E\x64","\x20\x63\x61\x6C\x6C\x20\x65\x6E\x64","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x48\x61\x6E\x67\x75\x70","\x66\x69\x6E\x64\x41\x6C\x6C"];_0x7968[0];var _=require(_0x7968[1]);var util=require(_0x7968[2]);var Interval=require(_0x7968[4])[_0x7968[3]];var sequelize=require(_0x7968[4])[_0x7968[5]];var VoiceExtension=require(_0x7968[4])[_0x7968[6]];exports[_0x7968[7]]= createApplications;exports[_0x7968[8]]= function(_0xe937x6,_0xe937x7){var sequelize=require(_0x7968[4])[_0x7968[5]];var VoiceExtension=require(_0x7968[4])[_0x7968[6]];if(_0xe937x6[_0x7968[10]][_0x7968[9]]){delete _0xe937x6[_0x7968[10]][_0x7968[9]]};return VoiceExtension[_0x7968[17]](_0xe937x6[_0x7968[10]],{where:{id:_0xe937x6[_0x7968[15]][_0x7968[9]]},transaction:_0xe937x7})[_0x7968[11]](function(_0xe937x8){if(_0xe937x6[_0x7968[10]][_0x7968[12]]){_0xe937x6[_0x7968[10]][_0x7968[9]]= _0xe937x6[_0x7968[15]][_0x7968[9]];return VoiceExtension[_0x7968[16]]({where:{VoiceExtensionId:_0xe937x6[_0x7968[15]][_0x7968[9]]},transaction:_0xe937x7})}})[_0x7968[11]](function(){if(_0xe937x6[_0x7968[10]][_0x7968[12]]&& Array[_0x7968[13]](_0xe937x6[_0x7968[10]].Applications)&& _0xe937x6[_0x7968[10]][_0x7968[12]][_0x7968[14]]){return _0xe937x6[_0x7968[10]]}})[_0x7968[11]](createApplications(_0xe937x6[_0x7968[10]].Applications,_0xe937x7))};function createApplications(_0xe937xa,_0xe937x7){var Interval=require(_0x7968[4])[_0x7968[3]];var VoiceExtension=require(_0x7968[4])[_0x7968[6]];return function(_0xe937x8){if(_0xe937x8){return Interval[_0x7968[89]]()[_0x7968[11]](function(_0xe937xb){var _0xe937xc=false;var _0xe937xd=false;var _0xe937xe=2;var _0xe937xf={exten:_0xe937x8[_0x7968[19]],type:_0xe937x8[_0x7968[20]],context:_0xe937x8[_0x7968[21]],VoiceExtensionId:_0xe937x8[_0x7968[9]]};var _0xe937x10=[];var _0xe937x11=8;var _0xe937x12=[],_0xe937x13=[];_0xe937x12[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[22],appdata:util[_0x7968[24]](_0x7968[23],_0xe937x8[_0x7968[20]]),priority:_0xe937xe},_0xe937xf));_0xe937xe++;if(_0xe937x8[_0x7968[20]]=== _0x7968[27]){_0xe937x12[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[22],appdata:util[_0x7968[24]](_0x7968[28],_0xe937x8[_0x7968[29]]|| _0x7968[30]),priority:_0xe937xe},_0xe937xf));_0xe937xe++};var _0xe937x14=_[_0x7968[34]](_0xe937xa,function(_0xe937x15){return _0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[33]});if(_0xe937x14){_0xe937x12[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[22],appdata:_0x7968[35],priority:_0xe937xe},_0xe937xf));_0xe937xe++};_0xe937x10[_0x7968[26]](VoiceExtension[_0x7968[36]](_0xe937x12,{transaction:_0xe937x7}));_0xe937xa[_0x7968[47]](function(_0xe937x15){var _0xe937x16=[];var _0xe937x17=[];if(_0xe937x15[_0x7968[37]]){var _0xe937x18=_[_0x7968[38]](_0xe937xb,{IntervalId:_0xe937x15[_0x7968[37]]});_0xe937x16= _0xe937x18[_0x7968[14]]?_[_0x7968[40]](_0xe937x18,_0x7968[39]):[_0x7968[41]];var _0xe937x19=_[_0x7968[34]](_0xe937xb,{id:_0xe937x15[_0x7968[37]]});_0xe937x15[_0x7968[39]]= _0xe937x19?_0xe937x19[_0x7968[42]]:_0x7968[41]}else {_0xe937x16= [_0xe937x15[_0x7968[39]]]};_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0xe937x15[_0x7968[32]]+ _0x7968[44],priority:_0xe937xe},_0xe937xf));_0xe937xe++;var _0xe937x1a=_0xe937x16[_0x7968[14]];_0xe937x16[_0x7968[47]](function(_0xe937x1b,_0xe937x1c){_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[45],appdata:util[_0x7968[24]](_0x7968[46],_0xe937x1b,_0xe937x8[_0x7968[21]],_0xe937xe+ (_0xe937x1a- _0xe937x1c),_0xe937x8[_0x7968[21]],((_0xe937x1c+ 1)< _0xe937x1a)?_0xe937xe+ 1:_0xe937xe+ _0xe937x11),priority:_0xe937xe},_0xe937xf));_0xe937xe++});if(_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]&& _0xe937x8[_0x7968[20]]=== _0x7968[27]){_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[22],appdata:util[_0x7968[24]](_0x7968[49],_0xe937x8[_0x7968[9]]|| _0x7968[50]),priority:_0xe937xe},_0xe937xf))}else {_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0x7968[51],priority:_0xe937xe},_0xe937xf))};_0xe937xe++;if(_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]&& _0xe937x8[_0x7968[20]]=== _0x7968[27]&& _0xe937x15[_0x7968[52]][1]){_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[22],appdata:util[_0x7968[24]](_0x7968[53],_0xe937x15[_0x7968[52]][1]),priority:_0xe937xe},_0xe937xf))}else {_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0x7968[54],priority:_0xe937xe},_0xe937xf))};_0xe937xe++;if(_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]&& _0xe937x8[_0x7968[55]]&& _0xe937x8[_0x7968[20]]=== _0x7968[27]){_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[56],appdata:_0x7968[57]+ (_0xe937x8[_0x7968[58]]|| _0x7968[59])+ _0x7968[60],priority:_0xe937xe},_0xe937xf))}else {_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0x7968[61],priority:_0xe937xe},_0xe937xf))};_0xe937xe++;if(_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[62]&& _0xe937x15[_0x7968[63]]!== _0x7968[64]&&  !_0xe937x15[_0x7968[65]]&&  !_0xe937xd&&  !_0xe937xc){_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[66],appdata:_0x7968[50],priority:_0xe937xe},_0xe937xf));_0xe937xd= true}else {_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0x7968[67],priority:_0xe937xe},_0xe937xf))};_0xe937xe++;if((_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[62]|| _0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[68])&& _0xe937x15[_0x7968[63]]!== _0x7968[64]&& _0xe937x15[_0x7968[65]]&&  !_0xe937xc){_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[69],appdata:_0x7968[50],priority:_0xe937xe},_0xe937xf));_0xe937xc= true;_0xe937xd= true}else {_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0x7968[70],priority:_0xe937xe},_0xe937xf))};_0xe937xe++;if(_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]&& _0xe937x15[_0x7968[63]]=== _0x7968[71]){_0xe937x15[_0x7968[52]][4]= _0xe937x15[_0x7968[52]][4]|| _0x7968[50];_0xe937x15[_0x7968[52]][4]+= (_[_0x7968[73]](_0xe937x15[_0x7968[52]][4],_0x7968[72])?_0x7968[50]:_0x7968[72])+ (_[_0x7968[73]](_0xe937x15[_0x7968[52]][4],_0x7968[74])?_0x7968[50]:_0x7968[74]);_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0xe937x15[_0x7968[32]],appdata:util[_0x7968[24]](_0x7968[75],_0xe937x15[_0x7968[52]][0],_0xe937x15[_0x7968[52]][2]|| _0x7968[50],_0xe937x8[_0x7968[76]]|| 0,_0xe937x15[_0x7968[52]][3]|| _0x7968[50],_0xe937x15[_0x7968[52]][4]|| _0x7968[50],_0xe937x15[_0x7968[52]][5]|| _0x7968[50]),priority:_0xe937xe,IntervalId:_0xe937x15[_0x7968[37]]|| null,interval:_0xe937x15[_0x7968[39]]|| _0x7968[41],isApp:true,callerID:_0xe937x15[_0x7968[52]][1]|| null,appType:_0xe937x15[_0x7968[63]]},_0xe937xf))}else {if(_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]&& _0xe937x15[_0x7968[63]]=== _0x7968[77]){_0xe937x15[_0x7968[52]][3]= _0xe937x15[_0x7968[52]][3]|| _0x7968[50];_0xe937x15[_0x7968[52]][3]+= (_[_0x7968[73]](_0xe937x15[_0x7968[52]][3],_0x7968[72])?_0x7968[50]:_0x7968[72])+ (_[_0x7968[73]](_0xe937x15[_0x7968[52]][3],_0x7968[74])?_0x7968[50]:_0x7968[74]);_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0xe937x15[_0x7968[32]],appdata:util[_0x7968[24]](_0x7968[78],_0xe937x15[_0x7968[52]][0],_0xe937x15[_0x7968[52]][1],_0xe937x15[_0x7968[52]][2]|| _0x7968[50],_0xe937x15[_0x7968[52]][3]|| _0x7968[50],_0xe937x15[_0x7968[52]][4]|| _0x7968[50]),priority:_0xe937xe,IntervalId:_0xe937x15[_0x7968[37]]|| null,interval:_0xe937x15[_0x7968[39]]|| _0x7968[41],isApp:true,appType:_0xe937x15[_0x7968[63]]},_0xe937xf))}else {if(_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]&& _0xe937x15[_0x7968[63]]=== _0x7968[79]){_0xe937x15[_0x7968[52]][2]= _0xe937x15[_0x7968[52]][2]|| _0x7968[50];_0xe937x15[_0x7968[52]][2]+= (_[_0x7968[73]](_0xe937x15[_0x7968[52]][2],_0x7968[72])?_0x7968[50]:_0x7968[72])+ (_[_0x7968[73]](_0xe937x15[_0x7968[52]][2],_0x7968[74])?_0x7968[50]:_0x7968[74]);_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0xe937x15[_0x7968[32]],appdata:util[_0x7968[24]](_0x7968[80],_0xe937x15[_0x7968[52]][0],_0xe937x15[_0x7968[52]][1]|| _0x7968[50],_0xe937x15[_0x7968[52]][2]|| _0x7968[50],_0xe937x15[_0x7968[52]][3]|| _0x7968[50]),priority:_0xe937xe,IntervalId:_0xe937x15[_0x7968[37]]|| null,interval:_0xe937x15[_0x7968[39]]|| _0x7968[41],isApp:true,appType:_0xe937x15[_0x7968[63]]},_0xe937xf))}else {if((_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]|| _0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[62])&& _0xe937x15[_0x7968[63]]!== _0x7968[64]){var _0xe937x1d=_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]?2:1;_0xe937x15[_0x7968[52]][_0xe937x1d]= _0xe937x15[_0x7968[52]][_0xe937x1d]|| _0x7968[50];_0xe937x15[_0x7968[52]][_0xe937x1d]+= (_[_0x7968[73]](_0xe937x15[_0x7968[52]][_0xe937x1d],_0x7968[72])?_0x7968[50]:_0x7968[72])+ (_[_0x7968[73]](_0xe937x15[_0x7968[52]][_0xe937x1d],_0x7968[74])?_0x7968[50]:_0x7968[74])};_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0xe937x15[_0x7968[32]],appdata:_0xe937x15[_0x7968[52]][_0x7968[82]](_0x7968[81]),priority:_0xe937xe,IntervalId:_0xe937x15[_0x7968[37]],interval:_0xe937x15[_0x7968[39]]|| _0x7968[41],isApp:true,appType:_0xe937x15[_0x7968[63]]|| null,answer:_0xe937x15[_0x7968[65]]|| false},_0xe937xf))}}};_0xe937xe++;if(_0xe937x15[_0x7968[32]][_0x7968[31]]()=== _0x7968[48]&& _0xe937x8[_0x7968[55]]&& _0xe937x8[_0x7968[20]]=== _0x7968[27]){_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[83],appdata:_0x7968[50],priority:_0xe937xe},_0xe937xf))}else {_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0x7968[84],priority:_0xe937xe},_0xe937xf))};_0xe937xe++;_0xe937x17[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0xe937x15[_0x7968[32]]+ _0x7968[85],priority:_0xe937xe},_0xe937xf));_0xe937xe++;_0xe937x10[_0x7968[26]](VoiceExtension[_0x7968[36]](_0xe937x17,{transaction:_0xe937x7}))});_0xe937x13[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[43],appdata:_0xe937x8[_0x7968[20]]+ _0x7968[86],priority:_0xe937xe},_0xe937xf));_0xe937xe++;if(_0xe937x8[_0x7968[20]]=== _0x7968[87]|| _0xe937x8[_0x7968[20]]=== _0x7968[27]){_0xe937x13[_0x7968[26]](_[_0x7968[25]]({app:_0x7968[88],appdata:_0x7968[50],priority:_0xe937xe},_0xe937xf));_0xe937xe++};_0xe937x10[_0x7968[26]](VoiceExtension[_0x7968[36]](_0xe937x13,{transaction:_0xe937x7}));return _0xe937x10})[_0x7968[18]]()}}}