dd5f69724f8ef052703e04da9e8f0be735e1a828
[motion.git] / server / api / voice_context / voice_context.ami.js
1 var _0x63e2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\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","\x72\x65\x67\x69\x73\x74\x65\x72","\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\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","\x68","\x6E","\x61\x6E\x79","\x48\x61\x6E\x67\x75\x70","\x68\x61\x6E\x67\x75\x70\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x20\x63\x72\x65\x61\x74\x65\x64","\x63\x72\x65\x61\x74\x65"];_0x63e2[0];var VoiceContext=require(_0x63e2[2])[_0x63e2[1]];var VoiceExtension=require(_0x63e2[2])[_0x63e2[3]];var fs=require(_0x63e2[4]);var util=require(_0x63e2[5]);var path=require(_0x63e2[6]);var config=require(_0x63e2[7]);exports[_0x63e2[8]]=function(_0xc6f3x7){VoiceContext[_0x63e2[14]](function(_0xc6f3x8){if(_0xc6f3x8[_0x63e2[10]](_0x63e2[9])){throw  new Error(_0x63e2[11])};if(_0xc6f3x8[_0x63e2[12]]){throw  new Error(_0x63e2[13])};});VoiceContext[_0x63e2[16]](function(_0xc6f3x9){if(_0xc6f3x9[_0x63e2[12]]){throw  new Error(_0x63e2[15])}});VoiceContext[_0x63e2[17]](function(_0xc6f3xa){rewriteContexts(_0xc6f3xa,_0xc6f3x7,false);createHangup(_0xc6f3xa);});VoiceContext[_0x63e2[18]](function(_0xc6f3xa){rewriteContexts(_0xc6f3xa,_0xc6f3x7,true)});};function rewriteContexts(_0xc6f3xa,_0xc6f3x7,_0xc6f3xc){var _0xc6f3xd=_0x63e2[19];if(!_0xc6f3xc){_0xc6f3xd=util[_0x63e2[21]](_0x63e2[20],_0xc6f3xa[_0x63e2[9]])};VoiceContext[_0x63e2[37]]({where:{id:{$ne:_0xc6f3xa[_0x63e2[36]]}}})[_0x63e2[35]](function(_0xc6f3xf){_0xc6f3xf[_0x63e2[24]](function(_0xc6f3x10){_0xc6f3xd+=util[_0x63e2[21]](_0x63e2[20],_0xc6f3x10[_0x63e2[9]])});fs[_0x63e2[34]](path[_0x63e2[27]](config[_0x63e2[25]],_0x63e2[26]),_0xc6f3xd,{flags:_0x63e2[28],mode:parseInt(_0x63e2[29],8)},function(_0xc6f3xe){if(_0xc6f3xe){throw _0xc6f3xe};console[_0x63e2[22]](_0x63e2[30]);_0xc6f3x7[_0x63e2[33]]({Action:_0x63e2[31]},function(_0xc6f3xe,_0xc6f3x11){if(_0xc6f3xe){console[_0x63e2[32]](_0xc6f3xe)}else {console[_0x63e2[22]](_0xc6f3x11)}});});})[_0x63e2[23]](function(_0xc6f3xe){console[_0x63e2[22]](_0xc6f3xe)});}function createHangup(_0xc6f3xa){var _0xc6f3x13={context:_0xc6f3xa[_0x63e2[9]],exten:_0x63e2[38],priority:_0x63e2[39],VoiceContextId:_0xc6f3xa[_0x63e2[36]],type:_0x63e2[40],app:_0x63e2[41]};VoiceExtension[_0x63e2[43]](_0xc6f3x13)[_0x63e2[35]](function(_0xc6f3x11){console[_0x63e2[22]](_0x63e2[42])})[_0x63e2[23]](function(_0xc6f3xe){console[_0x63e2[22]](_0xc6f3xe)});}