Built motion from commit 746c7d2a.|2.5.35
[motion2.git] / server / services / xdr / calls.controller.js
index 4612923..505884c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x26f9=['_attended','transfertargetchannel','origtransfererchannel','destinationchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','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','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','startsWith','toLowerCase','cdr','split','lastIndexOf','execif','set','lodash','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','linkedid','OutgoingSpoolFailed','info','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','answertime','disposition','toNumber','hangup','debug','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x26f9,0x16f));var _0x926f=function(_0x5b3aca,_0x3d0d08){_0x5b3aca=_0x5b3aca-0x0;var _0x3c93b1=_0x26f9[_0x5b3aca];return _0x3c93b1;};'use strict';var _=require(_0x926f('0x0'));var util=require(_0x926f('0x1'));var utils=require('./utils');var transfers=require(_0x926f('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x926f('0x3'),_0x926f('0x4'),'NO\x20ANSWER',_0x926f('0x4'),_0x926f('0x5'),_0x926f('0x6'),_0x926f('0x3'),_0x926f('0x3'),_0x926f('0x3')];var channels={};function writeDB(_0xf56fcb){var _0x1e455d;if(transfers[_0x926f('0x7')][_0xf56fcb[_0x926f('0x8')]]){_0x1e455d=_0xf56fcb['uniqueid'];_0xf56fcb[_0x926f('0x8')]=transfers['blinds'][_0xf56fcb[_0x926f('0x8')]][_0x926f('0x9')];}utils['info'](util[_0x926f('0xa')](_0x926f('0xb'),_0xf56fcb[_0x926f('0x8')],_0xf56fcb[_0x926f('0xc')],_0xf56fcb[_0x926f('0xd')],_0xf56fcb['membername'],_0xf56fcb[_0x926f('0xe')],_0xf56fcb[_0x926f('0xf')],_0xf56fcb[_0x926f('0x10')],_0xf56fcb[_0x926f('0x11')]));if(_0xf56fcb[_0x926f('0x12')]){utils[_0x926f('0x13')](_0xf56fcb[_0x926f('0x12')])['then'](function(_0x48ee07){if(_0x48ee07){_0xf56fcb['UserId']=_0x48ee07['id'];}utils[_0x926f('0x14')](_0x926f('0x15'),_0xf56fcb);});}else{utils[_0x926f('0x14')](_0x926f('0x15'),_0xf56fcb);}if(channels[_0xf56fcb['uniqueid']]){delete channels[_0xf56fcb[_0x926f('0x8')]];}else if(_0x1e455d&&channels[_0x1e455d]){delete transfers[_0x926f('0x7')][_0x1e455d];delete channels[_0x1e455d];}}exports['newchannel']=function(_0x20307b){try{utils['debug'](util[_0x926f('0xa')]('[%s][calls][newchannel]',_0x20307b['uniqueid']),_0x20307b);if(_0x20307b[_0x926f('0x8')]==_0x20307b[_0x926f('0x16')]&&_0x20307b['channel']!=_0x926f('0x17')){utils[_0x926f('0x18')](util[_0x926f('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x20307b[_0x926f('0x8')],_0x20307b[_0x926f('0x19')],_0x20307b['exten']));channels[_0x20307b[_0x926f('0x8')]]={'uniqueid':_0x20307b[_0x926f('0x8')],'accountcode':_0x20307b['accountcode'],'source':_0x20307b[_0x926f('0xf')],'destination':_0x20307b[_0x926f('0x1a')],'destinationcontext':_0x20307b[_0x926f('0x19')],'channel':_0x20307b[_0x926f('0xc')],'starttime':utils[_0x926f('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x926f('0x4'),'amaflags':_0x926f('0x1c')};}}catch(_0x1694c3){utils[_0x926f('0x1d')](util[_0x926f('0xa')](_0x926f('0x1e'),_0x20307b['uniqueid']),_0x1694c3);}};exports[_0x926f('0x1f')]=function(_0x151f71){try{utils['debug'](util[_0x926f('0xa')](_0x926f('0x20'),_0x151f71[_0x926f('0x8')]),_0x151f71);if(!_[_0x926f('0x21')](channels[_0x151f71[_0x926f('0x8')]])&&_0x151f71[_0x926f('0x22')]==0x6){utils['info'](util[_0x926f('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x151f71[_0x926f('0x8')],_0x151f71[_0x926f('0x19')],_0x151f71[_0x926f('0xc')]));if(_[_0x926f('0x21')](channels[_0x151f71['uniqueid']][_0x926f('0x23')])){channels[_0x151f71['uniqueid']][_0x926f('0x23')]=utils[_0x926f('0x1b')]();}}else if(!_['isNil'](channels[_0x151f71['linkedid']])&&_0x151f71[_0x926f('0x22')]==0x6&&_0x151f71[_0x926f('0x19')]!='transfer'){utils[_0x926f('0x18')](util[_0x926f('0xa')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x151f71['uniqueid'],_0x151f71[_0x926f('0x16')],_0x151f71[_0x926f('0x19')],_0x151f71[_0x926f('0xc')]));channels[_0x151f71['linkedid']][_0x926f('0x12')]=_0x151f71[_0x926f('0x12')];channels[_0x151f71[_0x926f('0x16')]]['destinationchannel']=_0x151f71[_0x926f('0xc')];if(_[_0x926f('0x21')](channels[_0x151f71[_0x926f('0x16')]][_0x926f('0x24')])){channels[_0x151f71[_0x926f('0x16')]][_0x926f('0x24')]=utils['now']();}channels[_0x151f71[_0x926f('0x16')]][_0x926f('0x25')]=dispositions[_[_0x926f('0x26')](_0x151f71[_0x926f('0x22')])]||'ANSWERED';}}catch(_0x21096a){utils[_0x926f('0x1d')](util[_0x926f('0xa')](_0x926f('0x20'),_0x151f71[_0x926f('0x8')]),_0x21096a);}};exports[_0x926f('0x27')]=function(_0x1d7e5c){try{if(!_[_0x926f('0x21')](channels[_0x1d7e5c[_0x926f('0x8')]])){utils[_0x926f('0x28')](util[_0x926f('0xa')]('[%s][calls][hangup]',_0x1d7e5c[_0x926f('0x8')]),_0x1d7e5c);if(_[_0x926f('0x21')](channels[_0x1d7e5c['uniqueid']][_0x926f('0x29')])){channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x29')]=_0x1d7e5c[_0x926f('0x2a')]+'\x20<'+_0x1d7e5c[_0x926f('0xf')]+'>';}utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x2b'),_0x1d7e5c['uniqueid'],channels[_0x1d7e5c[_0x926f('0x8')]]['callerid'],_0x1d7e5c[_0x926f('0x2c')]));channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x2d')]=utils[_0x926f('0x1b')]();channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x2e')]=utils[_0x926f('0x2f')](channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x2d')],channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x30')]);channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x31')]=channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x24')]?utils['diffTime'](channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x2d')],channels[_0x1d7e5c[_0x926f('0x8')]][_0x926f('0x24')]):0x0;writeDB(channels[_0x1d7e5c[_0x926f('0x8')]]);}}catch(_0x1c542d){utils[_0x926f('0x1d')](util[_0x926f('0xa')]('[%s][calls][hangup]',_0x1d7e5c[_0x926f('0x8')]),_0x1c542d);}};exports[_0x926f('0x32')]=function(_0x2d6cfd){try{if(!_[_0x926f('0x21')](channels[_0x2d6cfd[_0x926f('0x33')]])){utils['debug'](util[_0x926f('0xa')](_0x926f('0x34'),_0x2d6cfd[_0x926f('0x35')]),_0x2d6cfd);if(channels[_0x2d6cfd[_0x926f('0x33')]][_0x926f('0xc')]==_0x2d6cfd['transfereechannel']){utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x36'),_0x2d6cfd[_0x926f('0x35')],_0x2d6cfd[_0x926f('0x33')],_0x2d6cfd['secondtransfererchannel']));channels[_0x2d6cfd[_0x926f('0x33')]]['destinationchannel']=_0x2d6cfd[_0x926f('0x37')];channels[_0x2d6cfd[_0x926f('0x33')]][_0x926f('0x38')]=_0x926f('0x39');}else if(channels[_0x2d6cfd[_0x926f('0x33')]][_0x926f('0xc')]=_0x2d6cfd[_0x926f('0x3a')]){utils['info'](util[_0x926f('0xa')](_0x926f('0x36'),_0x2d6cfd[_0x926f('0x35')],_0x2d6cfd[_0x926f('0x33')],_0x2d6cfd[_0x926f('0x3b')]));channels[_0x2d6cfd[_0x926f('0x33')]][_0x926f('0x3c')]=_0x2d6cfd[_0x926f('0x3b')];channels[_0x2d6cfd[_0x926f('0x33')]][_0x926f('0x38')]='_attended';}}}catch(_0x351ac6){utils['error'](util[_0x926f('0xa')](_0x926f('0x34'),_0x2d6cfd[_0x926f('0x35')]),_0x351ac6);}};exports[_0x926f('0x3d')]=function(_0x430ad1){try{if(!_['isNil'](channels[_0x430ad1[_0x926f('0x8')]])){utils[_0x926f('0x28')](util[_0x926f('0xa')](_0x926f('0x3e'),_0x430ad1[_0x926f('0x8')]),_0x430ad1);channels[_0x430ad1['uniqueid']][_0x926f('0x3f')]=utils[_0x926f('0x1b')]();utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x40'),_0x430ad1[_0x926f('0x8')],channels[_0x430ad1['uniqueid']][_0x926f('0x3f')]));}}catch(_0x5b626f){utils['error'](util[_0x926f('0xa')](_0x926f('0x3e'),_0x430ad1[_0x926f('0x8')]),_0x5b626f);}};exports[_0x926f('0x41')]=function(_0x30de10){try{if(!_['isNil'](channels[_0x30de10[_0x926f('0x8')]])){utils[_0x926f('0x28')](util[_0x926f('0xa')]('[%s][calls][musiconholdstop]',_0x30de10[_0x926f('0x8')]),_0x30de10);if(!_[_0x926f('0x21')](channels[_0x30de10[_0x926f('0x8')]][_0x926f('0x3f')])){channels[_0x30de10['uniqueid']][_0x926f('0x42')]+=utils['diffTime'](utils[_0x926f('0x1b')](),channels[_0x30de10['uniqueid']][_0x926f('0x3f')]);utils[_0x926f('0x18')](util['format'](_0x926f('0x43'),_0x30de10[_0x926f('0x8')],channels[_0x30de10[_0x926f('0x8')]][_0x926f('0x42')]));delete channels[_0x30de10[_0x926f('0x8')]]['musiconholdstartAt'];}}}catch(_0xeca49){utils[_0x926f('0x1d')](util[_0x926f('0xa')](_0x926f('0x44'),_0x30de10[_0x926f('0x8')]),_0xeca49);}};exports[_0x926f('0x45')]=function(_0x5463c3){try{if(!_[_0x926f('0x21')](channels[_0x5463c3[_0x926f('0x8')]])){utils[_0x926f('0x28')](util[_0x926f('0xa')](_0x926f('0x46'),_0x5463c3[_0x926f('0x8')]),_0x5463c3);if(!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')][_0x926f('0x48')])){utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x49'),_0x5463c3[_0x926f('0x8')],_0x5463c3[_0x926f('0x4a')]));channels[_0x5463c3[_0x926f('0x8')]]['source']=_0x5463c3[_0x926f('0x4a')];}if(!_['isNil'](_0x5463c3[_0x926f('0x47')][_0x926f('0x4b')])){utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x4c'),_0x5463c3[_0x926f('0x8')],_0x5463c3[_0x926f('0x4a')]));channels[_0x5463c3[_0x926f('0x8')]][_0x926f('0x4d')]=_0x5463c3[_0x926f('0x4a')];channels[_0x5463c3[_0x926f('0x8')]][_0x926f('0x29')]='\x22'+_0x5463c3[_0x926f('0x4a')]+_0x926f('0x4e')+_0x5463c3[_0x926f('0x4a')]+'>';}if(!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')][_0x926f('0x4f')])||!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')][_0x926f('0x50')])){utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x51'),_0x5463c3[_0x926f('0x8')],!_['isNil'](_0x5463c3['variable']['xmd-callerid-preview'])?_0x926f('0x4f'):_0x926f('0x50'),_0x5463c3[_0x926f('0x4a')]));channels[_0x5463c3[_0x926f('0x8')]][_0x926f('0x29')]=_0x5463c3[_0x926f('0x4a')];}if(!_['isNil'](_0x5463c3[_0x926f('0x47')][_0x926f('0x52')])||!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')][_0x926f('0x53')])){utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x51'),_0x5463c3['uniqueid'],!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')][_0x926f('0x52')])?_0x926f('0x52'):_0x926f('0x53'),_0x5463c3['value']));channels[_0x5463c3[_0x926f('0x8')]][_0x926f('0x54')]=_0x926f('0x55');channels[_0x5463c3['uniqueid']][_0x926f('0x56')]=_0x5463c3[_0x926f('0x4a')];channels[_0x5463c3[_0x926f('0x8')]][_0x926f('0xd')]=!![];}if(!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')]['xmd-contactid'])){utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x57'),_0x5463c3[_0x926f('0x8')],_0x5463c3[_0x926f('0x4a')]));channels[_0x5463c3[_0x926f('0x8')]][_0x926f('0x58')]=_0x5463c3[_0x926f('0x4a')];}if(!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')][_0x926f('0x59')])){utils[_0x926f('0x18')](util[_0x926f('0xa')](_0x926f('0x5a'),_0x5463c3['uniqueid'],_0x5463c3[_0x926f('0x4a')]));channels[_0x5463c3[_0x926f('0x8')]][_0x926f('0x5b')]=_0x5463c3['value'];}if(!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')]['outboundrouteid'])){utils[_0x926f('0x18')](util['format'](_0x926f('0x5c'),_0x5463c3[_0x926f('0x8')],_0x5463c3[_0x926f('0x4a')]));channels[_0x5463c3[_0x926f('0x8')]]['routeid']=_0x5463c3['value'];}if(!_[_0x926f('0x21')](_0x5463c3[_0x926f('0x47')][_0x926f('0x5d')])){utils['info'](util[_0x926f('0xa')](_0x926f('0x5e'),_0x5463c3['uniqueid'],_0x5463c3['value']));channels[_0x5463c3[_0x926f('0x8')]][_0x926f('0x5d')]=_0x5463c3[_0x926f('0x4a')];}}}catch(_0x2f4c58){utils[_0x926f('0x1d')](util[_0x926f('0xa')](_0x926f('0x46'),_0x5463c3[_0x926f('0x8')]),_0x2f4c58);}};exports[_0x926f('0x5f')]=function(_0x7d9025){try{if(!_[_0x926f('0x21')](channels[_0x7d9025[_0x926f('0x8')]])){utils['debug'](util[_0x926f('0xa')](_0x926f('0x60'),_0x7d9025['uniqueid']),_0x7d9025);utils[_0x926f('0x18')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x7d9025['uniqueid'],_0x7d9025[_0x926f('0x61')],_0x7d9025[_0x926f('0x62')]));if(_0x7d9025[_0x926f('0x61')]['toLowerCase']()=='set'&&_[_0x926f('0x63')](_0x7d9025[_0x926f('0x62')][_0x926f('0x64')](),_0x926f('0x65'))){var _0x180d39=_0x7d9025[_0x926f('0x62')][_0x926f('0x66')]('=');var _0x4a5374=_0x180d39[0x0]['substring'](_0x180d39[0x0]['lastIndexOf']('(')+0x1,_0x180d39[0x0][_0x926f('0x67')](')'));var _0xff8f64=_0x180d39[0x1];channels[_0x7d9025[_0x926f('0x8')]][_0x4a5374]=_0xff8f64;}if(!_['includes']([_0x926f('0x27'),'noop',_0x926f('0x68'),_0x926f('0x69'),'gotoif'],_0x7d9025['application'][_0x926f('0x64')]())){channels[_0x7d9025['uniqueid']][_0x926f('0x54')]=_0x7d9025[_0x926f('0x61')];channels[_0x7d9025[_0x926f('0x8')]][_0x926f('0x56')]=_0x7d9025[_0x926f('0x62')];}}}catch(_0x779a60){utils[_0x926f('0x1d')](util['format']('[%s][calls][newexten]',_0x7d9025[_0x926f('0x8')]),_0x779a60);}};
\ No newline at end of file
+var _0x2042=['[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','endtime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime'];(function(_0x224705,_0x135167){var _0x3354b1=function(_0x188bd7){while(--_0x188bd7){_0x224705['push'](_0x224705['shift']());}};_0x3354b1(++_0x135167);}(_0x2042,0xfe));var _0x2204=function(_0x24946f,_0x623783){_0x24946f=_0x24946f-0x0;var _0x4e4f15=_0x2042[_0x24946f];return _0x4e4f15;};'use strict';var _=require(_0x2204('0x0'));var util=require(_0x2204('0x1'));var utils=require(_0x2204('0x2'));var transfers=require(_0x2204('0x3'));var dispositions=[_0x2204('0x4'),_0x2204('0x5'),_0x2204('0x5'),'NO\x20ANSWER',_0x2204('0x4'),_0x2204('0x4'),_0x2204('0x6'),_0x2204('0x7'),'FAILED',_0x2204('0x5'),_0x2204('0x5')];var channels={};function writeDB(_0x322f01){var _0x11fa2f;if(transfers[_0x2204('0x8')][_0x322f01[_0x2204('0x9')]]){_0x11fa2f=_0x322f01[_0x2204('0x9')];_0x322f01[_0x2204('0x9')]=transfers[_0x2204('0x8')][_0x322f01[_0x2204('0x9')]][_0x2204('0xa')];}utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0xd'),_0x322f01[_0x2204('0x9')],_0x322f01[_0x2204('0xe')],_0x322f01[_0x2204('0xf')],_0x322f01[_0x2204('0x10')],_0x322f01['interface'],_0x322f01[_0x2204('0x11')],_0x322f01['connectedlinenum'],_0x322f01['lastevent']));if(_0x322f01[_0x2204('0x12')]){utils['getUserByInternal'](_0x322f01[_0x2204('0x12')])[_0x2204('0x13')](function(_0xc24301){if(_0xc24301){_0x322f01[_0x2204('0x14')]=_0xc24301['id'];}utils[_0x2204('0x15')](_0x2204('0x16'),_0x322f01);});}else{utils[_0x2204('0x15')](_0x2204('0x16'),_0x322f01);}if(channels[_0x322f01[_0x2204('0x9')]]){delete channels[_0x322f01['uniqueid']];}else if(_0x11fa2f&&channels[_0x11fa2f]){delete transfers[_0x2204('0x8')][_0x11fa2f];delete channels[_0x11fa2f];}}exports[_0x2204('0x17')]=function(_0x34193c){try{utils[_0x2204('0x18')](util[_0x2204('0xc')](_0x2204('0x19'),_0x34193c[_0x2204('0x9')]),_0x34193c);if(_0x34193c[_0x2204('0x9')]==_0x34193c[_0x2204('0x1a')]&&_0x34193c[_0x2204('0xe')]!=_0x2204('0x1b')){utils['info'](util[_0x2204('0xc')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x34193c[_0x2204('0x9')],_0x34193c[_0x2204('0x1c')],_0x34193c[_0x2204('0x1d')]));channels[_0x34193c['uniqueid']]={'uniqueid':_0x34193c[_0x2204('0x9')],'accountcode':_0x34193c[_0x2204('0x12')],'source':_0x34193c[_0x2204('0x11')],'destination':_0x34193c[_0x2204('0x1d')],'destinationcontext':_0x34193c[_0x2204('0x1c')],'channel':_0x34193c[_0x2204('0xe')],'starttime':utils[_0x2204('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x2204('0x1f')};}}catch(_0xf6a7e){utils['error'](util[_0x2204('0xc')](_0x2204('0x19'),_0x34193c['uniqueid']),_0xf6a7e);}};exports[_0x2204('0x20')]=function(_0x5e6108){try{utils[_0x2204('0x18')](util[_0x2204('0xc')]('[%s][calls][newstate]',_0x5e6108[_0x2204('0x9')]),_0x5e6108);if(!_[_0x2204('0x21')](channels[_0x5e6108[_0x2204('0x9')]])&&_0x5e6108[_0x2204('0x22')]==0x6){utils['info'](util[_0x2204('0xc')](_0x2204('0x23'),_0x5e6108[_0x2204('0x9')],_0x5e6108['context'],_0x5e6108[_0x2204('0xe')]));if(_['isNil'](channels[_0x5e6108[_0x2204('0x9')]]['systemanswertime'])){channels[_0x5e6108[_0x2204('0x9')]][_0x2204('0x24')]=utils[_0x2204('0x1e')]();}}else if(!_[_0x2204('0x21')](channels[_0x5e6108[_0x2204('0x1a')]])&&_0x5e6108[_0x2204('0x22')]==0x6&&_0x5e6108[_0x2204('0x1c')]!='transfer'){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x25'),_0x5e6108[_0x2204('0x9')],_0x5e6108['linkedid'],_0x5e6108[_0x2204('0x1c')],_0x5e6108[_0x2204('0xe')]));channels[_0x5e6108[_0x2204('0x1a')]]['accountcode']=_0x5e6108[_0x2204('0x12')];channels[_0x5e6108['linkedid']][_0x2204('0x26')]=_0x5e6108[_0x2204('0xe')];if(_[_0x2204('0x21')](channels[_0x5e6108[_0x2204('0x1a')]][_0x2204('0x27')])){channels[_0x5e6108[_0x2204('0x1a')]][_0x2204('0x27')]=utils[_0x2204('0x1e')]();}channels[_0x5e6108['linkedid']][_0x2204('0x28')]=dispositions[_[_0x2204('0x29')](_0x5e6108[_0x2204('0x22')])]||'ANSWERED';}}catch(_0x176867){utils[_0x2204('0x2a')](util[_0x2204('0xc')](_0x2204('0x2b'),_0x5e6108[_0x2204('0x9')]),_0x176867);}};exports[_0x2204('0x2c')]=function(_0x1dd5c6){try{if(!_[_0x2204('0x21')](channels[_0x1dd5c6[_0x2204('0x9')]])){utils['debug'](util[_0x2204('0xc')](_0x2204('0x2d'),_0x1dd5c6[_0x2204('0x9')]),_0x1dd5c6);if(_[_0x2204('0x21')](channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x2e')])){channels[_0x1dd5c6[_0x2204('0x9')]]['callerid']=_0x1dd5c6[_0x2204('0x2f')]+'\x20<'+_0x1dd5c6['calleridnum']+'>';}utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x30'),_0x1dd5c6['uniqueid'],channels[_0x1dd5c6[_0x2204('0x9')]]['callerid'],_0x1dd5c6[_0x2204('0x31')]));channels[_0x1dd5c6[_0x2204('0x9')]]['endtime']=utils['now']();channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x32')]=utils[_0x2204('0x33')](channels[_0x1dd5c6['uniqueid']]['endtime'],channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x34')]);channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x35')]=channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x27')]?utils['diffTime'](channels[_0x1dd5c6[_0x2204('0x9')]][_0x2204('0x36')],channels[_0x1dd5c6[_0x2204('0x9')]]['answertime']):0x0;writeDB(channels[_0x1dd5c6[_0x2204('0x9')]]);}}catch(_0x3d44aa){utils['error'](util[_0x2204('0xc')](_0x2204('0x2d'),_0x1dd5c6['uniqueid']),_0x3d44aa);}};exports['attendedtransfer']=function(_0x3b033e){try{if(!_[_0x2204('0x21')](channels[_0x3b033e[_0x2204('0x37')]])){utils['debug'](util[_0x2204('0xc')](_0x2204('0x38'),_0x3b033e[_0x2204('0x39')]),_0x3b033e);if(channels[_0x3b033e[_0x2204('0x37')]][_0x2204('0xe')]==_0x3b033e[_0x2204('0x3a')]){utils[_0x2204('0xb')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3b033e['origtransfereruniqueid'],_0x3b033e['localtwolinkedid'],_0x3b033e[_0x2204('0x3b')]));channels[_0x3b033e['localtwolinkedid']][_0x2204('0x26')]=_0x3b033e[_0x2204('0x3b')];channels[_0x3b033e[_0x2204('0x37')]]['userfield']=_0x2204('0x3c');}else if(channels[_0x3b033e[_0x2204('0x37')]]['channel']=_0x3b033e['transfertargetchannel']){utils[_0x2204('0xb')](util[_0x2204('0xc')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3b033e['origtransfereruniqueid'],_0x3b033e[_0x2204('0x37')],_0x3b033e[_0x2204('0x3d')]));channels[_0x3b033e[_0x2204('0x37')]][_0x2204('0x26')]=_0x3b033e[_0x2204('0x3d')];channels[_0x3b033e[_0x2204('0x37')]][_0x2204('0x3e')]=_0x2204('0x3c');}}}catch(_0x20852d){utils[_0x2204('0x2a')](util[_0x2204('0xc')](_0x2204('0x38'),_0x3b033e[_0x2204('0x39')]),_0x20852d);}};exports[_0x2204('0x3f')]=function(_0x5cb7d4){try{if(!_[_0x2204('0x21')](channels[_0x5cb7d4['uniqueid']])){utils['debug'](util['format'](_0x2204('0x40'),_0x5cb7d4[_0x2204('0x9')]),_0x5cb7d4);channels[_0x5cb7d4[_0x2204('0x9')]][_0x2204('0x41')]=utils[_0x2204('0x1e')]();utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x42'),_0x5cb7d4[_0x2204('0x9')],channels[_0x5cb7d4['uniqueid']]['musiconholdstartAt']));}}catch(_0x32d0e1){utils[_0x2204('0x2a')](util['format'](_0x2204('0x40'),_0x5cb7d4[_0x2204('0x9')]),_0x32d0e1);}};exports[_0x2204('0x43')]=function(_0x3edd02){try{if(!_[_0x2204('0x21')](channels[_0x3edd02['uniqueid']])){utils['debug'](util['format'](_0x2204('0x44'),_0x3edd02[_0x2204('0x9')]),_0x3edd02);if(!_[_0x2204('0x21')](channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x41')])){channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x45')]+=utils[_0x2204('0x33')](utils[_0x2204('0x1e')](),channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x41')]);utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x46'),_0x3edd02['uniqueid'],channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x45')]));delete channels[_0x3edd02[_0x2204('0x9')]][_0x2204('0x41')];}}}catch(_0x189cb2){utils[_0x2204('0x2a')](util[_0x2204('0xc')](_0x2204('0x44'),_0x3edd02[_0x2204('0x9')]),_0x189cb2);}};exports[_0x2204('0x47')]=function(_0x5073fd){try{if(!_['isNil'](channels[_0x5073fd[_0x2204('0x9')]])){utils['debug'](util[_0x2204('0xc')](_0x2204('0x48'),_0x5073fd[_0x2204('0x9')]),_0x5073fd);if(!_[_0x2204('0x21')](_0x5073fd[_0x2204('0x49')][_0x2204('0x4a')])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x4b'),_0x5073fd[_0x2204('0x9')],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x4d')]=_0x5073fd[_0x2204('0x4c')];}if(!_['isNil'](_0x5073fd[_0x2204('0x49')][_0x2204('0x4e')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5073fd[_0x2204('0x9')],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x4f')]=_0x5073fd[_0x2204('0x4c')];channels[_0x5073fd[_0x2204('0x9')]][_0x2204('0x2e')]='\x22'+_0x5073fd[_0x2204('0x4c')]+_0x2204('0x50')+_0x5073fd['value']+'>';}if(!_[_0x2204('0x21')](_0x5073fd[_0x2204('0x49')]['xmd-callerid-preview'])||!_[_0x2204('0x21')](_0x5073fd['variable'][_0x2204('0x51')])){utils['info'](util[_0x2204('0xc')](_0x2204('0x52'),_0x5073fd[_0x2204('0x9')],!_[_0x2204('0x21')](_0x5073fd['variable'][_0x2204('0x53')])?_0x2204('0x53'):_0x2204('0x51'),_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x2e')]=_0x5073fd[_0x2204('0x4c')];}if(!_[_0x2204('0x21')](_0x5073fd['variable'][_0x2204('0x54')])||!_['isNil'](_0x5073fd['variable'][_0x2204('0x55')])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x52'),_0x5073fd[_0x2204('0x9')],!_['isNil'](_0x5073fd[_0x2204('0x49')][_0x2204('0x54')])?_0x2204('0x54'):'xmcs-queue',_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x56')]=_0x2204('0x57');channels[_0x5073fd[_0x2204('0x9')]][_0x2204('0x58')]=_0x5073fd[_0x2204('0x4c')];channels[_0x5073fd[_0x2204('0x9')]][_0x2204('0xf')]=!![];}if(!_[_0x2204('0x21')](_0x5073fd[_0x2204('0x49')]['xmd-contactid'])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x59'),_0x5073fd[_0x2204('0x9')],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd['uniqueid']][_0x2204('0x5a')]=_0x5073fd[_0x2204('0x4c')];}if(!_['isNil'](_0x5073fd[_0x2204('0x49')]['xmd-cdrtype'])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x5b'),_0x5073fd['uniqueid'],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd[_0x2204('0x9')]]['type']=_0x5073fd['value'];}if(!_['isNil'](_0x5073fd['variable']['outboundrouteid'])){utils['info'](util[_0x2204('0xc')](_0x2204('0x5c'),_0x5073fd[_0x2204('0x9')],_0x5073fd['value']));channels[_0x5073fd['uniqueid']][_0x2204('0x5d')]=_0x5073fd['value'];}if(!_[_0x2204('0x21')](_0x5073fd[_0x2204('0x49')]['sipcallid'])){utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x5e'),_0x5073fd[_0x2204('0x9')],_0x5073fd[_0x2204('0x4c')]));channels[_0x5073fd[_0x2204('0x9')]]['sipcallid']=_0x5073fd['value'];}}}catch(_0x933d89){utils[_0x2204('0x2a')](util[_0x2204('0xc')](_0x2204('0x48'),_0x5073fd[_0x2204('0x9')]),_0x933d89);}};exports[_0x2204('0x5f')]=function(_0x319a64){try{if(!_[_0x2204('0x21')](channels[_0x319a64['uniqueid']])){utils[_0x2204('0x18')](util['format']('[%s][calls][newexten]',_0x319a64[_0x2204('0x9')]),_0x319a64);utils[_0x2204('0xb')](util[_0x2204('0xc')](_0x2204('0x60'),_0x319a64['uniqueid'],_0x319a64['application'],_0x319a64[_0x2204('0x61')]));if(_0x319a64[_0x2204('0x62')][_0x2204('0x63')]()==_0x2204('0x64')&&_['startsWith'](_0x319a64[_0x2204('0x61')]['toLowerCase'](),_0x2204('0x65'))){var _0x1c9f12=_0x319a64['appdata'][_0x2204('0x66')]('=');var _0x355cbb=_0x1c9f12[0x0][_0x2204('0x67')](_0x1c9f12[0x0][_0x2204('0x68')]('(')+0x1,_0x1c9f12[0x0][_0x2204('0x68')](')'));var _0x19b16e=_0x1c9f12[0x1];channels[_0x319a64[_0x2204('0x9')]][_0x355cbb]=_0x19b16e;}if(!_[_0x2204('0x69')]([_0x2204('0x2c'),_0x2204('0x6a'),'execif',_0x2204('0x64'),'gotoif'],_0x319a64[_0x2204('0x62')][_0x2204('0x63')]())){channels[_0x319a64[_0x2204('0x9')]][_0x2204('0x56')]=_0x319a64[_0x2204('0x62')];channels[_0x319a64[_0x2204('0x9')]]['lastdata']=_0x319a64[_0x2204('0x61')];}}}catch(_0x552816){utils[_0x2204('0x2a')](util['format'](_0x2204('0x6b'),_0x319a64[_0x2204('0x9')]),_0x552816);}};
\ No newline at end of file