Asterisk DID switch to out outgoing trunk? - asterisk

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.

Related

Asterisk, force timeout delay between consecutive inbound calls

We have one problem we've been suffering of for a long long time,It's the unknown callerID received from asterisk that happens on specific situations.
First we have a sip soft phone (sipml5)
and on server side we have
asterisk-11.25.0-0
elastix-4.0.0-1
Setup: we have any cid/did inbound route connects our calls to one ring-group(that have all the extensions)
The unknown caller id shows when we have:
1-Short timeout for call(which lead to make the call stick at asterisk and asterisk resent the call to extensions but with unknown caller id).. possible solution would be to make big timeout.
2-All extensions do hangup and the call stick on asterisk and asterisk resend it to extensions with unknown caller id (possible solution would be to prevent extensions doing hangup unless they answer the call first)
3-Receiving one unknown caller id lead to successive unknown caller id calls.. no solution
What we're trying to solve is the 3rd problem and we have an idea of forcing asterisk to wait for a specific timeout between inbound calls(we tried this manually by not allowing immediate successive calls,make 4-5 seconds delay between calls and it works fine)
We want to know what configuration has to be edited to force this timeout delay between inbound calls.
You can use EPOCH function and store value somewhere(ASTDB?)
After that in dialplan compare it when dialling
No, elastic not support that and will not support it in future(weird request).

Unable to locate Registered client Asterisk - Kamailio

Problem: My main issue is that when I “REGISTER” a client via Kamailio, and I attempt to “Dial” a different endpoint within an Asterisk Dial Plan, Asterisk throws an error stating that the endpoint (the number I am dialing via “Dial”) is not registered or reachable. However, commands like “Playback” do work correctly for the client I “REGISTERED” via Kamailio.
E.g. I register client 10001 in Kamailio, I then register another client 10002 in Kamalio; both 10001 and 10002 can exercise an Asterisk Dial Plan which will play videos/audio (No Problem). But, now I want 10001 to Call (Dial) 10002; it is at this point that Asterisk throws the error “10002 is not registered or reachable”.
I have tried many of the suggestion on many different help boards (several times) but I am still unable to forward a registration from Kamailio to Asterisk.
With my current Kamailio configuration (I do use dispatching), I see , via tcpdump, Asterisk receiving a “REGISTER” request, and Asterisk sends back the “unauthorized” as expected, however, Kamailio does not re-send the “REGISTER” as is customary. I am not sure of the next step to take, but I feel I have a couple of options.
- I can continue to try and figure out why Kamailio is not sending the second “REGISTER” (I have not yet been able to figure this out).
- Tell Asterisk to not require authentication. (I am using pjsip and do not know how to not require authentication in Asterisk when the request is from Kamailio).
I have put a lot of time into this one, and I am at a sticking point. Any help or suggestions would be very much appreciated.
Thank you,
Kamailio is proxy. It SHOULD NOT do send second register unless you EXPLICTLY ask it do that in dialplan.
Dispatcher module is fast processing module. It should not do for you all staff, it just give you suggestion for dispatch.
You should not do check on asterisk for registration, you have send request to kamailio, and kamailio SHOULD do that work(it do much faster and HAVE info).
Main issue is:
asterisk main goal - give easy to understand platform for begginers. So anyone can get working pbx for free. It work on top level, with calls.
kamailio main goal is PERFOMANCE. It is not for begginer, you need have solid understanding of sip protocol, not just know that you want call. You have define what to do on packets level.

Unable to set callerID using ARI

I have a java stasis application on Asterisk 14 using ari4java. It mostly works great. I am now trying to receive an external call and relay it back out. I do following
Incoming call enters Stasis
Create bridge
Add first call(channel) to bridge
Create channel
Add second channel to bridge
Dial( secondChID, "Local/2601", 30)
No matter what I try, the second outbound call gets the callerID of the first inbound call. That is actually OK for many calls, but in this case I want to set another callerId.
Before Dial() I have tried to setChannelVar(CALLERID(num)) and this value I can see in all events coming from Asterisk. But once the SIP call is placed, no sign of my callerID.
I doubt it is the ari4java doing anything wrong as I see the callerID in all the "dial" events. I thought I could force a callerID in sip.conf, but unable to do that too.

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.

Asynchronous Message Queue on Cluster

I've a site which in some cases use Message Queue asynchronously.
The method which sends the message returns its id. Then I make an AJAX call to get the response for the message with the saved id.
This works great, but now the site is going to be on a cluster and there starts my problem. I can't ensure that the AJAX call will be recieved by the same server which sent the message. Is there any known solution to this problem? Any suggestions?
Thanks, Diego
three solutions come to my mind:
Make client aware of server
Dispatch the request on server based on client input
Dispatch the request on server by remembering which request was processed earlier by which server
Sometime ago I developed a web application like this and I dispatched the request based on client input parameter, that's a better solution I think.
Clusters typically have one name and IP address combination, even though there is more than one node that makes up the cluster. If you use the clustered application's IP name or address, you should be directed to the active node of the cluster.

Resources