Is there any way to know which peer disconnected the call Asterisk - asterisk

I am trying to collect some info about the ongoing call in asterisk but during hangup I want to log which peer initiated the process of hangup. I am new to asterisk so I have no idea if its possible or not. Please help me if it can be done. I have tried to use HANGUPCAUSE_KEYS but it does not provide much information.
Actually I want to know who has released the line first? If A and B are connected with bridge and B releases I want to record that B has released the channel and vice versa.
Thanks!

I can see 2 ways.
1) Set a Hangup Handler in your dialplan (extensions.conf). Maybe it is the easiest way, but limited. WIKI: Hangup Handler
2) Use AMI and try to monitor the channels. It can be complicated, but almost limitless and powerful. WIKI: Asterisk AMI

Related

Do I need a dialplan?

I'm getting started with Asterisk and I have to develop an app that will only be used to call people (an alarm system).
I'm using Java and Asterisk-Java, and I read that on their GitHub:
Did you know you can originate directly into AGI? This is really powerful and eliminates the need for dialplan when doing AGI.
So, if I get it properly, that means I can do without a dialplan.
Though, I can't get Asterisk-Java to work properly, but I don't know it is because I have no dial plan or for some other reason.
Thanks
Yes, you need dialplan for anything except outgoing calling(initiated from asterisk side).
If you using only Originate and not need hangup handlers, caller id etc etc you can go without dialplan.
But in most cases it will be really tricky and usless.

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

Is it possible to monitor a channel using Astersik AMI

I am using asterisk
I would like to debug a channel
I want to track the channel activities
Like Dialing, Ringing, Call established and Hangup etc
Is there any cli commands available ??? or any other way to do this
Thanks in advance
Although I come from Freeswitch world. I would think that it should. A little search leads to this :
http://www.voip-info.org/wiki/view/Asterisk+CLI
You should be able to see all the events logged on a cli.

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