Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / services / xdr / calls.controller.js
index 03bb454..789de95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xceb2=['lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','execif','gotoif','lastdata','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum'];(function(_0x11e5e2,_0x3a2bba){var _0x37f697=function(_0x1a85ee){while(--_0x1a85ee){_0x11e5e2['push'](_0x11e5e2['shift']());}};_0x37f697(++_0x3a2bba);}(_0xceb2,0xca));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2ceb('0x0'));var utils=require(_0x2ceb('0x1'));var transfers=require(_0x2ceb('0x2'));var dispositions=['NO\x20ANSWER',_0x2ceb('0x3'),_0x2ceb('0x3'),_0x2ceb('0x4'),_0x2ceb('0x4'),_0x2ceb('0x4'),'ANSWERED',_0x2ceb('0x5'),_0x2ceb('0x3'),'FAILED',_0x2ceb('0x3')];var channels={};function writeDB(_0x3e71bc){var _0x9b8eed;if(transfers[_0x2ceb('0x6')][_0x3e71bc[_0x2ceb('0x7')]]){_0x9b8eed=_0x3e71bc['uniqueid'];_0x3e71bc[_0x2ceb('0x7')]=transfers[_0x2ceb('0x6')][_0x3e71bc['uniqueid']][_0x2ceb('0x8')];}utils[_0x2ceb('0x9')](util['format'](_0x2ceb('0xa'),_0x3e71bc[_0x2ceb('0x7')],_0x3e71bc[_0x2ceb('0xb')],_0x3e71bc[_0x2ceb('0xc')],_0x3e71bc['membername'],_0x3e71bc[_0x2ceb('0xd')],_0x3e71bc[_0x2ceb('0xe')],_0x3e71bc[_0x2ceb('0xf')],_0x3e71bc[_0x2ceb('0x10')]));if(_0x3e71bc[_0x2ceb('0x11')]){utils['getUserByInternal'](_0x3e71bc[_0x2ceb('0x11')])[_0x2ceb('0x12')](function(_0x467961){if(_0x467961){_0x3e71bc[_0x2ceb('0x13')]=_0x467961['id'];}utils[_0x2ceb('0x14')](_0x2ceb('0x15'),_0x3e71bc);});}else{utils['request'](_0x2ceb('0x15'),_0x3e71bc);}if(channels[_0x3e71bc[_0x2ceb('0x7')]]){delete channels[_0x3e71bc['uniqueid']];}else if(_0x9b8eed&&channels[_0x9b8eed]){delete transfers[_0x2ceb('0x6')][_0x9b8eed];delete channels[_0x9b8eed];}}exports['newchannel']=function(_0x1ae677){try{utils[_0x2ceb('0x16')](util[_0x2ceb('0x17')](_0x2ceb('0x18'),_0x1ae677[_0x2ceb('0x7')]),_0x1ae677);if(_0x1ae677[_0x2ceb('0x7')]==_0x1ae677[_0x2ceb('0x19')]&&_0x1ae677[_0x2ceb('0xb')]!=_0x2ceb('0x1a')){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')](_0x2ceb('0x1b'),_0x1ae677['uniqueid'],_0x1ae677[_0x2ceb('0x1c')],_0x1ae677[_0x2ceb('0x1d')]));channels[_0x1ae677[_0x2ceb('0x7')]]={'uniqueid':_0x1ae677[_0x2ceb('0x7')],'accountcode':_0x1ae677['accountcode'],'source':_0x1ae677[_0x2ceb('0xe')],'destination':_0x1ae677[_0x2ceb('0x1d')],'destinationcontext':_0x1ae677[_0x2ceb('0x1c')],'channel':_0x1ae677[_0x2ceb('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2ceb('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x54e5f9){utils[_0x2ceb('0x1e')](util[_0x2ceb('0x17')](_0x2ceb('0x18'),_0x1ae677[_0x2ceb('0x7')]),_0x54e5f9);}};exports[_0x2ceb('0x1f')]=function(_0x1bcd7f){try{utils[_0x2ceb('0x16')](util[_0x2ceb('0x17')](_0x2ceb('0x20'),_0x1bcd7f[_0x2ceb('0x7')]),_0x1bcd7f);if(!_[_0x2ceb('0x21')](channels[_0x1bcd7f[_0x2ceb('0x7')]])&&_0x1bcd7f[_0x2ceb('0x22')]==0x6){utils['info'](util[_0x2ceb('0x17')](_0x2ceb('0x23'),_0x1bcd7f[_0x2ceb('0x7')],_0x1bcd7f[_0x2ceb('0x1c')],_0x1bcd7f[_0x2ceb('0xb')]));if(_[_0x2ceb('0x21')](channels[_0x1bcd7f[_0x2ceb('0x7')]]['systemanswertime'])){channels[_0x1bcd7f[_0x2ceb('0x7')]][_0x2ceb('0x24')]=utils[_0x2ceb('0x25')]();}}else if(!_[_0x2ceb('0x21')](channels[_0x1bcd7f[_0x2ceb('0x19')]])&&_0x1bcd7f[_0x2ceb('0x22')]==0x6&&_0x1bcd7f['context']!=_0x2ceb('0x26')){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1bcd7f['uniqueid'],_0x1bcd7f['linkedid'],_0x1bcd7f[_0x2ceb('0x1c')],_0x1bcd7f[_0x2ceb('0xb')]));channels[_0x1bcd7f[_0x2ceb('0x19')]][_0x2ceb('0x11')]=_0x1bcd7f['accountcode'];channels[_0x1bcd7f['linkedid']]['destinationchannel']=_0x1bcd7f[_0x2ceb('0xb')];if(_['isNil'](channels[_0x1bcd7f[_0x2ceb('0x19')]][_0x2ceb('0x27')])){channels[_0x1bcd7f['linkedid']][_0x2ceb('0x27')]=utils['now']();}channels[_0x1bcd7f[_0x2ceb('0x19')]][_0x2ceb('0x28')]=dispositions[_[_0x2ceb('0x29')](_0x1bcd7f[_0x2ceb('0x22')])]||_0x2ceb('0x2a');}}catch(_0x37823f){utils['error'](util[_0x2ceb('0x17')](_0x2ceb('0x20'),_0x1bcd7f[_0x2ceb('0x7')]),_0x37823f);}};exports[_0x2ceb('0x2b')]=function(_0xa4d840){try{if(!_[_0x2ceb('0x21')](channels[_0xa4d840[_0x2ceb('0x7')]])){utils[_0x2ceb('0x16')](util['format'](_0x2ceb('0x2c'),_0xa4d840[_0x2ceb('0x7')]),_0xa4d840);if(_[_0x2ceb('0x21')](channels[_0xa4d840[_0x2ceb('0x7')]]['callerid'])){channels[_0xa4d840[_0x2ceb('0x7')]][_0x2ceb('0x2d')]=_0xa4d840[_0x2ceb('0x2e')]+'\x20<'+_0xa4d840[_0x2ceb('0xe')]+'>';}utils[_0x2ceb('0x9')](util['format'](_0x2ceb('0x2f'),_0xa4d840['uniqueid'],channels[_0xa4d840[_0x2ceb('0x7')]][_0x2ceb('0x2d')],_0xa4d840[_0x2ceb('0x30')]));channels[_0xa4d840[_0x2ceb('0x7')]][_0x2ceb('0x31')]=utils[_0x2ceb('0x25')]();channels[_0xa4d840[_0x2ceb('0x7')]]['duration']=utils['diffTime'](channels[_0xa4d840['uniqueid']]['endtime'],channels[_0xa4d840[_0x2ceb('0x7')]]['starttime']);channels[_0xa4d840[_0x2ceb('0x7')]]['billableseconds']=channels[_0xa4d840[_0x2ceb('0x7')]][_0x2ceb('0x27')]?utils[_0x2ceb('0x32')](channels[_0xa4d840[_0x2ceb('0x7')]][_0x2ceb('0x31')],channels[_0xa4d840[_0x2ceb('0x7')]][_0x2ceb('0x27')]):0x0;writeDB(channels[_0xa4d840[_0x2ceb('0x7')]]);}}catch(_0xa0973b){utils[_0x2ceb('0x1e')](util['format'](_0x2ceb('0x2c'),_0xa4d840[_0x2ceb('0x7')]),_0xa0973b);}};exports['attendedtransfer']=function(_0x2a144a){try{if(!_[_0x2ceb('0x21')](channels[_0x2a144a['localtwolinkedid']])){utils[_0x2ceb('0x16')](util[_0x2ceb('0x17')](_0x2ceb('0x33'),_0x2a144a[_0x2ceb('0x34')]),_0x2a144a);if(channels[_0x2a144a[_0x2ceb('0x35')]]['channel']==_0x2a144a[_0x2ceb('0x36')]){utils['info'](util['format'](_0x2ceb('0x37'),_0x2a144a[_0x2ceb('0x34')],_0x2a144a['localtwolinkedid'],_0x2a144a[_0x2ceb('0x38')]));channels[_0x2a144a['localtwolinkedid']][_0x2ceb('0x39')]=_0x2a144a[_0x2ceb('0x38')];channels[_0x2a144a[_0x2ceb('0x35')]][_0x2ceb('0x3a')]='_attended';}else if(channels[_0x2a144a[_0x2ceb('0x35')]][_0x2ceb('0xb')]=_0x2a144a['transfertargetchannel']){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')](_0x2ceb('0x37'),_0x2a144a['origtransfereruniqueid'],_0x2a144a['localtwolinkedid'],_0x2a144a['origtransfererchannel']));channels[_0x2a144a[_0x2ceb('0x35')]]['destinationchannel']=_0x2a144a[_0x2ceb('0x3b')];channels[_0x2a144a[_0x2ceb('0x35')]][_0x2ceb('0x3a')]='_attended';}}}catch(_0x1d6619){utils[_0x2ceb('0x1e')](util[_0x2ceb('0x17')]('[%s][calls][attendedtransfer]',_0x2a144a['origtransfereruniqueid']),_0x1d6619);}};exports[_0x2ceb('0x3c')]=function(_0x3f32c4){try{if(!_[_0x2ceb('0x21')](channels[_0x3f32c4['uniqueid']])){utils['debug'](util['format'](_0x2ceb('0x3d'),_0x3f32c4['uniqueid']),_0x3f32c4);channels[_0x3f32c4[_0x2ceb('0x7')]][_0x2ceb('0x3e')]=utils[_0x2ceb('0x25')]();utils['info'](util[_0x2ceb('0x17')](_0x2ceb('0x3f'),_0x3f32c4[_0x2ceb('0x7')],channels[_0x3f32c4[_0x2ceb('0x7')]]['musiconholdstartAt']));}}catch(_0x5769ad){utils[_0x2ceb('0x1e')](util[_0x2ceb('0x17')](_0x2ceb('0x3d'),_0x3f32c4[_0x2ceb('0x7')]),_0x5769ad);}};exports[_0x2ceb('0x40')]=function(_0x489ea5){try{if(!_[_0x2ceb('0x21')](channels[_0x489ea5[_0x2ceb('0x7')]])){utils[_0x2ceb('0x16')](util[_0x2ceb('0x17')](_0x2ceb('0x41'),_0x489ea5['uniqueid']),_0x489ea5);if(!_['isNil'](channels[_0x489ea5[_0x2ceb('0x7')]][_0x2ceb('0x3e')])){channels[_0x489ea5[_0x2ceb('0x7')]][_0x2ceb('0x42')]+=utils['diffTime'](utils[_0x2ceb('0x25')](),channels[_0x489ea5[_0x2ceb('0x7')]]['musiconholdstartAt']);utils['info'](util[_0x2ceb('0x17')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x489ea5[_0x2ceb('0x7')],channels[_0x489ea5['uniqueid']][_0x2ceb('0x42')]));delete channels[_0x489ea5[_0x2ceb('0x7')]][_0x2ceb('0x3e')];}}}catch(_0x22d681){utils[_0x2ceb('0x1e')](util[_0x2ceb('0x17')](_0x2ceb('0x41'),_0x489ea5[_0x2ceb('0x7')]),_0x22d681);}};exports[_0x2ceb('0x43')]=function(_0x2dcba2){try{if(!_[_0x2ceb('0x21')](channels[_0x2dcba2[_0x2ceb('0x7')]])){utils[_0x2ceb('0x16')](util[_0x2ceb('0x17')](_0x2ceb('0x44'),_0x2dcba2[_0x2ceb('0x7')]),_0x2dcba2);if(!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x46')])){utils[_0x2ceb('0x9')](util['format'](_0x2ceb('0x47'),_0x2dcba2['uniqueid'],_0x2dcba2[_0x2ceb('0x48')]));channels[_0x2dcba2[_0x2ceb('0x7')]][_0x2ceb('0x49')]=_0x2dcba2['value'];}if(!_['isNil'](_0x2dcba2['variable']['xmd-phone'])){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')](_0x2ceb('0x4a'),_0x2dcba2[_0x2ceb('0x7')],_0x2dcba2['value']));channels[_0x2dcba2['uniqueid']][_0x2ceb('0x4b')]=_0x2dcba2[_0x2ceb('0x48')];channels[_0x2dcba2[_0x2ceb('0x7')]][_0x2ceb('0x2d')]='\x22'+_0x2dcba2['value']+_0x2ceb('0x4c')+_0x2dcba2[_0x2ceb('0x48')]+'>';}if(!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')]['xmd-callerid-preview'])||!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x4d')])){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')](_0x2ceb('0x4e'),_0x2dcba2[_0x2ceb('0x7')],!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x4f')])?_0x2ceb('0x4f'):_0x2ceb('0x4d'),_0x2dcba2[_0x2ceb('0x48')]));channels[_0x2dcba2[_0x2ceb('0x7')]][_0x2ceb('0x2d')]=_0x2dcba2['value'];}if(!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x50')])||!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x51')])){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')](_0x2ceb('0x4e'),_0x2dcba2[_0x2ceb('0x7')],!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x50')])?_0x2ceb('0x50'):_0x2ceb('0x51'),_0x2dcba2[_0x2ceb('0x48')]));channels[_0x2dcba2[_0x2ceb('0x7')]]['lastapplication']=_0x2ceb('0x52');channels[_0x2dcba2['uniqueid']]['lastdata']=_0x2dcba2[_0x2ceb('0x48')];channels[_0x2dcba2[_0x2ceb('0x7')]][_0x2ceb('0xc')]=!![];}if(!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x53')])){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')](_0x2ceb('0x54'),_0x2dcba2['uniqueid'],_0x2dcba2[_0x2ceb('0x48')]));channels[_0x2dcba2[_0x2ceb('0x7')]][_0x2ceb('0x55')]=_0x2dcba2[_0x2ceb('0x48')];}if(!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x56')])){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2dcba2[_0x2ceb('0x7')],_0x2dcba2['value']));channels[_0x2dcba2[_0x2ceb('0x7')]][_0x2ceb('0x57')]=_0x2dcba2[_0x2ceb('0x48')];}if(!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')][_0x2ceb('0x58')])){utils['info'](util['format'](_0x2ceb('0x59'),_0x2dcba2[_0x2ceb('0x7')],_0x2dcba2['value']));channels[_0x2dcba2[_0x2ceb('0x7')]][_0x2ceb('0x5a')]=_0x2dcba2[_0x2ceb('0x48')];}if(!_[_0x2ceb('0x21')](_0x2dcba2[_0x2ceb('0x45')]['sipcallid'])){utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')](_0x2ceb('0x5b'),_0x2dcba2[_0x2ceb('0x7')],_0x2dcba2[_0x2ceb('0x48')]));channels[_0x2dcba2['uniqueid']][_0x2ceb('0x5c')]=_0x2dcba2[_0x2ceb('0x48')];}}}catch(_0x3b8fbf){utils[_0x2ceb('0x1e')](util['format'](_0x2ceb('0x44'),_0x2dcba2[_0x2ceb('0x7')]),_0x3b8fbf);}};exports[_0x2ceb('0x5d')]=function(_0x3b7bcc){try{if(!_[_0x2ceb('0x21')](channels[_0x3b7bcc[_0x2ceb('0x7')]])){utils[_0x2ceb('0x16')](util[_0x2ceb('0x17')](_0x2ceb('0x5e'),_0x3b7bcc[_0x2ceb('0x7')]),_0x3b7bcc);utils[_0x2ceb('0x9')](util[_0x2ceb('0x17')](_0x2ceb('0x5f'),_0x3b7bcc[_0x2ceb('0x7')],_0x3b7bcc[_0x2ceb('0x60')],_0x3b7bcc[_0x2ceb('0x61')]));if(_0x3b7bcc['application'][_0x2ceb('0x62')]()==_0x2ceb('0x63')&&_[_0x2ceb('0x64')](_0x3b7bcc[_0x2ceb('0x61')][_0x2ceb('0x62')](),_0x2ceb('0x65'))){var _0x29bcf0=_0x3b7bcc[_0x2ceb('0x61')][_0x2ceb('0x66')]('=');var _0x4dc7f2=_0x29bcf0[0x0][_0x2ceb('0x67')](_0x29bcf0[0x0]['lastIndexOf']('(')+0x1,_0x29bcf0[0x0][_0x2ceb('0x68')](')'));var _0x35c569=_0x29bcf0[0x1];channels[_0x3b7bcc[_0x2ceb('0x7')]][_0x4dc7f2]=_0x35c569;}if(!_[_0x2ceb('0x69')]([_0x2ceb('0x2b'),'noop',_0x2ceb('0x6a'),_0x2ceb('0x63'),_0x2ceb('0x6b')],_0x3b7bcc['application'][_0x2ceb('0x62')]())){channels[_0x3b7bcc[_0x2ceb('0x7')]]['lastapplication']=_0x3b7bcc[_0x2ceb('0x60')];channels[_0x3b7bcc[_0x2ceb('0x7')]][_0x2ceb('0x6c')]=_0x3b7bcc[_0x2ceb('0x61')];}}}catch(_0x24ce1e){utils[_0x2ceb('0x1e')](util[_0x2ceb('0x17')](_0x2ceb('0x5e'),_0x3b7bcc[_0x2ceb('0x7')]),_0x24ce1e);}};
\ No newline at end of file
+var _0x93f8=['musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','split','lastIndexOf','includes','noop','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x93f8,0x17c));var _0x893f=function(_0x3942f5,_0x52c01e){_0x3942f5=_0x3942f5-0x0;var _0xbaebbc=_0x93f8[_0x3942f5];return _0xbaebbc;};'use strict';var _=require(_0x893f('0x0'));var util=require(_0x893f('0x1'));var utils=require(_0x893f('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x893f('0x3'),'FAILED',_0x893f('0x4'),'NO\x20ANSWER',_0x893f('0x3'),_0x893f('0x3'),_0x893f('0x5'),_0x893f('0x6'),_0x893f('0x4'),_0x893f('0x4'),'FAILED'];var channels={};function writeDB(_0x505774){var _0x81c2d1;if(transfers[_0x893f('0x7')][_0x505774[_0x893f('0x8')]]){_0x81c2d1=_0x505774['uniqueid'];_0x505774['uniqueid']=transfers['blinds'][_0x505774[_0x893f('0x8')]]['transfereeuniqueid'];}utils[_0x893f('0x9')](util[_0x893f('0xa')](_0x893f('0xb'),_0x505774['uniqueid'],_0x505774[_0x893f('0xc')],_0x505774[_0x893f('0xd')],_0x505774[_0x893f('0xe')],_0x505774[_0x893f('0xf')],_0x505774['calleridnum'],_0x505774[_0x893f('0x10')],_0x505774[_0x893f('0x11')]));if(_0x505774[_0x893f('0x12')]){utils[_0x893f('0x13')](_0x505774[_0x893f('0x12')])['then'](function(_0x5d9899){if(_0x5d9899){_0x505774[_0x893f('0x14')]=_0x5d9899['id'];}utils[_0x893f('0x15')](_0x893f('0x16'),_0x505774);});}else{utils[_0x893f('0x15')](_0x893f('0x16'),_0x505774);}if(channels[_0x505774[_0x893f('0x8')]]){delete channels[_0x505774['uniqueid']];}else if(_0x81c2d1&&channels[_0x81c2d1]){delete transfers[_0x893f('0x7')][_0x81c2d1];delete channels[_0x81c2d1];}}exports[_0x893f('0x17')]=function(_0x242d1c){try{utils[_0x893f('0x18')](util[_0x893f('0xa')](_0x893f('0x19'),_0x242d1c[_0x893f('0x8')]),_0x242d1c);if(_0x242d1c[_0x893f('0x8')]==_0x242d1c['linkedid']&&_0x242d1c['channel']!=_0x893f('0x1a')){utils['info'](util[_0x893f('0xa')](_0x893f('0x1b'),_0x242d1c[_0x893f('0x8')],_0x242d1c[_0x893f('0x1c')],_0x242d1c[_0x893f('0x1d')]));channels[_0x242d1c[_0x893f('0x8')]]={'uniqueid':_0x242d1c[_0x893f('0x8')],'accountcode':_0x242d1c[_0x893f('0x12')],'source':_0x242d1c[_0x893f('0x1e')],'destination':_0x242d1c[_0x893f('0x1d')],'destinationcontext':_0x242d1c[_0x893f('0x1c')],'channel':_0x242d1c[_0x893f('0xc')],'starttime':utils[_0x893f('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x893f('0x3'),'amaflags':_0x893f('0x20')};}}catch(_0x167e50){utils['error'](util[_0x893f('0xa')](_0x893f('0x19'),_0x242d1c[_0x893f('0x8')]),_0x167e50);}};exports[_0x893f('0x21')]=function(_0x29153a){try{utils['debug'](util[_0x893f('0xa')](_0x893f('0x22'),_0x29153a[_0x893f('0x8')]),_0x29153a);if(!_[_0x893f('0x23')](channels[_0x29153a[_0x893f('0x8')]])&&_0x29153a['channelstate']==0x6){utils[_0x893f('0x9')](util[_0x893f('0xa')](_0x893f('0x24'),_0x29153a[_0x893f('0x8')],_0x29153a[_0x893f('0x1c')],_0x29153a[_0x893f('0xc')]));if(_['isNil'](channels[_0x29153a[_0x893f('0x8')]][_0x893f('0x25')])){channels[_0x29153a[_0x893f('0x8')]][_0x893f('0x25')]=utils[_0x893f('0x1f')]();}}else if(!_[_0x893f('0x23')](channels[_0x29153a[_0x893f('0x26')]])&&_0x29153a[_0x893f('0x27')]==0x6&&_0x29153a[_0x893f('0x1c')]!=_0x893f('0x28')){utils[_0x893f('0x9')](util[_0x893f('0xa')](_0x893f('0x29'),_0x29153a[_0x893f('0x8')],_0x29153a['linkedid'],_0x29153a[_0x893f('0x1c')],_0x29153a[_0x893f('0xc')]));channels[_0x29153a[_0x893f('0x26')]][_0x893f('0x12')]=_0x29153a[_0x893f('0x12')];channels[_0x29153a[_0x893f('0x26')]]['destinationchannel']=_0x29153a[_0x893f('0xc')];if(_['isNil'](channels[_0x29153a['linkedid']][_0x893f('0x2a')])){channels[_0x29153a[_0x893f('0x26')]][_0x893f('0x2a')]=utils[_0x893f('0x1f')]();}channels[_0x29153a[_0x893f('0x26')]][_0x893f('0x2b')]=dispositions[_[_0x893f('0x2c')](_0x29153a['channelstate'])]||'ANSWERED';}}catch(_0xbec40a){utils[_0x893f('0x2d')](util[_0x893f('0xa')]('[%s][calls][newstate]',_0x29153a[_0x893f('0x8')]),_0xbec40a);}};exports[_0x893f('0x2e')]=function(_0x59aace){try{if(!_[_0x893f('0x23')](channels[_0x59aace[_0x893f('0x8')]])){utils[_0x893f('0x18')](util[_0x893f('0xa')](_0x893f('0x2f'),_0x59aace[_0x893f('0x8')]),_0x59aace);if(_[_0x893f('0x23')](channels[_0x59aace['uniqueid']][_0x893f('0x30')])){channels[_0x59aace['uniqueid']][_0x893f('0x30')]=_0x59aace[_0x893f('0x31')]+'\x20<'+_0x59aace[_0x893f('0x1e')]+'>';}utils[_0x893f('0x9')](util['format'](_0x893f('0x32'),_0x59aace['uniqueid'],channels[_0x59aace[_0x893f('0x8')]][_0x893f('0x30')],_0x59aace[_0x893f('0x33')]));channels[_0x59aace[_0x893f('0x8')]][_0x893f('0x34')]=utils[_0x893f('0x1f')]();channels[_0x59aace[_0x893f('0x8')]][_0x893f('0x35')]=utils[_0x893f('0x36')](channels[_0x59aace['uniqueid']][_0x893f('0x34')],channels[_0x59aace[_0x893f('0x8')]][_0x893f('0x37')]);channels[_0x59aace[_0x893f('0x8')]]['billableseconds']=channels[_0x59aace[_0x893f('0x8')]][_0x893f('0x2a')]?utils[_0x893f('0x36')](channels[_0x59aace[_0x893f('0x8')]][_0x893f('0x34')],channels[_0x59aace[_0x893f('0x8')]][_0x893f('0x2a')]):0x0;writeDB(channels[_0x59aace[_0x893f('0x8')]]);}}catch(_0x34baf4){utils[_0x893f('0x2d')](util[_0x893f('0xa')](_0x893f('0x2f'),_0x59aace[_0x893f('0x8')]),_0x34baf4);}};exports[_0x893f('0x38')]=function(_0x28cbe4){try{if(!_['isNil'](channels[_0x28cbe4[_0x893f('0x39')]])){utils[_0x893f('0x18')](util['format']('[%s][calls][attendedtransfer]',_0x28cbe4[_0x893f('0x3a')]),_0x28cbe4);if(channels[_0x28cbe4[_0x893f('0x39')]]['channel']==_0x28cbe4[_0x893f('0x3b')]){utils[_0x893f('0x9')](util['format'](_0x893f('0x3c'),_0x28cbe4[_0x893f('0x3a')],_0x28cbe4[_0x893f('0x39')],_0x28cbe4[_0x893f('0x3d')]));channels[_0x28cbe4[_0x893f('0x39')]][_0x893f('0x3e')]=_0x28cbe4[_0x893f('0x3d')];channels[_0x28cbe4[_0x893f('0x39')]][_0x893f('0x3f')]='_attended';}else if(channels[_0x28cbe4[_0x893f('0x39')]]['channel']=_0x28cbe4['transfertargetchannel']){utils[_0x893f('0x9')](util['format'](_0x893f('0x3c'),_0x28cbe4[_0x893f('0x3a')],_0x28cbe4['localtwolinkedid'],_0x28cbe4[_0x893f('0x40')]));channels[_0x28cbe4['localtwolinkedid']]['destinationchannel']=_0x28cbe4['origtransfererchannel'];channels[_0x28cbe4[_0x893f('0x39')]][_0x893f('0x3f')]=_0x893f('0x41');}}}catch(_0x3f1358){utils['error'](util[_0x893f('0xa')]('[%s][calls][attendedtransfer]',_0x28cbe4[_0x893f('0x3a')]),_0x3f1358);}};exports[_0x893f('0x42')]=function(_0x165d28){try{if(!_[_0x893f('0x23')](channels[_0x165d28[_0x893f('0x8')]])){utils[_0x893f('0x18')](util[_0x893f('0xa')](_0x893f('0x43'),_0x165d28[_0x893f('0x8')]),_0x165d28);channels[_0x165d28[_0x893f('0x8')]][_0x893f('0x44')]=utils[_0x893f('0x1f')]();utils['info'](util[_0x893f('0xa')](_0x893f('0x45'),_0x165d28['uniqueid'],channels[_0x165d28['uniqueid']][_0x893f('0x44')]));}}catch(_0x3e6cf6){utils['error'](util[_0x893f('0xa')]('[%s][calls][musiconholdstart]',_0x165d28[_0x893f('0x8')]),_0x3e6cf6);}};exports[_0x893f('0x46')]=function(_0x768422){try{if(!_[_0x893f('0x23')](channels[_0x768422[_0x893f('0x8')]])){utils[_0x893f('0x18')](util[_0x893f('0xa')](_0x893f('0x47'),_0x768422[_0x893f('0x8')]),_0x768422);if(!_['isNil'](channels[_0x768422[_0x893f('0x8')]][_0x893f('0x44')])){channels[_0x768422[_0x893f('0x8')]][_0x893f('0x48')]+=utils[_0x893f('0x36')](utils[_0x893f('0x1f')](),channels[_0x768422['uniqueid']][_0x893f('0x44')]);utils['info'](util[_0x893f('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x768422['uniqueid'],channels[_0x768422['uniqueid']][_0x893f('0x48')]));delete channels[_0x768422[_0x893f('0x8')]][_0x893f('0x44')];}}}catch(_0x1a6323){utils[_0x893f('0x2d')](util['format']('[%s][calls][musiconholdstop]',_0x768422[_0x893f('0x8')]),_0x1a6323);}};exports[_0x893f('0x49')]=function(_0x1d9c90){try{if(!_[_0x893f('0x23')](channels[_0x1d9c90['uniqueid']])){utils[_0x893f('0x18')](util['format'](_0x893f('0x4a'),_0x1d9c90[_0x893f('0x8')]),_0x1d9c90);if(!_[_0x893f('0x23')](_0x1d9c90[_0x893f('0x4b')][_0x893f('0x4c')])){utils[_0x893f('0x9')](util[_0x893f('0xa')](_0x893f('0x4d'),_0x1d9c90[_0x893f('0x8')],_0x1d9c90[_0x893f('0x4e')]));channels[_0x1d9c90[_0x893f('0x8')]]['source']=_0x1d9c90[_0x893f('0x4e')];}if(!_[_0x893f('0x23')](_0x1d9c90['variable'][_0x893f('0x4f')])){utils['info'](util[_0x893f('0xa')](_0x893f('0x50'),_0x1d9c90['uniqueid'],_0x1d9c90['value']));channels[_0x1d9c90[_0x893f('0x8')]]['destination']=_0x1d9c90[_0x893f('0x4e')];channels[_0x1d9c90[_0x893f('0x8')]][_0x893f('0x30')]='\x22'+_0x1d9c90[_0x893f('0x4e')]+_0x893f('0x51')+_0x1d9c90[_0x893f('0x4e')]+'>';}if(!_[_0x893f('0x23')](_0x1d9c90[_0x893f('0x4b')]['xmd-callerid-preview'])||!_[_0x893f('0x23')](_0x1d9c90[_0x893f('0x4b')][_0x893f('0x52')])){utils[_0x893f('0x9')](util['format'](_0x893f('0x53'),_0x1d9c90[_0x893f('0x8')],!_[_0x893f('0x23')](_0x1d9c90[_0x893f('0x4b')]['xmd-callerid-preview'])?_0x893f('0x54'):_0x893f('0x52'),_0x1d9c90['value']));channels[_0x1d9c90[_0x893f('0x8')]][_0x893f('0x30')]=_0x1d9c90[_0x893f('0x4e')];}if(!_[_0x893f('0x23')](_0x1d9c90[_0x893f('0x4b')][_0x893f('0x55')])||!_[_0x893f('0x23')](_0x1d9c90[_0x893f('0x4b')][_0x893f('0x56')])){utils[_0x893f('0x9')](util[_0x893f('0xa')](_0x893f('0x53'),_0x1d9c90[_0x893f('0x8')],!_[_0x893f('0x23')](_0x1d9c90['variable'][_0x893f('0x55')])?_0x893f('0x55'):_0x893f('0x56'),_0x1d9c90[_0x893f('0x4e')]));channels[_0x1d9c90[_0x893f('0x8')]][_0x893f('0x57')]=_0x893f('0x58');channels[_0x1d9c90[_0x893f('0x8')]][_0x893f('0x59')]=_0x1d9c90[_0x893f('0x4e')];channels[_0x1d9c90[_0x893f('0x8')]]['queue']=!![];}if(!_['isNil'](_0x1d9c90[_0x893f('0x4b')][_0x893f('0x5a')])){utils['info'](util[_0x893f('0xa')](_0x893f('0x5b'),_0x1d9c90[_0x893f('0x8')],_0x1d9c90[_0x893f('0x4e')]));channels[_0x1d9c90[_0x893f('0x8')]]['ContactId']=_0x1d9c90['value'];}if(!_[_0x893f('0x23')](_0x1d9c90[_0x893f('0x4b')]['xmd-cdrtype'])){utils[_0x893f('0x9')](util[_0x893f('0xa')](_0x893f('0x5c'),_0x1d9c90['uniqueid'],_0x1d9c90[_0x893f('0x4e')]));channels[_0x1d9c90[_0x893f('0x8')]][_0x893f('0x5d')]=_0x1d9c90[_0x893f('0x4e')];}if(!_[_0x893f('0x23')](_0x1d9c90[_0x893f('0x4b')][_0x893f('0x5e')])){utils[_0x893f('0x9')](util[_0x893f('0xa')](_0x893f('0x5f'),_0x1d9c90[_0x893f('0x8')],_0x1d9c90[_0x893f('0x4e')]));channels[_0x1d9c90[_0x893f('0x8')]][_0x893f('0x60')]=_0x1d9c90[_0x893f('0x4e')];}if(!_[_0x893f('0x23')](_0x1d9c90['variable'][_0x893f('0x61')])){utils[_0x893f('0x9')](util[_0x893f('0xa')](_0x893f('0x62'),_0x1d9c90[_0x893f('0x8')],_0x1d9c90[_0x893f('0x4e')]));channels[_0x1d9c90[_0x893f('0x8')]][_0x893f('0x61')]=_0x1d9c90[_0x893f('0x4e')];}}}catch(_0x162729){utils['error'](util[_0x893f('0xa')]('[%s][calls][varset]',_0x1d9c90['uniqueid']),_0x162729);}};exports[_0x893f('0x63')]=function(_0x4409ee){try{if(!_[_0x893f('0x23')](channels[_0x4409ee[_0x893f('0x8')]])){utils['debug'](util[_0x893f('0xa')](_0x893f('0x64'),_0x4409ee[_0x893f('0x8')]),_0x4409ee);utils['info'](util[_0x893f('0xa')](_0x893f('0x65'),_0x4409ee[_0x893f('0x8')],_0x4409ee['application'],_0x4409ee[_0x893f('0x66')]));if(_0x4409ee[_0x893f('0x67')][_0x893f('0x68')]()==_0x893f('0x69')&&_[_0x893f('0x6a')](_0x4409ee['appdata']['toLowerCase'](),'cdr')){var _0x520e30=_0x4409ee[_0x893f('0x66')][_0x893f('0x6b')]('=');var _0xd47aa7=_0x520e30[0x0]['substring'](_0x520e30[0x0][_0x893f('0x6c')]('(')+0x1,_0x520e30[0x0]['lastIndexOf'](')'));var _0x138afa=_0x520e30[0x1];channels[_0x4409ee[_0x893f('0x8')]][_0xd47aa7]=_0x138afa;}if(!_[_0x893f('0x6d')]([_0x893f('0x2e'),_0x893f('0x6e'),'execif',_0x893f('0x69'),_0x893f('0x6f')],_0x4409ee[_0x893f('0x67')][_0x893f('0x68')]())){channels[_0x4409ee[_0x893f('0x8')]][_0x893f('0x57')]=_0x4409ee[_0x893f('0x67')];channels[_0x4409ee[_0x893f('0x8')]][_0x893f('0x59')]=_0x4409ee[_0x893f('0x66')];}}}catch(_0x82a686){utils[_0x893f('0x2d')](util[_0x893f('0xa')](_0x893f('0x64'),_0x4409ee['uniqueid']),_0x82a686);}};
\ No newline at end of file