[asterisk-users] Discover connected Zap lines

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sun May 18 12:16:08 CDT 2008


On Sun, May 18, 2008 at 11:44:48AM -0400, Jay R. Ashworth wrote:
> On Sun, May 18, 2008 at 07:47:02AM +0300, Tzafrir Cohen wrote:
> > > Is that true for *all* makes of card?  I know the Sangomas put it in
> > > ifconfig, but for pick-it-off-with-SNMP-for-Nagios purposes, that will
> > > make my life a lot easier...
> > 
> > I don't really think Sangoma can put this in ifconfig for analog ports.
> > Unless they have a network interface per port.
> 
> Well, from some inspection on some of my own boxen later, RED applies
> to the spans, not the channels... at least on T-1 cards, and yes, it's
> available on both.
> 
> I'm not *entirely* happy with the way the Zaptel driver writers
> structured the /proc/zaptel 'directory'; I'm going to have to do more
> userspace parsing than I'd like to make use of it, but at least it's
> there; thanks for the pointer.

Sorry, I misread it. Most of the parsing is already done for you, but it
is indeed slightly broken.

Actually we could use a bit of help with parsing the alarms.

On my system:

Span 1: XBUS-00/XPD-00 "Xorcom XPD #00/00: FXS" (MASTER) 

           1 XPP_FXS/00/00/0 FXOLS (In use) 
           2 XPP_FXS/00/00/1 FXOLS (In use) 
           3 XPP_FXS/00/00/2 FXOLS (In use) 
           4 XPP_FXS/00/00/3 FXOLS (In use) 
           5 XPP_FXS/00/00/4 FXOLS (In use) 
           6 XPP_FXS/00/00/5 FXOLS (In use) 
           7 XPP_FXS/00/00/6 FXOLS (In use) 
           8 XPP_FXS/00/00/7 FXOLS (In use) 
           9 XPP_OUT/00/00/8 FXOLS (In use) 
          10 XPP_OUT/00/00/9 FXOLS (In use) 
          11 XPP_IN/00/00/10 FXOLS (In use) 
          12 XPP_IN/00/00/11 FXOLS (In use) 
          13 XPP_IN/00/00/12 FXOLS (In use) 
          14 XPP_IN/00/00/13 FXOLS (In use) 
Span 2: XBUS-00/XPD-10 "Xorcom XPD #00/10: FXO" 

          15 XPP_FXO/00/10/0 FXSKS (In use) RED
          16 XPP_FXO/00/10/1 FXSKS (In use) RED
          17 XPP_FXO/00/10/2 FXSKS (In use) RED
          18 XPP_FXO/00/10/3 FXSKS (In use) RED
          19 XPP_FXO/00/10/4 FXSKS (In use) RED
          20 XPP_FXO/00/10/5 FXSKS (In use) RED
          21 XPP_FXO/00/10/6 FXSKS (In use) 
          22 XPP_FXO/00/10/7 FXSKS (In use) RED
pan 3: XBUS-01/XPD-00 "Xorcom XPD #01/00: BRI_TE" AMI/CCS 

          23 XPP_BRI_TE/01/00/0 Clear (In use) 
          24 XPP_BRI_TE/01/00/1 Clear (In use) 
          25 XPP_BRI_TE/01/00/2 HDLCFCS (In use) 
Span 4: XBUS-01/XPD-01 "Xorcom XPD #01/01: BRI_TE" AMI/CCS 

          26 XPP_BRI_TE/01/01/0 Clear (In use) 
          27 XPP_BRI_TE/01/01/1 Clear (In use) 
          28 XPP_BRI_TE/01/01/2 HDLCFCS (In use) 


$ perl -MZaptel -e 'foreach (Zaptel::spans) {
	foreach my $chan ($_->chans()) {
		print $chan->num.": type: ".$chan->type.", signalling: ". $chan->signalling. ", info: ". $chan->info. ", batt: ".$chan->batt."\n"
	} 
}'
1: type: FXS, signalling: FXOLS, info: (In use), batt: 
2: type: FXS, signalling: FXOLS, info: (In use), batt: 
3: type: FXS, signalling: FXOLS, info: (In use), batt: 
4: type: FXS, signalling: FXOLS, info: (In use), batt: 
5: type: FXS, signalling: FXOLS, info: (In use), batt: 
6: type: FXS, signalling: FXOLS, info: (In use), batt: 
7: type: FXS, signalling: FXOLS, info: (In use), batt: 
8: type: FXS, signalling: FXOLS, info: (In use), batt: 
9: type: OUT, signalling: FXOLS, info: (In use), batt: 
10: type: OUT, signalling: FXOLS, info: (In use), batt: 
11: type: IN, signalling: FXOLS, info: (In use), batt: 
12: type: IN, signalling: FXOLS, info: (In use), batt: 
13: type: IN, signalling: FXOLS, info: (In use), batt: 
14: type: IN, signalling: FXOLS, info: (In use), batt: 
15: type: FXO, signalling: FXSKS, info: (In use) RED, batt: 
16: type: FXO, signalling: FXSKS, info: (In use) RED, batt: 
17: type: FXO, signalling: FXSKS, info: (In use) RED, batt: 
18: type: FXO, signalling: FXSKS, info: (In use) RED, batt: 
19: type: FXO, signalling: FXSKS, info: (In use) RED, batt: 
20: type: FXO, signalling: FXSKS, info: (In use) RED, batt: 
21: type: FXO, signalling: FXSKS, info: (In use), batt: 
22: type: FXO, signalling: FXSKS, info: (In use) RED, batt: 
23: type: BRI_TE, signalling: Clear, info: (In use), batt: 
24: type: BRI_TE, signalling: Clear, info: (In use), batt: 
25: type: BRI_TE, signalling: HDLCFCS, info: (In use), batt: 
26: type: BRI_TE, signalling: Clear, info: (In use), batt: 
27: type: BRI_TE, signalling: Clear, info: (In use), batt: 
28: type: BRI_TE, signalling: HDLCFCS, info: (In use), batt: 
29: type: BRI_NT, signalling: Clear, info: (In use), batt: 


Or, slightly better formatted in the following simple per script:

$ /usr/sbin/lszaptel 
### Span  1: XBUS-00/XPD-00 "Xorcom XPD #00/00: FXS" (MASTER) 
  1 FXS        FXOLS      (In use) 
  2 FXS        FXOLS      (In use) 
  3 FXS        FXOLS      (In use) 
  4 FXS        FXOLS      (In use) 
  5 FXS        FXOLS      (In use) 
  6 FXS        FXOLS      (In use) 
  7 FXS        FXOLS      (In use) 
  8 FXS        FXOLS      (In use) 
  9 Output     FXOLS      (In use) 
 10 Output     FXOLS      (In use) 
 11 Input      FXOLS      (In use) 
 12 Input      FXOLS      (In use) 
 13 Input      FXOLS      (In use) 
 14 Input      FXOLS      (In use) 
### Span  2: XBUS-00/XPD-10 "Xorcom XPD #00/10: FXO" 
 15 FXO        FXSKS      (In use) RED 
 16 FXO        FXSKS      (In use) RED 
 17 FXO        FXSKS      (In use) RED 
 18 FXO        FXSKS      (In use) RED 
 19 FXO        FXSKS      (In use) RED 
 20 FXO        FXSKS      (In use) RED 
 21 FXO        FXSKS      (In use) 
 22 FXO        FXSKS      (In use) RED 
### Span  3: XBUS-01/XPD-00 "Xorcom XPD #01/00: BRI_TE" AMI/CCS 
 23 BRI_TE     Clear      (In use) 
 24 BRI_TE     Clear      (In use) 
 25 BRI_TE     HDLCFCS    (In use) 
### Span  4: XBUS-01/XPD-01 "Xorcom XPD #01/01: BRI_TE" AMI/CCS 
 26 BRI_TE     Clear      (In use) 
 27 BRI_TE     Clear      (In use) 
 28 BRI_TE     HDLCFCS    (In use) 

As you can see from the prompt, no special permissions are required.

The parsing code is mostly in [kernel/]xpp/utils/Zconf/Zaptel/Span.pm .

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+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