IVR vs Asp.net MVC: How can I stop reinventing the browser? - asp.net-mvc

I'm making an IVR system for a project, and have decided on Twilio to handle the phone portion (making and receiving calls, sending and receiving SMS messages). This will surface a website with an IVR front-end, allowing users to navigate the site using their touch-tone phone.
I'm not making all the content browse-able over the phone, just what makes sense.
Twilio sends in parameters to your URL on the querystring or via POST, and you respond with a special subset of XML that tells the IVR how to act. I made a lot of headway very quickly with ASP.net MVC, treating the Twilio XML content as a View and rendering the site's data to it.
Here's what a response to Twilio looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<Say>Hello World</Say>
<Play>http://api.twilio.com/Cowbell.mp3</Play>
</Response>
Here's what a menu looks like to Twilio:
<?xml version="1.0" encoding="UTF-8" ?>
<Gather action="http://your_url" numdigits="1">
<Say>Press 1 to execute your_url, passing a parameter named "digits"</Say>
</Response>
Here's where I'm stuck:
I'm trying to add a universal "back" button, maybe a "skip" button, a "repeat" button, etc, and I'm finding that on each view, I'm detecting the digit pressed and then if-ing to a hardcoded Response.Redirect(). I know this is going to quickly become unmaintainable for large numbers of views and menus.
So, how can I model the MVC app so that it's more like an application and less like a game of Zork? Stacks of Menu objects, each with Lists of MenuItem objects? How can I make, say "9" the universal option for "back" and have the app respect it, no matter where in the menu system the user is, without having to code for it in each view?
The back feature is just a symptom of the chaos this project will step into if I don't take a moment now to design it properly. Are there .net IVR frameworks out there I can inspect for ideas? Any help would be appreciated, I know this is not a novel problem, I just can't seem to get my head around the best path to take.

Although I almost don't have a clue about what you are talking, since nobody sofar said anything I will have a shot at it (don't shoot me if I'm totally not in the direction).
In MVC 2 you can render actions in your views:
<%= Html.Action("home", "menu" , new { someparam = somevalue, someotherparam = someothervalue }) %>
This would call the Menu action in your Home controller with the given parameters. The Result of this Action would then be inserted in your view.
This way you can keep your views clean, and all your Menu stuff in one place. Just have to add the above stated line in every view.
Again the same can be done with HtmlHelper's, yet sometimes the above stated way is just easier.

Ricky from Twilio here.
For some reason, having code that's organized like Zork sounds like fun to me but in practice I can understand how that may drive someone crazy!
We just launched a bunch of non-trivial, production ready tutorials to help when developers have questions about how to organize a specific kind of application. One tutorial is an IVR built using C# with ASP.NET MVC.
Taking a look out how we decide to structure things, we're using 3 controllers to control our logic:
IVRController.cs: This controller contains the code that welcomes a user when they call into our IVR.
MenuController.cs: This controller is where we determine the appropriate IVR menu for the user depending on their inputs.
PhoneExchangeController.cs: In this controller, we have the logic to forward a call from our IVR to another phone number.
As you're looking to customize the experience by adding something like "Press 9 to go back", making changes to MenuController.cs should help get you there.

Related

Reverse engineering website : cannot find the form inputs in the post request

I need to interact with an external website I don't own. This external website requires credentials that I have. My goal is to add a user but the external website does not offer an external API. It looks like they are using Vaadin.
So to add a new user I need to manually fill in a form. Yet I have been searching for the route the "form" takes to post the input I give but could not find any.
Here is my issue : when I look at the HTML source code in browser I cannot see any form tag. The buttons have all the same id "button". When I fill in the form and look at the network tab in the developer tools, in the "parameters" section I cannot see the inputs I just gave although the POST request does appear. The cookies tab does not show the inputs either.
Consequently my questions are : why can't I find the inputs in the POST request and where can they be ?
Please note : this external website is a medical site so I prefer not share the url and they don't offer a mobile app, so there is no mobile API I could reverse engineer.
Any help appreciated :-)
Not stating the Vaadin version makes that a tad harder give an exact
answer, but at the core both the Vaadin 8 and 10+ behave the same way.
And the short answer to your question is: without another entry-point,
like an API, this can not simply be done using just some POST-Request.
Vaadin is not simply a html-form/request/response-html based framework;
it holds the scenegraph on the serverside in a session. All
communication is done via a single endpoint to the server and state
changes only are communicated back to the client.
For what you are after, your best bet is to use test automation
frameworks like selenium, geb, cypress, ...

Hackathon project regarding Twitter

I will be attending my first hackathon this upcoming weekend, and plan to create a Twitter-based Chrome extension. Basically, when someone wants to tweet or reply to something, and they click the 'tweet' button, it will open up a pop-up modal that asks them some questions about their tweet (so as to encourage them to be mindful about what they post). Within the modal, there will be a button that then publishes the tweet.
So, to sum it up, my modal will be an intermediary in the process of posting a tweet.
What technologies will be useful in implementing this? Specifically, how can I implement the feature in which someone clicks the tweet/reply button, and it opens up my web app's modal on the same screen? Correct me if I am wrong, but I think this is called event capture? Does this have anything to do with Web Intents?
Thanks!
I have done similar things on other sites. A high level overview of what you should try doing:
Find out how twitter sends tweets, the "tweet" button has a "js-send-tweets" class, I would start by investigating that. They probably have a piece of js listening to the button press.
Once you figured it out you can override that function by injecting your own script to the page after twitter's. This way when you press tweet your function will execute.
You should write your own logic in there then add twitter's function logic too which would conditionally execute based on the user's action.

How to automatically link a word(s) to an external site every time it appears anywhere on the site?

For the life of me I do not know what the terminology is for this. And my search engine searches are straight up hopeless. I know I'm not the only one wanting to know this; I just don't know how to ask it or what keywords to use to figure this out on my own. So I'm here to explain it to you all the best I can in hopes someone might now and shed some light on my darkness. Okay here goes...
Site page 1 content:
Georgio went to the store after he stopped by to see how Nichols was doing.
Site page 2 content:
The cat was afraid of Georgio and his dog.
Site page 3 content:
My best friend is not a friend of Nichols, who is the best friend of Georgio, but is a friend of Georgio.
What I need done:
On each page (1, 2, 3) and each time it appears on each page, I want "Georgio" to be linked to the same external website (like http://geethr33whiskers.net <---I just made that up), but without me having to manually link each "Georgio". I want to be able to link "Georgio" once and then automatically the other instances will be linked to the same external website.
On each page (1, 3) and each time it appears on each page, I want "Nichols" to be linked to the same external website (like http://www.nichols2zzz4wedding.com <---I just made that up), but without me having to manually link each "Nichols". I want to be able to link "Nichols" once and then automatically the other instances will be linked to the same external website.
I hope this makes sense. If you know what I'm talking about, how do I set this up? I've got the site hosted on Netfirms (so it's not a wordpress.org site) with the WP blog platform set up on it. Or is there a WP plugin that will help me out doing this?
Also, what is this kind of process called? Oh, and I have tons of words that need this kind of automatic linking or whatever you call it.
You should use the_content to filter the text displayed.
add_filter( 'the_content', 'function_to_replace_text' );
function function_to_replace_text($content){
//add PHP code to replace your word by link in $content
return $content
}

Gem for creating a left/right scrollable notification viewer for web app?

I'm new to Ruby on Rails so please bear with me.
I'm creating a web app for users to trade cards and would like to include in the user's home page a notification section that shows relevant alerts for the user based on possible trade matches and other things like new messages. The functionality would require alerts to be generated based on certain triggers (userB accepts trade, trade is proposed to userA, userB messages userA, and possibly even incorporate sponsored posts). This will basically function like the "notification center" on iOS.
I've made a quick mockup: http://i.imgur.com/hQ3Fc.jpg (or if that's too big --> http://imgur.com/hQ3Fc) -- wouldn't let me embed image because I'm new :(
So the idea is the view will probably have 5-15 alerts at any given time (give or take) and can scroll through them using those left/right arrows. The alerts will be a basic message with a link to the relevant page, or for something like a trade rating have the message "open" to fill the viewer and show the necessary functionality.
Hopefully I explained this okay. Anyone know anything out there that might make building this easier? Please let me know if there is any info I missed in asking this?
Not sure I get exactly what your wanting to do but if I understand correctly this may help. I have used swipe.js it is easy to use, should get you started on a swipeable/scrollable interface.

URL Redirection for Coming Soon Page?

I have a site with over 100 pages. We need to go live with products that are soon available, however, many site pages will not be prepared at the time of release.
In order to move forward, I would like to reference a "coming soon" page with links to pages that are current and available.
Is there an easy way to forward a URL to a Coming Soon page?
Is this valid, or is there a better way?
Found this at:
http://www.web-source.net/html_redirect.htm
"Place the following HTML redirect code between the and tags of your HTML code.
meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html"
Does this negatively affect you if the search engines crawl through your site?
Thank you!
The code you listed will work. However, I would never do this:
You could just show the page you wanted to show immediately, without a redirect. This will be faster for the visitor, as they don't need to load two pages.
If you must use a redirect, why not create it programmatically, for example by instructing your web server (e.g. Apache) to redirect certain pages?
I would not link to pages that don't exist yet. Most visitors will dislike that - clicking on something to find out "come back later" is a disappointment. We've all seen those coming soon pages, with the content never arriving, or only after months or even years. Either leave out those links (or perhaps put a "work in progress sign" without a link), or add the items only after they've been finished.
Search engines should work well with redirect pages, although it is unlikely your "coming soon" page will show up anywhere in the top the rankings anyway.
Perhaps a better or "more correct way" would be to do the redirection at the header level. Using PHP, you would call
<?php
header("Location: http://www.yourdomain.com/index.html");
There's also ways to do this in Apache (assuming you are using it) and .htaccess-files. See http://www.webweaver.nu/html-tips/web-redirection.shtml for more info about that.

Resources