Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / services / xdr / calls.controller.js
index 3c8f3c2..9d96447 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ce6=['disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','hangup','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','isNil','answertime'];(function(_0x4fc425,_0x5cfc14){var _0x4a50a9=function(_0x3875a1){while(--_0x3875a1){_0x4fc425['push'](_0x4fc425['shift']());}};_0x4a50a9(++_0x5cfc14);}(_0x7ce6,0x17b));var _0x67ce=function(_0x939db2,_0x58e90c){_0x939db2=_0x939db2-0x0;var _0x5f18a4=_0x7ce6[_0x939db2];return _0x5f18a4;};'use strict';var _=require(_0x67ce('0x0'));var util=require(_0x67ce('0x1'));var utils=require(_0x67ce('0x2'));var dispositions=[_0x67ce('0x3'),_0x67ce('0x4'),'FAILED',_0x67ce('0x3'),_0x67ce('0x3'),_0x67ce('0x3'),'ANSWERED','BUSY',_0x67ce('0x4'),'FAILED',_0x67ce('0x4')];var channels={};function writeDB(_0x50ab0b){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x7'),_0x50ab0b[_0x67ce('0x8')],_0x50ab0b[_0x67ce('0x9')],_0x50ab0b['queue'],_0x50ab0b[_0x67ce('0xa')],_0x50ab0b['interface'],_0x50ab0b['calleridnum'],_0x50ab0b[_0x67ce('0xb')],_0x50ab0b[_0x67ce('0xc')]));if(_0x50ab0b[_0x67ce('0xd')]){utils[_0x67ce('0xe')](_0x50ab0b[_0x67ce('0xd')])[_0x67ce('0xf')](function(_0x1da455){if(_0x1da455){_0x50ab0b['UserId']=_0x1da455['id'];}utils[_0x67ce('0x10')](_0x67ce('0x11'),_0x50ab0b);});}else{utils[_0x67ce('0x10')](_0x67ce('0x11'),_0x50ab0b);}if(channels[_0x50ab0b[_0x67ce('0x8')]]){delete channels[_0x50ab0b[_0x67ce('0x8')]];}}exports[_0x67ce('0x12')]=function(_0x94c21){try{utils[_0x67ce('0x13')](util[_0x67ce('0x6')]('[%s][calls][newchannel]',_0x94c21[_0x67ce('0x8')]),_0x94c21);if(_0x94c21[_0x67ce('0x8')]==_0x94c21[_0x67ce('0x14')]&&_0x94c21[_0x67ce('0x9')]!=_0x67ce('0x15')){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x16'),_0x94c21['uniqueid'],_0x94c21[_0x67ce('0x17')],_0x94c21[_0x67ce('0x18')]));channels[_0x94c21['uniqueid']]={'uniqueid':_0x94c21[_0x67ce('0x8')],'accountcode':_0x94c21[_0x67ce('0xd')],'source':_0x94c21[_0x67ce('0x19')],'destination':_0x94c21['exten'],'destinationcontext':_0x94c21[_0x67ce('0x17')],'channel':_0x94c21[_0x67ce('0x9')],'starttime':utils[_0x67ce('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x67ce('0x3'),'amaflags':_0x67ce('0x1b')};}}catch(_0x225ce2){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')](_0x67ce('0x1d'),_0x94c21['uniqueid']),_0x225ce2);}};exports[_0x67ce('0x1e')]=function(_0x384d35){try{utils['debug'](util[_0x67ce('0x6')]('[%s][calls][newstate]',_0x384d35['uniqueid']),_0x384d35);if(!_['isNil'](channels[_0x384d35[_0x67ce('0x8')]])&&_0x384d35['channelstate']==0x6){utils[_0x67ce('0x5')](util[_0x67ce('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x384d35[_0x67ce('0x8')],_0x384d35['context'],_0x384d35[_0x67ce('0x9')]));if(_['isNil'](channels[_0x384d35[_0x67ce('0x8')]]['systemanswertime'])){channels[_0x384d35[_0x67ce('0x8')]][_0x67ce('0x1f')]=utils['now']();}}else if(!_['isNil'](channels[_0x384d35[_0x67ce('0x14')]])&&_0x384d35[_0x67ce('0x20')]==0x6&&_0x384d35[_0x67ce('0x17')]!=_0x67ce('0x21')){utils['info'](util['format'](_0x67ce('0x22'),_0x384d35[_0x67ce('0x8')],_0x384d35[_0x67ce('0x14')],_0x384d35['context'],_0x384d35['channel']));channels[_0x384d35['linkedid']][_0x67ce('0xd')]=_0x384d35[_0x67ce('0xd')];channels[_0x384d35['linkedid']]['destinationchannel']=_0x384d35[_0x67ce('0x9')];if(_[_0x67ce('0x23')](channels[_0x384d35['linkedid']][_0x67ce('0x24')])){channels[_0x384d35['linkedid']][_0x67ce('0x24')]=utils[_0x67ce('0x1a')]();}channels[_0x384d35['linkedid']][_0x67ce('0x25')]=dispositions[_[_0x67ce('0x26')](_0x384d35['channelstate'])]||'ANSWERED';}}catch(_0x1c22c5){utils[_0x67ce('0x1c')](util['format'](_0x67ce('0x27'),_0x384d35['uniqueid']),_0x1c22c5);}};exports['hangup']=function(_0x27f4a1){try{if(!_[_0x67ce('0x23')](channels[_0x27f4a1[_0x67ce('0x8')]])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')](_0x67ce('0x28'),_0x27f4a1[_0x67ce('0x8')]),_0x27f4a1);if(_[_0x67ce('0x23')](channels[_0x27f4a1['uniqueid']][_0x67ce('0x29')])){channels[_0x27f4a1['uniqueid']]['callerid']=_0x27f4a1[_0x67ce('0x2a')]+'\x20<'+_0x27f4a1[_0x67ce('0x19')]+'>';}utils[_0x67ce('0x5')](util['format'](_0x67ce('0x2b'),_0x27f4a1[_0x67ce('0x8')],channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x29')],_0x27f4a1[_0x67ce('0x2c')]));channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x2d')]=utils['now']();channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x2e')]=utils['diffTime'](channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x2d')],channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x2f')]);channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x30')]=channels[_0x27f4a1[_0x67ce('0x8')]]['answertime']?utils[_0x67ce('0x31')](channels[_0x27f4a1['uniqueid']][_0x67ce('0x2d')],channels[_0x27f4a1[_0x67ce('0x8')]]['answertime']):0x0;writeDB(channels[_0x27f4a1[_0x67ce('0x8')]]);}}catch(_0x516af0){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')](_0x67ce('0x28'),_0x27f4a1[_0x67ce('0x8')]),_0x516af0);}};exports['attendedtransfer']=function(_0x512bbf){try{if(!_[_0x67ce('0x23')](channels[_0x512bbf[_0x67ce('0x32')]])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')](_0x67ce('0x33'),_0x512bbf[_0x67ce('0x34')]),_0x512bbf);if(channels[_0x512bbf[_0x67ce('0x32')]][_0x67ce('0x9')]==_0x512bbf[_0x67ce('0x35')]){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x36'),_0x512bbf[_0x67ce('0x34')],_0x512bbf['localtwolinkedid'],_0x512bbf[_0x67ce('0x37')]));channels[_0x512bbf['localtwolinkedid']][_0x67ce('0x38')]=_0x512bbf[_0x67ce('0x37')];channels[_0x512bbf[_0x67ce('0x32')]][_0x67ce('0x39')]=_0x67ce('0x3a');}else if(channels[_0x512bbf['localtwolinkedid']][_0x67ce('0x9')]=_0x512bbf[_0x67ce('0x3b')]){utils['info'](util[_0x67ce('0x6')](_0x67ce('0x36'),_0x512bbf[_0x67ce('0x34')],_0x512bbf['localtwolinkedid'],_0x512bbf[_0x67ce('0x3c')]));channels[_0x512bbf['localtwolinkedid']][_0x67ce('0x38')]=_0x512bbf['origtransfererchannel'];channels[_0x512bbf[_0x67ce('0x32')]]['userfield']=_0x67ce('0x3a');}}}catch(_0x53240e){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')](_0x67ce('0x33'),_0x512bbf[_0x67ce('0x34')]),_0x53240e);}};exports[_0x67ce('0x3d')]=function(_0x5de4e2){try{if(!_[_0x67ce('0x23')](channels[_0x5de4e2[_0x67ce('0x8')]])){utils[_0x67ce('0x13')](util['format']('[%s][calls][musiconholdstart]',_0x5de4e2[_0x67ce('0x8')]),_0x5de4e2);channels[_0x5de4e2[_0x67ce('0x8')]][_0x67ce('0x3e')]=utils[_0x67ce('0x1a')]();utils[_0x67ce('0x5')](util[_0x67ce('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5de4e2['uniqueid'],channels[_0x5de4e2['uniqueid']]['musiconholdstartAt']));}}catch(_0x4d850b){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')]('[%s][calls][musiconholdstart]',_0x5de4e2[_0x67ce('0x8')]),_0x4d850b);}};exports[_0x67ce('0x3f')]=function(_0x15ed3b){try{if(!_[_0x67ce('0x23')](channels[_0x15ed3b[_0x67ce('0x8')]])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')]('[%s][calls][musiconholdstop]',_0x15ed3b[_0x67ce('0x8')]),_0x15ed3b);if(!_[_0x67ce('0x23')](channels[_0x15ed3b['uniqueid']][_0x67ce('0x3e')])){channels[_0x15ed3b[_0x67ce('0x8')]][_0x67ce('0x40')]+=utils[_0x67ce('0x31')](utils[_0x67ce('0x1a')](),channels[_0x15ed3b['uniqueid']][_0x67ce('0x3e')]);utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x41'),_0x15ed3b[_0x67ce('0x8')],channels[_0x15ed3b[_0x67ce('0x8')]][_0x67ce('0x40')]));delete channels[_0x15ed3b[_0x67ce('0x8')]][_0x67ce('0x3e')];}}}catch(_0x19b1da){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')]('[%s][calls][musiconholdstop]',_0x15ed3b['uniqueid']),_0x19b1da);}};exports[_0x67ce('0x42')]=function(_0xaddb32){try{if(!_['isNil'](channels[_0xaddb32[_0x67ce('0x8')]])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')]('[%s][calls][varset]',_0xaddb32['uniqueid']),_0xaddb32);if(!_['isNil'](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x44')])){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x45'),_0xaddb32['uniqueid'],_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x47')]=_0xaddb32[_0x67ce('0x46')];}if(!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x48')])){utils[_0x67ce('0x5')](util['format'](_0x67ce('0x49'),_0xaddb32['uniqueid'],_0xaddb32['value']));channels[_0xaddb32['uniqueid']][_0x67ce('0x4a')]=_0xaddb32[_0x67ce('0x46')];channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x29')]='\x22'+_0xaddb32[_0x67ce('0x46')]+_0x67ce('0x4b')+_0xaddb32[_0x67ce('0x46')]+'>';}if(!_['isNil'](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x4c')])||!_['isNil'](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x4d')])){utils[_0x67ce('0x5')](util['format'](_0x67ce('0x4e'),_0xaddb32[_0x67ce('0x8')],!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x4c')])?_0x67ce('0x4c'):'xmd-callerid',_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32[_0x67ce('0x8')]]['callerid']=_0xaddb32[_0x67ce('0x46')];}if(!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x4f')])||!_[_0x67ce('0x23')](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x50')])){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x4e'),_0xaddb32['uniqueid'],!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x4f')])?_0x67ce('0x4f'):_0x67ce('0x50'),_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x51')]=_0x67ce('0x52');channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x53')]=_0xaddb32[_0x67ce('0x46')];channels[_0xaddb32['uniqueid']]['queue']=!![];}if(!_[_0x67ce('0x23')](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x54')])){utils['info'](util['format'](_0x67ce('0x55'),_0xaddb32[_0x67ce('0x8')],_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32['uniqueid']][_0x67ce('0x56')]=_0xaddb32['value'];}if(!_[_0x67ce('0x23')](_0xaddb32[_0x67ce('0x43')]['xmd-cdrtype'])){utils[_0x67ce('0x5')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xaddb32['uniqueid'],_0xaddb32['value']));channels[_0xaddb32['uniqueid']][_0x67ce('0x57')]=_0xaddb32[_0x67ce('0x46')];}if(!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x58')])){utils[_0x67ce('0x5')](util[_0x67ce('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xaddb32[_0x67ce('0x8')],_0xaddb32['value']));channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x59')]=_0xaddb32['value'];}if(!_[_0x67ce('0x23')](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x5a')])){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x5b'),_0xaddb32[_0x67ce('0x8')],_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x5a')]=_0xaddb32[_0x67ce('0x46')];}}}catch(_0x1dacc8){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')]('[%s][calls][varset]',_0xaddb32['uniqueid']),_0x1dacc8);}};exports[_0x67ce('0x5c')]=function(_0x3048e3){try{if(!_[_0x67ce('0x23')](channels[_0x3048e3['uniqueid']])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')](_0x67ce('0x5d'),_0x3048e3[_0x67ce('0x8')]),_0x3048e3);utils[_0x67ce('0x5')](util['format'](_0x67ce('0x5e'),_0x3048e3['uniqueid'],_0x3048e3[_0x67ce('0x5f')],_0x3048e3[_0x67ce('0x60')]));if(_0x3048e3['application']['toLowerCase']()=='set'&&_['startsWith'](_0x3048e3[_0x67ce('0x60')][_0x67ce('0x61')](),_0x67ce('0x62'))){var _0x383edc=_0x3048e3[_0x67ce('0x60')][_0x67ce('0x63')]('=');var _0x291c74=_0x383edc[0x0][_0x67ce('0x64')](_0x383edc[0x0][_0x67ce('0x65')]('(')+0x1,_0x383edc[0x0][_0x67ce('0x65')](')'));var _0x83809e=_0x383edc[0x1];channels[_0x3048e3['uniqueid']][_0x291c74]=_0x83809e;}if(!_['includes']([_0x67ce('0x66'),'noop','execif','set',_0x67ce('0x67')],_0x3048e3[_0x67ce('0x5f')]['toLowerCase']())){channels[_0x3048e3['uniqueid']]['lastapplication']=_0x3048e3[_0x67ce('0x5f')];channels[_0x3048e3[_0x67ce('0x8')]][_0x67ce('0x53')]=_0x3048e3[_0x67ce('0x60')];}}}catch(_0x269edd){utils[_0x67ce('0x1c')](util['format']('[%s][calls][newexten]',_0x3048e3[_0x67ce('0x8')]),_0x269edd);}};
\ No newline at end of file
+var _0x8541=['xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','UserId','request','uniqueid','newchannel','debug','format','[%s][calls][newchannel]','linkedid','channel','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','disposition','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','billableseconds','answertime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','destinationchannel','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%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'];(function(_0x262346,_0xfc5ef1){var _0x4d7205=function(_0x5cb1d2){while(--_0x5cb1d2){_0x262346['push'](_0x262346['shift']());}};_0x4d7205(++_0xfc5ef1);}(_0x8541,0x1c6));var _0x1854=function(_0x47c463,_0xeeb1d9){_0x47c463=_0x47c463-0x0;var _0x31dd29=_0x8541[_0x47c463];return _0x31dd29;};'use strict';var _=require(_0x1854('0x0'));var util=require(_0x1854('0x1'));var utils=require(_0x1854('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x1854('0x3'),_0x1854('0x4'),_0x1854('0x4'),'NO\x20ANSWER',_0x1854('0x5'),_0x1854('0x6'),_0x1854('0x3'),_0x1854('0x3'),_0x1854('0x3')];var channels={};function writeDB(_0x4624a0){utils['info'](util['format'](_0x1854('0x7'),_0x4624a0['uniqueid'],_0x4624a0['channel'],_0x4624a0[_0x1854('0x8')],_0x4624a0[_0x1854('0x9')],_0x4624a0['interface'],_0x4624a0[_0x1854('0xa')],_0x4624a0[_0x1854('0xb')],_0x4624a0['lastevent']));if(_0x4624a0[_0x1854('0xc')]){utils[_0x1854('0xd')](_0x4624a0[_0x1854('0xc')])['then'](function(_0x37aca9){if(_0x37aca9){_0x4624a0[_0x1854('0xe')]=_0x37aca9['id'];}utils[_0x1854('0xf')]('CreateVoiceCallReport',_0x4624a0);});}else{utils[_0x1854('0xf')]('CreateVoiceCallReport',_0x4624a0);}if(channels[_0x4624a0[_0x1854('0x10')]]){delete channels[_0x4624a0[_0x1854('0x10')]];}}exports[_0x1854('0x11')]=function(_0x124119){try{utils[_0x1854('0x12')](util[_0x1854('0x13')](_0x1854('0x14'),_0x124119[_0x1854('0x10')]),_0x124119);if(_0x124119[_0x1854('0x10')]==_0x124119[_0x1854('0x15')]&&_0x124119[_0x1854('0x16')]!='OutgoingSpoolFailed'){utils[_0x1854('0x17')](util[_0x1854('0x13')](_0x1854('0x18'),_0x124119['uniqueid'],_0x124119[_0x1854('0x19')],_0x124119['exten']));channels[_0x124119[_0x1854('0x10')]]={'uniqueid':_0x124119[_0x1854('0x10')],'accountcode':_0x124119['accountcode'],'source':_0x124119['calleridnum'],'destination':_0x124119[_0x1854('0x1a')],'destinationcontext':_0x124119['context'],'channel':_0x124119['channel'],'starttime':utils[_0x1854('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1854('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x9e308c){utils['error'](util[_0x1854('0x13')](_0x1854('0x14'),_0x124119[_0x1854('0x10')]),_0x9e308c);}};exports['newstate']=function(_0x4f3511){try{utils['debug'](util[_0x1854('0x13')]('[%s][calls][newstate]',_0x4f3511[_0x1854('0x10')]),_0x4f3511);if(!_[_0x1854('0x1c')](channels[_0x4f3511[_0x1854('0x10')]])&&_0x4f3511[_0x1854('0x1d')]==0x6){utils[_0x1854('0x17')](util[_0x1854('0x13')](_0x1854('0x1e'),_0x4f3511[_0x1854('0x10')],_0x4f3511[_0x1854('0x19')],_0x4f3511['channel']));if(_['isNil'](channels[_0x4f3511[_0x1854('0x10')]][_0x1854('0x1f')])){channels[_0x4f3511[_0x1854('0x10')]][_0x1854('0x1f')]=utils[_0x1854('0x1b')]();}}else if(!_['isNil'](channels[_0x4f3511['linkedid']])&&_0x4f3511[_0x1854('0x1d')]==0x6&&_0x4f3511['context']!=_0x1854('0x20')){utils[_0x1854('0x17')](util[_0x1854('0x13')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4f3511['uniqueid'],_0x4f3511[_0x1854('0x15')],_0x4f3511[_0x1854('0x19')],_0x4f3511[_0x1854('0x16')]));channels[_0x4f3511[_0x1854('0x15')]][_0x1854('0xc')]=_0x4f3511[_0x1854('0xc')];channels[_0x4f3511[_0x1854('0x15')]]['destinationchannel']=_0x4f3511[_0x1854('0x16')];if(_[_0x1854('0x1c')](channels[_0x4f3511['linkedid']]['answertime'])){channels[_0x4f3511[_0x1854('0x15')]]['answertime']=utils['now']();}channels[_0x4f3511[_0x1854('0x15')]][_0x1854('0x21')]=dispositions[_['toNumber'](_0x4f3511[_0x1854('0x1d')])]||'ANSWERED';}}catch(_0x34daf6){utils[_0x1854('0x22')](util[_0x1854('0x13')](_0x1854('0x23'),_0x4f3511[_0x1854('0x10')]),_0x34daf6);}};exports[_0x1854('0x24')]=function(_0x135be1){try{if(!_[_0x1854('0x1c')](channels[_0x135be1[_0x1854('0x10')]])){utils[_0x1854('0x12')](util['format'](_0x1854('0x25'),_0x135be1[_0x1854('0x10')]),_0x135be1);if(_['isNil'](channels[_0x135be1[_0x1854('0x10')]][_0x1854('0x26')])){channels[_0x135be1[_0x1854('0x10')]][_0x1854('0x26')]=_0x135be1['calleridname']+'\x20<'+_0x135be1[_0x1854('0xa')]+'>';}utils[_0x1854('0x17')](util[_0x1854('0x13')](_0x1854('0x27'),_0x135be1[_0x1854('0x10')],channels[_0x135be1[_0x1854('0x10')]][_0x1854('0x26')],_0x135be1[_0x1854('0x28')]));channels[_0x135be1['uniqueid']][_0x1854('0x29')]=utils[_0x1854('0x1b')]();channels[_0x135be1['uniqueid']][_0x1854('0x2a')]=utils['diffTime'](channels[_0x135be1[_0x1854('0x10')]][_0x1854('0x29')],channels[_0x135be1[_0x1854('0x10')]]['starttime']);channels[_0x135be1[_0x1854('0x10')]][_0x1854('0x2b')]=channels[_0x135be1[_0x1854('0x10')]]['answertime']?utils['diffTime'](channels[_0x135be1[_0x1854('0x10')]][_0x1854('0x29')],channels[_0x135be1[_0x1854('0x10')]][_0x1854('0x2c')]):0x0;writeDB(channels[_0x135be1[_0x1854('0x10')]]);}}catch(_0x42487c){utils[_0x1854('0x22')](util[_0x1854('0x13')](_0x1854('0x25'),_0x135be1['uniqueid']),_0x42487c);}};exports[_0x1854('0x2d')]=function(_0x4ade86){try{if(!_['isNil'](channels[_0x4ade86[_0x1854('0x2e')]])){utils['debug'](util[_0x1854('0x13')](_0x1854('0x2f'),_0x4ade86[_0x1854('0x30')]),_0x4ade86);if(channels[_0x4ade86['localtwolinkedid']]['channel']==_0x4ade86[_0x1854('0x31')]){utils[_0x1854('0x17')](util[_0x1854('0x13')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4ade86[_0x1854('0x30')],_0x4ade86[_0x1854('0x2e')],_0x4ade86['secondtransfererchannel']));channels[_0x4ade86[_0x1854('0x2e')]][_0x1854('0x32')]=_0x4ade86['secondtransfererchannel'];channels[_0x4ade86[_0x1854('0x2e')]]['userfield']=_0x1854('0x33');}else if(channels[_0x4ade86[_0x1854('0x2e')]]['channel']=_0x4ade86['transfertargetchannel']){utils[_0x1854('0x17')](util[_0x1854('0x13')](_0x1854('0x34'),_0x4ade86['origtransfereruniqueid'],_0x4ade86[_0x1854('0x2e')],_0x4ade86['origtransfererchannel']));channels[_0x4ade86['localtwolinkedid']]['destinationchannel']=_0x4ade86[_0x1854('0x35')];channels[_0x4ade86['localtwolinkedid']][_0x1854('0x36')]=_0x1854('0x33');}}}catch(_0x2a9e08){utils[_0x1854('0x22')](util[_0x1854('0x13')](_0x1854('0x2f'),_0x4ade86[_0x1854('0x30')]),_0x2a9e08);}};exports['musiconholdstart']=function(_0x74b5ef){try{if(!_['isNil'](channels[_0x74b5ef[_0x1854('0x10')]])){utils['debug'](util[_0x1854('0x13')](_0x1854('0x37'),_0x74b5ef['uniqueid']),_0x74b5ef);channels[_0x74b5ef[_0x1854('0x10')]][_0x1854('0x38')]=utils[_0x1854('0x1b')]();utils['info'](util[_0x1854('0x13')](_0x1854('0x39'),_0x74b5ef[_0x1854('0x10')],channels[_0x74b5ef[_0x1854('0x10')]][_0x1854('0x38')]));}}catch(_0x370711){utils[_0x1854('0x22')](util[_0x1854('0x13')](_0x1854('0x37'),_0x74b5ef[_0x1854('0x10')]),_0x370711);}};exports['musiconholdstop']=function(_0xc54f75){try{if(!_[_0x1854('0x1c')](channels[_0xc54f75['uniqueid']])){utils[_0x1854('0x12')](util[_0x1854('0x13')](_0x1854('0x3a'),_0xc54f75[_0x1854('0x10')]),_0xc54f75);if(!_[_0x1854('0x1c')](channels[_0xc54f75['uniqueid']][_0x1854('0x38')])){channels[_0xc54f75[_0x1854('0x10')]][_0x1854('0x3b')]+=utils[_0x1854('0x3c')](utils[_0x1854('0x1b')](),channels[_0xc54f75[_0x1854('0x10')]]['musiconholdstartAt']);utils['info'](util[_0x1854('0x13')](_0x1854('0x3d'),_0xc54f75[_0x1854('0x10')],channels[_0xc54f75[_0x1854('0x10')]][_0x1854('0x3b')]));delete channels[_0xc54f75[_0x1854('0x10')]][_0x1854('0x38')];}}}catch(_0x2b1eb2){utils[_0x1854('0x22')](util[_0x1854('0x13')](_0x1854('0x3a'),_0xc54f75['uniqueid']),_0x2b1eb2);}};exports[_0x1854('0x3e')]=function(_0x5e2abb){try{if(!_[_0x1854('0x1c')](channels[_0x5e2abb[_0x1854('0x10')]])){utils['debug'](util[_0x1854('0x13')]('[%s][calls][varset]',_0x5e2abb[_0x1854('0x10')]),_0x5e2abb);if(!_[_0x1854('0x1c')](_0x5e2abb['variable'][_0x1854('0x3f')])){utils[_0x1854('0x17')](util['format'](_0x1854('0x40'),_0x5e2abb[_0x1854('0x10')],_0x5e2abb[_0x1854('0x41')]));channels[_0x5e2abb[_0x1854('0x10')]][_0x1854('0x42')]=_0x5e2abb[_0x1854('0x41')];}if(!_['isNil'](_0x5e2abb[_0x1854('0x43')][_0x1854('0x44')])){utils[_0x1854('0x17')](util['format'](_0x1854('0x45'),_0x5e2abb[_0x1854('0x10')],_0x5e2abb[_0x1854('0x41')]));channels[_0x5e2abb[_0x1854('0x10')]][_0x1854('0x46')]=_0x5e2abb[_0x1854('0x41')];channels[_0x5e2abb[_0x1854('0x10')]][_0x1854('0x26')]='\x22'+_0x5e2abb[_0x1854('0x41')]+_0x1854('0x47')+_0x5e2abb[_0x1854('0x41')]+'>';}if(!_[_0x1854('0x1c')](_0x5e2abb[_0x1854('0x43')]['xmd-callerid-preview'])||!_[_0x1854('0x1c')](_0x5e2abb[_0x1854('0x43')][_0x1854('0x48')])){utils['info'](util[_0x1854('0x13')](_0x1854('0x49'),_0x5e2abb['uniqueid'],!_[_0x1854('0x1c')](_0x5e2abb[_0x1854('0x43')][_0x1854('0x4a')])?_0x1854('0x4a'):_0x1854('0x48'),_0x5e2abb['value']));channels[_0x5e2abb['uniqueid']]['callerid']=_0x5e2abb[_0x1854('0x41')];}if(!_[_0x1854('0x1c')](_0x5e2abb['variable'][_0x1854('0x4b')])||!_[_0x1854('0x1c')](_0x5e2abb[_0x1854('0x43')][_0x1854('0x4c')])){utils[_0x1854('0x17')](util[_0x1854('0x13')](_0x1854('0x49'),_0x5e2abb[_0x1854('0x10')],!_[_0x1854('0x1c')](_0x5e2abb[_0x1854('0x43')][_0x1854('0x4b')])?_0x1854('0x4b'):_0x1854('0x4c'),_0x5e2abb[_0x1854('0x41')]));channels[_0x5e2abb[_0x1854('0x10')]][_0x1854('0x4d')]=_0x1854('0x4e');channels[_0x5e2abb['uniqueid']][_0x1854('0x4f')]=_0x5e2abb[_0x1854('0x41')];channels[_0x5e2abb[_0x1854('0x10')]]['queue']=!![];}if(!_[_0x1854('0x1c')](_0x5e2abb[_0x1854('0x43')][_0x1854('0x50')])){utils['info'](util['format'](_0x1854('0x51'),_0x5e2abb[_0x1854('0x10')],_0x5e2abb[_0x1854('0x41')]));channels[_0x5e2abb[_0x1854('0x10')]][_0x1854('0x52')]=_0x5e2abb[_0x1854('0x41')];}if(!_[_0x1854('0x1c')](_0x5e2abb[_0x1854('0x43')][_0x1854('0x53')])){utils[_0x1854('0x17')](util[_0x1854('0x13')](_0x1854('0x54'),_0x5e2abb[_0x1854('0x10')],_0x5e2abb[_0x1854('0x41')]));channels[_0x5e2abb[_0x1854('0x10')]][_0x1854('0x55')]=_0x5e2abb[_0x1854('0x41')];}if(!_[_0x1854('0x1c')](_0x5e2abb[_0x1854('0x43')][_0x1854('0x56')])){utils['info'](util[_0x1854('0x13')](_0x1854('0x57'),_0x5e2abb[_0x1854('0x10')],_0x5e2abb[_0x1854('0x41')]));channels[_0x5e2abb[_0x1854('0x10')]]['routeid']=_0x5e2abb['value'];}if(!_['isNil'](_0x5e2abb[_0x1854('0x43')][_0x1854('0x58')])){utils[_0x1854('0x17')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5e2abb[_0x1854('0x10')],_0x5e2abb['value']));channels[_0x5e2abb[_0x1854('0x10')]][_0x1854('0x58')]=_0x5e2abb[_0x1854('0x41')];}}}catch(_0xd08fbc){utils[_0x1854('0x22')](util['format'](_0x1854('0x59'),_0x5e2abb[_0x1854('0x10')]),_0xd08fbc);}};exports[_0x1854('0x5a')]=function(_0xf9736b){try{if(!_['isNil'](channels[_0xf9736b[_0x1854('0x10')]])){utils[_0x1854('0x12')](util['format'](_0x1854('0x5b'),_0xf9736b['uniqueid']),_0xf9736b);utils['info'](util[_0x1854('0x13')](_0x1854('0x5c'),_0xf9736b['uniqueid'],_0xf9736b['application'],_0xf9736b[_0x1854('0x5d')]));if(_0xf9736b[_0x1854('0x5e')][_0x1854('0x5f')]()=='set'&&_[_0x1854('0x60')](_0xf9736b[_0x1854('0x5d')][_0x1854('0x5f')](),_0x1854('0x61'))){var _0x40d467=_0xf9736b[_0x1854('0x5d')][_0x1854('0x62')]('=');var _0x1ebd9a=_0x40d467[0x0][_0x1854('0x63')](_0x40d467[0x0][_0x1854('0x64')]('(')+0x1,_0x40d467[0x0][_0x1854('0x64')](')'));var _0xab8a3c=_0x40d467[0x1];channels[_0xf9736b[_0x1854('0x10')]][_0x1ebd9a]=_0xab8a3c;}if(!_[_0x1854('0x65')]([_0x1854('0x24'),_0x1854('0x66'),_0x1854('0x67'),_0x1854('0x68'),_0x1854('0x69')],_0xf9736b['application'][_0x1854('0x5f')]())){channels[_0xf9736b[_0x1854('0x10')]]['lastapplication']=_0xf9736b[_0x1854('0x5e')];channels[_0xf9736b[_0x1854('0x10')]][_0x1854('0x4f')]=_0xf9736b['appdata'];}}}catch(_0x5eeb38){utils[_0x1854('0x22')](util[_0x1854('0x13')](_0x1854('0x5b'),_0xf9736b[_0x1854('0x10')]),_0x5eeb38);}};
\ No newline at end of file