Wednesday, May 30, 2018

Oracle Bot Cloud (IBCS): Voice based coversation

Problem Description: In this blog we are trying to enhance our web chatbot ui created in previous blog and add voice features.

Idea here is to send text message to Bot and receive only text messages but before sending convert user voice (speech) to text and again when we receive and message from bot server play it as audio.

There are few options available to convert voice and text. In this blog we are going to use
1. Speech to Text:  webkitSpeechRecognition api of browser
2. Text to Speech: speechSynthesis api of browser

Lets take our previous chatbot UI created in blog http://sanjeev-technology.blogspot.com/2018/05/oracle-bot-cloud-ibcs-custom-ui.html and enhance it for voice support.

Now we can follow below steps
1. Add a button to initiate voice chatting
<oj-button id="start_button" on-oj-action="[[startVoiceChat]]">Start Voice Chat</oj-button>
Now add corresponding code in appcontroller.js
self.startVoiceChat = function(event){
        listenUserVoice();
      }

NOTE: I am using oracle jet so I use oj-button. Point is we have to call listenUserVoice method on button click.

2. Add speak method in app.js. This method will provide audio to text message. It will also callback once meassage reading is finished.

function speak(text, onendcallback){
    var msg = new SpeechSynthesisUtterance();
     msg.text = text;
     if(onendcallback){
        msg.onend = onendcallback;
     }
     window.speechSynthesis.speak(msg);

     console.log(JSON.stringify(msg));;
  }

3. Add listenUserVoice method also in app.js. This method reconizes user voice and converts it to text. It also calls bots sendmessage or triggerpostback depending on situation.

function listenUserVoice(){
    var recognition = new webkitSpeechRecognition();
            recognition.continuous = false;
            recognition.interimResults = true;

            recognition.onstart = function() {
                recognizing = true;
            };

            recognition.onend = function() {
                recognizing = false;
            };

            recognition.onresult = function(event) {
                console.log("recognition-onresult" + event);
              console.log(event);

              var interim_transcript = '';
              if (typeof(event.results) == 'undefined') {
                recognition.onend = null;
                recognition.stop();
                upgrade();
                return;
              }
              for (var i = event.resultIndex; i < event.results.length; ++i) {
                if (event.results[i].isFinal) {
                  final_transcript += event.results[i][0].transcript;
                } else {
                  interim_transcript += event.results[i][0].transcript;
                }
              }
              

              if(final_transcript){

                console.log("User said: " + final_transcript);
                var totalMsg = Bots.getConversation().messages.length;
                if(Bots.getConversation().messages[totalMsg-1] && Bots.getConversation().messages[totalMsg-1].actions){
        
                var actions = Bots.getConversation().messages[totalMsg-1].actions.filter(function(action){
                    return action.text === final_transcript; //Improve it by performing case insensitive matching
                })
                if(actions && actions[0]){
                    Bots.triggerPostback(actions[0]._id).then(function() {
                                console.log("postback");
                            });
                }
                
                }
                else{
                   Bots.sendMessage(final_transcript).then(function() {
                            console.log("normal message");
                        }); 
                }

                
                if(final_transcript){
                  recognizing = false;
                }
                

            }
            }

            if (recognizing) {
              recognition.stop();
              return;
            }
            final_transcript = '';
            recognition.start();

        }
  
4. Now modify displayServerMessage method to call listenUserVoice method so that system automatically starts taking user message after providing any information.

function displayServerMessage(message) {
         console.log(message);
            var conversationElement = document.getElementById('conversation');
            var messageElement = document.createElement('li');
            var text = 'Server says "' + message.text + '"';
            messageElement.innerText = text;

            if(message.actions && message.actions.length > 0){
                var wrapperElement = document.createElement('div');
                for(var i = 0; i < message.actions.length; i++){
                    var action = message.actions[i];
                    var btnElement = createButtonElement(action);
                    wrapperElement.appendChild(btnElement);
                }
                messageElement.appendChild(wrapperElement);
                
            }
            conversationElement.appendChild(messageElement);


            speak(text, listenUserVoice);
        }

Thats all.

129 comments:

Buzz4Fun said...

thanks for sharing......

CouponTopper.com said...
This comment has been removed by the author.
One Federal Solution said...

Thanks for giving us such a great information.

Unknown said...

It is a Great post regarding "Oracle Bot Cloud (IBCS): Voice based coversation"

Thanks,

Hotmail Support Number

Outlook Support Phone Number 1877-342-4448 said...

The amazing post is written by you.

Outlook Support Phone Number

Gmail Helpline Number 1877-342-4448 said...

It is a really superb post.

thanks for sharing.

Gmail Helpline Number

richardfeynman said...

Look forward to the future with an open mind and open arms as technology brings about new ideas and concepts that are making the green economy a reality. Click here to get more about computer & laptop repair service.

Unknown said...

Thanks for sharing Infoamtion.
English to kannada translation |certified translation services in Pune | voice-over services | localization companies in India

Mayur said...

Super information thanks go now USB Full Form

Unknown said...

If you're trying hard to lose kilograms then you absolutely have to start using this totally brand new tailor-made keto meal plan diet.

To create this service, certified nutritionists, personal trainers, and professional chefs united to produce keto meal plans that are efficient, painless, price-efficient, and enjoyable.

Since their launch in early 2019, 1000's of individuals have already transformed their figure and health with the benefits a smart keto meal plan diet can offer.

Speaking of benefits: clicking this link, you'll discover eight scientifically-confirmed ones given by the keto meal plan diet.

Unknown said...

Hai temen-temen, saya disini ingin bersilaturahmi dengan temen-temen semua, oh iya disini saya ada blog yang membahas tentang teknologi, baik dari sejarah teknologi, ulasan teknologi, dan lain-lain. Jika temen-temen tertarik bisa langsung berkunjung ke blog saya dibawah ini.

Bung Fajri - Blog Membahas tentang Teknologi

Membahas tentang sejarah teknologi, sejarah mobil, sejarah ponsel, sejarah motor

Review produk ponsel

Blog Teknologi terbaik, terlengkap, dengan berbagai sumber

Yudi said...

Good post, thanks for sharing
Click here https://gamequator.blogspot.com/2020/04/5-games-that-similar-to-animal-crossing.html if you want to know games that similar to Animal Crossing: New Horizons

Jean. said...

Tempat Download Anime Subtitle Indonesia Tanpa Iklan Yang menggangu

Unknown said...

Nice blog useful information.The Technology Headlines (TTH) has an established image as a knowledge-sharing platform among industry leaders, such as CEOs, CFOs, CIOs, CXOs, CMOs and so on, as well as professionals for sharing experiences, ideas, and suggestions within the enterprise IT community.
The Technology Headlines
Latest Technology News
Technology News Today
Technology Headlines
Latest Technology News Headlines



Anonymous said...
This comment has been removed by the author.
Anonymous said...

Good Post...Its very informative, Thanks for sharing the blog...Keep updating the blog. see this blog for How outsourcing can help tech startups during the Coronavirus Outbreak

Jennifer Tuffen said...

Great Share. Thanks for this. I loved it.
Also, I created one website on Sofa Reviews. So if you want to purchase some sofa, or looking for new sofas, then here is the link to my website Checkout here for more information related to Sofas.

Jennifer Tuffen said...

Great Share. Thanks for this. I loved it.
Also, I created one website on Sofa Reviews. So if you want to purchase some sofa, or looking for new sofas, then here is the link to my website Checkout here for more information related to Sofas.

HOFSA said...

This article is awesome. meanwhile I have also written one article on Monitors and technology. So if you want to check it out then you can Click here for more information related to Monitors

MafiaTekno said...

Nice info, for more interesting information about technology only at MafiaTekno

Deepak Sallagundla said...

Good One!
contract packing

Securerr said...

Best Mobile Phone Under 15000 Rs
Best App Lock For Android
Best Earphones Under 1000

Anonymous said...

Lovely Article <3
keep growoing and visit my blog too!
GeeksWeeks

TOP HACKER said...

Hello would you mind stating which blog platform you’re working
with? I’m planning to start my own blog soon but I’m having a hard time choosing
between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something
unique. P.S Sorry for being off-topic but I had to ask!

I wanted to thank you for this very good read!!
I certainly enjoyed every bit of it. I’ve got you book marked to look at new stuff you Ahaa, its pleasant conversation about this article at this
place at this blog, I have read all that, so now me also commenting here.

Affluenz IT Academy said...

Nice article. Studying Ethical hacking opens a world of opportunities and will help you to become a white hat hacker. Join
Ethical hacking Course in kolkata

TechTanker said...

Article ideas very clear . Your writing style is very unique. I very much appreciate the articles you write.

techtanker

TechTanker said...

TechTanker
TechTanker
TechTanker
TechTanker
TechTanker

Ascent World said...

Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles. Check this out

ISO 9001 Certification

Anonymous said...

Center Post
Center Post
Center Post
Center Post
Center Post

Anonymous said...

Center Post
Center Post
Center Post
Center Post
Center Post

Anonymous said...

https://technewstoday101.blogspot.com/

Alexa james said...

http://paddingforrecliner.blogolize.com/
sofafordogs
bestkidschairsofa
kidscouchesandsofas
sofasforkids

Amelia said...

You have outdone yourself this time. It is probably the best, most short step by step guide that I have ever seen.facebook

reviewsguide4u said...

best tech of us

One Hour Device Repaire said...

This is very helpful. Thank you!

Big discounts One Hour Device iPhone Repair

Muhammad Azwar said...

Nice Article, thanks for this information
Also check this out
Laptops, Mobiles, Games, Tv, Smartwatches etc Daily Tech News Updates.

Learn Quran Online with Tajweed Classes in UK said...

Awesome & Looks Excellent.

Shubham Singh Rajput said...

What is Antivirus Software?

Thanks for sharing this wonderful article. Keep going. Please visit my blog you will see the basic info about computers and all of the things.

Arctic said...

Thank You for sharing this Informative article. Keep going

If you are interested in increasing your business's Throughput and decreasing operating expenses, take a peek at our Driver Operated Systems that can easily be integrated using a weighbridge sysem. Alternatively, give Us a call or visit @ https://www.surajinformatics.com/.

Outsource Autocad Drafting said...

Nice details you provide thanks for sharing this useful content with us. Also get CAD Outsourcing Services.

techmienews.blogspot.com said...

Nice info, for more information about technology/news/smartphone Visit us:https://techmie.com/

Akansha said...

Just before few years, we were happy to receive a vga Smartphone camera phone, but now there are more then 100 megapixel phones in the smartphone, which is truly incredible and amazing. How fast the world is changing, Thanks for the information. Keep posting.

James Eral said...
This comment has been removed by the author.
Ascent World said...

Found your post interesting to read. I can’t wait to see your post soon. Good Luck for the upcoming update. This article is really very interesting and effective.

CE Marking

DEEPAK SUNHEL said...

Hii you are very helpful
Please visit my website www.dtech7.info

leejackson said...

Awesome...
I have learned and this is super easily explained. Appreciated. Now I am gonna read your next post :D
Hoping for more informative stuff like this.
Wiki Tech GO.
You can check this website.

James Eral said...
This comment has been removed by the author.
Anonymous said...

best informartion technology
best informartion technology
best informartion technology
best informartion technology
best informartion technology
best informartion technology

ADMIN said...

100% VERIFIED

SMS INTERCEPTION

WESTERN UNION BUG ULTIMATE VERSION

CASH APP MONEY ADDER SOFTWARE

BITCOIN MINER ULTIMATE

FACEBOOK SPY

SS7 LESSON / SOFTWARE/ SET-UP

United Kingdom Willowbridge Way
Unit 4 Whitwood Nr.
Castleford WF10 5NP
Mobile: +44 (0)845 6075858
Telegram: https://t.me/tech_center0
E-MAIL: tech_center.com@tech-center.com

RS Theme said...

Gym Fitness theme for WordPress

With best gym fitness wordpress themes get all the top features and functionality to start your digital presence with RSTHEME and stay connected with your target audience to see new heights for your business..

ittechjuice said...

Free Hosting website -How To Creat A Free Website With Free Domain And Hosting

Harsh said...

Nice post Motivational quotes

Harsh said...

Nice post
Read Motivational quotes in hindi ➡️Motivational quotes

Silveredge Casino said...

Silveredge Casino is for sure a decent modern digital platform that offers a wide assortment of contemporary and classic games to choose from. Game selectors have wisely chosen software providers that hold a tall position in the gaming industry.

Anonymous said...

maps.google.co.uk/url?sa=t&url=https%3A%2F%2Fureadit.com

Anonymous said...

Click Here

john said...

Awesome...
I have learn this article and this is super easily explained. Appreciated. Now I am gonna read your next post :D
Hoping for more informative stuff like this.
seo expert in lahore.
You can check this website.

Md. Saifur Rahman said...

Very Nice Post Thank you, this post is very helpful.

Unknown said...

Best Dog Shoes for Winter | NeoPaws

Give extra safety and comfort for your dogs with impeccable Neopaws dogs and more accessories. NeoPaws offers high performance orthopeadic dogs shoes that adds protection and brings them more relaxation as well. These Dog shoes for winter are built with all the highest standards and keep your pets composure for effective duration.

Unknown said...

Best Antibacterial hand sanitizer with vitamin e in UK

Be prepared for your pandemic situation with Kash Global EC 100 % Best Antibacterial hand sanitizer with vitamin e in UK. Our products use the latest industry standard to bring more reliability and trust to our customers. You can buy single or multiple products of antibacterial hand santizer for keeping things organized in this pandemic situation and stay safe!

Insta Follower said...

The problem is an issue that too few folks are speaking intelligently about. I'm very happy that I found this during my search for something regarding this.
Buy Instagram Likes

Silveredge casino hub said...

Silveredge Casino a offers this unique opportunity to the players and members to play and have a first-hand experience of games by popular software companies that are yet to release on common platforms. So be the first one to play the game and be a part of a group of elite members.

Let Me Post said...

Read Here What Are Microsoft Outlook Pii Errors for solve it.

Admin said...

Nice post admin.

Alcatel PC Suite

Robert John said...

Interesting blog, actually quite happy I could visit this Blog. Hp Printer Error 49

Anonymous said...

Really nice blog. I am happy to see this blog topic. Thanks for the blog. If anyone is looking to build apps with the latest trends & technologies, reach Way2Smile Solutions. Mobile App Development Company in Chennai

Anonymous said...

upvc casement door in bhubaneswar

Saksham Khandelwal said...

Ureadit.com

Anonymous said...

Read Here What Are Microsoft Outlook Pii Errors for solve it.

Let Me Post said...

Read Here What Are Microsoft Outlook Pii Errors for solve it.

Unknown said...

customer data platform, Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our.

Ashish Kumar said...

Blog commenting
Thanks for updates.

ivr service provider

toll free number service provider

click2call service provider

International toll free number

virtual number service provider

Outbound Calling Solutions

Minavo Telecom Networks

bulk sms services

Vagent Blog

My Gadgets News said...

Hey Nice Blog!! Thanks For Sharing !Wonderful information & good post. Its really helpful for me, waiting for a more new post. My blog is your niche based in My Mobiles News Find the upcoming phones reviews.

Gadget Saman said...

Share now

Gadget Saman said...

Technology
https://gadgetsaman.blogspot.com/

Apple World said...

Digital Mass


Thank you for providing such a helpful information

BlockTech Nerd said...

This was an amazing post. Thanks for this Blog, if you would like to read more about these topics, have a look at BlockTech Nerd

SparkInList said...

Very informative, I really enjoyed reading it.
Top 10 Cheapest Technologies To Generate Power at Home

Info Mehfil said...

Very nice and informative article...Info Mehfil

dharmishitechnologies said...

very nice article thanks web development company in kanpur

gps tracker said...

Gps tracker For more information
but information is very best

My Software Tutorial said...

Hey admin, I found some really interesting things. Thank you so much for sharing this.Quick Solutions to Error Codes on Canon Printer

Livetime Reviews said...

Thanks for sharing this post and its very help, Also Check this Resolve The Error Code E225 On Canon Printer

Arley Arden said...

OPPO Mobile Phone
Find X2 Pro 5G
5G download speeds
Smartphone

Arley Arden said...

Lenovo V15 Laptop

Arley Arden said...

best laptop for businessmen
savingbuyers
Best Travel Jewelry Cases
laptops for lawyers
best wine racks
hp omen x2s review

Dinesh said...

nice post thanks for sharing information

Are you looking for a good car music system that has enough features and value for the price? But you are unable to decide which one is the best. Don’t worry we are here to clear your confusion please visit
Best Car Music Systems Under Rs. 5000

HitnTech said...

This is a nice and helpful post you have shared here. I love this kind of post. You should read
virtual receptionist zooom. From here you can get a better information.

herbie ai said...

chatbot companies
conversational AI
AI chatbot

Dissertations-services.co.uk said...

Here You shared nice content with us. Get details about pop ups examples.

pop ups websites
email pop ups
email capturing

Nettechindia said...

It was actually amazing. I rarely read blogs but today I found that it is worth it!

Nettechindia said...

It was actually amazing. I rarely read blogs but today I found that it is worth it!

Learn All coding Languages

Technology Industry News said...

Exclusive post.

Unknown said...

Do you need an urgent loan of any kind? Loans to liquidate debts or need to loan to improve your business have you been rejected by any other banks and financial institutions? Do you need a loan or a mortgage? This is the place to look, we are here to solve all your financial problems. We borrow money for the public. Need financial help with a bad credit in need of money. To pay for a commercial investment at a reasonable rate of 3%, let me use this method to inform you that we are providing reliable and helpful assistance and we will be ready to lend you. Contact us today by email: daveloganloanfirm@gmail.com Call/Text: +1(501)800-0690 And whatsapp: +1 (501) 214‑1395

NEED A LOAN?
Ask Me.

Ampcus Inc said...

A global technology and consulting firm has a track record of assisting leading organizations with their Enterprise Intelligent Automation and Digital Transformation efforts leveraging the
appian services.

Digital Marketing Brains said...

Smart scribe app offers multilingual audio to text solutions in 31 languages and dialects. So that you can speak and prioritize your everyday tasks efficiently.

Ben Kelvin said...

Thanks for sharing such an informative blog. For making the business successful with the use of technology people hire IT consultants who are good with tech business consulting services. This will help the business to grow on the path of success and the business can easily achieve its goals with the help of the strategies of IT consultants.

Ampcus Inc said...

IT consulting company in usa
Consultants have Significant Business, Engineering and Technology Experience in Cloud Computing, ERP, CRM, Testing, Mobile Applications, Staffing Services.

Digisok Blogs said...

It's really a amzing post i looking from a long time, thanks for make this blog and make the things easy for me. God bless you

Buy Best Product Online
Best Product Online
Product Online
Buy Product Online

Anonymous said...

You have shared useful information via your blog which is related to Oracle Bot Cloud (IBCS): Voice based coversation. You can get details about France Dedicated Server Hosting and you can buy the plans from Onlive Server.

Buy Tarpaulins said...

https://www.sbnation.com/users/buytarpaulinsuk

Training Portal said...

Thanks for sharing .. good content

https://www.trainingportal.in/

Saksham Khandelwal said...

Great Article! ureadit.com

BagasUnix said...

Wow... you are really great have a good day.
Please visit the web www.bagasunix.com for the latest technology news.

Anonymous said...

Thanks for sharing. Please check out chipset ranking

Nitesh Sharma said...

Nice blog. Such a good information share with us. this is very informative & innovative things. nice blog. If you want to write for us Technology.. Than visit my website Write for us Technology

Qurat Ul Ain said...

I loved your blog and your content.
sira approved cctv company in dubai

Hannan Rana said...

The Top Smart Healthcare Electronic Devices That Are Changing Healthcare
Smart healthcare electronic devices are revolutionizing the healthcare industry, in the same way that smartphones and computers changed everyday life as we know it just a few decades ago.
These devices are making healthcare and medical treatment more accessible, more convenient, and in some cases less expensive.
Although these devices may be revolutionary on their own, they also have the power to make new health trends possible, like personalized medicine and data-driven technology.
In this article we’ll take an overview of some of the top smart healthcare electronic devices of 2018 and discuss how each of them is transforming the healthcare landscape.

dharmishitechnologies said...

hey nice article keep post more content software companies in kanpur

Anonymous said...

Tech World Times
Tech World Times
Tech World Times
Tech World Times
Tech World Times
Tech World Times
Tech World Times
Tech World Times
Tech World Times
Tech World Times

XANA said...

Thanks for providing me with that sensational information which will surely increase my knowledge and prove quite helpful.

Hire Bike On Rent said...

Nice blog! The blog is very informative, I enjoyed reading something that is new to me. We offer you good condition bikes that are suitable on the rash roads of mountains. Read our blogs all about Manali.
Bike on rent in Manali
Bike Rentals in Manali

infrassist said...

outlook rules not working
80090016
powershell script
script hub
join Microsoft Teams Meeting
MDM Authority

SKR_MSMS said...

Pharmaceutical Business Intelligence Pharmaceutical Business Intelligence


Life Sciences Data Analytics Life Sciences Data Analytics
Enterprise Analytics Solutions Enterprise Analytics Solutions

Fani blog's said...

Very Nice Information

Assetmantle said...

This is probably the best, most concise step by step guide I have ever seen on how to build a successful blog.
How to create a NFT

galaxie software said...


Awesome Blog! Thanks for sharing this post. It is an interesting post for everyone. When i read about this post then got more information. I like it.


Ecommerce Web Design Kent

Website Design Agency Kent

sheligibbas said...

Fantastic Blog! I appreciate you sharing this content. Everybody will find this post interesting. I learned further stuff after reading this post. I enjoy it. write for technology Blog

Anushi said...

Thanks for your information blog, this is nice and helpful… Definitely going to share this article with your friends, thanks for sharing this blog article.
For More : What is computer? Different Types of Computers

Charlie Morris said...

Hey Nice Blog!! Thanks For Sharing !Wonderful information & good post. Its really helpful for me, waiting for a more new post.I am also working on my own project techmoog which gives all the information about technology such as How Long Does iOs 15 Take To Install? , laptop issues, How to use DSLR cameras, etc.

Mudasar Ali said...

Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles. I would like to share my blog Kmode Exception Not Handled error.

Mudasar Ali said...

Hi there,
Nice Article I really enjoyed this post Thanks for Sharing. I would like to share my blog how to fix the last line no longer available error on iPhone.

kowshik ahmed said...

Much thanks to you for setting aside an ideal opportunity to distribute this data extremely sports helpful!

British Overseas 1 said...

The best IELTS coaching in Chandigarh is offered by the British Institute. We have IDP-certified instructors with five years of IELTS teaching expertise. Contact us...

Rahma Ani said...

Great, good job bro, i like the article.

APLIKASI PENGHASIL UANG
GRUP PENGHASIL UANG PREMIUM
GRUP CUAN ONLINE PERMIUM
APLIKASI PENGHASIL UANG
CARI UANG ONLINE TANPA USAHA

Anonymous said...

I really enjoy reading your news - you write amazingly now you can read news about one of the best sports in the world See what happened in this game See how the nose broke Why did you slip your foot

Online Education said...

Really nice content. Thanks for sharing this post it is very useful for our business. Career Counselling Online

Anonymous said...

"Danelton
Audiounit
Garsoaparaturosnuomavilniuje
Djpaslaugos
Garsoaparaturosnuomaeu
Garsoaparaturosnuomacom
Blogaudiounitlt
Renginiuvedejai
Bloggarsoaparaturosnuoma
Newsaudiounit
Bloggarsoaparaturosnuomavilniuje"

John Watson said...

The exploration of Oracle Bot Cloud and its voice-based capabilities is intriguing and highlights the evolving landscape of technology-driven solutions. In today's digital era, businesses in Hertfordshire rely heavily on robust IT support to leverage such innovative tools effectively. IT Support Hertfordshire offers tailored solutions to cater to the diverse needs of businesses, ensuring seamless integration and optimization of cutting-edge technologies like Oracle Bot Cloud. Their team of experts provides proactive monitoring, troubleshooting, and strategic guidance, empowering businesses to harness the full potential of their IT infrastructure. Visit https://totalgroup.co.uk to discover how IT Support Hertfordshire can elevate your business's technological capabilities and drive growth in the digital age.