FreeSwitch: Send image data on SIP body / multipart on call - sip

I'm looking for a way to be able to pass one image data (binary or base64) in a call. Perhaps in the SIP body / multipart SDP in the dialplan since I understand that in the SIP header it is not viable due to size limitations.
The purpose is to be able to display a preview image of the caller on the target device (mobile) so that they can see it before taking or rejecting the call.
Currently, I have the image saved and send it using a push notification when the call occurs but I would like to skip that step and send it over SIP. In this way, you could send the image on the fly without having to store it on the server. For this, I need to know if there is the possibility of sending the image as data using the SIP protocol.
I have been looking at the official documentation without finding anything about it and they have not been able to help me on the "freeswitch users help list" where I have consulted first.
Any ideas on how to do it?

Related

How can I create a multi-part response with DialogFlow?

So far, I have a conversational app that works with webhooks to my backend PHP server that sends JSON responses back to the Dialogflow API. So far, its working rather well.
The next step in the development would be to have the Google Assitant respond to the user with multi-part responses. I've seen the "Lucky Trivia" game do something similar (screenshot attached).
It is not clear to me how I can have the Assistant App generate multiple bubbles.
Some solutions I've tried:
Using rich responses with multiple parts
Generating SSML responses and using several <speak> or <p> tags
Using message objects
Using a followupEvent object
None of these have gotten me to the point Id like.
Rich responses will work for a maximum of two separate bubbles and no more.
SSML seems promising and is a great way to add prosody and sound bites, but everything I've tried will not deliver multi-part speech bubbles.
I can't find a syntax for message objects that works with "platform":"google". Indeed, specific support for platform=google isn't listed on that page, but I have seen it in some request/response JSON objects.
The followupEvent response seemed most promising, but as far as I can tell, the intent that triggers from the named event completely replaces the current response, it doesn't just add onto it.
So, my question is: What's the best strategy for getting similar multi-part messages on Google Assistant using DialogFlow?
Optimally, I'd like to fire new requests to my webhook sequentially, but building one large response containing all parts is a viable option if necessary.
How does Lucky Trivia do this?
I suspect that Lucky Trivial is able to get around the rules because it was made by Google and doesn't use the same library that we do. But let's look at each of your attempts and then some possible other approaches.
What doesn't work
As you note, RichResponses are limited to only two SimpleResponses which translate to two text bubbles. You could make larger responses, but there is still a suggested limit of 300 characters per bubble, and a hard limit of 640 characters.
The SSML responses, as the name suggests, are about what you hear - not so much what you see.
Message objects are turned into native platform objects anyway, so unless there was some way to support it in Google (and there isn't), then you can't do it.
Follow-up events are specifically documented to ignore the text that is returned from the original event. Their entire point is to delegate processing to the other intent.
What might work: Cards
This doesn't look exactly the same as what you want, but one way to get additional text included that is separate from the two bubbles is through a Basic card as one of the rich response items. You can even do some basic formatting in the card and include graphics.
More complicated: Media Response
Including a Media response object with the rich response items is a way you can send multiple responses to the user without having to wait for them to say something. In this way, you can get multiple text bubbles in a row without the user having to reply.
The trick is that you'll send the two simple responses in the rich response, and then include a Media response with a very short, and possibly silent, audio file.
After the audio file finished playing, you'll get an intent that indicates the media has finished playing. You can then send another reply with one or two more simple responses. If necessary, you can repeat this.
There are some downsides - the media player will show while it is playing, which will interrupt the bubbles, but once done it should clear. There will also be a pause in between some of the bubbles. But playing audio might also enhance your reply.

constructing xml within ios app

I am sending a request back to the server I am communicating with, the gist of this request will have a bunch of different parameters, like user ID, request number etc.
One of the more important parts of the request is a segment of XML that im hoping to create based of a few user selections in my interface.
Then at the end i will wrap this all up and send it off to the server...
However at the moment I have no idea how to form an segment xml, I have been reading this but im not sure how it relates to what I would like to do.
any help, example code, example tutorials or anything would be really helpful.
A plist is just xml with a strict dtd; and you can use NSPropertyListSerialization to create one to send back to the server from an NSArray/NSDictionary, very easily.

Determining if a request came from an iPhone app

I have an iPhone app that communicates with a server (both of which I own and wrote the code for). I need to way to determine if a request on my server came from an iPhone (or any mobile device running the app I wrote for that matter). Basically, I only want to allow apps that I wrote to communicate with the server and need a way to verify that. Since I'm writing the apps, I can modify the headers and what not any way I need to.
I read up a little on Public Key Encryption, but I don't think it'd work. If I sent some sort of secret hashed word in my headers to verify it, couldn't some outside party simply get those headers and use the same ones in their request?
You can use a checksum. Let's say that you have something like:
date
subject
and calculate the checksum by using, let's say MD5 of (date + "string" + subject),
and you calculate the MD5 in the very same way on the server. If they match, they are from the mobile client.
This will work until someone figures out your algorithm.
You could have your server send a message to your app that contains a random code. This message and code changes every time it is sent.
Your app then does some kind of algorithm on that message to "encrypt" it and send it back to the server and the server can then check it. That way there's nothing to intercept and use without knowing your "encryption".
Of course, they could intercept the message from each direction and then work out your algorithm, but if you make it sufficiently difficult, then that would be a while.
You could just use HTTP Basic authentication, unless you needed something more secure.

How can I transfer data from core data via mail in iOS 5?

I am recently making an app which needs to exchange messages between different iOS devices.I decide to use mail to do with the data transfer.And I read a tutorial by Ray( http://www.raywenderlich.com/1948/how-integrate-itunes-file-sharing-with-your-ios-app )
.It tells a way to handle this thing.But my situation is that the data I want to transfer are all stored in the sqlite.I think it's better to convert these data into NSString and than send them.But I have no idea of how to define custom UTI which will specify the specific type,like .myapp which will be sent to the receiver,and how to user can open it and import data in the app.Because I use iOS5,so I can't even follow the steps in the tutorial.By now,i can send email to users with the data,but not with the .myapp attachment.So , can anyone give any advice on how to get the data into .myapp file and how the receiver will get data and import it in the app,specially for iOS5?Great thanks.
I successfully made this work via Email by simply constructing a text file in CSV format (comma separated values) to be attached to the email message. I registered the .csv with my app, added an import handler, and now one can then open the file on the other iOS device running the same app.
However, I found this approach rather clumsy and not very user friendly. Have you considered using the Dropbox API instead? Even better, use the new iCloud interface right built right into the SDK. That seems so much more convenient from the user's perspective.
Another approach could be to send the data to a webservice which informs the receiver by notification (Apple Push Service Notification). Your data is then stored on a central system and can be loaded by the app as soon as the receiver gets the notification and opens the app.

Sending data to a server for computation

I want to create an application which will will be a webapp. I want to collect the data from the user, send it to a server where the computation will take place, and have the result displayed on the iPhone screen. The server normally takes results from a regular webpage via text fields and computes it and displays the result on the webpage. I just want the send the data via iPhone. Navigating my iPhone safari to the webpage is NOT an option, as the webpage is not optimized. So I how do I send data to the server, make it compute the results and have the results displayed on my iPhone?
Thank you.
Regards
EDIT:
I have no control over the server. Imagine my case to be as follows: The user enters a word, the word is sent by the iPhone to a Google server, the server compiles the search results and sends it back to my iPhone, and then the iPhone displays this result on the screen.Any more suggestions?
You might consider using ASIHTTPRequest/ASIFormDataRequest if you want to submit form data to your existing web page using form fields (per your description.)
In general I find ASIHTTPRequest friendlier to use than NSURLConnection / NSURLRequest.
http://allseeing-i.com/ASIHTTPRequest/
The most straightforward way is to use NSMutableURLRequest to create the GET or POST request, and then NSURLConnection to (asynchronously) send the data and receive the result. You could also use any number of third-party libraries to do the same thing.
As for the server side of things, you would have it accept a GET or POST just as you would with a web-based app, and output data in an appropriate format.
As for the output format that will be parsed by your app: With the standard classes, you can easily parse plist data and (with a little more work) XML; third-party libraries can be found to parse json and many other formats, if you so desire.