Built motion from commit bab6f49e.|2.6.17
[motion2.git] / server / services / routing / server / applications / dialogflow.js
index a892ec8..dee9204 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x04cc=['InteractionId','isEmpty','getMustacheRender','create','then','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','result','fulfillment','speech','providerName','providerResponse','Message','metadata','lodash','moment','apiai-promise','md5','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst'];(function(_0x3a1580,_0x565597){var _0xb101a6=function(_0xdb5833){while(--_0xdb5833){_0x3a1580['push'](_0x3a1580['shift']());}};_0xb101a6(++_0x565597);}(_0x04cc,0x11a));var _0xc04c=function(_0x45bee0,_0x42bf09){_0x45bee0=_0x45bee0-0x0;var _0x1fcfd5=_0x04cc[_0x45bee0];return _0x1fcfd5;};'use strict';var _=require(_0xc04c('0x0'));var moment=require(_0xc04c('0x1'));var apiai=require(_0xc04c('0x2'));var md5=require(_0xc04c('0x3'));var utils=require('./utils');var logger=require(_0xc04c('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc04c('0x5')),'mailMessage':require(_0xc04c('0x6')),'smsMessage':require(_0xc04c('0x7')),'faxMessage':require(_0xc04c('0x8')),'whatsappMessage':require(_0xc04c('0x9'))};exports[_0xc04c('0xa')]=function(_0x5c32d8,_0x5a6076){return function(_0x422430){try{if(!_[_0xc04c('0xb')](this[_0xc04c('0xc')][_0xc04c('0xd')])){logger[_0xc04c('0xe')](_0xc04c('0xf'),_0x5c32d8,_0xc04c('0x10'));return _0x422430[_0xc04c('0x11')]();}var _0x4dcea5={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc04c('0x12')](_0xc04c('0x13')),'direction':_0xc04c('0x14')};if(this[_0xc04c('0x15')]===_0xc04c('0x16')||this[_0xc04c('0x15')]===_0xc04c('0x17')){_0x4dcea5['phone']=this['interaction'][_0xc04c('0x18')];}var _0x49771f=this[_0xc04c('0x15')];if(_0x49771f===_0xc04c('0x19')){_0x4dcea5[_0xc04c('0x1a')]=this[_0xc04c('0x1b')]['id'];}else{_0x4dcea5[_['upperFirst'](_0x49771f)+_0xc04c('0x1c')]=this[_0xc04c('0x1b')]['id'];}_0x4dcea5[_[_0xc04c('0x1d')](_0x49771f)+_0xc04c('0x1e')]=this['interaction']['id'];if(this['interaction']['created']){var _0x32f350=_0x5a6076[0x2];if(!_[_0xc04c('0x1f')](_0x32f350)){_0x4dcea5['body']=utils[_0xc04c('0x20')](_0x32f350,this);return rpc[_0x49771f+'Message'][_0xc04c('0x21')](_0x4dcea5)[_0xc04c('0x22')](function(_0x59d405){logger[_0xc04c('0xe')](_0xc04c('0xf'),_0x5c32d8,_0x4dcea5[_0xc04c('0x23')]);})[_0xc04c('0x24')](function(_0x29db9f){logger[_0xc04c('0x25')](_0xc04c('0xf'),_0x5c32d8,JSON[_0xc04c('0x26')](_0x29db9f));})[_0xc04c('0x27')](function(){logger[_0xc04c('0xe')](_0xc04c('0x28'),_0x5c32d8);_0x422430['stop']();});}else{logger[_0xc04c('0xe')](_0xc04c('0x29'),_0x5c32d8);_0x422430[_0xc04c('0x2a')]();}}else{var _0x1fa984=this;var _0x2422af=apiai(_0x5a6076[0x0],{'language':_0x5a6076[0x1]||'en'});return _0x2422af[_0xc04c('0x2b')](this[_0xc04c('0x2c')][_0xc04c('0x23')],{'sessionId':md5(this[_0xc04c('0xc')]['id'])})[_0xc04c('0x22')](function(_0x47dddc){_0x1fa984[_0xc04c('0x23')]['dialogflow']=_0x47dddc;_0x4dcea5[_0xc04c('0x23')]=_0x47dddc[_0xc04c('0x2d')][_0xc04c('0x2e')][_0xc04c('0x2f')];_0x4dcea5[_0xc04c('0x30')]='dialogflow';_0x4dcea5[_0xc04c('0x31')]=JSON[_0xc04c('0x26')](_0x47dddc);return rpc[_0x49771f+_0xc04c('0x32')][_0xc04c('0x21')](_0x4dcea5)[_0xc04c('0x22')](function(_0x4e6e43){logger[_0xc04c('0xe')](_0xc04c('0xf'),_0x5c32d8,_0x4dcea5[_0xc04c('0x23')]);if(_0x47dddc['result'][_0xc04c('0x33')]['endConversation']){_0x422430[_0xc04c('0x11')]();}else{_0x422430[_0xc04c('0x2a')]();}})[_0xc04c('0x24')](function(_0x596b9b){logger[_0xc04c('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x5c32d8,JSON[_0xc04c('0x26')](_0x596b9b));_0x422430[_0xc04c('0x11')]();});})[_0xc04c('0x24')](function(_0x348525){logger[_0xc04c('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x5c32d8,_0x348525[_0xc04c('0x2c')]);_0x422430['next']();});}}catch(_0x393448){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x5c32d8,JSON['stringify'](_0x393448));_0x422430[_0xc04c('0x2a')]();}};};
\ No newline at end of file
+var _0x8be8=['error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','Message','create','then','info','body','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','stringify','metadata','endConversation','catch'];(function(_0x138feb,_0x9ab7e9){var _0x3742b6=function(_0x44806f){while(--_0x44806f){_0x138feb['push'](_0x138feb['shift']());}};_0x3742b6(++_0x9ab7e9);}(_0x8be8,0xf6));var _0x88be=function(_0x419018,_0x23a46c){_0x419018=_0x419018-0x0;var _0x2197ef=_0x8be8[_0x419018];return _0x2197ef;};'use strict';var _=require(_0x88be('0x0'));var moment=require(_0x88be('0x1'));var apiai=require(_0x88be('0x2'));var md5=require(_0x88be('0x3'));var utils=require(_0x88be('0x4'));var logger=require(_0x88be('0x5'))(_0x88be('0x6'));var rpc={'chatMessage':require(_0x88be('0x7')),'openchannelMessage':require(_0x88be('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x88be('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x88be('0xa'))};exports['consequence']=function(_0xe98d35,_0x50fc6e){return function(_0xb5d944){try{if(!_[_0x88be('0xb')](this[_0x88be('0xc')][_0x88be('0xd')])){logger['info'](_0x88be('0xe'),_0xe98d35,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xb5d944[_0x88be('0xf')]();}var _0x2f6fb0={'ContactId':this[_0x88be('0x10')]['id'],'sentAt':moment()['format'](_0x88be('0x11')),'direction':_0x88be('0x12')};if(this[_0x88be('0x13')]==='sms'||this[_0x88be('0x13')]==='whatsapp'){_0x2f6fb0[_0x88be('0x14')]=this['interaction']['phone'];}var _0x3cacc3=this[_0x88be('0x13')];if(_0x3cacc3===_0x88be('0x15')){_0x2f6fb0[_0x88be('0x16')]=this[_0x88be('0x17')]['id'];}else{_0x2f6fb0[_[_0x88be('0x18')](_0x3cacc3)+_0x88be('0x19')]=this[_0x88be('0x17')]['id'];}_0x2f6fb0[_['upperFirst'](_0x3cacc3)+_0x88be('0x1a')]=this[_0x88be('0xc')]['id'];if(this[_0x88be('0xc')]['created']){var _0x5658e4=_0x50fc6e[0x2];if(!_[_0x88be('0x1b')](_0x5658e4)){_0x2f6fb0['body']=utils[_0x88be('0x1c')](_0x5658e4,this);return rpc[_0x3cacc3+_0x88be('0x1d')][_0x88be('0x1e')](_0x2f6fb0)[_0x88be('0x1f')](function(_0x152918){logger[_0x88be('0x20')](_0x88be('0xe'),_0xe98d35,_0x2f6fb0[_0x88be('0x21')]);})['catch'](function(_0x3d83b0){logger['error'](_0x88be('0xe'),_0xe98d35,JSON['stringify'](_0x3d83b0));})['finally'](function(){logger[_0x88be('0x20')](_0x88be('0x22'),_0xe98d35);_0xb5d944[_0x88be('0x23')]();});}else{logger['info'](_0x88be('0x24'),_0xe98d35);_0xb5d944[_0x88be('0x23')]();}}else{var _0x1d0414=this;var _0x213580=apiai(_0x50fc6e[0x0],{'language':_0x50fc6e[0x1]||'en'});return _0x213580[_0x88be('0x25')](this[_0x88be('0x26')][_0x88be('0x21')],{'sessionId':md5(this[_0x88be('0xc')]['id'])})[_0x88be('0x1f')](function(_0x215024){_0x1d0414[_0x88be('0x21')][_0x88be('0x27')]=_0x215024;_0x2f6fb0[_0x88be('0x21')]=_0x215024[_0x88be('0x28')][_0x88be('0x29')][_0x88be('0x2a')];_0x2f6fb0['providerName']=_0x88be('0x27');_0x2f6fb0[_0x88be('0x2b')]=JSON[_0x88be('0x2c')](_0x215024);return rpc[_0x3cacc3+'Message'][_0x88be('0x1e')](_0x2f6fb0)[_0x88be('0x1f')](function(_0x1ca77c){logger[_0x88be('0x20')](_0x88be('0xe'),_0xe98d35,_0x2f6fb0['body']);if(_0x215024[_0x88be('0x28')][_0x88be('0x2d')][_0x88be('0x2e')]){_0xb5d944['next']();}else{_0xb5d944[_0x88be('0x23')]();}})[_0x88be('0x2f')](function(_0x1af670){logger[_0x88be('0x30')](_0x88be('0xe'),_0xe98d35,JSON[_0x88be('0x2c')](_0x1af670));_0xb5d944[_0x88be('0xf')]();});})[_0x88be('0x2f')](function(_0x1de831){logger['error'](_0x88be('0xe'),_0xe98d35,_0x1de831[_0x88be('0x26')]);_0xb5d944[_0x88be('0xf')]();});}}catch(_0x23ccbe){logger[_0x88be('0x30')](_0x88be('0xe'),_0xe98d35,JSON[_0x88be('0x2c')](_0x23ccbe));_0xb5d944[_0x88be('0x23')]();}};};
\ No newline at end of file