24741e9a93c4a4c1d709311539c07614bb666fa8
[motion.git] / server / config / ami / voice_context.js
1 var _0xd512=["\x56\x6F\x69\x63\x65\x43\x6F\x6E\x74\x65\x78\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6E\x61\x6D\x65","\x63\x68\x61\x6E\x67\x65\x64","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x61\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x6E\x61\x6D\x65","\x64\x65\x66\x61\x75\x6C\x74\x45\x6E\x74\x72\x79","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x61\x20\x64\x65\x66\x61\x75\x6C\x74\x20\x63\x6F\x6E\x74\x65\x78\x74","\x62\x65\x66\x6F\x72\x65\x55\x70\x64\x61\x74\x65","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x64\x65\x6C\x65\x74\x65\x20\x61\x20\x64\x65\x66\x61\x75\x6C\x74\x20\x63\x6F\x6E\x74\x65\x78\x74","\x62\x65\x66\x6F\x72\x65\x44\x65\x6C\x65\x74\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","","\x5B\x25\x73\x5D\x0A\x69\x6E\x63\x6C\x75\x64\x65\x20\x3D\x3E\x20\x25\x73\x2D\x63\x75\x73\x74\x6F\x6D\x0A\x73\x77\x69\x74\x63\x68\x20\x3D\x3E\x20\x52\x65\x61\x6C\x74\x69\x6D\x65\x0A","\x66\x6F\x72\x6D\x61\x74","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x66\x6F\x72\x45\x61\x63\x68","\x61\x73\x74\x65\x72\x69\x73\x6B\x43\x6F\x6E\x66","\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73\x5F\x78\x63\x61\x6C\x6C\x79\x5F\x63\x6F\x6E\x74\x65\x78\x74\x73\x2E\x63\x6F\x6E\x66","\x6A\x6F\x69\x6E","\x77","\x30\x37\x37\x37","\x43\x6F\x6E\x74\x65\x78\x74\x73\x20\x66\x69\x6C\x65\x20\x73\x61\x76\x65\x64\x21","\x52\x65\x6C\x6F\x61\x64","\x65\x72\x72\x6F\x72","\x61\x63\x74\x69\x6F\x6E","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65\x20\x63\x6F\x6E\x74\x65\x78\x74\x20\x68\x61\x6E\x67\x75\x70","\x68","\x31","\x73\x79\x73\x74\x65\x6D","\x48\x61\x6E\x67\x75\x70","\x66\x61\x69\x6C\x65\x64","\x68\x61\x6E\x67\x75\x70\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x20\x63\x72\x65\x61\x74\x65\x64","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var VoiceContext=require(_0xd512[1])[_0xd512[0]];var VoiceExtension=require(_0xd512[1])[_0xd512[2]];var fs=require(_0xd512[3]);var util=require(_0xd512[4]);var path=require(_0xd512[5]);var config=require(_0xd512[6]);function Context(_0x2192x8){VoiceContext[_0xd512[12]](function(_0x2192x9){if(_0x2192x9[_0xd512[8]](_0xd512[7])){throw  new Error(_0xd512[9])};if(_0x2192x9[_0xd512[10]]){throw  new Error(_0xd512[11])}});VoiceContext[_0xd512[14]](function(_0x2192xa){if(_0x2192xa[_0xd512[10]]){throw  new Error(_0xd512[13])}});VoiceContext[_0xd512[15]](function(_0x2192xb){rewriteContexts(_0x2192xb,_0x2192x8,false);createHangup(_0x2192xb)});VoiceContext[_0xd512[16]](function(_0x2192xb){rewriteContexts(_0x2192xb,_0x2192x8,true)})}function rewriteContexts(_0x2192xb,_0x2192x8,_0x2192xd){var _0x2192xe=_0xd512[17];if(!_0x2192xd){_0x2192xe= util[_0xd512[19]](_0xd512[18],_0x2192xb[_0xd512[7]],_0x2192xb[_0xd512[7]])};VoiceContext[_0xd512[35]]({where:{id:{$ne:_0x2192xb[_0xd512[34]]}}})[_0xd512[33]](function(_0x2192x10){_0x2192x10[_0xd512[22]](function(_0x2192x11){_0x2192xe+= util[_0xd512[19]](_0xd512[18],_0x2192x11[_0xd512[7]],_0x2192x11[_0xd512[7]])});fs[_0xd512[32]](path[_0xd512[25]](config[_0xd512[23]],_0xd512[24]),_0x2192xe,{flags:_0xd512[26],mode:parseInt(_0xd512[27],8)},function(_0x2192xf){if(_0x2192xf){throw _0x2192xf};console[_0xd512[20]](_0xd512[28]);_0x2192x8[_0xd512[31]]({Action:_0xd512[29]},function(_0x2192xf,_0x2192x12){if(_0x2192xf){console[_0xd512[30]](_0x2192xf)}else {console[_0xd512[20]](_0x2192x12)}})})})[_0xd512[21]](function(_0x2192xf){console[_0xd512[20]](_0x2192xf)})}function createHangup(_0x2192xb){console[_0xd512[20]](_0xd512[36],_0x2192xb[_0xd512[7]]);var _0x2192x14=[{context:_0x2192xb[_0xd512[7]],exten:_0xd512[37],priority:_0xd512[38],VoiceContextId:_0x2192xb[_0xd512[34]],type:_0xd512[39],app:_0xd512[40]},{context:_0x2192xb[_0xd512[7]],exten:_0xd512[41],priority:_0xd512[38],VoiceContextId:_0x2192xb[_0xd512[34]],type:_0xd512[39],app:_0xd512[40]}];return VoiceExtension[_0xd512[43]](_0x2192x14)[_0xd512[33]](function(_0x2192x12){console[_0xd512[20]](_0xd512[42])})[_0xd512[21]](function(_0x2192xf){console[_0xd512[20]](_0x2192xf)})}module[_0xd512[44]]= Context