I'm stuck :-( [SOLVED]

Status
Not open for further replies.

smashlar

New Member
Jul 7, 2017
7
0
1
53
Long story short: I'm trying to install FusionPBX (FPBX) and FS on a Debian 8 server, but I'm not able to get the softphones registered, I keep getting this error in the FreeSWITCH (FS) log:
2017-07-07 17:45:59.758807 [WARNING] sofia_reg.c:2906 Can't find user [101@192.168.1.11] from [IP Redacted]
You must define a domain called '192.168.1.11' in your directory and add a user with the id="101" attribute
and you must configure your device to use the proper domain in it's authentication credentials.
2017-07-07 17:46:12.918807 [WARNING] sofia_reg.c:2906 Can't find user [102@192.168.1.11] from [IP Redacted]
You must define a domain called '192.168.1.11' in your directory and add a user with the id="102" attribute
and you must configure your device to use the proper domain in it's authentication credentials.


Server is NATted, local LAN IP is 192.168.1.11
I understand there are many different variables in play, but I have tried so many times and yet I cannot figure out what's wrong. It's like FPBX is not "talking" to FS, everything else looks fine, there are no errors in the logs, but still FS ain't able to recognize the domain and extensions created in FPBX.

This is in brief the installation story:

1) Install from FPBX script fusionpbx-install.sh, only thing I changed is the nginix script (commented out) so that nginix is not installed and FPBX runs under apache2.

2) FS stable, compiled with pgsql and zrt support:
FreeSWITCH Version 1.6.18+git~20170630T173819Z~db529ca382~64bit (git db529ca 2017-06-30 17:38:19Z 64bit)

./configure --prefix=/usr/local/freeswitch --enable-core-pgsql-support --disable-fhs --enable-zrtp
make
make install


Install sounds, then check systemctl file: works with no errors, LUA ok, config.php and config.lua ok.

Only point I don't understand is why FPBX scripts make a copy of conf files in /etc/freeswitch, thought they were for package install, not source. Anyway, nothing happens in /etc/freeswitch as well, FS runs on /usr/local/freeswitch/conf files.

3) FPBX v.4.2, install with no errors

4) Domain and extensions created in FPBX, but FS seems to ignore them, and still looks for a domain with {local_ip_v4} as domain name

5) SIP trace in fs_cli shows that FS gets the correct registration message from UA (REGISTER 101@domain.tld), answers correct 401 unauthorized, then FS gets new sip request with nonce but answers 403 forbidden:

+OK Global siptrace on

recv 505 bytes from tcp/[IP Redacted]:64291 at 18:16:14.030719:
------------------------------------------------------------------------
REGISTER sip:domain.tld SIP/2.0

Via: SIP/2.0/TCP IP Redacted:64290;branch=z9hG4bK46b6997972fea682e15910cbe5628733;rport
From: "101" <sip:101@domain.tld>;tag=902758182
To: "101" <sip:101@domain.tld>
Call-ID: 498072297@192_168_0_141
CSeq: 21634 REGISTER
Contact: <sip:101@IP Redacted:64290;transport=tcp>
Max-Forwards: 70
User-Agent: Redacted
Expires: 300
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, SUBSCRIBE, NOTIFY, REFER
Content-Length: 0
------------------------------------------------------------------------

send 662 bytes to tcp/[IP Redacted]:64291 at 18:16:14.031680:
------------------------------------------------------------------------
SIP/2.0 401 Unauthorized

Via: SIP/2.0/TCP IP Redacted:64290;branch=z9hG4bK46b6997972fea682e15910cbe5628733;rport=64291
From: "101" <sip:201@domain.tld>;tag=902758182
To: "101" <sip:101@domain.tld>;tag=yK523g32ta0ZB
Call-ID: 498072297@192_168_0_141
CSeq: 21634 REGISTER
User-Agent: FreeSWITCH-mod_sofia/1.6.18+git~20170630T173819Z~db529ca382~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
WWW-Authenticate: Digest realm="domain.tld", nonce="f33e69b0-978f-47c7-885c-2d7134b48853", algorithm=MD5, qop="auth"
Content-Length: 0
------------------------------------------------------------------------

recv 767 bytes from tcp/[IP Redacted]:64291 at 18:16:14.360647:
------------------------------------------------------------------------
REGISTER sip:domain.tld SIP/2.0

Via: SIP/2.0/TCP 192.168.0.141:64291;branch=z9hG4bK56bdb88f6580805f9520e12260c54bf5;rport
From: "101" <sip:101@domain.tld>;tag=902758182
To: "101" <sip:101@domain.tld>
Call-ID: 498072297@192_168_0_141
CSeq: 21635 REGISTER
Contact: <sip:101@IP Redacted:64291;transport=tcp>
Authorization: Digest username="101", realm="domain.tld", qop=auth, algorithm=MD5, uri="sip:domain.tld", nonce="f33e69b0-978f-47c7-885c-2d7134b48853", nc=00000001, cnonce="d1329c8f751bf8bb1b3f0823ebf5128a", response="e7efd8dfd2aa02e48d1c46ba2488d00f"
Max-Forwards: 70
User-Agent: Redacted
Expires: 300
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, SUBSCRIBE, NOTIFY, REFER
Content-Length: 0
------------------------------------------------------------------------

send 557 bytes to tcp/[IP Redacted]:64291 at 18:16:14.361773:
------------------------------------------------------------------------
SIP/2.0 403 Forbidden

Via: SIP/2.0/TCP 192.168.0.141:64291;branch=z9hG4bK56bdb88f6580805f9520e12260c54bf5;rport=64291;received=IP Redacted
From: "101" <sip:101@domain.tld>;tag=902758182
To: "101" <sip:101@domain.tld>;tag=ZvyU5Bm6QKpjQ
Call-ID: 498072297@192_168_0_141
CSeq: 21635 REGISTER
User-Agent: FreeSWITCH-mod_sofia/1.6.18+git~20170630T173819Z~db529ca382~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0
------------------------------------------------------------------------


Any suggestion? Help will be highly appreciated, thanks!
 

smashlar

New Member
Jul 7, 2017
7
0
1
53
Never mind, I found the error.

There's a bug in the FPBX installation script, here's the wrong sequence:

1) pre-install.sh --> install.sh - OK

2) On line 66, install.sh --> resources/switch.sh - OK
#FreeSWITCH
resources/switch.sh


3) resources/switch.sh can launch 4 different scripts, depending on type of installation of FreeSWITCH, if from source or package, and then from Master or Stable. Here's the full script with the error:
#!/bin/sh

#move to script directory so all relative paths work
cd "$(dirname "$0")"


#includes
. ./config.sh


if [ .$switch_source = .true ]; then
if [ ."$switch_branch" = "master" ]; then
switch/source-master.sh
else
switch/source-release.sh
fi


#copy the switch conf files to /etc/freeswitch <-- THIS IS WRONG!
switch/conf-copy.sh <-- THIS IS WRONG!


#set the file permissions
switch/source-permissions.sh <-- THIS SCRIPT HAS AN ERROR AS WELL, freeswitch.log PATH IS WRONG

#systemd service
switch/source-systemd.sh
fi


if [ .$switch_package = .true ]; then
if [ ."$switch_branch" = "master" ]; then
if [ .$switch_package_all = .true ]; then
switch/package-master-all.sh
else
switch/package-master.sh
fi
else
if [ .$switch_package_all = .true ]; then
switch/package-all.sh
else
switch/package-release.sh
fi
fi


#copy the switch conf files to /etc/freeswitch
switch/conf-copy.sh <-- OK HERE, BUT I'D CHANGE THE NAME TO switch/package-conf-copy.sh TO AVOID CONFUSION


#set the file permissions
switch/package-permissions.sh


#systemd service
switch/package-systemd.sh

fi


The error is using the same script "conf-copy.sh" for either source install or package install, as the "conf" directory for source install is different form the "conf" directory for package install. I suggest:

- rename switch/conf-copy.sh to switch/source-conf-copy.sh
- cp /switch/source-conf-copy.sh to /switch/package-conf-copy.sh. Now, package-conf-copy.sh is ok for package install, just edit source-conf-copy.sh to be like this:

mv /usr/local/freeswitch/conf /usr/local/freeswitch/conf.orig
mkdir /usr/local/freeswitch/conf
cp -R /var/www/fusionpbx/resources/templates/conf/* /usr/local/freeswitch/conf


- adjust resources/switch.sh to the new names:
...
15
16 #copy the switch conf files to /usr/local/freeswitch/conf
17 switch/source-conf-copy.sh
...
40
41 #copy the switch conf files to /etc/freeswitch
42 switch/package-conf-copy.sh

- check switch/source-permissions.sh and adjust the freeswitch.log path:
#setup owner and group, permissions and sticky
chown -R www-data:www-data /usr/local/freeswitch
chmod -R ug+rw /usr/local/freeswitch

touch /usr/local/freeswitch/log/freeswitch.log <-- source install puts log in /usr/local/freeswitch/log/
chown -R www-data:www-data /usr/local/freeswitch/log
find /usr/local/freeswitch -type d -exec chmod 2770 {} \;



The problem I had in my previous post was solved by simply moving the conf files from /etc/freeswitch to /usr/local/freeswitch/conf and then by restarting FreeSWITCH:

# keep a copy of actual confs just in case
mkdir /tmp/freeswitch.conf
cp -R /usr/local/freeswitch/conf/* /tmp/freeswitch.conf
# Remove actual confs
rm -R /usr/local/freeswitch/conf/*
# Move the confs copied during the first install to the right place
mv /etc/freeswitch/* /usr/local/freeswitch/conf/*
systemctl restart freeswitch

 

smashlar

New Member
Jul 7, 2017
7
0
1
53
Yes, that's totally correct! Actually the packaged install is using /etc/freeswitch, and that's right.

My point was that if you decide to install FreeSWITCH from sources (by changing the variables in ./resources/config.sh), the script will still copy the conf files in /etc/freeswitch instead of /usr/local/freeswitch/conf

That's why I suggested to use two different scripts to copy the conf files, one for the packaged install, the other for the install from source.

Anyway, besides the above problem, I also found many other issues while installing FusionPBX from script, I now feel this probably too difficult for my skill level.

I'm sure it is an easy task if you install on a clean system without changing anything, but as soon as you change some parameter, you get quickly into a mess. At least that's what happened to me. :-(((
 
Status
Not open for further replies.