I'm creating a Fiddler extension that is simplifying my interaction with Twilio during development. I'm about to release it to the wild, but I would like one more feature before I do so.
I'm able to return the various phone numbers on my Twilio Account, and list them with the various URLS that are required.
I would like to select on of the numbers, and "Click-To-Test" whick will dial the selected phone number. I would then like to interact with my Twilio service via my computer rather than picking up a phone.. I should be able listen to the voice prompts, and interact by dialing 1, 2, 3 etc. when prompted.
Twilio offers this JavaScript library here (Twilio in the Browser), and give an example here via Azure (Twilio in Javascript Application), or here via MVC (Hello Monkey Client)
All of which leverage a Javascript library which creates a Twilio Device on the client side. I'm NOT a Javascript guy (yet, but it looks like that's next on my every growing learn-this-technology list), but I have to think that the same functionality could be implmented in C#.
I've attempted to host the device in a browser control, but I'm not getting to far with it, and the integration still remains on how to pass a select item in C# to a executing Java Script library running in a browser.
I've also looked into IronJS run the JavaScript via the Dynamic Run Time, but I'm not sure if that will work in the end. The Twilio Library looks for a script tag in the web page, and hooks up several event handlers. Running the library in IronJS, causes it to fail as there is no web page, and my Java chops are not up to hacking this piece out.
My question is: Can't this Javascript Library be ported to C#, and create a full client that Twilio sees like the Javascript soft phone? I would think this would not only be helpful for me, but also for Win 8 dev, and Windows Phone 8 Dev as well.
I'm not a C# developer, I believe hosting the JS library in a WebBrowser control seems the way to go (at least much easier than porting the library to C#).
According to MSDN, you can use the Document property to call JS code from your application. For example, if you had this defined in your web page:
function test(message) {
alert(message);
}
You can call it from your application:
webBrowser1.Document.InvokeScript("test",
new String[] { "called from client code" });
Unfortunately, there's not a straightforward path to using Twilio Client in Windows 8 or other Windows desktop apps. I will pass along this feedback that it would be great to have VoIP functionality through Twilio for Windows 8 apps.
The Twilio C# helper library should help with this.
https://github.com/twilio/twilio-csharp
See the blog post below for an example application:
http://www.twilio.com/blog/2012/02/twilio-for-net-developers-part-5-twilio-client-mvc-and-webmatrix-helper-libraries.html
You also linked earlier to a Twilio Client C# code example:
http://www.twilio.com/docs/quickstart/csharp/client/hello-monkey
All of the Twilio Quickstarts can be viewed in C# using the language drop down in the upper right.
Related
I would like to access a special hardware (a penta scanner, for the wisest ;) ) from a web page.
The aim is to retrieve the information from the scanner and compute it on server side.
The problem here, is that I have to summon functions from a DLL that has to be on the client side. I have two leads for that:
Develop a COM DLL and use ActiveX
Try to get through a homemade extension for a web browser in order to communicate with the local DLLs.
I've tried the first option, and I got stuck and I've posted another thread about it. Anyway, even if it works, there are too many constraints about it (as to use IE or the fact that even Microsoft is not fond of this feature and banned it from edge).
The second method is something that I found on another forum but, I do not understand how I can interact with a browser extension (whatever the browser).
So what I am asking is:
Is it possible to use a web browser extension as a medium to a local DLL and if so, would you be so kind as to give a hint about how to do ar anything that might look like a start about how to do it (even just some key words to use on google, since mine didn't get anything)....
Thanks.
Based on my understanding, the motive to develop an Extensions is to enhance the feature and functionality for particular web browser.
You cannot control any hardware devices like printer or scanner with it.
So if your goal is to control the scanner from your web page with the help of any kind of extension than I think you cannot do this with Extension.
I've just started learning ionic framework. It uses web browser capabilities for building apps.
These capabilities namely HTML, javascript and CSS are client side stuff. Which on browsers can be seen with view source.
My questions is how will be the visibility of the source? Will the end user be able to see the source of the app?
If yes, is it normal for any app? Shall one be worried about the security of the source?
The visibility of the source in chrome://inspect#device , is pretty much the whole application. And no, end user cannot see the source of your application once you set and push the project to production mode.
Well, since you are developing a hybrid application, there are of course, pros and cons for each. Security might not be as strong as native apps, but development time is greatly reduced to push the app to different platforms.
If you would to do something would requires high security and non-visibility of your source , then native is the way to go. As for hybrid apps,if you need somewhere to store your data securely, you will need plugins to communicate with native platform's secure storage which might pose a security risk. But then again, even native applications can be de-compiled. The way developers tries to make it harder is via obfuscation methods.
Once u set your application to production mode, you will not be able to inspect your application anymore.
To show your web-app on chrome://inspect/#devices :
1) Make sure your web-app is running and your phone is plugged into your computer via usb with USB debugging on and your PC is trusted by the phone.
2) Under device manager, you should not have missing phone drivers. (it would look something like this)
3) ADB should not be running co-currently. And you should be able to see something like this on ur inspect page:
4) Click on inspect button and you're done! (:
You have a signed apk, when you install it on a device and inspect the device on google chrome the inspect option will not be available. Theres an easy way to do that decompile the signed apk using apktools you will get the AndroidManifest.xml file. simply add android:debuggable="true" to the tag and recompile it resign it and you will be able to inspect it. If you check the main.js file in the inspect section the source code is visible.
Hence you can use Jscrambler to prevent this (Its a paid service i too am new to it)
How can I use a scanner connected to pc in a web page i'm created using php and javascript
Javascript only interacts with your browser, i don't now if is possible that your scanner act as a WebCam, in this case you can use HTML5 api for webcam
Php or any server-side language is able to interact with the server and run commands , so is posible in someways if your scanner device has some command-line way to scan , but keep in mind this will only work with an scanner attached to the server where this script is host, this probably works for you if you are planning to create this for a home network o company network, mostly like a Web GUI for the "home/company" scanner
if you are thinking to do it to scanning app to the "world", They only way i can think you are able to do it, is probably creating a Java Applet , but nowadays is very common that web browser block java applets
This is not possible directly with JS or PHP, but you can try scanner.js
click here for demo and documentation
Edit:PDF Document for Scanner.js . Just include .js and using javascript callback functions to perform action.
Right now we have a Windows app that continuously reads a USB-attached scale and displays (and uses) the value.
Can I do this via a web page? Someone mentioned a "javascript input event listener", maybe? Does anyone have a simple HTML example?
thanks
I doubt you would be able to get information from hardware using a browser without using a java applet or something similar.
You could write a web interface that communicates with a process running on the machine, but you would not be able to access the hardware directly through the browser.
For more information regarding the protections surrounding browsers, look here:
http://www.australianscience.com.au/research/google/35779.pdf
My suggestion:
If you have a windows application but you want to run the interface in the browser, do something like VLC (http://www.howtogeek.com/117261/how-to-activate-vlcs-web-interface-control-vlc-from-a-browser-use-any-smartphone-as-a-remote/)
I have a system tray icon that receives incoming phone calls. When a call comes in, I want to send the phone number into a web app that does stuff on that phone number. We can launch the web app with the phone number in a query string, but if I launch a new window for every call, it will junk up the user's computer with lots of browser instances, would not preserve the location/size the user moved the browser window to, and would take longer than just refreshing the page. Instead, I'd like to make the Win32 app re-use the same IE browser window and just send the web app the new phone number every time a new call comes in. I'm envisioning somehow sending a Windows message, or somehow instructing the IE browser to run a certain javascript event with some data? I can see why doing the reverse (javascript out to Win32) would be a security issue, but this would be just sending a message from Win32 to javascript.
So I'm specifically NOT asking how to do what's been answered in this question: How to Interact Between Web App and Windows Form Application
That user was asking how to launch a Win32 app from Javascript and pass data to the win32 app. Roughly, I need to do the opposite. I need to send data from a Win32 app into a running javascript program.
Note also that I'm not asking how to launch one IE window with arguments to Javascript one time; I can easily do that with query strings. What I'm asking is how can I / is it possible to pass data from a running Win32 app outside the browser to a running Javascript app inside a browser window.
Since you can send the phone number to the site through a querystring, all you really need to do is tell IE to navigate to a URL of your choosing.
To that end, you can use what is in this KB article to help you find the instance of IE you want to connect to.
http://support.microsoft.com/kb/299356/de
Granted, its in Visual J++ of all things, but since you are interacting through COM Automation, the calls should be easy to translate.
Once you have the instance of IE (in the form of an IWebBrowser2 interface implementation) you can simply call the Navigate or Navigate2 method with the URL you need (with the phone number in the query string of course).
You should be able to find the handle of the IE window, and then send messages (keypresses perhaps) to it. Use a bit of javascript to capture all keypress activity and you have a very simple method to transfer information.
It won't be easy (the devil is in the details - issues of focus, etc) but it should be possible.
-Adam
What you need is a way to How To Connect to a Running Instance of Internet Explorer
(caveat: this one is in Java, but you should be able to translate it to C# quite easy).
Or you could enumerate the top-level windows to find a particular instance of IE and then Get IHTMLDocument2 from a HWND (this one is in C++, so you might need to do some Win32 interop; you can find all necessary declarations on PInvoke.net).
If you search on your friendly local search engine for How to connect to a running instance of Internet Explorer, you will find a lot more info.
Once you get to the document, you can either invoke the JavaScript function through the document scripting interface, or you can just navigate it to your page and pass the phone number as a parameter.
you could possibly get around the security and other issues with this method by using a web service on the web server, and have the win32 app update the web service and have the web page poll the same web service every however many seconds. Then you the the option of mapping that number to a database and getting additional information.
The only draw back is that instead of being immediate, there is a delay to get the information displayed in the browser.
How about you write an active-x control that you create in the browser using Javascript. This is effectively an Explorer browser plugin. Same idea for Mozilla, etc., except they use a different plug-in structure. This lets you support other browsers in the future.
The control can talk to your win32 app using a pipe or a socket or whatever type of inter-process communications and is then accessible as a Javascript object.