Built motion from commit b5996064.|2.6.21
[motion2.git] / server / services / xdr / calls.controller.js
index 25a20a9..f33f4d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd48e=['[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','source','value','xmd-phone','destination','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','xmd-cdrtype','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','hangup','execif','gotoif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','uniqueid','blinds','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','recording','newchannel','debug','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','info','context','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','linkedid','transfer','destinationchannel','answertime','disposition','toNumber','ANSWERED','error','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt'];(function(_0xb76aa,_0x5b09f4){var _0x5c02d0=function(_0x224c48){while(--_0x224c48){_0xb76aa['push'](_0xb76aa['shift']());}};_0x5c02d0(++_0x5b09f4);}(_0xd48e,0x93));var _0xed48=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xd48e[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require('lodash');var util=require(_0xed48('0x0'));var utils=require(_0xed48('0x1'));var transfers=require(_0xed48('0x2'));var dispositions=[_0xed48('0x3'),_0xed48('0x4'),'FAILED',_0xed48('0x3'),_0xed48('0x3'),_0xed48('0x3'),'ANSWERED',_0xed48('0x5'),_0xed48('0x4'),_0xed48('0x4'),'FAILED'];var channels={};function writeDB(_0x2cc522){var _0x1c9299;if(transfers['blinds'][_0x2cc522['uniqueid']]){_0x1c9299=_0x2cc522['uniqueid'];_0x2cc522[_0xed48('0x6')]=transfers[_0xed48('0x7')][_0x2cc522[_0xed48('0x6')]]['transfereeuniqueid'];}utils['info'](util[_0xed48('0x8')](_0xed48('0x9'),_0x2cc522[_0xed48('0x6')],_0x2cc522['channel'],_0x2cc522[_0xed48('0xa')],_0x2cc522[_0xed48('0xb')],_0x2cc522[_0xed48('0xc')],_0x2cc522[_0xed48('0xd')],_0x2cc522[_0xed48('0xe')],_0x2cc522[_0xed48('0xf')]));if(_0x2cc522[_0xed48('0x10')]){utils[_0xed48('0x11')](_0x2cc522[_0xed48('0x10')])[_0xed48('0x12')](function(_0x408ce8){if(_0x408ce8){_0x2cc522[_0xed48('0x13')]=_0x408ce8['id'];}utils[_0xed48('0x14')]('CreateVoiceCallReport',_0x2cc522);});}else{utils[_0xed48('0x14')]('CreateVoiceCallReport',_0x2cc522);}if(channels[_0x2cc522[_0xed48('0x6')]]){delete channels[_0x2cc522['uniqueid']];}else if(_0x1c9299&&channels[_0x1c9299]){if(!transfers['blinds'][_0x1c9299][_0xed48('0x15')])delete transfers[_0xed48('0x7')][_0x1c9299];delete channels[_0x1c9299];}}exports[_0xed48('0x16')]=function(_0x4cb521){try{utils[_0xed48('0x17')](util['format'](_0xed48('0x18'),_0x4cb521['uniqueid']),_0x4cb521);if(_0x4cb521[_0xed48('0x6')]==_0x4cb521['linkedid']&&_0x4cb521[_0xed48('0x19')]!=_0xed48('0x1a')){utils[_0xed48('0x1b')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x4cb521[_0xed48('0x6')],_0x4cb521[_0xed48('0x1c')],_0x4cb521[_0xed48('0x1d')]));channels[_0x4cb521['uniqueid']]={'uniqueid':_0x4cb521[_0xed48('0x6')],'accountcode':_0x4cb521[_0xed48('0x10')],'source':_0x4cb521[_0xed48('0xd')],'destination':_0x4cb521['exten'],'destinationcontext':_0x4cb521[_0xed48('0x1c')],'channel':_0x4cb521[_0xed48('0x19')],'starttime':utils[_0xed48('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xed48('0x3'),'amaflags':_0xed48('0x1f')};}}catch(_0x17a39b){utils['error'](util[_0xed48('0x8')]('[%s][calls][newchannel]',_0x4cb521[_0xed48('0x6')]),_0x17a39b);}};exports[_0xed48('0x20')]=function(_0x14e642){try{utils['debug'](util['format'](_0xed48('0x21'),_0x14e642[_0xed48('0x6')]),_0x14e642);if(!_[_0xed48('0x22')](channels[_0x14e642[_0xed48('0x6')]])&&_0x14e642[_0xed48('0x23')]==0x6){utils[_0xed48('0x1b')](util[_0xed48('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x14e642[_0xed48('0x6')],_0x14e642[_0xed48('0x1c')],_0x14e642[_0xed48('0x19')]));if(_['isNil'](channels[_0x14e642[_0xed48('0x6')]][_0xed48('0x24')])){channels[_0x14e642['uniqueid']][_0xed48('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x14e642[_0xed48('0x25')]])&&_0x14e642['channelstate']==0x6&&_0x14e642['context']!=_0xed48('0x26')){utils[_0xed48('0x1b')](util[_0xed48('0x8')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x14e642[_0xed48('0x6')],_0x14e642[_0xed48('0x25')],_0x14e642[_0xed48('0x1c')],_0x14e642[_0xed48('0x19')]));channels[_0x14e642['linkedid']]['accountcode']=_0x14e642[_0xed48('0x10')];channels[_0x14e642['linkedid']][_0xed48('0x27')]=_0x14e642[_0xed48('0x19')];if(_[_0xed48('0x22')](channels[_0x14e642[_0xed48('0x25')]]['answertime'])){channels[_0x14e642['linkedid']][_0xed48('0x28')]=utils[_0xed48('0x1e')]();}channels[_0x14e642[_0xed48('0x25')]][_0xed48('0x29')]=dispositions[_[_0xed48('0x2a')](_0x14e642[_0xed48('0x23')])]||_0xed48('0x2b');}}catch(_0x3ce130){utils[_0xed48('0x2c')](util[_0xed48('0x8')](_0xed48('0x21'),_0x14e642[_0xed48('0x6')]),_0x3ce130);}};exports['hangup']=function(_0xdd9e08){try{if(!_[_0xed48('0x22')](channels[_0xdd9e08[_0xed48('0x6')]])){utils[_0xed48('0x17')](util[_0xed48('0x8')](_0xed48('0x2d'),_0xdd9e08[_0xed48('0x6')]),_0xdd9e08);if(_[_0xed48('0x22')](channels[_0xdd9e08[_0xed48('0x6')]][_0xed48('0x2e')])){channels[_0xdd9e08['uniqueid']][_0xed48('0x2e')]=_0xdd9e08[_0xed48('0x2f')]+'\x20<'+_0xdd9e08[_0xed48('0xd')]+'>';}utils[_0xed48('0x1b')](util['format'](_0xed48('0x30'),_0xdd9e08[_0xed48('0x6')],channels[_0xdd9e08['uniqueid']][_0xed48('0x2e')],_0xdd9e08[_0xed48('0x31')]));channels[_0xdd9e08[_0xed48('0x6')]]['endtime']=utils['now']();channels[_0xdd9e08[_0xed48('0x6')]]['duration']=utils[_0xed48('0x32')](channels[_0xdd9e08[_0xed48('0x6')]][_0xed48('0x33')],channels[_0xdd9e08[_0xed48('0x6')]][_0xed48('0x34')]);channels[_0xdd9e08[_0xed48('0x6')]][_0xed48('0x35')]=channels[_0xdd9e08[_0xed48('0x6')]][_0xed48('0x28')]?utils['diffTime'](channels[_0xdd9e08[_0xed48('0x6')]][_0xed48('0x33')],channels[_0xdd9e08[_0xed48('0x6')]][_0xed48('0x28')]):0x0;writeDB(channels[_0xdd9e08[_0xed48('0x6')]]);}}catch(_0x5b75b7){utils[_0xed48('0x2c')](util[_0xed48('0x8')](_0xed48('0x2d'),_0xdd9e08[_0xed48('0x6')]),_0x5b75b7);}};exports[_0xed48('0x36')]=function(_0x2563c8){try{if(!_[_0xed48('0x22')](channels[_0x2563c8[_0xed48('0x37')]])){utils[_0xed48('0x17')](util[_0xed48('0x8')](_0xed48('0x38'),_0x2563c8[_0xed48('0x39')]),_0x2563c8);if(channels[_0x2563c8[_0xed48('0x37')]][_0xed48('0x19')]==_0x2563c8[_0xed48('0x3a')]){utils[_0xed48('0x1b')](util[_0xed48('0x8')](_0xed48('0x3b'),_0x2563c8['origtransfereruniqueid'],_0x2563c8[_0xed48('0x37')],_0x2563c8[_0xed48('0x3c')]));channels[_0x2563c8[_0xed48('0x37')]][_0xed48('0x27')]=_0x2563c8[_0xed48('0x3c')];channels[_0x2563c8[_0xed48('0x37')]]['userfield']=_0xed48('0x3d');}else if(channels[_0x2563c8['localtwolinkedid']][_0xed48('0x19')]=_0x2563c8[_0xed48('0x3e')]){utils['info'](util['format'](_0xed48('0x3b'),_0x2563c8['origtransfereruniqueid'],_0x2563c8[_0xed48('0x37')],_0x2563c8['origtransfererchannel']));channels[_0x2563c8['localtwolinkedid']]['destinationchannel']=_0x2563c8[_0xed48('0x3f')];channels[_0x2563c8[_0xed48('0x37')]][_0xed48('0x40')]=_0xed48('0x3d');}}}catch(_0x283ab1){utils[_0xed48('0x2c')](util['format']('[%s][calls][attendedtransfer]',_0x2563c8[_0xed48('0x39')]),_0x283ab1);}};exports[_0xed48('0x41')]=function(_0xbab9c6){try{if(!_[_0xed48('0x22')](channels[_0xbab9c6[_0xed48('0x6')]])){utils[_0xed48('0x17')](util['format'](_0xed48('0x42'),_0xbab9c6['uniqueid']),_0xbab9c6);channels[_0xbab9c6['uniqueid']]['musiconholdstartAt']=utils[_0xed48('0x1e')]();utils[_0xed48('0x1b')](util[_0xed48('0x8')](_0xed48('0x43'),_0xbab9c6[_0xed48('0x6')],channels[_0xbab9c6[_0xed48('0x6')]][_0xed48('0x44')]));}}catch(_0x28924b){utils[_0xed48('0x2c')](util[_0xed48('0x8')](_0xed48('0x42'),_0xbab9c6[_0xed48('0x6')]),_0x28924b);}};exports['musiconholdstop']=function(_0x3f7deb){try{if(!_[_0xed48('0x22')](channels[_0x3f7deb[_0xed48('0x6')]])){utils[_0xed48('0x17')](util[_0xed48('0x8')](_0xed48('0x45'),_0x3f7deb[_0xed48('0x6')]),_0x3f7deb);if(!_[_0xed48('0x22')](channels[_0x3f7deb[_0xed48('0x6')]][_0xed48('0x44')])){channels[_0x3f7deb[_0xed48('0x6')]][_0xed48('0x46')]+=utils[_0xed48('0x32')](utils[_0xed48('0x1e')](),channels[_0x3f7deb['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xed48('0x8')](_0xed48('0x47'),_0x3f7deb[_0xed48('0x6')],channels[_0x3f7deb[_0xed48('0x6')]][_0xed48('0x46')]));delete channels[_0x3f7deb['uniqueid']]['musiconholdstartAt'];}}}catch(_0xbef0b0){utils[_0xed48('0x2c')](util[_0xed48('0x8')]('[%s][calls][musiconholdstop]',_0x3f7deb[_0xed48('0x6')]),_0xbef0b0);}};exports[_0xed48('0x48')]=function(_0x3f1943){try{if(!_[_0xed48('0x22')](channels[_0x3f1943[_0xed48('0x6')]])){utils['debug'](util[_0xed48('0x8')]('[%s][calls][varset]',_0x3f1943[_0xed48('0x6')]),_0x3f1943);if(!_[_0xed48('0x22')](_0x3f1943[_0xed48('0x49')][_0xed48('0x4a')])){utils[_0xed48('0x1b')](util[_0xed48('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3f1943[_0xed48('0x6')],_0x3f1943['value']));channels[_0x3f1943[_0xed48('0x6')]][_0xed48('0x4b')]=_0x3f1943[_0xed48('0x4c')];}if(!_['isNil'](_0x3f1943[_0xed48('0x49')][_0xed48('0x4d')])){utils['info'](util[_0xed48('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3f1943[_0xed48('0x6')],_0x3f1943['value']));channels[_0x3f1943[_0xed48('0x6')]][_0xed48('0x4e')]=_0x3f1943[_0xed48('0x4c')];channels[_0x3f1943[_0xed48('0x6')]]['callerid']='\x22'+_0x3f1943[_0xed48('0x4c')]+'\x22\x20<'+_0x3f1943[_0xed48('0x4c')]+'>';}if(!_[_0xed48('0x22')](_0x3f1943[_0xed48('0x49')][_0xed48('0x4f')])||!_[_0xed48('0x22')](_0x3f1943[_0xed48('0x49')][_0xed48('0x50')])){utils[_0xed48('0x1b')](util['format'](_0xed48('0x51'),_0x3f1943['uniqueid'],!_[_0xed48('0x22')](_0x3f1943['variable'][_0xed48('0x4f')])?_0xed48('0x4f'):_0xed48('0x50'),_0x3f1943[_0xed48('0x4c')]));channels[_0x3f1943[_0xed48('0x6')]][_0xed48('0x2e')]=_0x3f1943['value'];}if(!_['isNil'](_0x3f1943['variable'][_0xed48('0x52')])||!_['isNil'](_0x3f1943['variable'][_0xed48('0x53')])){utils['info'](util[_0xed48('0x8')](_0xed48('0x51'),_0x3f1943[_0xed48('0x6')],!_[_0xed48('0x22')](_0x3f1943['variable']['xmd-queue'])?_0xed48('0x52'):'xmcs-queue',_0x3f1943[_0xed48('0x4c')]));channels[_0x3f1943['uniqueid']][_0xed48('0x54')]=_0xed48('0x55');channels[_0x3f1943['uniqueid']][_0xed48('0x56')]=_0x3f1943['value'];channels[_0x3f1943[_0xed48('0x6')]][_0xed48('0xa')]=!![];}if(!_[_0xed48('0x22')](_0x3f1943[_0xed48('0x49')][_0xed48('0x57')])){utils[_0xed48('0x1b')](util[_0xed48('0x8')](_0xed48('0x58'),_0x3f1943['uniqueid'],_0x3f1943['value']));channels[_0x3f1943[_0xed48('0x6')]][_0xed48('0x59')]=_0x3f1943[_0xed48('0x4c')];}if(!_[_0xed48('0x22')](_0x3f1943['variable'][_0xed48('0x5a')])){utils[_0xed48('0x1b')](util[_0xed48('0x8')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3f1943[_0xed48('0x6')],_0x3f1943[_0xed48('0x4c')]));channels[_0x3f1943[_0xed48('0x6')]]['type']=_0x3f1943['value'];}if(!_[_0xed48('0x22')](_0x3f1943[_0xed48('0x49')]['outboundrouteid'])){utils[_0xed48('0x1b')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x3f1943['uniqueid'],_0x3f1943['value']));channels[_0x3f1943[_0xed48('0x6')]][_0xed48('0x5b')]=_0x3f1943[_0xed48('0x4c')];}if(!_[_0xed48('0x22')](_0x3f1943['variable'][_0xed48('0x5c')])){utils['info'](util['format'](_0xed48('0x5d'),_0x3f1943[_0xed48('0x6')],_0x3f1943['value']));channels[_0x3f1943['uniqueid']][_0xed48('0x5c')]=_0x3f1943[_0xed48('0x4c')];}}}catch(_0x332812){utils['error'](util[_0xed48('0x8')]('[%s][calls][varset]',_0x3f1943[_0xed48('0x6')]),_0x332812);}};exports[_0xed48('0x5e')]=function(_0x147e19){try{if(!_[_0xed48('0x22')](channels[_0x147e19[_0xed48('0x6')]])){utils[_0xed48('0x17')](util['format'](_0xed48('0x5f'),_0x147e19[_0xed48('0x6')]),_0x147e19);utils[_0xed48('0x1b')](util[_0xed48('0x8')](_0xed48('0x60'),_0x147e19['uniqueid'],_0x147e19[_0xed48('0x61')],_0x147e19[_0xed48('0x62')]));if(_0x147e19['application']['toLowerCase']()==_0xed48('0x63')&&_[_0xed48('0x64')](_0x147e19[_0xed48('0x62')][_0xed48('0x65')](),_0xed48('0x66'))){var _0x412aa4=_0x147e19['appdata'][_0xed48('0x67')]('=');var _0x399eed=_0x412aa4[0x0][_0xed48('0x68')](_0x412aa4[0x0]['lastIndexOf']('(')+0x1,_0x412aa4[0x0]['lastIndexOf'](')'));var _0x5ebe8d=_0x412aa4[0x1];channels[_0x147e19[_0xed48('0x6')]][_0x399eed]=_0x5ebe8d;}if(!_['includes']([_0xed48('0x69'),'noop',_0xed48('0x6a'),_0xed48('0x63'),_0xed48('0x6b')],_0x147e19[_0xed48('0x61')][_0xed48('0x65')]())){channels[_0x147e19['uniqueid']]['lastapplication']=_0x147e19['application'];channels[_0x147e19['uniqueid']]['lastdata']=_0x147e19['appdata'];}}}catch(_0x3ba81c){utils['error'](util[_0xed48('0x8')](_0xed48('0x5f'),_0x147e19[_0xed48('0x6')]),_0x3ba81c);}};
\ No newline at end of file
+var _0x6476=['variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','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','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','uniqueid','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][varset]'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x6476,0x8e));var _0x6647=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6476[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x6647('0x0'));var util=require(_0x6647('0x1'));var utils=require(_0x6647('0x2'));var dispositions=[_0x6647('0x3'),_0x6647('0x4'),_0x6647('0x4'),'NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0x6647('0x5'),_0x6647('0x6'),_0x6647('0x4'),_0x6647('0x4'),'FAILED'];var channels={};function writeDB(_0x1d34f8){utils['info'](util[_0x6647('0x7')](_0x6647('0x8'),_0x1d34f8['uniqueid'],_0x1d34f8[_0x6647('0x9')],_0x1d34f8[_0x6647('0xa')],_0x1d34f8['membername'],_0x1d34f8[_0x6647('0xb')],_0x1d34f8[_0x6647('0xc')],_0x1d34f8['connectedlinenum'],_0x1d34f8[_0x6647('0xd')]));if(_0x1d34f8[_0x6647('0xe')]){utils['getUserByInternal'](_0x1d34f8[_0x6647('0xe')])[_0x6647('0xf')](function(_0x35592c){if(_0x35592c){_0x1d34f8[_0x6647('0x10')]=_0x35592c['id'];}utils[_0x6647('0x11')](_0x6647('0x12'),_0x1d34f8);});}else{utils[_0x6647('0x11')]('CreateVoiceCallReport',_0x1d34f8);}if(channels[_0x1d34f8[_0x6647('0x13')]]){delete channels[_0x1d34f8['uniqueid']];}}exports['newchannel']=function(_0x2d577f){try{utils['debug'](util[_0x6647('0x7')](_0x6647('0x14'),_0x2d577f[_0x6647('0x13')]),_0x2d577f);if(_0x2d577f[_0x6647('0x13')]==_0x2d577f[_0x6647('0x15')]&&_0x2d577f[_0x6647('0x9')]!=_0x6647('0x16')){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x18'),_0x2d577f[_0x6647('0x13')],_0x2d577f[_0x6647('0x19')],_0x2d577f['exten']));channels[_0x2d577f[_0x6647('0x13')]]={'uniqueid':_0x2d577f[_0x6647('0x13')],'accountcode':_0x2d577f[_0x6647('0xe')],'source':_0x2d577f['calleridnum'],'destination':_0x2d577f[_0x6647('0x1a')],'destinationcontext':_0x2d577f[_0x6647('0x19')],'channel':_0x2d577f['channel'],'starttime':utils[_0x6647('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6647('0x3'),'amaflags':_0x6647('0x1c')};}}catch(_0x5cc465){utils[_0x6647('0x1d')](util[_0x6647('0x7')]('[%s][calls][newchannel]',_0x2d577f[_0x6647('0x13')]),_0x5cc465);}};exports['newstate']=function(_0xb5d60d){try{utils[_0x6647('0x1e')](util[_0x6647('0x7')](_0x6647('0x1f'),_0xb5d60d[_0x6647('0x13')]),_0xb5d60d);if(!_[_0x6647('0x20')](channels[_0xb5d60d[_0x6647('0x13')]])&&_0xb5d60d[_0x6647('0x21')]==0x6){utils['info'](util[_0x6647('0x7')](_0x6647('0x22'),_0xb5d60d['uniqueid'],_0xb5d60d['context'],_0xb5d60d['channel']));if(_['isNil'](channels[_0xb5d60d[_0x6647('0x13')]][_0x6647('0x23')])){channels[_0xb5d60d[_0x6647('0x13')]][_0x6647('0x23')]=utils[_0x6647('0x1b')]();}}else if(!_[_0x6647('0x20')](channels[_0xb5d60d['linkedid']])&&_0xb5d60d[_0x6647('0x21')]==0x6&&_0xb5d60d[_0x6647('0x19')]!=_0x6647('0x24')){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x25'),_0xb5d60d[_0x6647('0x13')],_0xb5d60d['linkedid'],_0xb5d60d[_0x6647('0x19')],_0xb5d60d[_0x6647('0x9')]));channels[_0xb5d60d[_0x6647('0x15')]][_0x6647('0xe')]=_0xb5d60d[_0x6647('0xe')];channels[_0xb5d60d[_0x6647('0x15')]][_0x6647('0x26')]=_0xb5d60d[_0x6647('0x9')];if(_[_0x6647('0x20')](channels[_0xb5d60d[_0x6647('0x15')]]['answertime'])){channels[_0xb5d60d['linkedid']][_0x6647('0x27')]=utils[_0x6647('0x1b')]();}channels[_0xb5d60d[_0x6647('0x15')]][_0x6647('0x28')]=dispositions[_['toNumber'](_0xb5d60d[_0x6647('0x21')])]||'ANSWERED';}}catch(_0x20cc66){utils[_0x6647('0x1d')](util['format'](_0x6647('0x1f'),_0xb5d60d[_0x6647('0x13')]),_0x20cc66);}};exports[_0x6647('0x29')]=function(_0x11dfd4){try{if(!_[_0x6647('0x20')](channels[_0x11dfd4['uniqueid']])){utils['debug'](util[_0x6647('0x7')]('[%s][calls][hangup]',_0x11dfd4[_0x6647('0x13')]),_0x11dfd4);if(_[_0x6647('0x20')](channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x2a')])){channels[_0x11dfd4['uniqueid']][_0x6647('0x2a')]=_0x11dfd4[_0x6647('0x2b')]+'\x20<'+_0x11dfd4['calleridnum']+'>';}utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x2c'),_0x11dfd4[_0x6647('0x13')],channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x2a')],_0x11dfd4[_0x6647('0x2d')]));channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x2e')]=utils['now']();channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x2f')]=utils['diffTime'](channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x2e')],channels[_0x11dfd4['uniqueid']]['starttime']);channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x30')]=channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x27')]?utils[_0x6647('0x31')](channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x2e')],channels[_0x11dfd4[_0x6647('0x13')]][_0x6647('0x27')]):0x0;writeDB(channels[_0x11dfd4[_0x6647('0x13')]]);}}catch(_0x54039b){utils[_0x6647('0x1d')](util[_0x6647('0x7')](_0x6647('0x32'),_0x11dfd4[_0x6647('0x13')]),_0x54039b);}};exports[_0x6647('0x33')]=function(_0x429c38){try{if(!_[_0x6647('0x20')](channels[_0x429c38['localtwolinkedid']])){utils[_0x6647('0x1e')](util[_0x6647('0x7')](_0x6647('0x34'),_0x429c38['origtransfereruniqueid']),_0x429c38);if(channels[_0x429c38['localtwolinkedid']][_0x6647('0x9')]==_0x429c38['transfereechannel']){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x35'),_0x429c38[_0x6647('0x36')],_0x429c38[_0x6647('0x37')],_0x429c38[_0x6647('0x38')]));channels[_0x429c38[_0x6647('0x37')]][_0x6647('0x26')]=_0x429c38['secondtransfererchannel'];channels[_0x429c38[_0x6647('0x37')]][_0x6647('0x39')]=_0x6647('0x3a');}else if(channels[_0x429c38[_0x6647('0x37')]][_0x6647('0x9')]=_0x429c38[_0x6647('0x3b')]){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x35'),_0x429c38[_0x6647('0x36')],_0x429c38[_0x6647('0x37')],_0x429c38[_0x6647('0x3c')]));channels[_0x429c38[_0x6647('0x37')]][_0x6647('0x26')]=_0x429c38['origtransfererchannel'];channels[_0x429c38['localtwolinkedid']][_0x6647('0x39')]=_0x6647('0x3a');}}}catch(_0x460e20){utils[_0x6647('0x1d')](util[_0x6647('0x7')](_0x6647('0x34'),_0x429c38['origtransfereruniqueid']),_0x460e20);}};exports['musiconholdstart']=function(_0x55acae){try{if(!_['isNil'](channels[_0x55acae[_0x6647('0x13')]])){utils[_0x6647('0x1e')](util[_0x6647('0x7')]('[%s][calls][musiconholdstart]',_0x55acae[_0x6647('0x13')]),_0x55acae);channels[_0x55acae[_0x6647('0x13')]]['musiconholdstartAt']=utils[_0x6647('0x1b')]();utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x3d'),_0x55acae[_0x6647('0x13')],channels[_0x55acae[_0x6647('0x13')]][_0x6647('0x3e')]));}}catch(_0x3ab86d){utils[_0x6647('0x1d')](util[_0x6647('0x7')]('[%s][calls][musiconholdstart]',_0x55acae['uniqueid']),_0x3ab86d);}};exports[_0x6647('0x3f')]=function(_0x120c6c){try{if(!_[_0x6647('0x20')](channels[_0x120c6c[_0x6647('0x13')]])){utils[_0x6647('0x1e')](util[_0x6647('0x7')]('[%s][calls][musiconholdstop]',_0x120c6c[_0x6647('0x13')]),_0x120c6c);if(!_['isNil'](channels[_0x120c6c[_0x6647('0x13')]][_0x6647('0x3e')])){channels[_0x120c6c[_0x6647('0x13')]][_0x6647('0x40')]+=utils[_0x6647('0x31')](utils[_0x6647('0x1b')](),channels[_0x120c6c[_0x6647('0x13')]][_0x6647('0x3e')]);utils[_0x6647('0x17')](util[_0x6647('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x120c6c[_0x6647('0x13')],channels[_0x120c6c[_0x6647('0x13')]][_0x6647('0x40')]));delete channels[_0x120c6c[_0x6647('0x13')]][_0x6647('0x3e')];}}}catch(_0x508692){utils['error'](util[_0x6647('0x7')]('[%s][calls][musiconholdstop]',_0x120c6c['uniqueid']),_0x508692);}};exports['varset']=function(_0x371795){try{if(!_[_0x6647('0x20')](channels[_0x371795[_0x6647('0x13')]])){utils[_0x6647('0x1e')](util[_0x6647('0x7')](_0x6647('0x41'),_0x371795[_0x6647('0x13')]),_0x371795);if(!_[_0x6647('0x20')](_0x371795[_0x6647('0x42')][_0x6647('0x43')])){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x44'),_0x371795[_0x6647('0x13')],_0x371795['value']));channels[_0x371795[_0x6647('0x13')]][_0x6647('0x45')]=_0x371795[_0x6647('0x46')];}if(!_['isNil'](_0x371795[_0x6647('0x42')]['xmd-phone'])){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x47'),_0x371795[_0x6647('0x13')],_0x371795['value']));channels[_0x371795[_0x6647('0x13')]][_0x6647('0x48')]=_0x371795[_0x6647('0x46')];channels[_0x371795[_0x6647('0x13')]][_0x6647('0x2a')]='\x22'+_0x371795['value']+_0x6647('0x49')+_0x371795[_0x6647('0x46')]+'>';}if(!_[_0x6647('0x20')](_0x371795[_0x6647('0x42')][_0x6647('0x4a')])||!_[_0x6647('0x20')](_0x371795[_0x6647('0x42')]['xmd-callerid'])){utils['info'](util[_0x6647('0x7')](_0x6647('0x4b'),_0x371795[_0x6647('0x13')],!_[_0x6647('0x20')](_0x371795[_0x6647('0x42')][_0x6647('0x4a')])?_0x6647('0x4a'):'xmd-callerid',_0x371795['value']));channels[_0x371795[_0x6647('0x13')]][_0x6647('0x2a')]=_0x371795['value'];}if(!_[_0x6647('0x20')](_0x371795['variable'][_0x6647('0x4c')])||!_[_0x6647('0x20')](_0x371795['variable'][_0x6647('0x4d')])){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x4b'),_0x371795[_0x6647('0x13')],!_[_0x6647('0x20')](_0x371795[_0x6647('0x42')][_0x6647('0x4c')])?_0x6647('0x4c'):_0x6647('0x4d'),_0x371795[_0x6647('0x46')]));channels[_0x371795['uniqueid']][_0x6647('0x4e')]='Queue';channels[_0x371795['uniqueid']][_0x6647('0x4f')]=_0x371795['value'];channels[_0x371795[_0x6647('0x13')]][_0x6647('0xa')]=!![];}if(!_['isNil'](_0x371795[_0x6647('0x42')]['xmd-contactid'])){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x50'),_0x371795[_0x6647('0x13')],_0x371795[_0x6647('0x46')]));channels[_0x371795[_0x6647('0x13')]]['ContactId']=_0x371795[_0x6647('0x46')];}if(!_[_0x6647('0x20')](_0x371795[_0x6647('0x42')][_0x6647('0x51')])){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x52'),_0x371795[_0x6647('0x13')],_0x371795[_0x6647('0x46')]));channels[_0x371795[_0x6647('0x13')]]['type']=_0x371795['value'];}if(!_[_0x6647('0x20')](_0x371795[_0x6647('0x42')][_0x6647('0x53')])){utils[_0x6647('0x17')](util[_0x6647('0x7')](_0x6647('0x54'),_0x371795['uniqueid'],_0x371795[_0x6647('0x46')]));channels[_0x371795[_0x6647('0x13')]][_0x6647('0x55')]=_0x371795['value'];}if(!_[_0x6647('0x20')](_0x371795['variable'][_0x6647('0x56')])){utils['info'](util[_0x6647('0x7')](_0x6647('0x57'),_0x371795[_0x6647('0x13')],_0x371795[_0x6647('0x46')]));channels[_0x371795[_0x6647('0x13')]][_0x6647('0x56')]=_0x371795['value'];}}}catch(_0x2f1af0){utils[_0x6647('0x1d')](util['format'](_0x6647('0x41'),_0x371795['uniqueid']),_0x2f1af0);}};exports[_0x6647('0x58')]=function(_0x5ea9bc){try{if(!_['isNil'](channels[_0x5ea9bc['uniqueid']])){utils['debug'](util['format'](_0x6647('0x59'),_0x5ea9bc[_0x6647('0x13')]),_0x5ea9bc);utils[_0x6647('0x17')](util['format'](_0x6647('0x5a'),_0x5ea9bc[_0x6647('0x13')],_0x5ea9bc[_0x6647('0x5b')],_0x5ea9bc[_0x6647('0x5c')]));if(_0x5ea9bc[_0x6647('0x5b')][_0x6647('0x5d')]()==_0x6647('0x5e')&&_[_0x6647('0x5f')](_0x5ea9bc['appdata'][_0x6647('0x5d')](),_0x6647('0x60'))){var _0x41cdea=_0x5ea9bc[_0x6647('0x5c')][_0x6647('0x61')]('=');var _0x401634=_0x41cdea[0x0][_0x6647('0x62')](_0x41cdea[0x0][_0x6647('0x63')]('(')+0x1,_0x41cdea[0x0]['lastIndexOf'](')'));var _0x5c4f07=_0x41cdea[0x1];channels[_0x5ea9bc['uniqueid']][_0x401634]=_0x5c4f07;}if(!_[_0x6647('0x64')]([_0x6647('0x29'),_0x6647('0x65'),_0x6647('0x66'),'set',_0x6647('0x67')],_0x5ea9bc[_0x6647('0x5b')][_0x6647('0x5d')]())){channels[_0x5ea9bc['uniqueid']][_0x6647('0x4e')]=_0x5ea9bc[_0x6647('0x5b')];channels[_0x5ea9bc[_0x6647('0x13')]]['lastdata']=_0x5ea9bc[_0x6647('0x5c')];}}}catch(_0x327272){utils[_0x6647('0x1d')](util['format'](_0x6647('0x59'),_0x5ea9bc[_0x6647('0x13')]),_0x327272);}};
\ No newline at end of file