Asterisk invalid Hangup cause - asterisk

I am using Adhearsion on top of Asterisk (version 11.9.0).
To make outbound calls Adhearsion uses AMI originate command. Problem is Asterisk doesn't say why the call got hung up.
If the callee is busy or did not pick up the call or hung up the call or switched off i am getting the same reason code ( 0 ).
Is there a way to get different Hung up reasons?

You can do originate to channel like Local/number#some_context/n
After that you can write some_context to dialout and handle in that context usual way any dial cause.

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 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.

Testing Asterisk SIP and DAHDI local calls

I am a real beginner in asterisk, so please tolerate my question :)
I tried to configure asterisk for realtime and it is working fine for local sip calls. Now, I am trying to make the following test with dahdi calls:
I connected an analog phone to an FXS channel of my Digium card and tried to call this phone (exten 124) from a sip softphone (X-lite).
I get the following error:
-- Executing [124#from-sip:1] Dial("SIP/2000-00000004", "SIP/124")
[May 31 10:24:22] WARNING[5457]: chan_sip.c:5667 create_addr: Purely numeric hostname (124), and not a peer--rejecting
my extensions.conf:
[from-sip]
switch =>Realtime
[from-pstn]
exten => 124,1,Dial(DAHDI/3)
It seems that the dial is done using from-sip context not from-pstn context as required.
Anyone to advise or correct my understanding?
Thanks million
Zak
In Asterisk realtime and not realtime you can configure where to send calls from particular extension, this should be configured in "context"(for realtime check context column), so I believe in your case it is "from-sip". This means all calls from that extension will hit this context, you can't send one call from same extension to one context and other to another, all calls will hit "from-sip" context.

Asterisk MixMonitor not recording queue calls

In my Asterisk 1.8 setup, MixMonitor() in the dial plan successfully records calls without issue.
However for queue calls, while a recording file is generated and the log shows that MixMonitor() is recording, however the files are tiny and contain no audio.
This is my queue:
member => SIP/extension123
monitor-type=MixMonitor
monitor-format=wav49
I have also tried changing the monitor type to "Monitor" and the format to "wav", with the same result. I have also tried adding local channels as queue members and recording from the local channel in the dial plan instead of using the queue's recording and I get the same result (even though when dialing the local channel extension directly the recording works fine).
Any help would be appreciated.
Update: I am trying the same thing now on Asterisk 11.7 and experiencing the same issue
Figured it out: calls were being passed to the queue via a local channel. Apparently you need to add "/n" to the local channel call to keep it from being "optimized away".
For example:
Dial(local/7001#Queues/n)
Source: http://svnview.digium.com/svn/asterisk/branches/1.6.1/apps/app_mixmonitor.c?view=markup&pathrev=197897

How to cancel call created with AMI originate

I am wondering if there is an easy way to hangup a channel created with Originate?
What I do is following:
Call in dialplan triggers Agi;
Agi starts AMI: Originate with Channel "SIP/201".
Now the extension rings. At answer I can bridge the channels. But, if the calling party leaves the call before the call is answered, I would like to stop the outgoing call. When I send AMI Hangup with Channel "SIP/201", It can't hangup originated call.
I can stop that call using 'hangup request channelname' using CLI
but how to hangup call using program.
please help me. how to hangup originated call
If calling party leave call,it will be auto-hanguped with CANCEL cause.
You also can use AMI action Hangup
http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Hangup
BTW, very likly you just doing it wrong way.

Resources