Asterisk AGI Encoding - encoding

I’m using a publically available AGI Script that wraps Google’s Speech Recognition API for converting speech to text in Asterisk. Basically, the script passes an audio file do Google and returns the text recognized from the audio.
This is working great, except for one deal breaking problem. Whenever the recognized text contains extended characters such as “á”, “ã”, “é”, etc., the dial plan gets a distorted string. For example, Google returns the text “não”, but ASTERISK gets “não”.
This, obviously, is related to the encoding… But I’m having trouble, due to limited knowledge in AGI and PEARL, determining where the problem. As far as I could determine, it could be
GOOGLE -> PEARL or PEARL -> ASTERISK
I hope someone can help me on this…

Got it!
Used a function called "decode" to decode the response from the Google API.

Related

how to record the voip call using sipsorcery sdk?

I am using sample programs provided by sipsorcery:
https://github.com/sipsorcery/sipsorcery/tree/master/sipsorcery-softphonev2
What I want to record the call or record the part of one side spoken text, process it, then generate the answer test and speak it back.
What I need right now to process the spoken text. I wanted to record the parts of call and save them to a wav file and generate text from it. but it seems to me that I am doing wrong. I am not able to generate the correct wav file using the provided method of sipsorcery SDK.
I have tried to follow the example on this forum as well, but it didn't work
https://markheath.net/post/how-to-record-and-play-audio-at-same
I expect that this should work using a small temporary wave file at each time the user speaks a sentence and response back again playing back the processed response file.
Any guidance how can I achieve this sense of interception and processing of the call?
Thanks,
Vivek
This example should be pretty close to what you need. It plays the audio (only ulaw support) via the default speaker using NAudio. To record it should be a matter of switching from using NAudio playback to saving to a wav file.

Can somebody explain why line break works only sometimes in api whatsapp?

Can you please explain why these line breaks work on phone, but not on desktop browser (whatsapp web)?
https://api.whatsapp.com/send?text=foo%0Abar
But actually, line breaks sometimes work on browser:
https://api.whatsapp.com/send?text=Lorem%2520ipsum%2520dolor%2520sit%2520amet%0ADuis%2520imperdiet%2520in%2520ligula%2520eu%2520scelerisq
(We have to be reaaaaally tricky about the encoding when using desktop)
Context
I'm using whatsapp kinda Whatsapp "api" to send messages from my webapp. In theory, they say line breaks can be sent via %0A but testing from the desktop we have to do this process:
Take the multiline string and encode it.
Take the encoded string, and replace all instances of %0A with real linebreaks (/n)
Encode that string (again).
And even sometimes that does not work. The lines have to have some length and amount of words for it to work.

Building an automated script to copy a page of text, translate it in Google Translator and paste it in Word

So, as the title says, I would like to make an automated script that is going to take all the text from one PDF page, copy it, paste it into Google Translate and then copy the translated text into another Microsoft Word document.
Since that PDF has a lot of pages (150+), I thought it may be easier to make an automated script to do that.
What language would I have to use, would it be complicated for me to do it and in the end, will I actually save time by using this script (implying that I have to learn it first, but I have some programming experience (I know C++, Javascript, PHP), but I do not have a strong grasp of algorithms (like Flood Fill, ...))?
Thanks in advance!
EDIT : I found that I could use AutoIt for scripting... but I don't know would I be better off using AutoIt or Powershell... I also want to learn something that would be enable me to create other scripts (for example to automate some processes I do in Camtasia Studio)... So, AutoIt or Powershell?
As an AutoIt user I would say AutoIt.
Copying text out of PDFs is not quite as simple as you might imagine. Mileage will vary on how the PDF was created, and there are several methods you can use:
Most PDFs will have most of the text in the file itself, allowing you to get the text using a simple method like this
This method uses zlib to do something to the pdf. Not sure what as I've never tried it.
There are a variety of examples of using third party programs to do this, which may be better. There is one using Debenu and another using XPDF
Automating other programs such as acrobat should be possible, in acrobats case they have an api that can be used, though I'm not aware of this already being wrapped in AutoIt.
As to the rest of the requirements, there is a UDF to translate with google translate here, and the word UDF is a standard one that comes with the AutoIt installation.

Support displaying emojis in UILabel

I'm having problems displaying emojis in a UILabel.
in some cases, it even causes a crash when lay-outing the characters in the label.
these characters are returning from server as unicode, and are parsed with AFNetworking framework.
this is an example of how it is returned from the server (console logs):
\U05d4\U05d9\U05d9
i have tried different approaches, like lowercasing this to "\u05d4" or playing with the encoding of the string returning.
nothing seems to work.
i did managed to show a couple of emojis properly (which makes me think it maybe a server related issue?) - does the server needs to support sets of unicode characters so it can return it in the appropriate encoding? i'd be happy if someone could clarify this point for me. (btw, server is written in RubyOnRails i believe.)
should i parse the data with a different parser (SBJSON)? although switching the networking framework at this point would be impossible due to time and resources available..
what other options do i have?
Thanks
i think you should be able to just paste an emoji character in the code directly as a text.

How can I parse raw email source and extract the HTML part?

In my iPhone app, I'm handed the raw source of an email, in RFC822 (or "eml") format. I'd like the HTML part of this message (if one exists).
Rather than attempting to parse it out myself and converting escape chars and so on, I thought I'd check to see if anyone knows of an objective-c library to do this for me.
In .NET, I've always used the Mailbee classes for anything email related, but I can't seem to find anything similar for cocoa.
You may have a look at the Pantomime framework for Mac OS X. It provides a full fledged email package, including RFC822 parsing. It can be downloaded directly from here.
As far as I know it has not been ported to iPhone, but it should give you a good starting point.
Claus