Built motion from commit bab6f49e.|2.6.17
[motion2.git] / server / api / webbar / webbar.controller.js
index 1b8667f..9d4ec38 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc03=['send','NotFound','request','then','code','message','result','catch','User','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','info','format','json','originate\x20executed!','hangup','hangup\x20fired:','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','stringify','handleError:','error','stack','name','status'];(function(_0x3bb2ac,_0x1c7310){var _0x5ec771=function(_0x2aaed1){while(--_0x2aaed1){_0x3bb2ac['push'](_0x3bb2ac['shift']());}};_0x5ec771(++_0x1c7310);}(_0xfc03,0x16f));var _0x3fc0=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xfc03[_0x3e44fa];return _0x2a0aba;};'use strict';var path=require(_0x3fc0('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x3fc0('0x1'))['db'];var config=require(_0x3fc0('0x2'));var util=require('util');var BPromise=require(_0x3fc0('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x3fc0('0x4')][_0x3fc0('0x5')]({'port':0x232a});var logger=require(_0x3fc0('0x6'))(_0x3fc0('0x7'));var Redis=require(_0x3fc0('0x8'));config[_0x3fc0('0x9')]=_[_0x3fc0('0xa')](config[_0x3fc0('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x3fc0('0xb'))(new Redis(config['redis']));var Schema=require(_0x3fc0('0xc'));var originateValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],_0x3fc0('0xe')]},'callNumber':{'type':_0x3fc0('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x3fc0('0xf')},'callbackUrl':{'type':_0x3fc0('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],_0x3fc0('0xe')]},'sessionId':{'type':_0x3fc0('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3fc0('0xe')]},'sessionId':{'type':_0x3fc0('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3fc0('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x3fc0('0xf'),'required':[!![],_0x3fc0('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3fc0('0xe')]},'sessionId':{'type':_0x3fc0('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3fc0('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],_0x3fc0('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x277dbf,_0x3d869e,_0x3ef95e){logger['info'](_0x277dbf,_0x3d869e,JSON[_0x3fc0('0x11')](_0x3ef95e));io['to'](_0x277dbf)['emit'](_0x3d869e,_0x3ef95e);}function handleError(_0x121931){return function(_0x3c5026){console['log'](_0x3fc0('0x12'),_0x3c5026,_0x3c5026 instanceof RangeError);logger[_0x3fc0('0x13')](_0x3c5026[_0x3fc0('0x14')]);if(_0x3c5026 instanceof RangeError){if(_0x3c5026[_0x3fc0('0x15')]){delete _0x3c5026[_0x3fc0('0x15')];}_0x121931[_0x3fc0('0x16')](0x194)[_0x3fc0('0x17')](_0x3c5026);}else{if(_0x3c5026[_0x3fc0('0x15')]){delete _0x3c5026[_0x3fc0('0x15')];}_0x121931['status'](0x1f4)[_0x3fc0('0x17')](_0x3c5026);}};}function checkError(){return function(_0x9ab2c5){if(!_0x9ab2c5){throw new RangeError(_0x3fc0('0x18'));}return _0x9ab2c5;};}function respondWithRpcPromise(_0x3d6c0a,_0x3a09cd){return new BPromise(function(_0x448293,_0x47c770){var _0x477674=amiClient;return _0x477674[_0x3fc0('0x19')](_0x3d6c0a,_0x3a09cd)[_0x3fc0('0x1a')](function(_0x28fc65){if(_0x28fc65[_0x3fc0('0x13')]){if(_0x28fc65[_0x3fc0('0x13')][_0x3fc0('0x1b')]===0x1f4){return _0x47c770(_0x28fc65[_0x3fc0('0x13')][_0x3fc0('0x1c')]);}return _0x448293(_0x28fc65[_0x3fc0('0x13')][_0x3fc0('0x1c')]);}else{_0x448293(_0x28fc65[_0x3fc0('0x1d')]);}})[_0x3fc0('0x1e')](function(_0xba1a23){_0x47c770(_0xba1a23);});});}function getAgent(_0x55f507){return db[_0x3fc0('0x1f')]['findOne']({'where':{'id':_0x55f507,'role':_0x3fc0('0x20')}})[_0x3fc0('0x1a')](checkError());}function getAgentCheckSession(_0x1d9932,_0x35c34c){return new BPromise(function(_0x5a9179,_0x134317){var _0x197dfa=respondWithRpcPromise(_0x3fc0('0x21'));var _0x2645b4=getAgent(_0x1d9932);Promise['all']([_0x197dfa,_0x2645b4])[_0x3fc0('0x1a')](function(_0x1a2261){var _0x1960a4=_0x1a2261[0x0];var _0xac736c=_0x1a2261[0x1];var _0x29aa32=_[_0x3fc0('0x22')](_0x1960a4['rows'],function(_0xd9ecae){return _0xd9ecae[_0x3fc0('0x23')]==_0xac736c['id']&&_0xd9ecae[_0x3fc0('0x24')]==_0x35c34c;});if(_0x29aa32[_0x3fc0('0x25')]==0x1){_0x5a9179(_0xac736c);}else{_0x134317(new RangeError(_0x3fc0('0x26')+_0x35c34c+_0x3fc0('0x27')));}});});}exports[_0x3fc0('0x28')]=function(_0x164a96,_0x4d6551){logger['info'](_0x3fc0('0x29'),_0x164a96['body']);var _0x58d698=originateValidation[_0x3fc0('0xc')](_0x164a96[_0x3fc0('0x2a')]);if(_0x58d698[_0x3fc0('0x25')]>0x0){return _0x4d6551[_0x3fc0('0x16')](0x190)['json'](_0x58d698);}var _0x4dc8cd=_0x164a96[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x151492=_0x164a96[_0x3fc0('0x2a')][_0x3fc0('0x2c')];var _0x5f0ca1=_0x164a96[_0x3fc0('0x2a')][_0x3fc0('0x2d')];var _0x399c9c=_0x164a96['body'][_0x3fc0('0x2e')];return getAgent(_0x4dc8cd)[_0x3fc0('0x1a')](function(_0x325a2f){logger[_0x3fc0('0x2f')]('entityFound:',_0x325a2f[_0x3fc0('0x15')]);emit(util[_0x3fc0('0x30')]('user:%s',_0x325a2f[_0x3fc0('0x15')]),'webbar:originate',{'callNumber':_0x151492,'callerId':_0x5f0ca1,'callbackUrl':_0x399c9c});return _0x4d6551[_0x3fc0('0x16')](0xc8)[_0x3fc0('0x31')]({'error':![],'message':_0x3fc0('0x32')});})[_0x3fc0('0x1e')](handleError(_0x4d6551));};exports[_0x3fc0('0x33')]=function(_0x104332,_0x469d4b){logger[_0x3fc0('0x2f')](_0x3fc0('0x34'),_0x104332[_0x3fc0('0x2a')]);var _0x41b4b3=hangupValidation['validate'](_0x104332[_0x3fc0('0x2a')]);if(_0x41b4b3[_0x3fc0('0x25')]>0x0){return _0x469d4b[_0x3fc0('0x16')](0x190)[_0x3fc0('0x31')](_0x41b4b3);}var _0x21de4c=_0x104332[_0x3fc0('0x2a')]['userId'];var _0x5ae22c=_0x104332[_0x3fc0('0x2a')][_0x3fc0('0x24')];return getAgent(_0x21de4c)[_0x3fc0('0x1a')](function(_0x3e285f){logger[_0x3fc0('0x2f')]('entityFound:',_0x3e285f['name']);emit(util['format'](_0x3fc0('0x35'),_0x3e285f[_0x3fc0('0x15')]),_0x3fc0('0x36'),{'sessionId':_0x5ae22c});return _0x469d4b['status'](0xc8)['json']({'error':![],'message':_0x3fc0('0x37')});})[_0x3fc0('0x1e')](handleError(_0x469d4b));};exports[_0x3fc0('0x38')]=function(_0x10b845,_0x494c66){logger['info'](_0x3fc0('0x39'),_0x10b845[_0x3fc0('0x2a')]);var _0x547670=answerValidation[_0x3fc0('0xc')](_0x10b845['body']);if(_0x547670[_0x3fc0('0x25')]>0x0){return _0x494c66[_0x3fc0('0x16')](0x190)[_0x3fc0('0x31')](_0x547670);}var _0x90120f=_0x10b845[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x80dfee=_0x10b845[_0x3fc0('0x2a')]['sessionId'];return getAgent(_0x90120f)[_0x3fc0('0x1a')](function(_0x5bd6a8){logger[_0x3fc0('0x2f')](_0x3fc0('0x3a'),_0x5bd6a8[_0x3fc0('0x15')]);emit(util[_0x3fc0('0x30')](_0x3fc0('0x35'),_0x5bd6a8['name']),_0x3fc0('0x3b'),{'sessionId':_0x80dfee});return _0x494c66[_0x3fc0('0x16')](0xc8)[_0x3fc0('0x31')]({'error':![],'message':_0x3fc0('0x3c')});})['catch'](handleError(_0x494c66));};exports[_0x3fc0('0x3d')]=function(_0x5a1672,_0x21c065){logger[_0x3fc0('0x2f')](_0x3fc0('0x3e'),_0x5a1672[_0x3fc0('0x2a')]);var _0x277480=holdValidation['validate'](_0x5a1672[_0x3fc0('0x2a')]);if(_0x277480[_0x3fc0('0x25')]>0x0){return _0x21c065[_0x3fc0('0x16')](0x190)['json'](_0x277480);}var _0x3df404=_0x5a1672[_0x3fc0('0x2a')]['userId'];var _0x1f5e6a=_0x5a1672[_0x3fc0('0x2a')][_0x3fc0('0x24')];return getAgent(_0x3df404)['then'](function(_0x5e5c73){logger[_0x3fc0('0x2f')](_0x3fc0('0x3a'),_0x5e5c73[_0x3fc0('0x15')]);emit(util['format'](_0x3fc0('0x35'),_0x5e5c73['name']),_0x3fc0('0x3f'),{'sessionId':_0x1f5e6a});return _0x21c065['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x3fc0('0x1e')](handleError(_0x21c065));};exports[_0x3fc0('0x40')]=function(_0x141b4c,_0x3730f5){logger[_0x3fc0('0x2f')](_0x3fc0('0x41'),_0x141b4c['body']);var _0x2cf279=unholdValidation[_0x3fc0('0xc')](_0x141b4c['body']);if(_0x2cf279['length']>0x0){return _0x3730f5[_0x3fc0('0x16')](0x190)[_0x3fc0('0x31')](_0x2cf279);}var _0x1f070b=_0x141b4c[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x330b8f=_0x141b4c[_0x3fc0('0x2a')][_0x3fc0('0x24')];return getAgent(_0x1f070b)[_0x3fc0('0x1a')](function(_0x1cc9f2){logger[_0x3fc0('0x2f')](_0x3fc0('0x3a'),_0x1cc9f2['name']);emit(util[_0x3fc0('0x30')](_0x3fc0('0x35'),_0x1cc9f2[_0x3fc0('0x15')]),_0x3fc0('0x42'),{'sessionId':_0x330b8f});return _0x3730f5[_0x3fc0('0x16')](0xc8)['json']({'error':![],'message':_0x3fc0('0x43')});})['catch'](handleError(_0x3730f5));};exports[_0x3fc0('0x44')]=function(_0xa4864f,_0x397434){logger[_0x3fc0('0x2f')]('calls\x20fired:',_0x397434[_0x3fc0('0x2a')]);var _0xd903e3=callsValidation[_0x3fc0('0xc')](_0xa4864f[_0x3fc0('0x2a')]);if(_0xd903e3[_0x3fc0('0x25')]>0x0){return _0x397434[_0x3fc0('0x16')](0x190)['json'](_0xd903e3);}var _0x2c5ca1=_0xa4864f[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x21c46f=respondWithRpcPromise(_0x3fc0('0x21'));var _0x737d45=getAgent(_0x2c5ca1);return Promise['all']([_0x21c46f,_0x737d45])[_0x3fc0('0x1a')](function(_0x258a27){var _0x3e04a1=_0x258a27[0x0];var _0x5a3732=_0x258a27[0x1];var _0x2cc735=_[_0x3fc0('0x22')](_0x3e04a1[_0x3fc0('0x45')],function(_0x2b709c){return _0x2b709c[_0x3fc0('0x23')]==_0x5a3732['id'];});return _0x397434[_0x3fc0('0x16')](0xc8)[_0x3fc0('0x31')]({'count':_0x2cc735[_0x3fc0('0x25')],'rows':_0x2cc735});})[_0x3fc0('0x1e')](handleError(_0x397434));};exports[_0x3fc0('0x46')]=function(_0x4a5b96,_0x194a3b){logger[_0x3fc0('0x2f')](_0x3fc0('0x47'),_0x4a5b96[_0x3fc0('0x2a')]);var _0x4cb346=conferenceValidation[_0x3fc0('0xc')](_0x4a5b96[_0x3fc0('0x2a')]);if(_0x4cb346[_0x3fc0('0x25')]>0x0){return _0x194a3b[_0x3fc0('0x16')](0x190)[_0x3fc0('0x31')](_0x4cb346);}var _0x27a828=_0x4a5b96[_0x3fc0('0x2a')][_0x3fc0('0x2b')];return getAgent(_0x27a828)[_0x3fc0('0x1a')](function(_0x2b9226){logger['info'](_0x3fc0('0x3a'),_0x2b9226[_0x3fc0('0x15')]);emit(util[_0x3fc0('0x30')](_0x3fc0('0x35'),_0x2b9226[_0x3fc0('0x15')]),_0x3fc0('0x48'));return _0x194a3b['status'](0xc8)[_0x3fc0('0x31')]({'error':![],'message':_0x3fc0('0x49')});})[_0x3fc0('0x1e')](handleError(_0x194a3b));};exports['transfer']=function(_0x40f6d8,_0x431087){logger[_0x3fc0('0x2f')](_0x3fc0('0x4a'),_0x40f6d8[_0x3fc0('0x2a')]);var _0x12758a=transferValidation[_0x3fc0('0xc')](_0x40f6d8[_0x3fc0('0x2a')]);if(_0x12758a[_0x3fc0('0x25')]>0x0){return _0x431087['status'](0x190)[_0x3fc0('0x31')](_0x12758a);}var _0x16cd67=_0x40f6d8[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x3b9b6f=_0x40f6d8['body'][_0x3fc0('0x24')];var _0x42c1ee=_0x40f6d8[_0x3fc0('0x2a')][_0x3fc0('0x4b')];return getAgent(_0x16cd67)[_0x3fc0('0x1a')](function(_0x20e372){logger[_0x3fc0('0x2f')](_0x3fc0('0x3a'),_0x20e372[_0x3fc0('0x15')]);emit(util[_0x3fc0('0x30')](_0x3fc0('0x35'),_0x20e372['name']),_0x3fc0('0x4c'),{'sessionId':_0x3b9b6f,'transferNumber':_0x42c1ee});return _0x431087['status'](0xc8)[_0x3fc0('0x31')]({'error':![],'message':_0x3fc0('0x4d')});})[_0x3fc0('0x1e')](handleError(_0x431087));};
\ No newline at end of file
+var _0x4bc3=['transfer\x20executed!','path','lodash','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','log','handleError:','stack','name','status','send','NotFound','error','code','message','result','catch','findOne','all','then','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate\x20fired:','body','userId','callerId','info','entityFound:','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer'];(function(_0x502378,_0x532792){var _0x238a67=function(_0x58f46e){while(--_0x58f46e){_0x502378['push'](_0x502378['shift']());}};_0x238a67(++_0x532792);}(_0x4bc3,0x16e));var _0x34bc=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x4bc3[_0x119d5a];return _0x15bff4;};'use strict';var path=require(_0x34bc('0x0'));var fs=require('fs');var _=require(_0x34bc('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x34bc('0x2'));var util=require(_0x34bc('0x3'));var BPromise=require('bluebird');var jayson=require(_0x34bc('0x4'));var amiClient=jayson[_0x34bc('0x5')][_0x34bc('0x6')]({'port':0x232a});var logger=require(_0x34bc('0x7'))(_0x34bc('0x8'));var Redis=require(_0x34bc('0x9'));config[_0x34bc('0xa')]=_['defaults'](config[_0x34bc('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x34bc('0xa')]));var Schema=require(_0x34bc('0xb'));var originateValidation=new Schema({'userId':{'type':_0x34bc('0xc'),'required':[!![],_0x34bc('0xd')]},'callNumber':{'type':_0x34bc('0xe'),'required':[!![],_0x34bc('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x34bc('0xc'),'required':[!![],_0x34bc('0xd')]},'sessionId':{'type':_0x34bc('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x34bc('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x34bc('0xc'),'required':[!![],_0x34bc('0xd')]},'sessionId':{'type':_0x34bc('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x34bc('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x34bc('0xc'),'required':[!![],_0x34bc('0xd')]},'sessionId':{'type':_0x34bc('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x34bc('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x34bc('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x34bc('0xc'),'required':[!![],_0x34bc('0xd')]}});function emit(_0x25da29,_0x2db2dd,_0x69542f){logger['info'](_0x25da29,_0x2db2dd,JSON['stringify'](_0x69542f));io['to'](_0x25da29)['emit'](_0x2db2dd,_0x69542f);}function handleError(_0x4205eb){return function(_0x3eaedf){console[_0x34bc('0x10')](_0x34bc('0x11'),_0x3eaedf,_0x3eaedf instanceof RangeError);logger['error'](_0x3eaedf[_0x34bc('0x12')]);if(_0x3eaedf instanceof RangeError){if(_0x3eaedf[_0x34bc('0x13')]){delete _0x3eaedf['name'];}_0x4205eb[_0x34bc('0x14')](0x194)[_0x34bc('0x15')](_0x3eaedf);}else{if(_0x3eaedf['name']){delete _0x3eaedf[_0x34bc('0x13')];}_0x4205eb[_0x34bc('0x14')](0x1f4)[_0x34bc('0x15')](_0x3eaedf);}};}function checkError(){return function(_0x120bd3){if(!_0x120bd3){throw new RangeError(_0x34bc('0x16'));}return _0x120bd3;};}function respondWithRpcPromise(_0x42c814,_0x48087e){return new BPromise(function(_0x40e128,_0x3c9939){var _0x38882c=amiClient;return _0x38882c['request'](_0x42c814,_0x48087e)['then'](function(_0x358d51){if(_0x358d51[_0x34bc('0x17')]){if(_0x358d51[_0x34bc('0x17')][_0x34bc('0x18')]===0x1f4){return _0x3c9939(_0x358d51[_0x34bc('0x17')][_0x34bc('0x19')]);}return _0x40e128(_0x358d51[_0x34bc('0x17')][_0x34bc('0x19')]);}else{_0x40e128(_0x358d51[_0x34bc('0x1a')]);}})[_0x34bc('0x1b')](function(_0x2de017){_0x3c9939(_0x2de017);});});}function getAgent(_0x1edcb0){return db['User'][_0x34bc('0x1c')]({'where':{'id':_0x1edcb0,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x3da96b,_0x5332c8){return new BPromise(function(_0x4082c3,_0x446b58){var _0x46fd76=respondWithRpcPromise('VoiceChannels');var _0x2e6d96=getAgent(_0x3da96b);Promise[_0x34bc('0x1d')]([_0x46fd76,_0x2e6d96])[_0x34bc('0x1e')](function(_0x1a83f7){var _0x2bb874=_0x1a83f7[0x0];var _0x33bf46=_0x1a83f7[0x1];var _0x520fd4=_[_0x34bc('0x1f')](_0x2bb874[_0x34bc('0x20')],function(_0x22aacc){return _0x22aacc[_0x34bc('0x21')]==_0x33bf46['id']&&_0x22aacc[_0x34bc('0x22')]==_0x5332c8;});if(_0x520fd4[_0x34bc('0x23')]==0x1){_0x4082c3(_0x33bf46);}else{_0x446b58(new RangeError('sessionId\x20'+_0x5332c8+_0x34bc('0x24')));}});});}exports['originate']=function(_0x530748,_0x42fd40){logger['info'](_0x34bc('0x25'),_0x530748[_0x34bc('0x26')]);var _0xb446f4=originateValidation[_0x34bc('0xb')](_0x530748[_0x34bc('0x26')]);if(_0xb446f4[_0x34bc('0x23')]>0x0){return _0x42fd40[_0x34bc('0x14')](0x190)['json'](_0xb446f4);}var _0xbd59f9=_0x530748[_0x34bc('0x26')][_0x34bc('0x27')];var _0x3224c7=_0x530748[_0x34bc('0x26')]['callNumber'];var _0x3bc739=_0x530748[_0x34bc('0x26')][_0x34bc('0x28')];var _0x493835=_0x530748[_0x34bc('0x26')]['callbackUrl'];return getAgent(_0xbd59f9)['then'](function(_0x39e630){logger[_0x34bc('0x29')](_0x34bc('0x2a'),_0x39e630[_0x34bc('0x13')]);emit(util['format'](_0x34bc('0x2b'),_0x39e630[_0x34bc('0x13')]),_0x34bc('0x2c'),{'callNumber':_0x3224c7,'callerId':_0x3bc739,'callbackUrl':_0x493835});return _0x42fd40['status'](0xc8)[_0x34bc('0x2d')]({'error':![],'message':_0x34bc('0x2e')});})[_0x34bc('0x1b')](handleError(_0x42fd40));};exports[_0x34bc('0x2f')]=function(_0x53a43a,_0x2ac72b){logger[_0x34bc('0x29')](_0x34bc('0x30'),_0x53a43a['body']);var _0x246a86=hangupValidation[_0x34bc('0xb')](_0x53a43a[_0x34bc('0x26')]);if(_0x246a86[_0x34bc('0x23')]>0x0){return _0x2ac72b[_0x34bc('0x14')](0x190)['json'](_0x246a86);}var _0xca2aaf=_0x53a43a[_0x34bc('0x26')][_0x34bc('0x27')];var _0x174cfe=_0x53a43a[_0x34bc('0x26')]['sessionId'];return getAgent(_0xca2aaf)[_0x34bc('0x1e')](function(_0x50f1ee){logger[_0x34bc('0x29')](_0x34bc('0x2a'),_0x50f1ee[_0x34bc('0x13')]);emit(util[_0x34bc('0x31')]('user:%s',_0x50f1ee[_0x34bc('0x13')]),_0x34bc('0x32'),{'sessionId':_0x174cfe});return _0x2ac72b['status'](0xc8)[_0x34bc('0x2d')]({'error':![],'message':_0x34bc('0x33')});})[_0x34bc('0x1b')](handleError(_0x2ac72b));};exports['answer']=function(_0x31afd3,_0xbf2127){logger[_0x34bc('0x29')](_0x34bc('0x34'),_0x31afd3[_0x34bc('0x26')]);var _0x20debf=answerValidation[_0x34bc('0xb')](_0x31afd3[_0x34bc('0x26')]);if(_0x20debf[_0x34bc('0x23')]>0x0){return _0xbf2127[_0x34bc('0x14')](0x190)[_0x34bc('0x2d')](_0x20debf);}var _0x570824=_0x31afd3['body'][_0x34bc('0x27')];var _0x1e1bf3=_0x31afd3[_0x34bc('0x26')][_0x34bc('0x22')];return getAgent(_0x570824)[_0x34bc('0x1e')](function(_0x2db155){logger['info'](_0x34bc('0x2a'),_0x2db155['name']);emit(util[_0x34bc('0x31')](_0x34bc('0x2b'),_0x2db155[_0x34bc('0x13')]),'webbar:answer',{'sessionId':_0x1e1bf3});return _0xbf2127[_0x34bc('0x14')](0xc8)[_0x34bc('0x2d')]({'error':![],'message':_0x34bc('0x35')});})[_0x34bc('0x1b')](handleError(_0xbf2127));};exports[_0x34bc('0x36')]=function(_0x26924c,_0xba179d){logger[_0x34bc('0x29')](_0x34bc('0x37'),_0x26924c[_0x34bc('0x26')]);var _0x100c70=holdValidation[_0x34bc('0xb')](_0x26924c['body']);if(_0x100c70['length']>0x0){return _0xba179d[_0x34bc('0x14')](0x190)[_0x34bc('0x2d')](_0x100c70);}var _0x180a51=_0x26924c['body']['userId'];var _0x898cf8=_0x26924c[_0x34bc('0x26')][_0x34bc('0x22')];return getAgent(_0x180a51)['then'](function(_0x43bfb7){logger[_0x34bc('0x29')]('entityFound:',_0x43bfb7[_0x34bc('0x13')]);emit(util['format'](_0x34bc('0x2b'),_0x43bfb7['name']),_0x34bc('0x38'),{'sessionId':_0x898cf8});return _0xba179d[_0x34bc('0x14')](0xc8)[_0x34bc('0x2d')]({'error':![],'message':_0x34bc('0x39')});})['catch'](handleError(_0xba179d));};exports[_0x34bc('0x3a')]=function(_0x2bbd0b,_0x103bd1){logger[_0x34bc('0x29')](_0x34bc('0x3b'),_0x2bbd0b[_0x34bc('0x26')]);var _0x18eadd=unholdValidation[_0x34bc('0xb')](_0x2bbd0b['body']);if(_0x18eadd['length']>0x0){return _0x103bd1['status'](0x190)[_0x34bc('0x2d')](_0x18eadd);}var _0x1ed088=_0x2bbd0b['body'][_0x34bc('0x27')];var _0xe7b515=_0x2bbd0b[_0x34bc('0x26')][_0x34bc('0x22')];return getAgent(_0x1ed088)[_0x34bc('0x1e')](function(_0x5c82c2){logger['info']('entityFound:',_0x5c82c2[_0x34bc('0x13')]);emit(util[_0x34bc('0x31')](_0x34bc('0x2b'),_0x5c82c2[_0x34bc('0x13')]),_0x34bc('0x3c'),{'sessionId':_0xe7b515});return _0x103bd1['status'](0xc8)[_0x34bc('0x2d')]({'error':![],'message':_0x34bc('0x3d')});})[_0x34bc('0x1b')](handleError(_0x103bd1));};exports[_0x34bc('0x3e')]=function(_0x58e4c3,_0x1a2cf2){logger[_0x34bc('0x29')](_0x34bc('0x3f'),_0x1a2cf2[_0x34bc('0x26')]);var _0x279a83=callsValidation[_0x34bc('0xb')](_0x58e4c3[_0x34bc('0x26')]);if(_0x279a83[_0x34bc('0x23')]>0x0){return _0x1a2cf2[_0x34bc('0x14')](0x190)[_0x34bc('0x2d')](_0x279a83);}var _0x39c580=_0x58e4c3[_0x34bc('0x26')][_0x34bc('0x27')];var _0x592e81=respondWithRpcPromise(_0x34bc('0x40'));var _0x2cc1f5=getAgent(_0x39c580);return Promise[_0x34bc('0x1d')]([_0x592e81,_0x2cc1f5])[_0x34bc('0x1e')](function(_0x426df1){var _0x1b3704=_0x426df1[0x0];var _0x31cf3a=_0x426df1[0x1];var _0x43337d=_[_0x34bc('0x1f')](_0x1b3704[_0x34bc('0x20')],function(_0x11cd4c){return _0x11cd4c[_0x34bc('0x21')]==_0x31cf3a['id'];});return _0x1a2cf2[_0x34bc('0x14')](0xc8)[_0x34bc('0x2d')]({'count':_0x43337d['length'],'rows':_0x43337d});})[_0x34bc('0x1b')](handleError(_0x1a2cf2));};exports[_0x34bc('0x41')]=function(_0x36143f,_0x320d86){logger[_0x34bc('0x29')](_0x34bc('0x42'),_0x36143f[_0x34bc('0x26')]);var _0x36d2fb=conferenceValidation[_0x34bc('0xb')](_0x36143f[_0x34bc('0x26')]);if(_0x36d2fb['length']>0x0){return _0x320d86[_0x34bc('0x14')](0x190)[_0x34bc('0x2d')](_0x36d2fb);}var _0x51bbbd=_0x36143f['body'][_0x34bc('0x27')];return getAgent(_0x51bbbd)[_0x34bc('0x1e')](function(_0x9dd563){logger[_0x34bc('0x29')]('entityFound:',_0x9dd563[_0x34bc('0x13')]);emit(util[_0x34bc('0x31')](_0x34bc('0x2b'),_0x9dd563[_0x34bc('0x13')]),_0x34bc('0x43'));return _0x320d86[_0x34bc('0x14')](0xc8)[_0x34bc('0x2d')]({'error':![],'message':_0x34bc('0x44')});})['catch'](handleError(_0x320d86));};exports['transfer']=function(_0x405abb,_0x1dd036){logger[_0x34bc('0x29')](_0x34bc('0x45'),_0x405abb[_0x34bc('0x26')]);var _0x3066d9=transferValidation[_0x34bc('0xb')](_0x405abb[_0x34bc('0x26')]);if(_0x3066d9[_0x34bc('0x23')]>0x0){return _0x1dd036[_0x34bc('0x14')](0x190)[_0x34bc('0x2d')](_0x3066d9);}var _0x2d0d2c=_0x405abb[_0x34bc('0x26')][_0x34bc('0x27')];var _0x4d7c67=_0x405abb[_0x34bc('0x26')][_0x34bc('0x22')];var _0xa4e120=_0x405abb['body'][_0x34bc('0x46')];return getAgent(_0x2d0d2c)[_0x34bc('0x1e')](function(_0x124945){logger[_0x34bc('0x29')]('entityFound:',_0x124945[_0x34bc('0x13')]);emit(util[_0x34bc('0x31')](_0x34bc('0x2b'),_0x124945[_0x34bc('0x13')]),_0x34bc('0x47'),{'sessionId':_0x4d7c67,'transferNumber':_0xa4e120});return _0x1dd036['status'](0xc8)[_0x34bc('0x2d')]({'error':![],'message':_0x34bc('0x48')});})[_0x34bc('0x1b')](handleError(_0x1dd036));};
\ No newline at end of file