~ubuntu-branches/ubuntu/saucy/dahdi-tools/saucy

« back to all changes in this revision

Viewing changes to xpp/perl_modules/Dahdi/Config/Gen/System.pm

  • Committer: Bazaar Package Importer
  • Author(s): Jean-Michel Dault, Tzafrir Cohen
  • Date: 2010-02-16 13:44:09 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100216134409-4y4k26mgzyra537o
Tags: 1:2.2.1-0ubuntu1
* Merge from Debian pkg-voip.
  * Changes from Debian:
  - debian/control: Change Maintainer
  - debian/control: Removed Uploaders field.
  - debian/control: Removed Debian Vcs-Svn entry and replaced with
      ubuntu-voip Vcs-Bzr, to reflect divergence in packages.
  - debian/control: Package dahdi Depends on  dahdi-dkms | dahdi-source

* From Debian pkg-voip:
[ Tzafrir Cohen ]
* New upstream release (Closes: #536257, #564381).
* Patch 'bashism' dropped: merged upstream. 
* Patch xpp_no_extra_at dropped: merged upstream. 
* Add an example genconf_parameters.
* Compat level 7.
* Bump standars version to 3.8.3.0 (no change needed)
* Udev rules are now in dahdi-linux.
* Patches perl_fix_noserial, perl_fix_transportdir: Fixes for some
  minor perl issues.
* Add the missing ${misc:Depends}, as per lintian. 
* Patch astribank_allow_ignoreend: an extra missing patch from upstream. 
* Patches init_unload_modules and init_unload_oslec: also unload OSLEC
  when unloading all modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
        print "echocanceller=$echo_can,$chans\n";
29
29
}
30
30
 
31
 
sub gen_digital($$) {
 
31
sub gen_t1_cas($$) {
 
32
        my $self = shift || die;
 
33
        my $gconfig = shift || die;
 
34
        my $parameters = $gconfig->{PARAMETERS} || die;
 
35
        my $genconf_file = $parameters->{GENCONF_FILE} || die;
 
36
        my $span = shift || die;
 
37
        my $num = $span->num() || die;
 
38
        my $proto = $span->proto || die;
 
39
        die "Generate configuration for '$proto' is not possible. Maybe you meant R2?"
 
40
                unless $proto eq 'T1';
 
41
        my $pri_connection_type = $gconfig->{pri_connection_type} || die;
 
42
        die "Span #$num is analog" unless $span->is_digital();
 
43
        die "Span #$num is not CAS" unless $span->is_pri && $pri_connection_type eq 'CAS';
 
44
        my $termtype = $span->termtype() || die "$0: Span #$num -- unkown termtype [NT/TE]\n";
 
45
        my $timing;
 
46
        my $lbo = 0;
 
47
        my $framing = $gconfig->{tdm_framing};
 
48
        if(!defined $framing) {
 
49
                $framing = 'esf';
 
50
        } elsif($framing ne 'esf' && $framing ne 'd4') {
 
51
                die "T1-CAS valid framing is only 'esf' or 'd4'. Not '$framing'. Check '$genconf_file'\n";
 
52
        }
 
53
        my $coding =  $span->coding() || die "$0: No coding information for span #$num\n";
 
54
        my $span_crc4 = $span->crc4();
 
55
        $span_crc4 = (defined $span_crc4) ? ",$span_crc4" : '';
 
56
        my $span_yellow = $span->yellow();
 
57
        $span_yellow = (defined $span_yellow) ? ",$span_yellow" : '';
 
58
        $timing = ($termtype eq 'NT') ? 0 : $bri_te_last_timing++;
 
59
        printf "span=%d,%d,%d,%s,%s%s%s\n",
 
60
                        $num,
 
61
                        $timing,
 
62
                        $lbo,
 
63
                        $framing,
 
64
                        $coding,
 
65
                        $span_crc4,
 
66
                        $span_yellow;
 
67
        printf "# termtype: %s\n", lc($termtype);
 
68
        my $dchan_type;
 
69
        my $chan_range;
 
70
        if($span->is_pri()) {
 
71
                if ($pri_connection_type eq 'PRI') {
 
72
                        $chan_range = Dahdi::Config::Gen::bchan_range($span);
 
73
                        printf "bchan=%s\n", $chan_range;
 
74
                        my $dchan = $span->dchan();
 
75
                        printf "dchan=%d\n", $dchan->num();
 
76
                } elsif ($pri_connection_type eq 'R2' ) {
 
77
                        my $idle_bits = $gconfig->{'r2_idle_bits'};
 
78
                        $chan_range = Dahdi::Config::Gen::bchan_range($span);
 
79
                        printf "cas=%s:$idle_bits\n", $chan_range;
 
80
                        printf "dchan=%d\n", $span->dchan()->num();
 
81
                } elsif ($pri_connection_type eq 'CAS' ) {
 
82
                        my $type = ($termtype eq 'TE') ? 'FXO' : 'FXS';
 
83
                        my $sig = $gconfig->{'dahdi_signalling'}{$type};
 
84
                        my $em_signalling = $gconfig->{'em_signalling'};
 
85
                        if ($em_signalling ne 'none') {
 
86
                                $sig = 'e&m';
 
87
                                # FIXME: but we don't handle E1 yet
 
88
                                $sig = 'e&me1' if $proto eq 'E1';
 
89
                        }
 
90
                        die "unknown default dahdi signalling for chan $num type $type" unless defined $sig;
 
91
                        $chan_range = Dahdi::Config::Gen::chan_range($span->chans());
 
92
                        printf "%s=%s\n", $sig, $chan_range;
 
93
                }
 
94
        } else {
 
95
                die "Digital span $num is not PRI";
 
96
        }
 
97
        print_echo_can($gconfig, $chan_range);
 
98
}
 
99
 
 
100
sub gen_digital($$$) {
 
101
        my $self = shift || die;
32
102
        my $gconfig = shift || die;
33
103
        my $span = shift || die;
34
104
        my $num = $span->num() || die;
145
215
HEAD
146
216
        foreach my $span (@spans) {
147
217
                printf "# Span %d: %s %s\n", $span->num, $span->name, $span->description;
148
 
                if($span->is_digital()) {
149
 
                        gen_digital($gconfig, $span);
 
218
                if($span->is_digital) {
 
219
                        if($span->is_pri) {
 
220
                                if($gconfig->{'pri_connection_type'} eq 'CAS') {
 
221
                                        $self->gen_t1_cas($gconfig, $span);
 
222
                                } else {
 
223
                                        $self->gen_digital($gconfig, $span);
 
224
                                }
 
225
                        } elsif($span->is_bri) {
 
226
                                $self->gen_digital($gconfig, $span);
 
227
                        }
150
228
                } else {
151
229
                        foreach my $chan ($span->chans()) {
152
230
                                if(1 || !defined $chan->type) {