Play record when operator pickup call - asterisk

My description could be a little vague because I have not big experience in this field.
The problem is that my web service should do the following steps.
Another service send phone number in my web service
My web service takes that number and start calling into a particular queue in asterisk
After someone in this queue pickup call he\she should hear a recorded audio message
After that astersik should dial to the phone number from first step
Right now I can call to a local extension and then asterisk do the rest by calling to a client and connecting him with manager.
The first problem is that I don't know how to dial not to a local extension but to a queue in asterisk.
The second issue is how to play audio only when manager pick up call made from my web service.
Would be appreciate any help.

IF you use freepbx, you should put message in Call Confirm Announce
If you use custom dialplan, you should use M option for dial command and create macro which will play needed file.
For dial queue in freepbx you have use queue_num#from-internal. No way give any suggestion for custom dialplan
Note: doing system like that without understanding asterisk internal can result hi bills for international calls becuase of hackers.

Related

Asterisk IP-PBX: API to set up and tear down a call between two extensions

I have a working system that controls a Cisco CUCM IP-PBX to set up and tear down a call between two parties A and B; it makes use of Java's JTAPI to:
make A call B
make B answer (pick up)
(wait for a few seconds)
make either A or B drop the call
Now I want to do the same with an Asterisk PBX (version 13.17.0). From what I have gathered, Asterisks JTAPI implementation doesn't work for recent Asterisks; the latest version that I can find, dates from 2006 and it seems to try and send AMI commands to which Asterisk replies something along the lines of "no such command" - I'm guessing the AMI syntax has changed over the years.
What I'm using now is a library called asterisk-java and more specifically, its AMI support. I'm sending an OriginateAction and the net effect is that:
Asterisk calls A
I have to pick up A's phone manually
A calls B
I have to pick up B's phone manually
finally a call is established between A and B
So instead of a fully automated process like in the Cisco case, I have to do manual work and I can't seem to find an API to just set up a call between A and B and having it drop after a couple of seconds.
Questions: is the AMI the correct API for my use case or is there a better alternative? And what API calls do I have to make to establish and drop a call?
Thanks,
Jan
Does this answered question help with establishing a call without picking up:
Originate a call with Asterisk - without the originating extension ringing
To have a channel drop a call, using AMI, you can use 'BridgeKick' to boot a channel, or 'BridgeDestroy' to cause each channel to 'BridgeLeave':
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerAction_BridgeKick

Freepbx data integration with custom CRM

NET experts,
I have a scenario where a 4-port PSTN card is installed in a server and I have installed Freebpx on that server as per suggestion by someone. When a call comes on any of the PSTN line, it is forwarded to one of the operators on his hard phone.
Each operator is also having a computer screen at his table, powered by an individual CPU. This runs our CRM software to be handled by operator. When a call arrives to an operator hard phone, say operator 2, we want that the Caller number should also be displayed in the CRM software. Based on this caller number, operator can enter some information related to the Caller and save it in database via our CRM software. Also, when operator disconnect the call, we should receive call stop time for statistics later on.
Thus, we need caller number and call start time when a call is picked by an operator on his hard phone. and then we need call end time when a call is finished.
Can someone help us how we can achieve this? Do we have to capture the SIP packets and parse them or their is some other way to do so? Our CRM database is totally separate from the Freepbx and resides on another server.
If you want to get these events realtime, you should look at AMI (Asterisk Manager Interface - port 5038 TCP by default) and it's configuration manager.conf (note: FreePBX uses the, see manager_custom.conf).
If you want the archived version, you should set up a database server, and point the CDR (Call Detail Records) module to it. PostgreSQL or MySQL/MariaDB works just fine. Asterisk will simply ignore additional fields in the CDR as long as they can be NULL or has a DEFAULT value. This can be used to store custom data.

Asterisk AMI Atxfer on explicitely bridged channels

I'm trying to complete software which does all call logic via AMI on it's own using Asterisk only as interface to VOIP, SIP/GSM. Almost everything works great, but...:
Here is my scenario:
- incoming call is forwarded to announcement and then to MOH forever
- my app decides which extensions to dial (7777) using AMI Action: Originate
- once somebody picks up on extension, his/her channel (SIP/306-xxxxx for example) is bridged with waiting call's channel using AMI Action: Bridge
Until this point everything is working fine, both connected parties can hear each other, recording on demand works. All is fine.
Now I'm trying to make assisted transfer to another extension (Atxfer) using AMI on one of the bridged channels. And it doesn't work. I got couple of ami events about DTMF's on a channel (audio is muted while they are played). Every DTMF digit couses quick Bridge:unlink and Bridge:link event on AMI.
I tried to change dtmfmode, upgrade from asterisk 1.8 to 11 (asterisk now) and it always was the same.
While having this problems with Atxfer blind transfer on those channels works (using AMI Action: Redirect).
full log shows nothing something like this:
[2013-11-11 20:24:57] DEBUG[9457]: features.c:3740 feature_interpret: Feature interpret: chan=SIP/306-00000017, peer=SIP/GTS-00000016, code=*2, sense=1, features=0, dynamic=apprecord#apprecord
I recommend you read some asterisk book for beginner like ORelly's "Asterisk the future of telephony".
In you case correct solution is use asterisk Dial command for first channel instead of second call creation.
It is not clear how you do transfer using AMI. If you want do it via ami(which is VERY bad way), you have do something like following
On transfer request(digit) unbridge channels. Better put it in AsyncAGI after that.
Collect digits where to transfer using Read command
Transfer to new destination
If fail bridge again
NOTE: You resulting application will be really buggy and not scalable. AMI interface is not designed to do such things and work very bad when you have alot of actions and channels running on same box. So you have test your app under hi concurrent load to ensure it work(or more likly not work).

Streaming a bridged call from Asterisk To ShoutCast

I'd like to broadcast an Asterisk agent's conversation to a ShoutCast server. As each queued caller gets through in turn to the agent, his current conversation with his current caller needs to be sent to a specific stream.
I can find lots of info on setting up Asterisk to receive a ShoutCast broadcast, and I can find some info on using Ices to send a MeetMe conference to ShoutCast. The latter is no good for me as I need the queueing system and as far as I can see there's no way to be in a queue and a conference at the same time. Any other information is eluding me.
Thanks.
[edit] - whilst I've said ShoutCast above, any broadcast server would do. Preferably one I can run locally.
[UPDATE] -
This question is no longer relevant to my particular problem. This functionality is no longer required for my project and therefore I don't need an answer anymore. However, it received 2 up votes so I can only assume that some other people would like an answer. Not sure of the etiquette in this case but should I leave it open so someone else can answer for others to reference?
You can use the asterisk ices command [1] or install a parallel freeswitch server, bridge both servers and use freeswitch's mod_shout [3].
[EDIT]
To capture the conversation use a conference room and setup a new call using a Local channel to the conference and to a dialplan context where you can run the ices command. [4]
More... you can use freeswitch and asterisk together to solve this. Make a call to freeswitch from asterisk Instead the ices command.
REFERENCES
[1] http://www.voip-info.org/wiki/view/Asterisk+cmd+Ices
[2] http://en.wikipedia.org/wiki/Icecast
[3] http://wiki.freeswitch.org/wiki/Mod_shout
[4] Join two conferences in asterisk

Record and playback simultaneously - Asterisk

I am trying to build an application where I am required to record and playback simultaneously. The application needs to go live on an asterisk telephony server. My problem is:
A user calls the asterisk server and starts to speak.
The voice packets being sent by the user are recorded in a wav file on the system.
A copy of the voice packets are sent as feedback simultaneously.
I have taken a look at ChanSpy, but it will not work if one is using Record.
My questions:
1. If a user calls an asterisk server, does that channel become a simplex or half-duplex channel?
2. Are there any commands etc. that allow us to do the above?
3. If not, does that mean I need to go into C programming for asterisk (agi-bin)?
P.S: Please let me know in case more information is needed.
Why not try MixMonitor? That allows you to record the call, and doesn't interfere with ChanSpy usage. ChanSpy IS the best way to do this, by the way.
You are wanting to feed to voice channel from the caller back to the same caller correct?
Have you tried the Echo command?

Resources