Communication error to telco? no inbound/outbound

I finally managed to install asterisk with all needed drivers
OS is Ubuntu 12.0.4
Hardware is Junghanns Quad BRI
I downloaded and installed the newest dahdi, libpri and asterisk
Asterisk is running but no inbound or outbound calls are possible.
When trying an inbound call:

    -- Accepting call from '0xxxxxxxx' to '298' on channel 0/1, span 3
    -- Executing [298@sys2000:1] Answer("DAHDI/i3/0xxxxxxxx-18", "") in new stack
    -- Executing [298@sys2000:2] Dial("DAHDI/i3/0xxxxxxxx-18", "SIP/31,20,tr") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/31
    -- SIP/31-00000007 is ringing
    -- SIP/31-00000007 is ringing
    -- SIP/31-00000007 is ringing
    -- SIP/31-00000007 is ringing
    -- SIP/31-00000007 answered DAHDI/i3/0xxxxxxxx-18
       > 0xb6d0f860 -- Probation passed - setting RTP source address to 192.168.0.49:58660
    -- Accepting overlap call from '03472221396' to '0' on channel 0/2, span 3
    -- Starting simple switch on 'DAHDI/i3/03472221396-19'
    -- Executing [0@sys2000:1] Playback("DAHDI/i3/03472221396-19", "invalid") in new stack
    -- <DAHDI/i3/03472221396-19> Playing 'invalid.gsm' (language 'de')
    -- Executing [0@sys2000:2] Hangup("DAHDI/i3/03472221396-19", "") in new stack
  == Spawn extension (sys2000, 0, 2) exited non-zero on 'DAHDI/i3/03472221396-19'
    -- Hungup 'DAHDI/i3/03472221396-19'
    -- Span 3: Channel 0/1 got hangup ACK

The local phone rings, but the caller gets no signal that it’s rining. After a while the caller gets disconnected with a message "no call possible at the moment"
In fact, regardless, what I put into the extensions, Answer(), Busy() or Playback(invalid) none of those can be heard by the caller.
So my D-Channel is working, I think
Trying an outbound call only brings this:

  == Using SIP RTP CoS mark 5
[Dec  6 11:56:21] ERROR[5840][C-00000025]: chan_sip.c:33075 setup_srtp: No SRTP module loaded, can't setup SRTP session.
    -- Executing [0123456789@sys2000:1] Dial("SIP/31-00000006", "dahdi/g1/123456789") in new stack
    -- Requested transfer capability: 0x00 - SPEECH
    -- Called dahdi/g1/123456789
    -- Span 2: Channel 0/1 got hangup, cause 18
    -- Hungup 'DAHDI/i2/123456789-8'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Auto fallthrough, channel 'SIP/31-00000006' status is 'CHANUNAVAIL'

I fear I did not understand all this telephony stuff correctly and made a mistake in configuration

asking pri about things will bring this:
TelefonCLI> pri show spans
PRI span 2/0: Up, Active
PRI span 3/0: Up, Active
Telefon
CLI> pri show channels
PRI B Chan Call PRI Channel
Span Chan Chan Idle Level Call Name
2 4 Yes Yes Idle No
2 5 Yes Yes Idle No
3 7 Yes Yes Idle No
3 8 Yes Yes Idle No

my configs:

cat system.conf

# Autogenerated by /usr/sbin/dahdi_genconf on Fri Jul 30 19:44:48 2010
# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
# Dahdi Configuration File
#
# This file is parsed by the Dahdi Configurator, dahdi_cfg
#
# Span 1: ztqoz/1/1 "quadBRI PCI ISDN Card 1 Span 1 [TE]" (MASTER)
span=1,0,0,ccs,ami
# termtype: te
bchan=1-2
hardhdlc=3
echocanceller=mg2,1-2

# Span 2: ztqoz/1/2 "quadBRI PCI ISDN Card 1 Span 2 [TE]"
span=2,2,0,ccs,ami
# termtype: te
bchan=4-5
hardhdlc=6
echocanceller=mg2,4-5

# Span 3: ztqoz/1/3 "quadBRI PCI ISDN Card 1 Span 3 [TE]"
span=3,3,0,ccs,ami
# termtype: te
bchan=7-8
hardhdlc=9
echocanceller=mg2,7-8

# Span 4: ztqoz/1/4 "quadBRI PCI ISDN Card 1 Span 4 [TE]"
span=4,4,0,ccs,ami
# termtype: te
bchan=10-11
hardhdlc=12
echocanceller=mg2,10-11

# Global data

loadzone        = de
defaultzone     = de

cat chan_dahdi.conf

[trunkgroups]

[channels]

language=de
usecallingpres=yes
switchtype = euroisdn

; p2mp TE mode (for connecting ISDN lines in point-to-multipoint mode)
;signalling = bri_cpe_ptmp
; p2p TE mode (for connecting ISDN lines in point-to-point mode) <-
;signalling = bri_cpe
; p2mp NT mode (for connecting ISDN phones in point-to-multipoint mode)
;signalling = bri_net_ptmp
; p2p NT mode (for connecting an ISDN pbx in point-to-point mode)
;signalling = bri_net


pridialplan=unknown
prilocaldialplan=unknown
internationalprefix = 00
nationalprefix = 0
localprefix = 0231

facilityenable = yes
usecallerid=yes
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
immediate=no
echocancel=no
echocancelwhenbridged=no
echotraining=no
callgroup=1
pickupgroup=1
mohinterpret=default
mohsuggest=default
overlapdial=yes

group = 1
context=sys2000
channel => 4-5,7-8

signalling=bri_cpe
;p2p TE mode  => bri_cpe

cat extensions.conf

[general]

; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified.  Remember that all comments
; made in the file will be lost when that happens. 
;
; XXX Not yet implemented XXX
;
static=yes
;
; if static=yes and writeprotect=no, you can save dialplan by
; CLI command 'save dialplan' too
;
writeprotect=no

[sys2000]

exten => 0,1,Playback(invalid)
exten => 0,n,HangUp()

exten => _0XXXX.,1,Dial(dahdi/g1/${EXTEN:1})

exten => 298,1,Answer()
exten => 298,n,Dial(SIP/31,20,tr)
exten => 298,n,HangUp()

exten => 297,1,Busy()

exten => i,1,Playback(invalid)
exten => i,n,HangUp()

0 is more specific than _0XXXX.

true, but I tried lots of things in the dialplan - lots of other things where there, too, including the 0.
but then I shortened it as much as possible.

I also tried lots of settings in all those config files, e.g. span=1,0,0,ccs,ami timing is 0 there, was 1 before (span=1,1,0,ccs,ami)
I did lots of testing by modifying a single number and then restart dahdi service and/or asterisk, but nothing helped yet.
Strange enough, the old pbx ran well, with asterisk 1.2 but the very same Junghanns BRI hardware.

I now try to copy the old hard drive and use the old pbx with some old hardware.
But I still want to setup the new hardware to have a backup when the old one finally dies.

Please provide a trace for a single, failing call, and all the trace for that call. If you provide bits of two calls, you are going to get the explanation for the one that looks least like a normal call.

Also considere cleaning up the dialplan, as you will tend to get answers based on the first thing that looks strange.

I finally found out … was a configuration problem within dahdi, as I thought. Dialplan was ok.

FYI my corrected config files. This topic is solved now.

cat system.conf

[code]# Autogenerated by /usr/sbin/dahdi_genconf on Fri Jul 30 19:44:48 2010

If you edit this file and execute /usr/sbin/dahdi_genconf again,

your manual changes will be LOST.

Dahdi Configuration File

This file is parsed by the Dahdi Configurator, dahdi_cfg

Span 1: ztqoz/1/1 “quadBRI PCI ISDN Card 1 Span 1 [TE]” (MASTER)

span=1,1,3,ccs,ami

termtype: te

bchan=1-2
hardhdlc=3
echocanceller=mg2,1-2

Span 2: ztqoz/1/2 “quadBRI PCI ISDN Card 1 Span 2 [TE]”

span=2,2,3,ccs,ami

termtype: te

bchan=4-5
hardhdlc=6
echocanceller=mg2,4-5

Span 3: ztqoz/1/3 “quadBRI PCI ISDN Card 1 Span 3 [TE]”

span=3,3,3,ccs,ami

termtype: te

bchan=7-8
hardhdlc=9
echocanceller=mg2,7-8

Span 4: ztqoz/1/4 “quadBRI PCI ISDN Card 1 Span 4 [TE]”

span=4,4,3,ccs,ami

termtype: te

bchan=10-11
hardhdlc=12
echocanceller=mg2,10-11

Global data

loadzone = de
defaultzone = de
[/code]

cat chan_dahdi.conf

[code][trunkgroups]

[channels]

language=de
context=from-pstn
internationalprefix=+
nationalprefix=+49
localprefix=+4940
privateprefix=+49XXXXXXXX
;signalling=fxs_ks
; EINTRAG entfernt
; p2p TE mode => bri_cpe
; p2mp TE mode => bri_cpe_ptmp
; p2p NT mode => bri_net
; p2mp NT mode => bri_net_ptmp
;

rxwink=300 ; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes

;callerid=asreceived ; trunk only
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
;echotraining=800
rxgain=1.0
txgain=1.0
group=0
callgroup=1
pickupgroup=1
;immediate=yes ; Caller ID wird nicht gesendent, stattdessen 's’
pridialplan=unknown

;faxdetect=both
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no

;Include setup-pstn configs
#include dahdi-channels.conf

group=1
[/code]

cat dahdi-channels.conf

group=1,12 context=sys2000-dahdi switchtype = euroisdn signalling = bri_cpe channel => 4-5,7-8