Select outgoing line on linksys spa400

I am new to Asterisk and FreePBK, but off to a good start bar one thing that I now find myself stuck on, after much searching I hope somebody can help me.

Asterisk version 10.11.0
FreePBX version 2.10.0
Linksys SPA firmware 1.1.2.2
Centos 5.8 x86_64

The SPA400 has 4x ports, with default names:
FXO_Port_ID_1
FXO_Port_ID_2
FXO_Port_ID_3
FXO_Port_ID_4

The current behaviour is that outgoing calls are made by default on line 1, only if I unplug the wire in the first socket does the SPA400 use line 2.
I wish to be able to choose to use line 2 and for it not to only be used is line 1 is unavailable.

I am new to FreePBX/Asterisk, so this may be a far from optimal setup, here is what I have:

2x Outbound Routes:
The first (first route position) called internal, match pattern “2.” (without quotes) with “spa400internal” trunk sequence 0.
The second (last route position) called external, match pattern “X.” (without quotes) with “spa400external” trunk sequence 0.

2x SIP Trunks:
“spa400internal”, where under outgoing settings I have name: FXO_Port_ID_1, and peer details:
user=7654
type=peer
secret=
port=FXO_Port_ID_1
insecure=very
host=192.168.2.101
dtmfmode=rfc2833
context=from-trunk
canreinvite=no
allow=ulaw

“spa400external”, where under outgoing settings I have name: FXO_Port_ID_2, and peer details:
user=7654
type=peer
secret=
port=FXO_Port_ID_2
insecure=very
host=192.168.2.101
dtmfmode=rfc2833
context=from-trunk
canreinvite=no
allow=ulaw

This page on Cisco would suggest that what i’d like to do is possible:

It also may have been answered in the final post here:
http://www.freepbx.org/forum/freepbx/users/spa400

Unfortunately, in both cases I don’t understand the solution. I wish to resolve the issue using the FreePBX web interface if possible.

Many thanks in advance!

Phil.

There is a basic concept of a “trunk”. normally all your FXO “lines” are grouped into a “trunk” in /etc/asterisk/chan_dahdi.conf the default trunk is dahdi/g0 which is all your trunks used in order from lowest to highest, this default behavior is wrong with most folks as they plug the phones in from lowest to highest, in reality to reduce “glare” we should use “highest to lowest” this is actually already self defined as dahdi/G0, note the capital G, just (re)define that Trunk in FreePBX, it will work just fine.

port=FXO_Port_ID_1

This is not correct, the argument of port must be an integer.

You might try inserting the L1 etc. into the prefix field in the trunk but I am almost sure that field only accepts integers.

Doubt you will be able to do this from the GUI unless you can make the SPA listen on different UDP ports for each telephone port.

Dicko wasn’t paying attention, DAHDI is for internal hardware cards.

Your port commands make no sense, the argument of port is an integer. The port command is used to set the UDP port that SIP packets are transmitted on. It has nothing to do with the phone ports.

Thank you both for your replies.

dicko: “channel g0 (zap)” exists from my install of freepbx, but I cannot see how I may change its config to anything that would work for me. /etc/asterisk/chan_dahdi.conf does not exist, but /etc/asterisk/chan_dahdi.conf.template does. Containing the following, but i’ve no idea where to start with it.

;# Flash Operator Panel will parse this file for dahdi trunk buttons
;# AMPLABEL will be used for the display labels on the buttons

;# %c Dahdi Channel number
;# %n Line number
;# %N Line number, but restart counter
;# Example:
;# ;AMPLABEL:Channel %c - Button %n

;# For Dahdi/* buttons use the following
;# (where x=number of buttons to dislpay)
;# ;AMPWILDCARDLABEL(x):MyLabel

[channels]
language=en

; include dahdi extensions defined in FreePBX
#include chan_dahdi_additional.conf

; XTDM20B Port #1,2 plugged into PSTN
;AMPLABEL:Channel %c - Button %n
context=from-pstn
signalling=fxs_ks
faxdetect=incoming
usecallerid=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=800
group=0
channel=1-2

SkyKingOH: adding a prefix did not work, and non-numeric prefixes were not accepted.
changing the port= line had the following results:

port=0 Line 1 used
port=1 Engaged tone
port=2 Engaged tone
port=3 Engaged tone
port=4 Engaged tone
port=L0 Line 1 used
port=L1 Line 1 used
port=L2 Line 1 used
port=L3 Line 1 used
port=L4 Line 1 used

oops, mea culpa.