[Freeswitch-users] FreeTDM - Sangoma B700 - ISDN connection questions - UK

John freeswitch at earthspike.net
Tue Jun 7 01:36:20 MSD 2011


Hello,

I have just set up a FreeSWITCH box with a Sangoma B700 connected to 2 x 
ISDN2e lines (each 2B+D, so 4 voice channels) in UK, so supplied by BT 
Openreach.  There are a number of anomalies that I am trying to solve.  
[One of these is that 1 line is dead, but that is for BT Openreach to 
resolve rather than anyone on this list.]

I have a few questions, but as they are all related, I hope you don't 
mind them in one post.  Some basics first.  The box is an Atom dual-core 
with 2GB of memory and a Sangoma B700 card.  It's built with Ubuntu 
10.04.2 LTS server 64-bit, patched and up to date, and also runs dhcpd, 
lighttpd and sshd.  I built the Sangoma ISDN libraries and FreeSWITCH 
using the latest git versions I could ('make current' about 2 weeks 
ago).  We have incoming and outgoing calls working, but some incoming 
calls ring in the caller's ear, but nothing appears on the FreeSWITCH 
console, and others fail.  Rebooting the server cures this.  We have had 
problems with lines being disconnected and then reconnected, and it 
seems that FreeTDM/wanrouter/whatever doesn't recognise previously 
disconnected lines coming back into use, because a reboot finds lines 
that were previously reported disconnected ('wanrouter status' or 'ftdm 
list').  We have ongoing problems with one line that is 'disconnected' 
(wanpipe2/wp2) but the queries I am describing below apply equally when 
both lines are connected and working.

1. There seems to be a lot of ISDN 'chatter' with channels going up and 
down all the time even when the switch is completely idle.  Is this 
normal?  Here is my /log 7 showing two of the cycles (which appear to be 
about 50s apart):

2011-06-06 22:01:54.992467 [DEBUG] ftmod_sangoma_isdn_stack_rcv.c:681 
[SNGISDN Q921] wp1: Protocol: Data Link connection DN(4): Disconnect 
initiated(263)
2011-06-06 22:02:29.952464 [WARNING] ftmod_sangoma_isdn_stack_rcv.c:748 
[SNGISDN Q931] s1: Interface: Down(261): Dchan(285)
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c1][1:1] Signalling link status changed to DOWN
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c2][1:2] Signalling link status changed to DOWN
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c3][1:3] Signalling link status changed to DOWN
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c1][1:1] Setting availability rate to:5
2011-06-06 22:02:29.952464 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c1][1:1] Setting availability rate to:5
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c2][1:2] Setting availability rate to:5
2011-06-06 22:02:29.952464 [INFO] mod_freetdm.c:2345 1:1 signalling 
changed to :DOWN
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c2][1:2] Setting availability rate to:5
2011-06-06 22:02:29.952464 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c3][1:3] Setting availability rate to:5
2011-06-06 22:02:29.952464 [INFO] mod_freetdm.c:2345 1:2 signalling 
changed to :DOWN
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c3][1:3] Setting availability rate to:5
2011-06-06 22:02:29.952464 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:02:29.952464 [INFO] mod_freetdm.c:2345 1:3 signalling 
changed to :DOWN
2011-06-06 22:02:29.952464 [INFO] ftmod_sangoma_isdn_stack_rcv.c:631 
Received RESTART CFM (dChan:1 ces:0 type:1)
2011-06-06 22:02:29.952464 [DEBUG] ftmod_sangoma_isdn_stack_hndl.c:1179 
Receved RESTART, but Restart Indicator IE not present
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_stack_rcv.c:681 
[SNGISDN Q921] wp1: Protocol: Data Link connection UP(3): UA frame with 
F-bit = 1(258)
2011-06-06 22:02:29.972464 [INFO] ftmod_sangoma_isdn_stack_rcv.c:631 
Received RESTART CFM (dChan:1 ces:0 type:0)
2011-06-06 22:02:29.972464 [INFO] ftmod_sangoma_isdn_stack_rcv.c:729 
[SNGISDN Q931] s1: Interface: UP(260): Dchan(285)
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c1][1:1] Signalling link status changed to UP
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c2][1:2] Signalling link status changed to UP
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c3][1:3] Signalling link status changed to UP
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c1][1:1] Setting availability rate to:10
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c1][1:1] Setting availability rate to:10
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c2][1:2] Setting availability rate to:10
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c2][1:2] Setting availability rate to:10
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c3][1:3] Setting availability rate to:10
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c3][1:3] Setting availability rate to:10
2011-06-06 22:02:29.972464 [DEBUG] ftmod_sangoma_isdn_stack_hndl.c:1179 
Receved RESTART, but Restart Indicator IE not present
2011-06-06 22:02:29.972464 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:02:29.972464 [INFO] mod_freetdm.c:2345 1:1 signalling 
changed to :UP
2011-06-06 22:02:29.972464 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:02:29.972464 [INFO] mod_freetdm.c:2345 1:2 signalling 
changed to :UP
2011-06-06 22:02:29.972464 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:02:29.972464 [INFO] mod_freetdm.c:2345 1:3 signalling 
changed to :UP
2011-06-06 22:03:19.912462 [DEBUG] ftmod_sangoma_isdn_stack_rcv.c:681 
[SNGISDN Q921] wp1: Protocol: Data Link connection DN(4): Disconnect 
initiated(263)
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_stack_rcv.c:681 
[SNGISDN Q921] wp1: Protocol: Data Link connection UP(3): UA frame with 
F-bit = 1(258)
2011-06-06 22:03:19.932483 [INFO] ftmod_sangoma_isdn_stack_rcv.c:631 
Received RESTART CFM (dChan:1 ces:0 type:0)
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_stack_hndl.c:1179 
Receved RESTART, but Restart Indicator IE not present
2011-06-06 22:03:19.932483 [INFO] ftmod_sangoma_isdn_stack_rcv.c:729 
[SNGISDN Q931] s1: Interface: UP(260): Dchan(285)
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c1][1:1] Signalling link status changed to UP
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c2][1:2] Signalling link status changed to UP
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_cntrl.c:43 
[s1c3][1:3] Signalling link status changed to UP
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c1][1:1] Setting availability rate to:10
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c1][1:1] Setting availability rate to:10
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c2][1:2] Setting availability rate to:10
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c2][1:2] Setting availability rate to:10
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_support.c:200 
[s1c3][1:3] Setting availability rate to:10
2011-06-06 22:03:19.932483 [DEBUG] ftmod_sangoma_isdn_support.c:186 
[s1c3][1:3] Setting availability rate to:10
2011-06-06 22:03:19.932483 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:03:19.932483 [INFO] mod_freetdm.c:2345 1:1 signalling 
changed to :UP
2011-06-06 22:03:19.932483 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:03:19.932483 [INFO] mod_freetdm.c:2345 1:2 signalling 
changed to :UP
2011-06-06 22:03:19.932483 [DEBUG] mod_freetdm.c:2268 got clear channel 
sig [SIGSTATUS_CHANGED]
2011-06-06 22:03:19.932483 [INFO] mod_freetdm.c:2345 1:3 signalling 
changed to :UP
freeswitch at internal> ftdm list
+OK
span: 1 (wp1)
type: Sangoma (ISDN)
physical_status: ok
signaling_status: UP
chan_count: 3
dialplan: XML
context: public
dial_regex:
fail_dial_regex:
hold_music:
analog_options: none
+OK
span: 2 (wp2)
type: Sangoma (ISDN)
physical_status: alarmed
signaling_status: DOWN
chan_count: 3
dialplan: XML
context: public
dial_regex:
fail_dial_regex:
hold_music:
analog_options: none
+OK
span: 3 (FXS)
type: analog
physical_status: ok
signaling_status: UP
chan_count: 2
dialplan: XML
context: default
dial_regex:
fail_dial_regex:
hold_music:
analog_options: none


# wanrouter status

Devices currently active:
     wanpipe1 wanpipe2 wanpipe3


Wanpipe Config:

Device name | Protocol Map | Adapter  | IRQ | Slot/IO | If's | CLK | 
Baud rate |
wanpipe1    | N/A          | A500/B700| 20  | 0       | 1    | N/A | 
0         |
wanpipe2    | N/A          | A500/B700| 20  | 0       | 1    | N/A | 
0         |
wanpipe3    | N/A          | A200/A400/B600/B700/B800| 20  | 0       | 
1    | N/A | 0         |

Wanrouter Status:

Device name | Protocol | Station | Status        |
wanpipe1    | AFT ISDN | N/A     | Connected     |
wanpipe2    | AFT ISDN | N/A     | Disconnected  |
wanpipe3    | A-ANALOG | N/A     | Connected     |


# cat /etc/wanpipe/wanrouter.rc
#!/bin/sh
# .. comments snipped ...
ROUTER_BOOT=YES
WAN_CONF_DIR=/etc/wanpipe
WAN_INTR_DIR=/etc/wanpipe/interfaces
WAN_BIN_DIR=/usr/sbin
WAN_LOG=/var/log/wanrouter
WAN_LOCK=/var/lock/wanrouter
WAN_LOCK_DIR=/var/lock
WAN_IP_FORWARD=NO
NEW_IF_TYPE=NO
WAN_LIB_DIR=/etc/wanpipe/lib
WAN_ADSL_LIST=/etc/wanpipe/wan_adsl.list
WAN_ANNEXG_LOAD=NO
WAN_SCTP_LOAD=NO
WAN_LIP_LOAD=NO
WAN_DYN_WANCONFIG=NO
WAN_SCRIPTS_DIR=/etc/wanpipe/scripts
WAN_FIRMWARE_DIR=/etc/wanpipe/firmware
WAN_DEVICES_REV_STOP_ORDER=YES
WAN_DEVICES="wanpipe1 wanpipe2 wanpipe3 "

# cat /etc/wanpipe/wanpipe1.conf
#================================================
# WANPIPE1 Configuration File
#================================================
#
# Note: This file was generated automatically
#       by /usr/local/sbin/setup-sangoma program.
#
#       If you want to edit this file, it is
#       recommended that you use wancfg program
#       to do so.
#================================================
# Sangoma Technologies Inc.
#================================================




[devices]
wanpipe1 = WAN_AFT_ISDN_BRI, Comment

[interfaces]
w1g1 = wanpipe1, , TDM_VOICE_API, Comment

[wanpipe1]
CARD_TYPE     = AFT
S514CPU     = A
CommPort     = PRI
AUTO_PCISLOT     = NO
PCISLOT     = 0
PCIBUS      = 5
FE_MEDIA    = BRI
FE_LINE        = 1
TDMV_LAW    = ALAW
RM_BRI_CLOCK_MASTER    = NO
MTU         = 1500
UDPPORT     = 9000
TTL        = 255
IGNORE_FRONT_END = NO
TDMV_SPAN    = 1
TE_AIS_MAINTENANCE = NO            #NO: defualt  YES: Start port in AIS 
Blue Alarm and keep line down
                                 #wanpipemon -i w1g1 -c Ttx_ais_off to 
disable AIS maintenance mode
                                 #wanpipemon -i w1g1 -c Ttx_ais_on to 
enable AIS maintenance mode
TDMV_HW_DTMF        = YES        # YES: receive dtmf events from hardware
TDMV_HW_FAX_DETECT      = YES     # YES: receive fax 1100hz events from 
hardware
HWEC_OPERATION_MODE     = OCT_NORMAL    # OCT_NORMAL: echo cancelation 
enabled with nlp (default)
                                         # OCT_SPEECH: improves software 
tone detection by disabling NLP (echo possible)
                                         # OCT_NO_ECHO:disables echo 
cancelation but allows VQE/tone functions.
HWEC_DTMF_REMOVAL       = NO    # NO: default  YES: remove dtmf out of 
incoming media (must have hwdtmf enabled)
HWEC_NOISE_REDUCTION    = NO    # NO: default  YES: reduces noise on the 
line - could break fax
HWEC_ACUSTIC_ECHO       = NO    # NO: default  YES: enables acustic echo 
cancelation
HWEC_NLP_DISABLE        = NO    # NO: default  YES: guarantees software 
tone detection (possible echo)
HWEC_TX_AUTO_GAIN       = 0     # 0: disable   -40-0: default tx audio 
level to be maintained (-20 default)
HWEC_RX_AUTO_GAIN       = 0     # 0: disable   -40-0: default tx audio 
level to be maintained (-20 default)
HWEC_TX_GAIN            = 0     # 0: disable   -24-24: db values to be 
applied to tx signal
HWEC_RX_GAIN            = 0     # 0: disable   -24-24: db values to be 
applied to tx signal

[w1g1]
ACTIVE_CH    = ALL
TDMV_HWEC    = YES
MTU         = 80

  ... and wanpipe2 was also automatically generated so just has '2' for 
FE_LINE and TDMV_SPAN instead of '1'.

# cat /usr/local/freeswitch/conf/freetdm.conf
[span wanpipe wp1]
trunk_type => bri
group=1
b-channel => 1:1-2
d-channel => 1:3

[span wanpipe wp2]
trunk_type => bri
group=1
b-channel => 2:1-2
d-channel => 2:3

[span wanpipe FXS]
name => freetdm
trunk_type => fxs
group => grp2
fxs-channel => 3:1

trunk_type => fxs
group => grp2
fxs-channel => 3:2

# cat /usr/local/freeswitch/conf/autoload_configs/freetdm.conf.xml
<configuration name="freetdm.conf" description="Freetdm Configuration">
<settings>
<param name="debug" value="0"/>
<!--<param name="hold-music" value="$${moh_uri}"/>-->
<!--<param name="enable-analog-option" value="call-swap"/>-->
<!--<param name="enable-analog-option" value="3-way"/>-->
</settings>

<config_profiles>

<profile name="my_bri_te_1">
<param name="switchtype" value="euroisdn" />
<param name="interface" value="cpe"/>
<param name="facility" value="no" />
</profile>

</config_profiles>

<sangoma_bri_spans>

<span name="wp1" cfgprofile="my_bri_te_1">
<param name="dialplan" value="XML"/>
<param name="context" value="public"/>
</span>

<span name="wp2" cfgprofile="my_bri_te_1">
<param name="dialplan" value="XML"/>
<param name="context" value="public"/>
</span>

</sangoma_bri_spans>


<analog_spans>

<span name="FXS">
<!--<param name="hold-music" value="$${moh_uri}"/>-->
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<!-- regex to stop dialing when it matches -->
<!--<param name="dial-regex" value="5555"/>-->
<!-- regex to stop dialing when it does not match -->
<!--<param name="fail-dial-regex" value="^5"/>-->
</span>

</analog_spans>

</configuration>

What other config files do I need to supply? I don't want to deluge the 
list any more in my first post!

2. We have 2 Single Number DDI numbers configured over the 4 channels.  
I want to set up outgoing calls so that they can appear to come from 
either of the two numbers, but at present the outgoing CLI appears to be 
overridden by the telco (BT) to only use one of the numbers.  Has anyone 
got this working in UK, and what is the format for the 
outbound_caller_id_number: last 6 digits or full 11 digits?  I note that 
the inbound called number is only the last 6 digits.

3. I have built FreeSWITCH from git and installed at /usr/local/... and 
then followed the steps on the Ubuntu page in the Wiki to set up the run 
control scripts, etc, and run FS non-root as freeswitch:daemon.  With 
FreeTDM, I have discovered that the /dev/wan* devices are owned by 
root:root, and so are inaccessible to FS running as non-root.  So for 
now I have added a line in /etc/init.d/freeswitch to 'chgrp freeswitch 
/dev/wan*'.  This is not the most elegant solution, because 'wanrouter 
restart' (which seems to be my best friend at the moment) resets the 
ownership to root:root.  I have tried grepping to see where the mknods 
are for these devices, but have been unsuccessful.  Is there a better 
place to 'permanently' change the device ownership?

Thanks for all the great support I have already got just from editing my 
Wiki User page; this is a friendly group!

John



More information about the FreeSWITCH-users mailing list