B410P not prepending nationalprefix on incoming calls

I am testing an AsteriskNOW system as follows:

AsteriskNOW 1.7.1
Asterisk 1.6.2.12
B410P BRI interface card connected to Australian Telco
DAHDI Version: 2.4.0 Echo Canceller: MG2
libpri version: 1.4.11.4

Pretty much everything is working except incoming Caller ID on calls with TON=2 don’t seem to have the nationalprefix prepended. Here’s an incoming call:

[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < TEI: 0 State 7(Multi-frame established)
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < V(A)=3, V(S)=3, V(R)=3
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < K=1, RC=0, l3initiated=0, reject_except=0, ack_pend=0
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < T200_id=0, N200=3, T203_id=1
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < [ 02 01 06 06 08 01 02 05 a1 04 03 80 90 a3 18 01 82 6c 0b 21 81 34 30 xx xx xx xx xx xx xx 70 09 c1 xx xx xx xx xx xx xx xx 7d 02 91 81 ]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < Informational frame:
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < SAPI: 00  C/R: 1 EA: 0
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: <  TEI: 000        EA: 1
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < N(S): 003   0: 0
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < N(R): 003   P: 0
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < 41 bytes of data
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < Protocol Discriminator: Q.931 (8)  len=41
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < TEI=0 Call Ref: len= 1 (reference 2/0x2) (Sent from originator)
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < Message Type: SETUP (5)
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < [a1]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < Sending Complete (len= 1)
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < [04 03 80 90 a3]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < Bearer Capability (len= 5) [ Ext: 1  Q.931 Std: 0  Info transfer capability: Speech (0)
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: <                              Ext: 1  Trans mode/rate: 64kbps, circuit-mode (16)
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: <                                User information layer 1: A-Law (35)
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < [18 01 82]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < Channel ID (len= 3) [ Ext: 1  IntID: Implicit  BRI  Spare: 0  Preferred  Dchan: 0
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: <                       ChanSel: B2 channel
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: <                     ]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < [6c 0b 21 81 34 30 xx xx xx xx xx xx xx]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < Calling Number (len=13) [ Ext: 0  TON: National Number (2)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: <                           Presentation: Presentation permitted, user number passed network screening (1)  '40xxxxxx' ]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < [70 09 c1 xx xx xx xx xx xx xx xx]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < Called Number (len=11) [ Ext: 1  TON: Subscriber Number (4)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)  'xxxxxxxx' ]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < [7d 02 91 81]
[Nov 20 15:09:22] VERBOSE[2516] chan_dahdi.c: < IE: High-layer Compatibility (len = 4)

There’s a few packets more back and forth on the BRI but then:

[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [xxxxx842@from-pstn:1] Set("DAHDI/5-1", "__FROM_DID=xxxxx842") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [xxxxx842@from-pstn:2] Gosub("DAHDI/5-1", "app-blacklist-check,s,1") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [s@app-blacklist-check:1] GotoIf("DAHDI/5-1", "0?blacklisted") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [s@app-blacklist-check:2] Set("DAHDI/5-1", "CALLED_BLACKLIST=1") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [s@app-blacklist-check:3] Return("DAHDI/5-1", "") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [xxxxx842@from-pstn:3] ExecIf("DAHDI/5-1", "1 ?Set(CALLERID(name)=40xxxxxxx)") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [xxxxx842@from-pstn:4] Set("DAHDI/5-1", "__CALLINGPRES_SV=allowed_passed_screen") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [xxxxx842@from-pstn:5] Set("DAHDI/5-1", "CALLERPRES()=allowed_not_screened") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Executing [xxxxx842@from-pstn:6] Goto("DAHDI/5-1", "from-did-direct,842,1") in new stack
[Nov 20 15:09:22] VERBOSE[2667] pbx.c:     -- Goto (from-did-direct,842,1)

You can see by the time the dial plan sees it we don’t have a 0 prefix prepended.

My chan_dahdi.conf is:

[general]
loadzone=au
defaultzone=au
pridialplan=unknown
prilocaldialplan=unknown
internationalprefix=0011
nationalprefix=0
localprefix=
privateprefix=
unknownprefix=0
hidecallerid=no
resetinterval=never

#include chan_dahdi_general.conf

[channels]

#include chan_dahdi_groups.conf

#include chan_dahdi_additional.conf

#include dahdi-channels.conf

My dahdi-channels.conf is:

; Span 1: B4/0/1 "B4XXP (PCI) Card 0 Span 1" (MASTER) AMI/CCS
group=0,11
context=from-pstn
switchtype = euroisdn
signalling = bri_cpe
channel => 1-2
context = default
group = 63

; Span 2: B4/0/2 "B4XXP (PCI) Card 0 Span 2" AMI/CCS
group=0,12
context=from-pstn
switchtype = euroisdn
signalling = bri_cpe
channel => 4-5
context = default
group = 63

; Span 3: B4/0/3 "B4XXP (PCI) Card 0 Span 3" AMI/CCS RED
group=0,13
context=from-pstn
switchtype = euroisdn
signalling = bri_cpe
channel => 7-8
context = default
group = 63

; Span 4: B4/0/4 "B4XXP (PCI) Card 0 Span 4" AMI/CCS RED
group=0,14
context=from-pstn
switchtype = euroisdn
signalling = bri_cpe
channel => 10-11
context = default
group = 63

Anyone familiar enough with the code to see if the prepend logic appears to be performed for the B410P with DAHDI?

Is there an Asterisk command that would let me see if the pridialplan, prilocaldialplan, internationalprefix and nationalprefix have been applied to the correct entity?

BTW this server is to replace an old Asterisk server running misdn which handles these calls correctly so the BRIs etc work.

Many thanks for any insights you can provide.

Ah… I think I see where I went wrong…

I added the options I wanted to apply to all lines in the [general] section but they should be in the [channels] section. When I moved them everything sprung into life.

The interesting things is that the AsteriskNOW/FreePBX chan_dahdi.conf file looks like this:

; Copied from DAHDI Module of FreePBX
 
[general]
 
#include chan_dahdi_general.conf
 
[channels]
 
; include dahdi groups defined by DAHDI module of FreePBX
#include chan_dahdi_groups.conf
 
; include dahdi extensions defined in FreePBX
#include chan_dahdi_additional.conf

You can see that this suggests that there is a [general] section and that FreePBX can build a file to be included in that section. I have read online that there should only be [trunkgroup] and [channel] sections in this file so maybe there shouldn’t be a [general] section at all. Anyone know if a [general] section should exist in this file and what it should contain?

Anyway, the pridialplan and prefix stuff definitely needs to be in the [channels] section.