Asterisk DID mISDN

Wholesale VOIP Providers
Provider Features
VoIP Innovations
API
Calling Card
Colocation
International A-Z
Metro Ethernet
Origination
Portal
Termination
Toll Free
E911

Details          
Telnyx
API
Calling Card
Colocation
International A-Z
Metro Ethernet
Origination
Portal
Termination
Toll Free
E911

Details          
Wholesale VoIP Provider
API
Calling Card
Colocation
International A-Z
Metro Ethernet
Origination
Portal
Termination
Toll Free
E911

Details          
API
Calling Card
Colocation
International A-Z
Metro Ethernet
Origination
Portal
Termination
Toll Free
E911

Details          
API
Calling Card
Colocation
International A-Z
Metro Ethernet
Origination
Portal
Termination
Toll Free
E911

Details          

DID with mISDN

The Task

Provide DID (German: Durchwahl) for an Asterisk PBX based on Asterisk@home v2.1 using a 8x BRI interface card connected to four ISDN PTP lines (German: Anlagenanschluß). mISDN is used to access the interface card because some ports are used in NT mode to connect ISDN telephones.
The assigned telephone numbers for the PBX are the blocks 610060, 610061, 610062, 610063, 610064, 610065 and 610066.
We want to have specific hotlines on 610063-1 to 610063-6 and general access to the individual staff phones using 610066-XXX where XXX is the three-digit internal phone number.

Configuration

Configuration of the BRI card

In order to make things work we first have to configure the interface card properly. In this example ports 1 to 4 are used for the ISDN lines and ports 5 to 8 are used for telephones.

Search /etc/misdn-init.conf for the "Port settings" paragraph and set your TE and NT ports. TE ports are used to connect to a S0 bus as terminal equipment, NT ports provide a S0 bus for the telephones.
PTP stands for point-to-point, meaning you have only one terminal equipment on a S0 bus.
PTMP stands for point-to-multipoint, meaning you can have more than one terminal equipment on a S0 bus.
(German: PTMP = Mehrgeräteanschluß, PTP = Anlagenanschluß)
#
# Port settings
#
# Syntax: <port_type>=<port_number>[,<port_number>...]
#
# <port_type> te_ptp - TE-Mode, PTP
# te_ptmp - TE-Mode, PTMP
# nt_ptp - NT-Mode, PTP
# nt_ptmp - NT-Mode, PTMP
# <port_number> port that should be considered
#
te_ptp=1,2,3,4
nt_ptmp=5,6,7,8

Next is /etc/asterisk/misdn.conf. Here is some advice I got from the BeroNet developers and off their website (thank you BeroNet!):
  • Set bridging=no if you experience one-way calls. The current stable version of mISDN seems to have trouble with bridging.
  • Set te_choose_channel=yes if you experience one-way calls

To make the ports work as they're supposed to I commented out all the example port group configurations and defined my own ones:
[TEports]
context=from-trunk
ports=1,2,3,4
msns=*

[NTports]
context=from-internal
ports=5,6,7,8
msns=*

Dialplan Settings

In /etc/asterisk/extensions_custom.conf create the new context ext-did-custom:
[ext-did-custom]
exten => _610063.,1,WaitForDigits(2000,1,true,15)
exten => _610066.,1,WaitForDigits(6000,3,true,15)


Use the AMP to create your Ring Groups, Extensions and the appropriate entries for Inbound Routing, e.g. 610063-1 to ring group X, 610066-123 to staff person C etc.

Last and most importantly, open /etc/asterisk/extensions.conf and look for the following line in [from-pstn-timecheck]
exten => _.,1,Goto(s,1) ; catch-all matching for calls that have DID info (if a DID route hasn't matched them)

and comment it out.

That's it. "Restart when convenient" and you're done.

How it works

You don't need to read the following as it is not necessary to make things work. But if you're curious as to why I did things the way I did you're welcome to. I'm trying to keep this as short and non-technical as possible.

ISDN E-DSS1 Signalling

First of all, this is by far not a complete description, I only view call setup. Caller is someone in the PSTN, Callee are we.
  • Caller sends a call setup datagram which (among other information) contains the number he wants to call, e.g. 610066
  • Callee looks at the number and decides whether or not to accept the call, reject the call ("not one of our numbers") or request more digits.
  • Callee signals back that he accepts the call and rings the appropriate extension(s) or that he rejects the call or that he needs more digits
  • In case the callee signals he needs more digits the caller will provide digit after digit (just as they're typed) until the callee is satisfied and signals that he will connect the call

The Problem

The problem that has been plaguing me for over one and a half week was that I couldn't make the channel driver signal that I want more digits. What makes matters worse is that Asterisk doesn't have any explicit means of signalling, but instead uses implicit signalling which isn't documented anywhere (or I just didn't use the right search expressions).

The Solution

Credits go to Mr Richter from BeroNet for that one. He pointed me to the app WaitForDigits which at the time of writing isn't documented in this Wiki. Since Asterisk doesn't do explicit signalling here is what happens:
  • The channel driver extracts the target MSN from the caller's setup message and tries to match it with an extension
    • If an exact match is found the channel driver signals "call accepted" and things go their way
    • If no match is found the channel driver signals "call rejected" and things go their way
  • If a partial match is found the channel driver signals "more digits needed" and keep doing so until one of the following conditions is met:
    • The timeout is reached
    • The specified number of digits is collected
    • The caller hangs up
  • After that the channel driver will try to find a match, if an exact match has been found it will connect, otherwise it will disconnect

That's why our dial plan looks like this:
exten => 610066.,1,WaitForDigits(6000,3,true,15)
exten => 610066123,1,Dial(SIP/123)

The first extension provides the partial match which makes Asterisk instruct the channel driver to fetch three more digits. The second extension is a potential exact match for a DDI number which will call an internal SIP phone.
And that's also why we have to remove the catchall in [from-pstn-timecheck]. This context is also included in the start context for incoming calls. Since . is a partial match for everything it will catapult us into the [from-pstn-timecheck] context and that would be the end for our DDI because there's no way to match an extension now.

DID with mISDN

The Task

Provide DID (German: Durchwahl) for an Asterisk PBX based on Asterisk@home v2.1 using a 8x BRI interface card connected to four ISDN PTP lines (German: Anlagenanschluß). mISDN is used to access the interface card because some ports are used in NT mode to connect ISDN telephones.
The assigned telephone numbers for the PBX are the blocks 610060, 610061, 610062, 610063, 610064, 610065 and 610066.
We want to have specific hotlines on 610063-1 to 610063-6 and general access to the individual staff phones using 610066-XXX where XXX is the three-digit internal phone number.

Configuration

Configuration of the BRI card

In order to make things work we first have to configure the interface card properly. In this example ports 1 to 4 are used for the ISDN lines and ports 5 to 8 are used for telephones.

Search /etc/misdn-init.conf for the "Port settings" paragraph and set your TE and NT ports. TE ports are used to connect to a S0 bus as terminal equipment, NT ports provide a S0 bus for the telephones.
PTP stands for point-to-point, meaning you have only one terminal equipment on a S0 bus.
PTMP stands for point-to-multipoint, meaning you can have more than one terminal equipment on a S0 bus.
(German: PTMP = Mehrgeräteanschluß, PTP = Anlagenanschluß)
#
# Port settings
#
# Syntax: <port_type>=<port_number>[,<port_number>...]
#
# <port_type> te_ptp - TE-Mode, PTP
# te_ptmp - TE-Mode, PTMP
# nt_ptp - NT-Mode, PTP
# nt_ptmp - NT-Mode, PTMP
# <port_number> port that should be considered
#
te_ptp=1,2,3,4
nt_ptmp=5,6,7,8

Next is /etc/asterisk/misdn.conf. Here is some advice I got from the BeroNet developers and off their website (thank you BeroNet!):
  • Set bridging=no if you experience one-way calls. The current stable version of mISDN seems to have trouble with bridging.
  • Set te_choose_channel=yes if you experience one-way calls

To make the ports work as they're supposed to I commented out all the example port group configurations and defined my own ones:
[TEports]
context=from-trunk
ports=1,2,3,4
msns=*

[NTports]
context=from-internal
ports=5,6,7,8
msns=*

Dialplan Settings

In /etc/asterisk/extensions_custom.conf create the new context ext-did-custom:
[ext-did-custom]
exten => _610063.,1,WaitForDigits(2000,1,true,15)
exten => _610066.,1,WaitForDigits(6000,3,true,15)


Use the AMP to create your Ring Groups, Extensions and the appropriate entries for Inbound Routing, e.g. 610063-1 to ring group X, 610066-123 to staff person C etc.

Last and most importantly, open /etc/asterisk/extensions.conf and look for the following line in [from-pstn-timecheck]
exten => _.,1,Goto(s,1) ; catch-all matching for calls that have DID info (if a DID route hasn't matched them)

and comment it out.

That's it. "Restart when convenient" and you're done.

How it works

You don't need to read the following as it is not necessary to make things work. But if you're curious as to why I did things the way I did you're welcome to. I'm trying to keep this as short and non-technical as possible.

ISDN E-DSS1 Signalling

First of all, this is by far not a complete description, I only view call setup. Caller is someone in the PSTN, Callee are we.
  • Caller sends a call setup datagram which (among other information) contains the number he wants to call, e.g. 610066
  • Callee looks at the number and decides whether or not to accept the call, reject the call ("not one of our numbers") or request more digits.
  • Callee signals back that he accepts the call and rings the appropriate extension(s) or that he rejects the call or that he needs more digits
  • In case the callee signals he needs more digits the caller will provide digit after digit (just as they're typed) until the callee is satisfied and signals that he will connect the call

The Problem

The problem that has been plaguing me for over one and a half week was that I couldn't make the channel driver signal that I want more digits. What makes matters worse is that Asterisk doesn't have any explicit means of signalling, but instead uses implicit signalling which isn't documented anywhere (or I just didn't use the right search expressions).

The Solution

Credits go to Mr Richter from BeroNet for that one. He pointed me to the app WaitForDigits which at the time of writing isn't documented in this Wiki. Since Asterisk doesn't do explicit signalling here is what happens:
  • The channel driver extracts the target MSN from the caller's setup message and tries to match it with an extension
    • If an exact match is found the channel driver signals "call accepted" and things go their way
    • If no match is found the channel driver signals "call rejected" and things go their way
  • If a partial match is found the channel driver signals "more digits needed" and keep doing so until one of the following conditions is met:
    • The timeout is reached
    • The specified number of digits is collected
    • The caller hangs up
  • After that the channel driver will try to find a match, if an exact match has been found it will connect, otherwise it will disconnect

That's why our dial plan looks like this:
exten => 610066.,1,WaitForDigits(6000,3,true,15)
exten => 610066123,1,Dial(SIP/123)

The first extension provides the partial match which makes Asterisk instruct the channel driver to fetch three more digits. The second extension is a potential exact match for a DDI number which will call an internal SIP phone.
And that's also why we have to remove the catchall in [from-pstn-timecheck]. This context is also included in the start context for incoming calls. Since . is a partial match for everything it will catapult us into the [from-pstn-timecheck] context and that would be the end for our DDI because there's no way to match an extension now.
Created by: Brain, Last modification: Thu 06 of Apr, 2006 (08:00 UTC) by crich
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+