Asterisk AMI: determining if a channel held - asterisk

I'm trying to figure out a way to reliably detect if a channel is held via AMI. I have two issues:
On Asterisk 1.8 I get the MusicOnHold event when a channel is held. Is this a reliable event? Can Asterisk be configured in a way that this event won't be sent?
Earlier versions of Asterisk (1.6.0) don't send an event for MusicOnHold. In fact, all I get is an ExtensionStatus event when I put a call on hold. Is there another event I could enable or command I could send to figure out if a channel is on hold?
I know these are older versions of Asterisk but we have customers that are still using them.

Yes event is realible if you AMI application is realible.
No idea about ealy versions.Except you can detect moh by dialplan using NewExten event. Sure that will nto detect moh from endpoint.
Note, some phones not do MOH but instead just plaiing moh sound. For such phones you can't detect MOh state.

I was missing "callevents=yes" in my sip.conf. I get hold events properly now even on older versions of Asterisk.

Related

Asterisk ARI early media detection

I'm playing with asterisk ARI and I have few problems that I'm unable to solve.
Originating a call from ARI does not register any events until channel is UP. Is it possible to force it to enter Stasis before channel is in UP state?
I'm trying to detect if there is voice in early media (operator messages on GSM gateway calls). Can it be done?
It is very much possible with Asterisk 14 version.
https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Channels+REST+API#Asterisk14ChannelsRESTAPI-create
This will create a new channel and place into Stasis immediately.
You will be able to do any operation over the newly created channel.
You can originate the call into a Local channel, then perform your dial from the local channel.
Early media is carried via SIP 183, which means, that Asterisk isn't really aware of it. Well, it is aware at the channel level, saying: "Please open media ports", however, there is not ARI event that says that.
Gotta admit, it does sound like a cool feature for ARI.

Asterisk DID switch to out outgoing trunk?

I have a toll free DID that users call to access my PBX service on an Asterisk box. The problem is; this DID comes only with a single channel so the system can only receive one call at a time. My initial idea was to simply get the caller ID of the incoming call, disconnect the caller and issue an automated call back to him to proceed with the call. This would free up my toll free number but could be confusing for the caller of course and also, there are issues where the caller calls from behind an extension. The best solution would be to somehow seemlessly switch the call to an outgoing trunk to reconnect the caller but now using my SIP trunk.
My question is; is there a way to do this in Asterisk (or I guess, does SIP somehow allow such operation)?
Thanks in advance.
That is called "callback".
Yes, you can do it. No, asterisk have no internal way do that and no way do it not noticable for user.

Asterisk HOLD functionality workaround

I'm using asterisk with webrtc in chrome (SIPml5 client) and also using their webrtc2sip gateway.
My problem is that I can't send the hook-flash/flash signal to asterisk for some reason.
Is there a possibility to trigger hook flash by sending DTMF signals ? (which apparently work for me )
Example: I want to trigger the standard hold functionality by sending the following DTMF sequence: #123.
On the other hand as a workaround, could I hold a channel using AMI or AGI ?
Basically I want the other party to hear OnHoldMusic while the channels/call remain active. On the local side I can just mute the audio tag which is fine.
Thanks.
Yes, you can do hold using ami command hold or AGI exec command musiconhold
That info is availible in AMI/AGI documentation
You can handle dtmf by using features.conf

Meteor.status() not change on disconnect

Meteor.status().status report "connected", also if I disconnect PC (ethX down)
It work only if I close meteor server.
How can I notify if client is connected (or not) to the server?
thanks in advance!
It takes a while for it to notice, keep in mind the web browser isn't aware of your hardware activities (ethernet disconnected, sudden loss of internet, etc). There are a couple of new APIs out there with HTML5 but meteor doesn't yet use these & they don't work under all browsers.
The only way to tell is to try to connect and watch for errors/failures to connect.
As soon as a heartbeat is missed (not sure what the interval is), or you run a .call,.insert, etc and there isn't a reply from the server then the status will change to disconnected.

Not able to detect talk events in confBridge 10

I am using confBridge in my asterisk for conferencing.
I want to detect who is talking and who is not talking inside a conference.
For this there is an option in confBridge "talk_detection_events=yes" this sends the talk events to AMI, but it only sends the talk events when the user joins a conference and after that I am not able to see any events in AMI.
I want that whenever a user starts talking or stops talking there should be an event triggered in AMI.
Or, is there any command by which I can detect if a user is talking or not in confbridge?
Also, I want to detect keypress (dtmf) events in confbridge. There is an option "dtmf_passthrough=yes" which pass the dtmf events to the AMI, but I did not see any events when a user presses any key in a conference.
Please help me in setting up these.
Regards
Anil
Talk Detection:
While setting talk_detection_events=yes will enable sending AMI events out denoting when a user begins/ends talking, that may not be sufficient to configure your ConfBridge depending on several other factors.
Whether or not a user is determined to be 'talking' depends on combinations of the dsp_talking_threshold and dsp_silence_threshold settings. If you are not receiving the talk detection events that you expect, then you may need to tweak these settings to match the audio properties that ConfBridge is receiving from its participants.
Alternatively, you should ensure that your AMI account has sufficient class permissions to receive the Talk Detection events. The event has the EVENT_FLAG_CALL class permission, and you should be listening for the event ConfbridgeTalking.
DTMF
dtmf_passthrough has nothing to do with the actual raising of the DTMF AMI event, which is done by the channel read/write routines. dtmf_passthrough allows the DTMF key presses to be sent to the other channels in the bridge - typically, the ConfBridge application absorbs the DTMF key presses.
With this enabled, you should see DTMF events - at a minimum - on the Bridging channel. If you aren't seeing events of any kind, you most likely don't have the appropriate class permissions set on the AMI account.
All of that being said, I have to wonder why you're looking for the DTMF key presses. In general, actions on channels in ConfBridge should take place using the menu system implemented in ConfBridge, or using the AMI/CLI commands. You'd be hard pressed to accurately intercept and handle a channel's DTMF while it was still in the conference bridge - the channel, at that point, is in owned by the bridge layer, and anything you choose to do to that channel is almost certainly unsafe.

Resources