Asterisk ARI early media detection - asterisk

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.

Related

Asterisk ARI initiating a call

I am trying to initiate a call between two local endpoints, a softphone(PJSIP/100) and a harphone(PJSIP/102). Using ARI I have created two channels, with app parameters and put them both into the same mixing bridge in stasisStart event.
At this moment, both of the channels are in the same bridge, but their state is "Down". If I now dial both of them separately from ARI and then press answer on both endpoints, they can share audio, but is it possible to avoid dialing and answering both of them? I have played around the "originator" and "callerid" parameters, which is passed when creating channels, but that does not help.
Is it possible to "dial" one of them from another via ARI?
It’s not 100% clear what you’re trying to do here, but from what I understand...
Dial PJSIP/100 and put it into bridge_1 in statisStart
Dial PJSIP/102 and put it into bridge_1 in stasisStart
You could dial them using stasis originate or an originate via the dialplan.

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

Asterisk AMI: determining if a channel held

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.

Detect FlexClient disconnect on Longpolling Channel

I'm developing a chat system and i need to detect the FlexClient disconnect in Java, using the longpolling channel.
I can't use the Streaming channel, because of some bugs that this kind of channel still has. Do you have any suggestion on how could i accomplish this? I'm using BlazeDS.
Regards.
There is no way to detect a client disconnect in real time unless using an RMTP channel which is using behind a socket. When using different channels you can do some workarounds like having some javascript in your web detecting the page unload event, or you can have your client using some kind of heart bit mechanism.

Resources