Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
});
// Initialize bots root dialog
const dialogs = new StateMachineDialog('main', 'offHook');
bot.rootDialog = dialogs;
// offHook state
const offHook = dialogs.addState('offHook', [
new SendActivity(`âī¸ off hook`),
new SendActivity(`say "place a call" to get started.`)
]);
offHook.permit('callDialed', 'ringing');
offHook.recognizer = new RegExpRecognizer().addIntent('PlaceCallIntent', /place .*call/i);
offHook.addRule(new OnIntent('PlaceCallIntent', [], [
new EmitEvent('callDialed')
]));
// ringing state
const ringing = dialogs.addState('ringing', [
new SendActivity(`âī¸ ring... ring...`),
new ConfirmInput('$answer', `Would you like to answer it?`, true),
new IfCondition('$answer == true', [
new EmitEvent('callConnected')
])
]);
ringing.permit('callConnected', 'connected');
// connected state
const connected = dialogs.addState('connected', [
// offHook state
const offHook = dialogs.addState('offHook', [
new botbuilder_dialogs_adaptive_1.SendActivity(`âī¸ off hook`),
new botbuilder_dialogs_adaptive_1.SendActivity(`say "place a call" to get started.`)
]);
offHook.permit('callDialed', 'ringing');
offHook.recognizer = new botbuilder_dialogs_adaptive_1.RegExpRecognizer().addIntent('PlaceCallIntent', /place .*call/i);
offHook.addRule(new botbuilder_dialogs_adaptive_1.OnIntent('PlaceCallIntent', [
new botbuilder_dialogs_adaptive_1.EmitEvent('callDialed')
]));
// ringing state
const ringing = dialogs.addState('ringing', [
new botbuilder_dialogs_adaptive_1.SendActivity(`âī¸ ring... ring...`),
new botbuilder_dialogs_adaptive_1.ConfirmInput('$answer', `Would you like to answer it?`, true),
new botbuilder_dialogs_adaptive_1.IfCondition('$answer == true', [
new botbuilder_dialogs_adaptive_1.EmitEvent('callConnected')
])
]);
ringing.permit('callConnected', 'connected');
// connected state
const connected = dialogs.addState('connected', [
new botbuilder_dialogs_adaptive_1.SendActivity(`đ talk... talk... talk... âšī¸`),
new botbuilder_dialogs_adaptive_1.ConfirmInput('$hangup', `Heard enough yet?`, true),
new botbuilder_dialogs_adaptive_1.IfCondition('$hangup == true', [
new botbuilder_dialogs_adaptive_1.EmitEvent('callEnded')
])
]);
connected.permit('callEnded', 'offHook');
//# sourceMappingURL=index.js.map
new SendActivity(`âī¸ off hook`),
new SendActivity(`say "place a call" to get started.`)
]);
offHook.permit('callDialed', 'ringing');
offHook.recognizer = new RegExpRecognizer().addIntent('PlaceCallIntent', /place .*call/i);
offHook.addRule(new OnIntent('PlaceCallIntent', [], [
new EmitEvent('callDialed')
]));
// ringing state
const ringing = dialogs.addState('ringing', [
new SendActivity(`âī¸ ring... ring...`),
new ConfirmInput('$answer', `Would you like to answer it?`, true),
new IfCondition('$answer == true', [
new EmitEvent('callConnected')
])
]);
ringing.permit('callConnected', 'connected');
// connected state
const connected = dialogs.addState('connected', [
new SendActivity(`đ talk... talk... talk... âšī¸`),
new ConfirmInput('$hangup', `Heard enough yet?`, true),
new IfCondition('$hangup == true', [
new EmitEvent('callEnded')
])
]);
connected.permit('callEnded', 'offHook');
]));
// ringing state
const ringing = dialogs.addState('ringing', [
new botbuilder_dialogs_adaptive_1.SendActivity(`âī¸ ring... ring...`),
new botbuilder_dialogs_adaptive_1.ConfirmInput('$answer', `Would you like to answer it?`, true),
new botbuilder_dialogs_adaptive_1.IfCondition('$answer == true', [
new botbuilder_dialogs_adaptive_1.EmitEvent('callConnected')
])
]);
ringing.permit('callConnected', 'connected');
// connected state
const connected = dialogs.addState('connected', [
new botbuilder_dialogs_adaptive_1.SendActivity(`đ talk... talk... talk... âšī¸`),
new botbuilder_dialogs_adaptive_1.ConfirmInput('$hangup', `Heard enough yet?`, true),
new botbuilder_dialogs_adaptive_1.IfCondition('$hangup == true', [
new botbuilder_dialogs_adaptive_1.EmitEvent('callEnded')
])
]);
connected.permit('callEnded', 'offHook');
//# sourceMappingURL=index.js.map
const ringing = dialogs.addState('ringing', [
new SendActivity(`âī¸ ring... ring...`),
new ConfirmInput('$answer', `Would you like to answer it?`, true),
new IfCondition('$answer == true', [
new EmitEvent('callConnected')
])
]);
ringing.permit('callConnected', 'connected');
// connected state
const connected = dialogs.addState('connected', [
new SendActivity(`đ talk... talk... talk... âšī¸`),
new ConfirmInput('$hangup', `Heard enough yet?`, true),
new IfCondition('$hangup == true', [
new EmitEvent('callEnded')
])
]);
connected.permit('callEnded', 'offHook');
// Route activity to bot.
await bot.onTurn(context);
});
});
// Initialize bots root dialog
const dialogs = new botbuilder_dialogs_adaptive_1.StateMachineDialog('main', 'offHook');
bot.rootDialog = dialogs;
// offHook state
const offHook = dialogs.addState('offHook', [
new botbuilder_dialogs_adaptive_1.SendActivity(`âī¸ off hook`),
new botbuilder_dialogs_adaptive_1.SendActivity(`say "place a call" to get started.`)
]);
offHook.permit('callDialed', 'ringing');
offHook.recognizer = new botbuilder_dialogs_adaptive_1.RegExpRecognizer().addIntent('PlaceCallIntent', /place .*call/i);
offHook.addRule(new botbuilder_dialogs_adaptive_1.OnIntent('PlaceCallIntent', [
new botbuilder_dialogs_adaptive_1.EmitEvent('callDialed')
]));
// ringing state
const ringing = dialogs.addState('ringing', [
new botbuilder_dialogs_adaptive_1.SendActivity(`âī¸ ring... ring...`),
new botbuilder_dialogs_adaptive_1.ConfirmInput('$answer', `Would you like to answer it?`, true),
new botbuilder_dialogs_adaptive_1.IfCondition('$answer == true', [
new botbuilder_dialogs_adaptive_1.EmitEvent('callConnected')
])
]);
ringing.permit('callConnected', 'connected');
// connected state
const connected = dialogs.addState('connected', [
new botbuilder_dialogs_adaptive_1.SendActivity(`đ talk... talk... talk... âšī¸`),
new botbuilder_dialogs_adaptive_1.ConfirmInput('$hangup', `Heard enough yet?`, true),
new botbuilder_dialogs_adaptive_1.IfCondition('$hangup == true', [
new botbuilder_dialogs_adaptive_1.EmitEvent('callEnded')