Identify caller id, hung up, call back with asterisk - sip

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.

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.

how to get queue information from asterisk

I am running asterisk on a elastix 2.2 distro. I have a Queue with EXT 9000 where 3 softphone (c#) extensions belong to this round robin queue.
I know that I could trigger a AGI or AMI event from the dialplan and let in some way a webservice know about the length of the queue and then forward this information to the softphones.
Is there any way that the softphones could get this information directly from asterisk. Either something AsteriskBuiltIn or ElastixBuiltIn.
a last resort (baaaaaad) idea was to open a line, call an encoded number like (555*1) and receive back a dtmf. it is a Bad Way but it would work.
Open for any suggestions
Queue drop events into ami.
Also queue log all actions into /var/log/asterisk/queue_log, which is posible put to mysql(see this)
There are no way say how your softphone can catch that event. But for sure you can get that info from mysql and rewrite your softphones to show that info.
Also elastix call center edition have web panel for call center. As option you can check fop2 project for panel.

Asterisk callback with IVR survey

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.

asterisk entry point to a SIP dialplan

I understand this should be really easy but I can't find my way around the asterisk configuration files to do this.
What I need in an entry point for a external SIP call to execute an asterisk script. To keep things simple let's say I want to execute something like this:
[my888app]
exten => 888,1,Answer()
exten => 888,2,SayDigits(1234)
exten => 888,3,Hangup
The user will dial this particular 888 SIP extension in the form:
sip:888#mydomain.com
This is not an internal call, the call comes from another server, to test I'm using this Phono sample and the call is getting onto the asterisk server ok, the problem is that I have no idea how to route it to my888app. Already tried /etc/asterisk/sip_general_custom.conf without luck, guess the problem is the context [my888app] is not right. I already have the asterisk CLI in front of me
So, to recap:
No DID funny business, just SIP
In which .conf file do I put the [my888appp]
I dont understand if 888 is an entension or a channel
Multiple calls will be made at the same time to [my888app], is that a
problem?
Right now when I dial from the Phono app I get please enter the
channel number follow by the # sign, I dont know if that is helpful
or not
Thanks!!!
Well, after a lot of searching turns out the routing is as follows (default FreePBX installation):
The SIP calls goes into a context called from-sip-external
from there, it goes to the context from-trunk
from there it goes to from-pstn
from there it goes to ext-did-catchall
And there, in ext-did-catchall, is where I can put my888app and it will execute ok
I'm 100% positive this is not the correct place to put the app, but as I'm not an Asterisk expert I will settle for it.
Hope this help someone else.
Thanks.-
You need check the context attributes in your sip.conf. You can have a context in general section and you can have another in your peer definition, if you dont define any specific context in you peer then the general context attribute is assumed.
For simplicity I advice you change context in general section of sip.conf and put your my888app in extensions.conf.
Example of sip.conf general section:
[general]
context=my888app
...
About 888: it is a extension, an extension is a end point to your call. A channel is a object created dynamically when setting up a call to retain the session information and to exchange data (voice) between two points.
Answer is very simple, Any external call first land on the context which is defined under general section in sip.conf file. There you can define your own dial plan. if you want to redirect to your own context from there then you can use GoSub.

How would I get SMS/Phone events, and act on them before they're sent to the system apps?

I'm trying to develop an application for a jailbroken iPhone similar to Mcleaner or iBlacklist.
What I want my app to be able to do is intercept SMS or Phone events and handle them before they're sent to the appropriate receiver. So for example, I want the application to get an SMS event, compare the sender to an array of numbers, and either process the data or ignore it and pass it off to the SMS app.
In MCleaner, you can define a blacklist of numbers, and if a text message is received that matches the blacklist the user won't get an alert from the phone and the data is instead handled by MCleaner.
How would I go about getting these events, and further, how would I get these before the appropriate apps receive them? From what I understand, I'd need to become a first responder for these things, but I really have no clue where to start. I can't seem to find any hints on how I'd go about this as this app will not be calling apple classes to get the data..
Thanks.
I can only guide in with this, sorry, the code isn't mine to give.
In memory, all the action calls are all just pointers. What you have to do is over ride the pointer to make it point to your own function. Once you do that, you do w/e you want in your function, and then call the default function call. This ensures the integrity of the action calls and allows you to intercept the actions.
You need to use the CKMessage class.
Check this out: http://hexorcist.com/private_frameworks/html/interface_c_k_message.html
and this: http://www.ifans.com/forums/showthread.php?t=232745