Asterisk callback with IVR survey - callback

I´m pretty now to all this Asterisk-thingy and I wonder, is there a way how to call a user back from asterisk after he ended (hangup) call and give him a IVR survey, then save results somewhere (in form of audio records or DTMF inputs) ?

Sure there are alot of way to do that. But all require understanding of how asterisk works.
Hangup events can be detected by "h" extensions something like this
exten => h,1,System(/etc/asterisk/create_callback.sh)
After that you have create script for callback, see
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
You need create IVR in your dialplan
http://www.voip-info.org/wiki/view/Asterisk+Dialplan+Introduction

If you have programming experience you can use AMI(Asterisk Manager Interface) to generate your calls from Asterisk to your customers, based on whatever logic. Once the customer answer the call all you have to do is redirect it to your IVR context.
For the IVR(survey) portion, you may want use AGI(Asterisk Gateway Interface). You can access both APIs with virtually any programming language. Take a look of the following:
Adhearsion (Ruby)
Asterisk-Java or Astive Toolkit (Java)
PHPAGI (PHP)
Good luck.

Related

Add multiple participants to Twilio conference

I am trying to move our existing call routing backend to conference to make advanced features available. Is there a possibility that I can take (1-1) simple calls that are going on, and place them inside a conference without loosing the connection? Basically I wanna be able to use conference only if specific features in conference (like whisper, barge) are required?
Or, do I have to start the call with the conference leg to be able to do this?
Here's what I've tried:
Start a simple Call from A - B (C1 -> call from browser client to twilio bridge, C2-> bridge to PSTN)
Call connects A to B for voice comms
If conference features are requested, I create new conference and try add both calls conference. It does work sometimes, but more often one of the calls ends up dropping.
Twilio developer evangelist here.
The issue you have with one call dropping as you move the other to the conference is that when you move that call, the other call then goes to the next TwiML verb (or the action attribute of a <Dial>). If there is no next TwiML to execute, then the call finishes.
The easiest way to achieve what you want here is to start in a conference.
If you want to achieve this with a 1:1 call first and then a conference, you will need to move the PSTN call first and provide more TwiML after your <Dial> so that the browser client has something to do until you can also move them to the conference. An example here could be to add a <Pause> after the <Dial> that would give you time to update the call using the REST API. Alternatively, if you know what the conference name will be beforehand, you could follow the initial <Dial> with a second <Dial><Conference> and the caller will be dropped straight into that conference as the other leg is moved.

Identify caller id, hung up, call back with asterisk

For a project I need to build an mvp of a service where users call a toll free number, on the other side, the pbx detects the call, saves the caller # and hangs up (so caller never gets charged for the call). Then the pbx calls the user back, allows him to dial a #, then pbx plays an audio file and when it finishes, makes the connection to the # introduced by the user.
I'm new to voip and asterisk, but which documentation should I read to achieve this (which features do I need to understand and look for?)
At begining you have to understand how to build dialplan and use it's applications(Dial, Playback and Read). If you want to use some programming language you can use AGI, there are library to write agi in almost all languages :)
For redialing user you can use call files or Asterisk Manager function originate. Call file can be used to call in future if you change creation time of file to future.
Simple flow can look like this:
User dial simple dialplan, run there some AGI, which read callerid and saves call file in near future. You do this without answering the call.
Call file dials user.
After answer you go to another dialplan which reads dtmf from user and dial that number.

Testing from JUnit if a SIP Soft Phone is ringing, answered a call, disconnected

I want to initiate calls to two numbers using a 3rd party API. I need to make sure that the devices ring when they get the calls, media starts to transmit when the call is answered, and the call is terminated when hungup.
Ideally I would like to do this from JUnit tests so that I can automate this whole process. But any other tool will also be fine.
So this is what I want to do programatically,
1) Configure two SIP soft phones to answer on 2 different numbers using some credentials provided by the test.
2) Make a call using the API
3) Assert that two phones are in ringing state
4) Answer the call
5) Assert that RTP media is being transmitted among them
6) Hang up
7) Assert that the call is now successfully disconnected
I am quite new to telephony, so would appreciate any pointers on any tool or SDK that will help me accomplish this.
Please check out SipUnit https://code.google.com/p/commtesting/wiki/SipUnit.
It can do all above except check out the media is flowing yet.
Check out the KitCAT framework. It's based on JUnit and can support all of your requirements. It supports multiple user agents, which can all be coordinated within a test case. It also provides coordination with other protocols (e.g., RTP, HTTP).
Sample code:
SIPAgent callee1 = createAgent("callee1"); // sip:callee1#host
SIPAgent callee2 = createAgent("callee2"); // sip:callee2#host
// invoke your API here
invoke3rdPartyAPI(callee1.getSipURI(), callee2.getSipURI());
pause(2000);
assertThat(callee1, is(invited()));
assertThat(callee2, is(invited()));
callee1.answer();
callee2.answer();
pause(500);
assertThat(callee1, is(connectedTo(callee2))); // check for SDP match
callee1.playAudio(audioFileName);
pause(500);
assertThat(callee2, has(incomingMedia());
callee1.disconnect();
pause(500);
assertThat(callee2, is(disconnected()));
Check out the complete API here.

"Do Not Disturb" feature in iOS 6 How to implement?

I want to implement the feature "DO Not Disturb" in iOS 6.
First question : Is there any framework or api apple exposed to control them through the code?
After lot of googling i found an application on the app store "Call Bliss" that provides this functionality and complete control over the calls, sms and mms.
Can anybody explain how this application works?
or
any other work around to learn and implement this feature in iOS?
Thanks in advance...
From reading the description of Call Bliss, it actually sounds quite simple in how it works.
1) Do Not Disturb must be enabled at all times. Not scheduled, not off, but on at all times.
2) It requires you to set the contacts group for exceptions to Do Not Disturb to "Bliss Exceptions". This implies that the application requires access to your address book.
From there, it's probably wise to assume that it manages the contacts in the "Bliss Exceptions" contact group based on whatever parameters you set in the application. It adds and removes people in that group based said parameters.
So to answer your question, no, there is no framework to do this. The way they're doing it is likely the only way to do it currently with no public API for managing do not disturb status.
There is no public API to even access do-not-disturb functionality.
I think this is what the app does:
The app creates and manages its own contact list (called Bliss exceptions)
the user have to select it in the do-not-disturb preferences.
The App can run in the background because it uses location tracking (probably significant only to save battery life), so when the user changes locations it can update the exception list.
When a call is received do-not-disturb system functionality checks the Bliss exceptions list and silences all calls from contacts on the list.
Please note that reviewers complain about the lack of time based call blocking. It is impossible because the app can only execute code when the location is changed.
In my Knowledge there is no way to implement it via code. There is no public api provided for restricting the calls.
But there is an API for detecting the calls : CTCallCenter and a FrameWork called CoreTelephonyFramework

How do I implement chess with backbone.js with a RESTful api?

When one player makes a move that is sent to the server. And that move is pushed by the server to the second player. As far as I know, the server pushing the move to the second player goes against being a RESTful api.
From what little I know about backbone.js it is meant really for RESTful setups. Is there a way to use backbone.js with websockets to allow the server to push data down to the clients at any time?
Is there even an idiomatic way of implementing chess with backbone.js and websockets? And if not then what would be the correct way to implement chess?
You can definitely do it. Instead of fetching your collection/model, you will just set or update/reset the json data from the websocket into the proper model or collection.
Somewhat pseudo-code example:
var board = new Backbone.Collection(); // this would probably be your own extended Collection instead.
function boardChange(jsonFromServer){
// Take the json array from server,
// and update the collection with it.
// This would trigger 'change' events in each model in the collection (if changed).
board.update(jsonFromServer);
}
Implementing a chess app doesn't really require a Backbone architecture. As long as your server supports Asynchronous API, WebSockets, or even long-polling (anything real-time), it's possible. There's tons of APIs out there on the web already that does this (ie FireBase) as well as frameworks (ie, Meteor) comes into mind.
Also check out Socket IO if you're using Node JS for your server-side. There's tons of open source projects on GitHub that takes advantage of some of these web technologies already, Backbone in particular. Backbone with Socket IO. Backbone.ioBind also looks like a promising project with code samples that you can look at.
To make it work with Backbone, the data API just needs to notify any client-side listeners that an update has been made on the server which in turn triggers a change event on your Backbone Model.
You can even set a timer that performs a request to the server every n amount of time just to test out your code prototypes.
You could overload the Backbone.sync method to use websockets. The de-facto To-Do example (http://addyosmani.github.com/todomvc/) does this to use localstorage instead of a RESTful datastore, and you could do the same for web sockets. In fact if you look around Github/Google you may be able to find someone who's already done it.