[asterisk-users] Analog FXO status checking

Tzafrir Cohen tzafrir.cohen at xorcom.com
Fri Jan 26 12:14:29 MST 2007


On Fri, Jan 26, 2007 at 06:17:03PM +0100, François Delawarde wrote:
> Hi all,
> 
> I would like to make a script/program that would be able to show lots of 
> status information from my analog FXO lines (and FXS lines in the near 
> future).
> 
> Example of interesting status information:
> - Hook status: is there a call being made with that zap?
> - Voltage status: cable connected, voltage values (if possible), line 
> ringing?
> - RX/TX Volume status
> 
> I'm using a TDM400 card with FXO modules plugged on spanish lines, and 
> trying to parse "zap show channel X" with Asterisk 1.4.0 gives me 
> unexpected results:
> 
> - "Hookstate (FXS only)" line shows Onhook when cable is disconnected 
> and Offhook when cable is connected, whether there is a phone call or 
> not... Is it normal (with an FXO line)? Can someone explain me why?
> 
> - The only way i found to know if the line is in use is to check the 
> "Echo Cancellation" line which shows "currently ON"... Is there another 
> way without having to parse "core show channels concise"?
> 
> - No volume information, voltage status or anything.

What about ztdiag? Is it useful?

It is not robust for usage with scripts, as its "output" goes to the
kernel. It also requires a code change as that ioctl is disabled by
default for reasons of stack size. If you're interested, I believe it
can be written so it on't keep data on the stack.

(BTW: users of the Xorcom Astribank have much of this information
already available under /proc/xpp )

> 
> Would it be possible to check status of those lines (with voltage info, 
> ...) making a program that would read information from "/dev/zap/X" 
> character devices (ioctl?) without having to stop asterisk ("/dev/zap/3: 
> Device or resource busy" when asterisk is running)?

No problem, basically. Take a look at, e.g. ztmonitor.

-- 
               Tzafrir Cohen       
icq#16849755                    jabber:tzafrir at jabber.org
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir


More information about the asterisk-users mailing list