Check line status (BUSY, DIAL, CONGESTION, ....)


I need to know how to check the line status (BUSY, DIAL, CONGESTION, …) before starting a call.
Is it possible?
Tipically I need to know if the line is busy or not, and if the call ends gracefully.

Thanks! :smile:

I’m running CentOS 6 with Asterisk 1.8.24 and I’m using a TDM410 card (with DAHDI driver) with 2 FXO modules (channels 1 and 2) and 2 FXS modules (channels 3 and 4).

You probably want the DEVICE_STATE function, but note that this can never tell you about non-local problems.

Normally, you would use groups and let Asterisk choose the first, locally, usable line.

I have only one phone line and I have to call a remote phone number. I use a .call file in the Outgoing folder to auto-generate the call.

I need to check:

  1. The line status (Busy, Congestion, …) before the auto-call starts, because I have to manage a scheduled call queue (managed by an external C++ software 8) ), so a call cannot start if another one is in progress.

  2. The result of the call (e.g. it has ended gracefully or not?)

Is it possible, and, in case, how?

The DEVICE_STATE function you suggest gives only the local status, as you said. For a call to a remote endpoint it always returns UNKNOWN, so it cannot help me. Any suggest?

Thanks!! :wink:

Change the requirement.

There is absolutely no means to signal this on an analogue line without making a call. This is a limitation of analogue lines, not of Asterisk.

It is not a service that is normally offered over the PSTN on ISDN, as it would probably be abused for pre-validating phone numbers prior to a telephone spamming run, or for clandestine surveillance. I doubt the signalling protocols allow, it, but if they did it would be treated as a special sort of call, which would abort before it entered the alerting state.

could you not add a VOIP trunk to place these outbound calls? These are better at returning what has is happening to the outbound call.

At least on my set up when you make a call to an analogue circuit, the DAHDI channel is automatically seized, the DTMF dialled and then the TDM audio passed to the calling endpoint so they hear ringback tone or Engaged/NU as applicable from the Telephone Exchange (of course if it is a human they would clear their extension on hearing these tones and the DAHDI circuit would then be cleared.

it is harder to detect in-band progress tones as they vary from country to country and some voices can trigger them.

You still can’t check for busy, etc., without attempting a call.

true, although the message is returned quicker so it would be easier to clear the failed call and reschedule it (even our analogue fax at work can do this).

The OP doesn’t clarify what the purpose of the call is - as there are only a few FXO lines its highly unlikely to be anything sinister the description sounds more like a way for a server or other equipment to “phone home” and report its status.

Here in the UK I was experimenting with some radio equipment (electronics is another hobby of mine) and noticed that POCSAG/FLEX radio pagers are still widely used for this purpose (presumably there is a web gateway for these rather than still using an analogue modem!)

Hi all,

I’ve studied :open_mouth: the book “Asterisk: The Definitive Guide” by Bryant, Madsen & Van Meggelen. In the chapter about trunking there is nothing interesting about outgoing calls and the possibility to check information on the call. There are a lot of information about SIP calls but nothing about analog calls using DAHDI channels.

What do you mean with

How can I use trunk?


In any case, although I cannot get line status before starting a call, I need to know at least if a call ends with success or not.
I’m not using Dial() application in my DialPlan, but I’m using a .call file in the Outgoing folder to start auto-calls: how can I understand if the dialling process works fine :question: (is the called party reachable and answered the phone?)

You have to use a Dial application, so you will need to use a Local channel, which then dials the real destination.

However, the reason there is very little on analogue lines is that there is very little information available on the cause of the failure. Asterisk doesn’t do extensive decoding of call progress tones, or SITs, and certainly cannot interpret spoken announcements.

Also note that you may not have answer supervision, in which case all calls will appear to succeed (or all to fail, if you configure Asterisk to look for it when it isn’t present).

The serious users of call files use ISDN, or VoIP to someone else that uses ISDN. On the other hand many of them generate junk calls, so tend not to get much help here.