Asterisk Manager not reporting busy/successful call

Well, it’s kind of reporting successful call…

I’ve created a C interface into the asterisk manager to place calls. I rely on Asterisk to perform the work using a variable to send the text to speech information so that it can play the message. This all works great.

However, I want to know more information if the call hasn’t made it through. If I get a busy signal the message
"Response: Error
Message: Originate Failed"
appears but this could also be due to line issues among other things. I need to know if it was busy or not vs. just knowing the call didn’t go through.

Is there anyway to set asterisk to reply back with the actual cause of failing to place the call?

I have jumped through some hoops to make this work properly on my system. I dial using Local/ channels into a context which does utilizes the SendEvent() application to send custom events with the actual dial result.

If you already have the framework in place for the manager events, it shouldn’t be terribly difficult. Here is a quick example that would work for you:

Your Originate (pseudo code) would contain something like:

Channel: Local/DIAL@mytest
Context: mytest
Extension: ANSWER
Priority: 1
CallerID: 5555551212
(channel var) message_id: [something unique]
(channel var) destination: 5554441212

You would then construct your dialplan to look something like:

exten => DIAL,1,Dial(SIP/${destination}@gateway,30)
exten => DIAL,n,UserEvent(SomeEvent|dialstatus:${DIALSTATUS}|message_id:${message_id})
exten => DIAL,n,Hangup()

exten => ANSWER,1,UserEvent(SomeEvent|dialstatus:ANSWER|message_id:${message_id})
exten => ANSWER,n,DoSomeThingElseWithChannel()
exten => ANSWER,n,Hangup()

Obviously that is just a rough outline as to how you might achieve this…

Is there a “BUSY” tag as well? I supposed I could write an AGI program to fire from the dialplan if there is one. So instead of monitoring the feedback from my C app through sockets, you are saying I could use a dialplan to finalize the call?

If there is a BUSY, what other states are there?

You can check the Dial documentation, but I believe it is:


${HANGUPCAUSE} gives finer detail.

Ah cool.

Do you know if there’s a way to push the ${hangupcause} through the manager socket port?