Softphone answer event in Asterisk - asterisk

I want to make a web interface that prints out a form that needs to be filled.
The problem is that i want to print out the form only when a call is answered by a softphone.
What event should i listen for?
I'm using Asterisk 1.6 and I get all the events in XML using AsterClick.
thanks,
Sebastian

AsterClick is an excellent choice as it is the only
event based Asterisk AMI /(XML)/JavaScript interface
on the planet that can propagates those events to
JavaScript AS they occur!! All others use polling,
As to your question...
During your AsterClick development,when your JavaScript inherits from the
wSocket class, you should implement the method(s)
your_wSocket.wSocketsReceiveString(String) and/or
your_wSocket.wSocketsReceiveXML(XMLdocument).
These wSocket methods should be documented on the AsterClick site http://asterclick.drclue.net
with more help being available in the forums http://forums.drclue.net/viewforum.php?f=13.
These functions can be used to monitor the XML command and event flow in real time
and represents all the data Asterisk AMI provides.
I tend to route this information to an autoscrolling widget with a handy [clear]
button near by.
By pressing your [clear] button and then interacting with your
phones while examining the event flow, you
should be able to pick out the events and related data for
any automation sequence.
As to jQuery, I know that there are jQuery/Asterclick projects
running out there, including a real-time HUD system that manages
calls,conferencing,parking,queues, etc.
The AsterClick client SDK is also squarely aimed at HTML5 and running
on an ever increasing range of devices as the HTML5 features required are
implemented.
You can also use the AsterClick "WBEA" tool to deploy your HTML5
AsterClick applications as desktop executables for Windows,Linux.
Anyways I Hope some of that helps.

You should capture events from AMI, you can use Adhearsion for this (Adhearsion can be also connected to a Rails app):
https://github.com/adhearsion/adhearsion
or PAMI if you prefer PHP:
https://github.com/marcelog/PAMI

Related

Disable client side decorations (CSD) on Wayland

I am working on a Wayland Compositor, and I need to disable CSD for Qt and Gtk client apps.
Is there any environment variable I can use to do it so?
I have been searching without luck!
For Qt, you can set QT_WAYLAND_DISABLE_WINDOWDECORATION=1
2021 Update (only relevant for compositor development):
There's now also an official protocol extension for negotiating window decorations, called xdg-decoration, so if you're working on a compositor you can implement it and make sure to send a configure event with server_side:
<event name="configure">
<description summary="suggest a surface change">
The configure event asks the client to change its decoration mode. The
configured state should not be applied immediately. Clients must send an
ack_configure in response to this event. See xdg_surface.configure and
xdg_surface.ack_configure for details.
A configure event can be sent at any time. The specified mode must be
obeyed by the client.
</description>
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
</event>
This would be the standardized and clean way to do it, but note however that toolkits are free to not implement this extension, so there's no guarantee that you will be able to use it.
If you're using the Qt Wayland Compositor API, the docs are here
Qt clients implement and obey it and some other toolkits, but I don't think GTK does. It looks like they implement an unofficial extension developed by KDE, though, so if you really want to go out of your way to get rid of decorations on GTK, look into implementing server-decoration as well.

How to communicate between two applications in Android?

I'm developing a keyboard, so I'm implementing an InputMethodService. I have a requirement to add other features to this keyboard application but to separate it as another application in order to leave the keyboard as a lone keyboard implementation.
So I need to create a keyboard application and another application with all the other features (other features include but not limited to: a News Activity, a Messenger, a Lock Screen implementation and some Widgets).
Those two applications will need to communicate between them, from my research I found that there are several mechanisms I could use:
A Bounded Service
URI implementation
BroadcastReceivers
My question is: what would be the best implementation for my needs? Where my needs are to pass data from one application to another as well as starts activities and other components from one app in another.
After I made some research on this topic I found that there are several ways to do this operation:
Using Bounded Services that uses either a Messenger object to pass messages between the local process and the Remote Bounded Service or using AIDL to create an interface that will be passed from the Remote Bounded Service to the local process so that they can communicate.
The second options would be using the good old fashion BroadcastReceivers. That way as always it is possible to fire an Intent from the local process to the remote process and there receive some information.
The different for the usage of those both two would be decided by how strong would you like the connection to be between the two processes and how often should they be communicating. If they need to do one operation once in a while the BroadcastReceivers would be a perfectly good solution. But if you need a more consistent connection the Bounded Service is the way to go.

How to capture biometric information on a webpage by using Java

what's the proper way to capture biometric information (pressure, speed...) by signing with a stylus on a canvas developed in a JSP web Page
Alright, since no one else has attempted to answer this question, I shall elaborate on my comment and opefully it will serve as an answer to others as well.
First, Java Server Pages (JSP) is a server-side language. It is meant to run on the web-server and not on the user's browser. The same goes for other server-side languages like PHP and ASP.
So a server-side language is not able to directly interact with devices (keyboard, scanners, cameras, etc). Only when the data is submitted by the browser or client program, the server receives it for processing.
For a device to receive input, there are two key pieces of software needed.
The device driver: which must be installed on the user's machine
The application program to capture inputs and do any processing.
If either one is missing, the device cannot function. And then there's another issues. Depending on the device, there's various feedback from the driver/API that should go back to the application that reads it. For example, if a fingerprint scan was not very successful for some reason, the scanner should tell this to the user. So again, there's the need for interactivity between the device and the user's application.
Thus, using any server-side language is out of the question for such applicatoins.
Now, in order to make this possible, you may use a client-side program. Here are some options.
A native application in VB, C/C++, Pascal or other language. If this is an option, the user must install this application on their computer.
A browser-based program. This can be a program created using JAVA (not Javascript or JSP), or ActiveX component. ActiveX is largely OS/browser dependent. And the TRUTH is that even Java is not truly platform independent when it comes to different operating systems. There are some technical differences that you'll need to look into. But for the most part of interactivity and high-level operations, yes, Java is more platform-independent than the others. But on a personal note, Java is my worst language. I try not to use it anywhere anymore. That's a different story.
In both options above, every client machine must have their own proprietory drivers and often some sort of API for browser integration.
A year or so ago, I had to program a Bio-Mini fingerprint scanner using VB. It was all sweet in the beginning. Then due to the restrictions of networkability and concurrent usage, the drivers/SDK could not take the load and things were going wrong. By the way, the drivers/SDK were meant for MS-Access. Knowing that the DB was the problem, I started to port this to MySQL. And it was a severe climb from there. I had to do a near-rewrite of the SDK for capturing and comparing data using arrays in VB. And to make things worst, the device was changed and things went wrong again. But do note that the new device was from the same manufacturer.
So keep in mind that even a simple change like that can cause a problem.

Generating SNMP traps

I am trying to implement just half of the SNMP functionality. On certain events, I want to create trap corresponding to each event. I am using C and Linux.
What would be the simplest way to achieve this? Do I need to use any open source utilities?Some of the events that I want to notify are very specific to my application. How to go about implementing this case?
I am new to SNMP. I have couple of basic questions: How agent and manager figure about what property i.e. object is being referred to? Do they both parse the MIB? How is MIB shared between agent and manager?
The easiest way is to execute Net-SNMP executable called snmptrap,
http://www.net-snmp.org/tutorial/tutorial-5/commands/snmptrap.html
Of course, you can also link to its underlying library so as to call the C functions directly.
About your basic questions on SNMP, you should start from a book, such as Essential SNMP or Understanding SNMP MIBs.

Controlling Spotify through Processing/Arduino

I am making a tangible controller for Spotify (like the one from Jordi Parra, http://vimeo.com/21387481#at=0) using an Arduino microcontroller.
I have a Processing sketch running which does all the calculations with the data from the Arduino. I want this Processing sketch to be able to control different options in Spotify like: Next, Previous, Play/Pause, Volume Up/Down, Shuffle.
Right now I use an extra Arduino Leonardo which simulates key presses while AutoHotKey listens to those and sends them to Spotify. It does not work very well and I only have limited options.
I would love to get rid of that extra Arduino while getting more control.
I am working on a Windows thing so Apple script won't work (for me).
Is there a possibility to control the Spotify app from Processing? Or is it possible to use the library to create a new Spotify app in Processing?
Many thanks in advance!
Paul
Disclaimer: I work at Spotify
Right now there is no cross-platform way to control the Spotify application. On Linux, Spotify will respond to dbus commands, which means that a bit of hacking could send play/pause/next/previous. I have heard that it is also possible to control Spotify on Mac OSX via applescript, but I'm not 100% certain about this. A quick google search for "control spotify mac os x applescript" produced some interesting results, though I'm not sure how current or relevant any of them are. As for Windows, I'm not sure if/how one would control the application at all.
Otherwise, your best bet would be libspotify, for which you would need to write a Processing library to communicate with it. Based on a bit of quick research, it seems that Processing libraries are written in Java, which means you'd either need to use a wrapper such as jlibspotify or hand-roll your own JNI wrapper for libspotify.
I'm not sure how current jlibspotify is, given that they are wrapping a rather old version of the library. If you do any libspotify hacking it is better done in C/C++ with a minimal JNI wrapper, but all of this may be way more work than you are intending for this project.
Why not utilize Spotify's keyboard integration.
The Arduino Leonardo supports USB HID mode.
So, send the keyboard keys for Next, Previous, Play/Pause, Volume Up/Down, Shuffle.
Most everything has a single bound global key. I believe only shuffle does not. You could create a global hotkey in your OS to bind to the app's shuffle control key.
If you are looking for status feedback on the state of each button, this of course won't help you.
Good luck.

Resources