How to configure DirectLineSpeech for Dialogs? - microsoft-cognitive

How do I configure the "Speak()" for saying out the prompts and other waterfall messages like the DirectLine Speech Echo bot sample for DirectLineSpeech does?
I tried using the DirectLine Speech Core-bot sample, but it just "speaks" the welcome and final message as those leverage the SpeakExtensions.Speak() as shown in the FinalStepAsync() method in this file.

When using Prompts and Waterfall messages, you are directly using the SDK methods which send the message. As a consequence, you cannot add the Speak field to your message easily.
It may evolve in the future as DirectLine Speech is still experimental in the samples, but I don't think that you could do something in a few lines of code today.
One idea could be the implementation of a Middleware (see doc for the concept of Middleware in Bot Framework) which would modify the Speak field for every outgoing Activity, given the Activity type (ActivityTypes.Message in your case) and content.
You can get inspiration for the Translate Middleware in the samples, see here

Related

How can I redirect messages from telegram channels that are in certain format?[telegram bot]

I have many telegram channels, 24\7 they send messages in the format
"buy usdjpy sl 145.2 tp 167.4"
"eurusd sell sl 145.2 tp 167.4"
"eurusd sl 145.2 tp 167.4 SELL"
or these words in some order
My idea is to create app that checks every channel's message, and redirects it to my channel if it is in the above format.
Does telegram api allow it?
I have written a simple python code, using the telethon python module.
What the code basically does, is forwarding messages from various telegram channels through the telegram client api to a channel of your choosing. You can find it here.
Using the client api, one is able to read messages from groups and channels that your user is a part of. No bots required.
The telethon module makes it easy to filter messages that you want to be read. Feel free to fork the project and make the desired changes. You should look at the module documentation here.
You cannot scrape from a telegram channel with a bot, unless, the bot is an administrator in the channel, which only the owner can add.
Once that is done, you can easily redirect posts to your channel by listening for channel_post updates.
In order to be able to scrape messages from Telegram channels that you do not own, you need to develop you own Telegram client that is capable of:
Joining your desired channels by links
Forwarding messages, arriving to the channels your client is subscribed to, to your own Telegram channel
In order to develop your own Telegram client, you need to use some implementation of MTProto.
You can find a lot of implementations of MTProto on https://github.com using mtproto keyword.
A few examples of well-documented implementations:
In PHP: https://github.com/danog/MadelineProto
In Python: http://github.com/LonamiWebs/Telethon
But probably it would be an overkill to develop your own solution to this problem if the only thing you want is to have several redirections from existing Telegram channels to your own channel.
There are applications that provide such a service.
For example, there is MultiFeed Bot that allows you to setup forwarding of messages from any Telegram channels to your own Telegram channel.
This bot has a flexible filtering system so it should be pretty easy to setup filters to skip certain types of messages (ads, media content and etc.) and to leave only those messages that you want to see in your destination channel.
I solved a similar problem with TdLib. Their GitHub site has full C++, Java and C# examples that you can just modify.
I worked on the Java example, and applied most of my changes to the UpdatesHandler.onResult method (line 353). The C++ and C# examples have a similar structure. This method gets called by Td whenever any event occurs. Hence you can just intercept them there.
If you're not really sure where to begin, start by adding simple System.out.println statements (if using Java) to each of the case statements in the aforementioned method, and make sure you read the starting guide.
They actually have examples for many other languages (Python included), but from my point of view they are not as complete as the three I mentioned before.
This is very easy to do with Full Telegram API.
first on your mobile phone subscribe to all the interested channels
Next you develop a simple telegram client the receives all the updates from these channels
Next you build some parsers that can understand the channel messages and filter out what you are interested in
Finally you send the filtered content (re-formatted) to your own channel.
that's all that is required.
Is this what are you looking for? telegram-forward-bot
In the readme file:
Simple Telegram Bot for forwarding messages easily between various related channels and groups.
This bot allows you to automatically forward messages between different channels. We use it on our Student Comitee because we have like 15 different Telegram groups for each commission we are working on. Then, if we want some commission receives some important information, we can automatically forward to them using hashtags at the beggining of the message (or the caption of a media file).
I think I know your feeling, I'am trader and I follow various prediction channel. But not all of the information is usefull (sometimes ads). Hope this work for you :)
Got the solution to this problem.
Here is bot which automatically forwards messages from one channel to another without the forward tag.
Moreover the copying speed is legit!
#copythatbot
This is the golden tool everyone is looking for.
Depending on the language you want to use there are many libraries you can use to get the job done.
Let's take for example python, you can use libraries such as Telethon (for both user or bots) or "python telegram bot".
Both libraries are fantastic on what they do. Telethon is async so I kinda lean more towards it.
To do what your looking for you will need to catch the event.Message and use python regex re module for matching patterns from the messages.
Here's the code you want using Telethon:
import re
from telethon import TelegramClient, sync, events
# These example values won't work. You must get your own api_id and
# api_hash from https://my.telegram.org, under API Development.
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'
client = TelegramClient('session_name', api_id, api_hash).start()
#client.on(events.NewMessage(chats=('TelethonChat', 'TelethonOffTopic')))
async def message_regex(event):
pattern = re.compile(".*145\.2 tp 167\.4.*", re.M)
raw_text = event.raw_text
if pattern.match(raw_text, raw_text):
## Pattern matched do something
pass
You just need to change the api keys and it should work properly. Now to add other things you will need knowledge about programming and python.
If you are looking for a simple solution you can always use this bot I've made #tg_feedbot
This is a bot used for forwarding messages from one/multiple groups to others. The way it works is by using your telegram account and when a message comes - if you have configured it so - it sees it and rewrites it to the channels you want. You can edit the way the message looks, filter it, delay and change words.
It's a free solution for automating Telegram User API and it has a simple to use interface together with documentation
If you are keen on learning yourself then I would suggest you to join Telegram groups such as Telethon or >>> telegram.Bot()

how accurate is microsoft cognitive speaker identification

I am trying to build an application with Microsoft Cognitive Speaker Identification Service. But when I check it using its api some audio are not recognized correctly. I would like to know how much is the accuracy level of the service. Is there any way to improve it.
There are various things that can affect the accuracy of the identification e.g. Noise level, microphone quality, echo, etc.
To improve the performance in your condition, you can make sure the enrollment audio is recorded in the same conditions as the test audio (e.g. same microphone) and try to ensure that recording is done in a quiet environment.
It does work across multiple users and tried on different PCs/microphones.
I'd make sure that:
It is in a quiet room/environment
You are sending the audio correctly... (it is just byte array data, no additional encoding.)
Also check the header MediaTypeHeaderValue/content type, all request seem to be 'application/json' even though we send wav files.
Take care when mapping your users to the azure guids, and make sure you are using the correct ones. If you are using the SDK rather than API for profile creation and enrollment, there's no retreival of profile by id at the moment, I have done a workaround, to recreate the profile , and update the id in a database just before Enrollment. (the API doesn't need this though)
Also make sure you are using the latest API, (urls ending .../speaker/verification/v2.0/ etc... Some of the text independent features in the SDK are V2 only, and can fail verification becuse V2 stores profiles in 3 separate locations depending on the verification method.
Also check the profile was created/enrolled using the same verification method you are using to verify. try with a new profile if unsure.

Are the Smart Home API Error Messages supposed to make Alexa respond with more usefully information?

I've nearly finished my lambda service for my smart home skill, and everything works great. The Echo is receiving my confirmations and correctly relaying their information. I'm now trying to build in error handling.
From the SHS API reference, there are a bunch of error messages listed that correspond to different circumstances. Are these errors supposed to change what Alexa says? Regardless of which one, if any, that I use Alexa just responds that the command doesn't work on that device. Right now I'm literally just using callback(err) and return the copy and pasted object from the API reference and still Alexa responds with the generic error.
It's easy to put in a bunch of constants to define error returns. It's harder to wire all of that into a firmware patch of a hardware device. Also, they only release an update to the SDK a few times a year. While they patch the hardware every couple of weeks.
Given that, I suspect that they put those error returns into the SDK to meet with a ship date with the SDK. More as placeholders than specific functionality. Over time, and if there is increased adoption of home skills, they will roll out updates to the hardware device that will take advantage of those returns.
My advice would be to use them. But not to expect there to be a difference right now. And don't mention differences in your documentation. If there is another place you can surface diagnostic information, you might want to do that so your customers can fix their problems.

asterisk get credit card info

I`m trying to build a script that will capture the credit card info like card number,cvc and expiration date using asterisk 11.x and asterisk-java library for AMI/AGI integration.
Right now I am able to build a script that will acquire that info if it is called via dialplan but i have a different scenario:
1. A call enters a queue.
2. An agent from the specific queue answer the call
3. The caller wants to input the card details
4. After the caller has entered the card details is redirected back to agent to continue the call.
My specific problem is related to step 3 as I do not know how to route the caller to my AGI and then back to the same agent. (eventually the agents has to be still involved in (some) call to guarantee that when the caller returns from agi it is still available)
Any idea how can I achieve that ? I know that this is a common practice so I think that there has to be a way.
When the call is delivered to the agent, use a macro to set a custom channel variable with the agent ID or extension in it.
Then, when your credit-card authentication function is done, read the variable and use an AGI command to transfer the call back to the agent.
Further Reading
http://www.voip-info.org/wiki/view/Asterisk+variables
http://www.voip-info.org/wiki/view/Asterisk+manager+Example:+Transfer
Note if this solution solves your problem, please 'accept' it to make it easier for others with the same issue to find it. thanks!
There are no any common practice for business process like you have. That depend of you and your client only.
You can use features conf or transfer. Can transfer to special extension or to conference room.
No way say what suite you better.
For sure you need understand how asterisk work before write any AGI/AMI or dialplan application. I can recommend ORelly's "Asterisk the future of telephony" book as start point.

ASP.NET - Use tracing to capture errors and send report back to ADMIN

I wanted to use tracing to capture errors and programmatically send reports via email and text message...that if the ADMIN is eating out at a restaurant on a saturday nite he can see the text message/email to notify and capture..any way to do this??
A site that lets you essentially post exceptions to it, and then you can configure message in a number of ways. I've not had a chance to use this much yet. I think it's more popular w/ ruby, but because it's using standard HTTP posts, you should be able to use it from anything.
http://www.getexceptional.com/
For something more .net-specific, check out: http://code.google.com/p/elmah/
This will save a ton of information locally, and there is then a handler that exposes the data as an RSS feed. From there, you should be able to find numerous ways to consume it. This one I've used to great effect.

Resources