DjangoPBX Beginners

Status
Not open for further replies.

ardyhash

Member
Jan 7, 2021
80
9
8
44
The gui is very configurable, i don’t recall anything about changing anything other than the whitelist IP during install
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,414
376
83
I need to look at ufw, the install script need to make sure it is not installed or if it is, disable it.

@chris021 Addition to SIP Customer List and SIP Gateway List will not survive a reboot or even a nftables reload but there are some options:
You can of course save the rules with nft list ruleset > my_firewall_rules
You can add your gateways and other important IPs to the defines at the top of /etc/nftables.conf
SIP Customer lists can be restored in the GUI Admin->Switch->IP Register and choose the action "Re-instate SIP Customer Firewall List"
 
  • Like
Reactions: chris021

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,414
376
83
I'm pretty sure standard Debian12 does not install ufw by default. Maybe it is installed by default in some cloud versions.

If you have ufw, it is better to remove or disable it for DjangPBX:
Run the following command to remove ufw:

Code:
root ~# apt purge ufw

OR
Run the following commands to disable ufw:

Code:
root ~# ufw disable
root ~# systemctl stop ufw
root ~# systemctl mask ufw
 

ou812

New Member
Nov 2, 2016
28
4
3
61
I rebuilt cloud server from Vultr and yes ufw is installed, removed it then did the install of Djangopbx and it works.

Thanks, to all for the help.
 
  • Like
Reactions: ardyhash

NerdUno

New Member
Sep 4, 2018
17
9
3
77
For those playing with the Debian 12 release, be advised that there was a missing Freeswitch piece using the src build for FreeSwitch (now fixed). Here are our notes on what worked using a SignalWire Personal Access Token.

First, you must have a public-facing FQDN for your server. It's the only way to login to the GUI (similar to iPBX PUBLIC).

Second, set up an account at Signalwire.com and obtain a Personal Access Token after you login (bottom left link)

Third, login to your Debian 12 server as root using SSH and issue the following commands:

Code:
mkdir -p /usr/src/djangopbx-install
cd /usr/src/djangopbx-install
wget https://raw.githubusercontent.com/djangopbx/djangopbx-install.sh/master/install.sh
chmod +x install.sh
nano -w install.sh

Fourth, once the installer script opens, make these entries. Then SAVE file: Ctrl-X, Y, ENTER...

Code:
Insert your domain_name=somebody.com
If you plan to have multiple tenants, use: domain_name=.somebody.com

Insert your default_domain_name=django.somebody.com
Be sure you've added an A record DNS entry for somebody.com and django.somebody.com

Change:
freeswitch_method=pkg
signalwire_token=pat-token-obtained-above

Fifth, run the script: ./install.sh and type y at all prompts. Be sure to whitelist your client PC's public IP address. Use default user account: django-pbx.

When the script finishes, enter the following commands BEFORE rebooting. Second command only required if nginx doesn't start on reboot.

Code:
systemctl enable nftables
sed -i '/PID/a ExecStartPre=/bin/sleep 10' /usr/lib/systemd/system/nginx.service
reboot

Finally, using browser, navigate to https://django.somebody.com and login as django-pbx with your password.

A word of warning about the firewall. Adding Firewall-> Add Whitelist entries in the GUI do NOT get preserved on reboot.
Instead, login via SSH and issue the following commands to whitelist additional IP address (12.34.56.78):

Code:
sed -i 's|ipv4_white_list = { |ipv4_white_list = { 12.34.56.78, |' /etc/nftables.conf

Run the config file as a script: /etc/nftables.conf

Verify your added whitelist entry: nft list set inet filter ipv4_white_list
 
Last edited:
  • Like
Reactions: ardyhash

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,414
376
83
Just a note about the post above, whilst it is very helpful, I must state that changes to /usr/lib/systemd/system/nginx.service are NOT required on many Debian12 installations. If your NGINX works fine, leave it alone. I have seen the issue on some cloud and vps deployments.

Building FreeSWITCH from source is fine with the latest installer.

Details about the firewall and how it works are given here:
https://www.djangopbx.com/static/documentation/architecture/firewall.html
 

NerdUno

New Member
Sep 4, 2018
17
9
3
77
Sorted out getting a VoIP.ms trunk registered with bug fix from @Adrian Fretwell. Thanks!!

Now if only we could make an outbound call. Both djangopbx and voip.ms show the trunk registered, and Status->Registrations shows the softphone registered. We then created an outbound route to VoIP.ms using the following settings;

Order: 100
Number: ^(\+1|1)?(\d{10})$
Destination: True
Hostname: my.djangopbx.domain
Domain: my.djangopbx.domain
Enabled: True
Description: voipms
Continue: True

But I get a 488 Not Acceptable error dialing either 10-digit or 11-digit NANPA number. No idea what Destination and Continue mean either but True or False doesn't seem to matter. Same result.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,414
376
83
488 normally indicates "no codec intersection" i.e. the two endpoint could not agree on a codec.
You will need to find out what codecs your softphone is offering and what codecs your SIP provider is willing to accept.

You should not have anything in Hostname, unless you are running multiple freeswitch instances. Continue should absolutely be false in this particular case.
You can find out about dialplans here:
https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Dialplan/XML-Dialplan/
 
Last edited:

ou812

New Member
Nov 2, 2016
28
4
3
61
Sorted out getting a VoIP.ms trunk registered with bug fix from @Adrian Fretwell. Thanks!!

Now if only we could make an outbound call. Both djangopbx and voip.ms show the trunk registered, and Status->Registrations shows the softphone registered. We then created an outbound route to VoIP.ms using the following settings;

Order: 100
Number: ^(\+1|1)?(\d{10})$
Destination: True
Hostname: my.djangopbx.domain
Domain: my.djangopbx.domain
Enabled: True
Description: voipms
Continue: True

But I get a 488 Not Acceptable error dialing either 10-digit or 11-digit NANPA number. No idea what Destination and Continue mean either but True or False doesn't seem to matter. Same result.
Please share the bug fix, I have been trying to get voipms working as well.

I found that my Yealink phone would not work with Ulaw I had to use Alaw
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,414
376
83
Please share the bug fix, I have been trying to get voipms working as well.
It wasn't really a bug fix. The user had deleted their selected domain and then tried to create a gateway - effectively with a non existent domain. The fix was just a test to stop someone deleting the domain they are currently working on.

I'm sorry I know nothing about voipms.
 

simonjw

New Member
Feb 6, 2024
22
0
1
31
Hey everyone.

So I am very new to Freeswitch and want to learn. I usually use 3CX or something that has a single install command and a GUI that just works. I installed it on a Vultr instance with Debian and it comes with UFW preinstalled. Removing UFW first and installing and vice versa stops the ability to connect to the VM via SSH and the web portal after adding my static IP and rebooting. I have not found a workaround yet, but I have not rebooted and it does work.

Moving past that, I have watched some Freeswitch videos, and it's "relatively" simple to set up the XML files for gateways, dial plans, and extensions. I have a few domains set up and working on internal calls, however, I cannot seem to get my gateways registered to my Porta instances as well as the dial plans to receive and make calls.

Is there anyone who may be able to assist me in setting it up? I only need to see it once and I should be good thereafter.

I would like to use this in production with the API and integrate it into my (all-in-one) portal which offers clients and partners all my services.

Thanks guys
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,414
376
83
Hi Simon, happy to help if I can.
Yes, UFW does need to be removed. The Django-PBX installer does attempt to remove it if it exists.
Django-PBX uses nftables for it's firewall and the is a point in the install script that prompts you to enter your IP address into a whitelist for service like sh.

I don't know anything about Porta instances but I'm sure will can work through Gateways and dialplans.

There is a documentation page for Gateways here:
https://www.djangopbx.com/static/documentation/admin/accounts/gateways.html

If you have any specific questions it may be better to start a new thread then it makes any solutions easier to find for others.
 

simonjw

New Member
Feb 6, 2024
22
0
1
31
Hi Simon, happy to help if I can.
Yes, UFW does need to be removed. The Django-PBX installer does attempt to remove it if it exists.
Django-PBX uses nftables for it's firewall and the is a point in the install script that prompts you to enter your IP address into a whitelist for service like sh.

I don't know anything about Porta instances but I'm sure will can work through Gateways and dialplans.

There is a documentation page for Gateways here:
https://www.djangopbx.com/static/documentation/admin/accounts/gateways.html

If you have any specific questions it may be better to start a new thread then it makes any solutions easier to find for others.
Thanks for the reply.

Weirdly it didn’t remove UFW and I had to do it manually. During the install when it asks to put in my IP it doesn’t actually save it so I did it manually with the command and then set the config and do the reboot and I get no joy as it just hangs. I’ll try do another install and see if it still does the same thing. So far working without setting the firewall and no reboot and doesn’t seem like any rogue connections.

I’ll take a look at the documentation and see where I may be going wrong. It’s a simple IP, username and password SIP trunk so it should work with a default setup.

I’ll let you know how it goes
 

chris021

New Member
Jan 29, 2024
6
1
3
New Zealand
Moving past that, I have watched some Freeswitch videos, and it's "relatively" simple to set up the XML files for gateways, dial plans, and extensions. I have a few domains set up and working on internal calls, however, I cannot seem to get my gateways registered to my Porta instances as well as the dial plans to receive and make calls.
Hi Simon,

Just some extra context that may or may not help you wrap your head around things. As I did not come from FusionPBX but had done some Freeswitch with static config files the concepts here were a little bit foreign to me to begin with.... The django based gui (DjangoPBX) writes stuff into the database then Freeswitch is configured to fetch the xml config in sections from the Django API so with DjangoPBX you will only find minimal XML config as its dynamically generated by the httapihandler. That being said once you know how the XML works and the freeswitch parameters you will see the XML very clearly in the dialplans etc.

Once you are up and running, I have found that some of the FusionPBX documentation helps with DjangoPBX as the freeswitch concepts are obviously the same under the hood.

Hope this helps a tiny bit getting across this pretty exciting project.
 

NerdUno

New Member
Sep 4, 2018
17
9
3
77
@Adrian Fretwell has obviously invested an enormous amount of effort in getting DjangoPBX out the door. The problem for beginners (like me) is there is virtually no documentation on how to do even the basics, i.e. set up an extension, set up a working trunk, set up an inbound and outbound route, and make a call. By my estimate, there are close to a thousand moving parts in DjangoPBX and without something that at least gets users to the point of making a successful call, the rest of the effort is of little value. Just my $.02.

Truth be told, I'm not quite a beginner. I've been using, developing, and writing about Asterisk for almost 20 years.
 

simonjw

New Member
Feb 6, 2024
22
0
1
31
Thanks for all the information guys.

So a second installation and the whole UFW saga and being locked out is over and the install runs perfectly. Additionally, I didn't realize that I had to reload the gateway which I did and it registered. I assumed it would be done automatically. The issue I am having is I cannot get my inbound and outbound working and I think it may be the regex for South African numbers that I am not getting correct and I've spent the last 16 or so hours trying to figure it out.

Is it possible, anyone here might know how to assist me?
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,414
376
83
Yes, post your regex and I will have a look at it, or tell me what pattern you are trying to match and I'll have a go at writing it for you.
Also you may find this site very useful for prototyping regex https://regex101.com/
 
Last edited:
Status
Not open for further replies.