Updated to 10.13.66-4 and now my Sangoma A200 card is no longer seen

That is happening because wanrouter is terminating with an exit code of something other than 0. This is outside the scope of freepbx at this point. Seems like a hardware issue. “setup-sangoma” should only be used if you arent using the dahdi configuration module. Which you are more than welcome to do.

Once it works, the card works very well and has performed flawlessly for months…

If anything it might be some sort of driver issue…

As far as I remember I was never able to get it to work by only using the DAHDI configuration module…

I can test with another Sangoma A200, I will let you know the results…

Nick

Same result with another Sangoma A200 card…

The first card is about 6 years old this one is much newer…

(The first card is PCI and this one is PCI-Express…)

Methinks it’s a path or config issue or something similar and definitely not a hardware problem…

If I start wanrouter using amportal restart I get this:

Wanrouter: No valid device configs found, if you have no Sangoma cards this is OK

amongst other things…

But if I start it manually

> # /usr/sbin/wanrouter start

> Executing DAHDI config T1

> ########################################################################
> #                          Sangoma Wanpipe                                  #
> #        Dahdi/Zaptel/SMG/TDMAPI/BOOT Configuration Script             #
> #                             v2.39                                    #
> #                     Sangoma Technologies Inc.                        #
> #                        Copyright(c) 2013.                            #
> ########################################################################

> -------------------------------------------------------
> Configuring T1/E1 cards [A101/A102/A104/A108/A116/T116]
> -------------------------------------------------------

> No Sangoma ISDN T1/E1 cards detected

> -------------------------------------------
> Configuring ISDN BRI cards [A500/B500/B700]
> -------------------------------------------

> No Sangoma ISDN BRI cards detected

> ------------------------------------
> Configuring GSM cards [W400]
> ------------------------------------

> No Sangoma GSM cards detected

> ------------------------------------
> Configuring analog cards [A200/A400/B600/B610/B700/B800]
> ------------------------------------
> AFT-200 configured on slot:4 bus:2 span:1

> Analog card configuration complete

> ------------------------------------
> Configuring USB devices [U100]
> ------------------------------------

> ###################################################################
> #                             SUMMARY                             #
> ###################################################################

>   0 T1/E1 port(s) detected, 0 configured
>   0 ISDN BRI port(s) detected, 0 configured
>   1 analog card(s) detected, 1 configured
>   0 GSM card(s) detected, 0 configured
>   0 usb device(s) detected, 0 configured

> Configurator will create the following files:
>         1. Wanpipe config files in /etc/wanpipe
>         2. Dahdi config file /etc/dahdi/system.conf


> Your original configuration files will be saved to:
>         1. /etc/dahdi/system.conf.bak

> Your configuration has been saved in /etc/wanpipe/debug-2015-09-04.tgz.
> When requesting support, email this file to [email protected]


> ###################################################################


> Stopping Asterisk...
> No such command 'stop now' (type 'core show help stop now' for other possible commands)
> Failed to stop asterisk using command: 'stop now' Forcing Asterisk Down
> Undefined subroutine &main::execute_command called at ./wancfg_zaptel.pl line 1023.
> Error: Device wanpipe1 is already running
>     Run 'wanrouter stop wanpipe1' first

> Configuring interfaces: w1g1
> done.
> Waiting for Dahdi /dev/dahdi ...
> Loading DAHDI hardware modules:
>   wct4xxp:                                                 [  OK  ]
>   wcte43x:                                                 [  OK  ]
>   wcte12xp:                                                [  OK  ]
>   wcte13xp:                                                [  OK  ]
>   wct1xxp:                                                 [  OK  ]
>   wcte11xp:                                                [  OK  ]
>   wctdm24xxp:                                              [  OK  ]
>   wcaxx:                                                   [  OK  ]
>   wcfxo:                                                   [  OK  ]
>   wctdm:                                                   [  OK  ]
>   wcb4xxp:                                                 [  OK  ]
>   wctc4xxp:                                                [  OK  ]
>   xpp_usb:                                                 [  OK  ]
>   r1t1:                                                    [  OK  ]
>   rxt1:                                                    [  OK  ]
>   rcbfx:                                                   [  OK  ]

> D: auto '/sys/bus/dahdi_devices/devices/wanpipe_devices:wanpipe1'
> auto-assign /sys/bus/dahdi_devices/devices/wanpipe_devices:wanpipe1
> Running dahdi_cfg:                                         [  OK  ]
> DAHDI Tools Version - 2.10.0.1

> DAHDI Version: 2.10.0.1
> Echo Canceller(s): HWEC
> Configuration
> ======================

0 channels to configure.

It’s now visible to FreePBX and it wants to “play” with it…

Before doing this I reran setup-sangoma one last time and told it not to start wanrouter at boot and redid my configuration in FreePBX…

What parameters are being passed to wanrouter when it’s started from amportal?

There’s obviously something my 2 Sangoma A200 do not like with them…

I have checked but I have not found yet where those scripts call wanrouter…

Thank you and have a nice day,

Nick

Same options you have. “start”

See for yourself:

12: https://github.com/FreePBX/dahdiconfig/blob/master/bin/freepbx_engine_hook_dahdiconfig#L11
13: dahdiconfig/Dahdiconfig.class.php at release/13.0 · FreePBX/dahdiconfig · GitHub

The offending line(s) of code appear to be in 13 with this:

	$process = new Process('which wanrouter');
	$process->run();
	$wrc = explode(PHP_EOL, file_get_contents('/etc/wanpipe/wanrouter.rc'));
	$wanrouterconf = array();
	foreach($wrc as $line){
		$c = explode("=", $line);
		$wanrouterconf[$c[0]] = $c[1];
	}
	$wandevices = explode(" ", $wanrouterconf['WAN_DEVICES']);
	$confspresent = 0;
	foreach ($wandevices as $wandev) {
		if(file_exists('/etc/wanpipe/'.trim($wandev).'.conf')){
			$confspresent++;
		}
	}

It would be nice to know whats in “/etc/wanpipe/wanrouter.rc” previously. Because it seems like it couldn’t parse or read “/etc/wanpipe/wanrouter.rc” correctly then it tried to find configs that didn’t exist.

Let me see if @jfinstrom has any thoughts

This is what I currently have in those files

/etc/wanpipe/wanrouter.rc:

> #!/bin/bash
> # router.rc     WAN router meta-configuration file.
> #
> #               This file defines variables used by the router shell scripts
> #               and should be located in /etc/wanpipe directory.  These are:
> #
> #               ROUTER_BOOT     =       Boot flag (YES/NO).
> #               WAN_CONF_DIR    =       Where to put wanpipe config files.
> #               WAN_INTR_DIR    =       Where to put wanpipe interface files.
> #               WAN_LOG         =       Where to put start-up log file.
> #               WAN_LOCK        =       File used as a lock.
> #               WAN_LOCK_DIR    =
> #               WAN_IP_FORWARD  =       Enable IP Forwarding on startup.
> #               WAN_DEVICES     =       Name of the wanpipe devices to be
> #                                       loaded on 'wanrouter start'
> #                                       (ex: "wanpipe1 wanpipe2 wanpipe3...")
> #
> #                              Note:    Name of wanpipe devices correspond
> #                                       to the configuration files in
> #                                       WANPIPE_CONF_DIR directory:
> #                                         (ex. /etc/wanpipe/wanpipe1.conf )
> #
> #               Note:   This file is 'executed' by the shell script, so
> #                       the usual shell syntax must be observed.
> 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_LIP_LOAD=YES
> 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 "

/etc/wanpipe/wanpipe1.conf

> #================================================
> # WANPIPE1 Configuration File
> #================================================
> #
> # Date: Mon Jul 31 17:10:23 EDT 2006
> #
> # 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_ANALOG, Comment

> [interfaces]
> w1g1 = wanpipe1, , TDM_VOICE, Comment

> [wanpipe1]
> CARD_TYPE       = AFT
> S514CPU         = A
> CommPort        = PRI
> AUTO_PCISLOT    = NO
> PCISLOT         = 4
> PCIBUS          = 2
> FE_MEDIA        = FXO/FXS
> TDMV_LAW        = MULAW
> TDMV_OPERMODE   = FCC
> RM_BATTTHRESH   = 3
> RM_BATTDEBOUNCE = 16
> FE_NETWORK_SYNC = 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        = NO        # YES: receive dtmf events from hardware
> TDMV_HW_FAX_DETECT      = NO     # 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
> MTU             = 8
> TDMV_HWEC       = YES

I am no PHP guru (I did a little but not much) but that’s what I thought when you started posting the links (before you added more info)…

(I am a programmer though, that’s why I want so much to get to the bottom of things, to figure things out…)

There are definitely files in there, it’s just not seeing them…

When I saw the space at the end of WAN_DEVICES in wanrouter.rc I wondered if it could be to blame but it looks like this is what you (and the driver guys) are using as a separator…

The code seems to enumerate the wanpipe devices I have and then check if they have a configuration…

In my case it thinks that nothing was configured and emits that Wanrouter: No valid device configs found, if you have no Sangoma cards this is OK

(At least that’s what I think the snippets you posted were doing…)

Thank you!

Have a nice day!

Nick

Well it works now because your files are correct. I’d have to see them before you got it working.

Andrew, it is not working when I do an amportal restart…

It only works when I start wanrouter manually…

Can I modify the code so that it echos what it parsed and could you tell me how to do it, my PHP is waaaay too rusty…

Please?

Thank you!

Nick

I tried adding this the $output->writeln($wandevices); here

            $wandevices = explode(" ", $wanrouterconf['WAN_DEVICES']);
            $output->writeln($wandevices);

I got this:
“wanpipe1

(and yes it failed like it always do when I start it with amportal…)

I am obviously trying to print an array of some kind but what does this kind of output means?
(yes those quotes are on two different lines, whatever that means…)

Thank you!

Nick

Eureka!

I added this an output in that the second loop

            foreach ($wandevices as $wandev) {
                    $output->writeln('/etc/wanpipe/'.trim($wandev).'.conf');
                    if(file_exists('/etc/wanpipe/'.trim($wandev).'.conf')){
                            $confspresent++;
                    }
            }

I got this:

/etc/wanpipe/"wanpipe1.conf
/etc/wanpipe/".conf

Oops???

This parameter is supposed to have quotes on each side and they are not removed before parsing so it doesn’t check for the right file name(s)…

I rewrote this line

$wandevices = explode(" ", $wanrouterconf[‘WAN_DEVICES’]);

like this

$wandevices = explode(" “, trim(str_replace('”', ‘’,$wanrouterconf[‘WAN_DEVICES’])));

the str_replace() is there to remove all the double quotes and I added the trim() because if the string is not trimmed it creates an empty entry (because of the space they put after the name of the device).

There is probably a better way to do it for someone who knows PHP better than I do but it seems to have done the trick…

I can now see my card in FreePBX and I will test it as soon as I swap it back with the A200 which is supposed to go in that server…

:smiley:

Nick

A better solution would be:

$wanrouterconf = @parse_ini_file("/etc/wanpipe/wanrouter.rc");

So sorry about this bug. At one point I thought you said or mentioned you restored a backup. I assumed pre 13. I’m going to apply the patch now a new dahdi module will be out shortly

Hi Andrew!

Nice, you have a function that handles parsing those file more gracefully…

I haven’t checked the code to see if it handles this but be careful about the space they added at the end of the list of devices even if they are no more devices, in my case before I added the trim it was trying to find one more device with an empty file name.

re:

WAN_DEVICES="wanpipe1 "
has a space before the ending quotes…

I understand that it’s used as a delimiter but I would not have expected it to be present after the name of the last device…

No problem…

I am just glad I was able to provide you with enough additional info that it became apparent there was a little bug somewhere…

To me it was but then you had to be the one having the problem to be convinced of that at first…

I was also beginning to be afraid that I was starting to become so insistent you would soon be p1$$3d at me… :relieved:

I guess as soon as I decided to go the backup way it might have been better to open a new thread…

I would not have been masochistic enough to try to restore a backup from one version to another as I am pretty sure all hell would have broken loose… It’s one thing to upgrade an install from one version to another using some sort of one-shot it’s quite another to expect a newer version to be able to make sense out of a backup of a previous version…

I love network/telephony admin stuff like this but I am a programmer before all else so I knew I could not have expected that to work…

I had upgraded using the script you had provided to upgrade to FreePBX 13/Asterisk 13 but I saw that the firmware was still the original one and this is what I had tried to fix but something didn’t get applied properly and at the end I decided it was best to reinstall and restore but my backup was one of 13… Some sort of hybrid maybe because it was an upgrade but still 13 so I was pretty sure a new install would be able to make sense out of it…

I have the commercial “System admin” module which is supposed to take care of applying minor updates to the firmware but for some reason it seemed to run and do something but after letting it do its job my system told me I was still using the old firmware (even after a reboot) so I tried to apply them manually and that’s when things started to misbehave. I guess those updates had, at least partially, been applied and running the update scripts manually only made matters worse…

Thank you very much!

Have a nice day and week-end!

Nick

Thanks for pointing that out. I added this:

		$wanrouterconf = @parse_ini_file("/etc/wanpipe/wanrouter.rc");
		if(!empty($wanrouterconf['WAN_DEVICES'])) {
			$wanrouterconf['WAN_DEVICES'] = trim($wanrouterconf['WAN_DEVICES']);
			$wandevices = explode(" ", $wanrouterconf['WAN_DEVICES']);

Right. @xrobau just worked this last week on actually fixing that utility.

Published in dahdiconfig v13.0.4

Note that I also did the same work on the stop utility so make sure it works for both start and stop

No problem…

Thanks! That’s nice to know!

Thank you! I have finally stopped seeing “red” (it was complaining since I had altered one of the modules files)…

I thought the stop module wouldn’t have cared about this and stopped everything in sight so I didn’t even check for this, good work!

Now that this is fixed I saw that I now have one more problem to take care of…

For some reason my DAHDI extensions cannot call other extensions even DAHDI ones… It looks like it’s missing digits so I guess it’s DTMF detection…

The “normally easy” way to do this would be to put TDMV_HW_DTMF = YES in wanpipe1.cf so the Sangoma A200 does the DTMF processing (it does it pretty well) but unfortunately that file gets rewritten by FreePBX…

(Unless I set “Run Wanpipe In DAHDI/DIGIUM Mode:” to “No” I believe but then I lose the possibility to configure it from FreePBX…)

I must have done something for this in the past (other than this…) but I don’t quite remember what it was…

edit: looks like it was relaxdtmf=yes added manually as a DAHDI setting… ** I guess I lost it when I started trying many different things to get my DAHDI working…

Have a very nice day and week-end!

Nick

1 Like