Skip to content

Commit 25eb7d2

Browse files
committed
Update 05292025 - N8ACL
1 parent be4091b commit 25eb7d2

23 files changed

+542
-464
lines changed

.DS_Store

6 KB
Binary file not shown.

._.DS_Store

4 KB
Binary file not shown.

docs/Installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ If you want to run this on a Windows or Mac machine, you will need to be able to
99
You will need a few things to be able to configure the scripts.
1010

1111
* Your DAPNET Username and Password
12-
* The Username, Password and IP Address of your MySQL Instance
12+
* The Username, Password and IP Address of your Database Server Instance
1313

1414
## Obtaining DAPNET Keys
1515

@@ -39,4 +39,4 @@ pip3 install -r requirements.txt
3939

4040
If you are going to run the callsign loader script on another computer, you will need to move that script and the ```requirements.txt``` file to that machine and install the requirements there as well.
4141

42-
Now let's setup the MySQL Database first.
42+
First let's setup the[```config.json``` file](https://n8acl.github.io/dapnet_paging_gateway/configure_scripts/). You will need this to be able to configure and use your system.

docs/changelog.md

Lines changed: 6 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,6 @@
1-
* 05/30/2021
2-
- Minor updates to README and the wiki.
3-
4-
* 05/19/2021 - Version 5.0 Release
5-
- Update of APRSNotify Database to consolidate callsign lists to one table
6-
- Redesign of an_util.py into a Flask app to allow for web browser based GUI to configure the script.
7-
- Addition of Discord to supported networks.
8-
- Automatically does not send a map image with WX Station Data or message notification to Telegram
9-
- Updated Wiki with new information.
10-
11-
* 01/15/2021 - Version 4.0 Release
12-
- Removal of APRSBot to a different project
13-
- Moved from text files for data storage to SQLlite3 Database
14-
- Various small bug fixes and rework of the code.
15-
- Added: ability to send status to Mastodon
16-
- Added: an_util.py configuration utility for interacting with the database
17-
- Added: New wiki user guide.
18-
- Added: Parsing of Weather Data packet from APRS.
19-
20-
* 12/11/2020 - Release 3.1 - Fixes around APRS.FI API limitations
21-
- APRSnotify
22-
- Updated aprsnotify.py to split position tracking and messge monitoring lists out to 2 seperate lists due to APRS.fi API restrictions
23-
- APRSbot
24-
- Updated aprsbot to fix APRS-IS Timeouts for sending locations and messages
25-
- README.md
26-
- Added limitations to the API to the APRS.fi API key section.
27-
- Other updates and clearifications to README.md
28-
- Configuration.md
29-
- Split callsign lists out to position tracking list and message list. This is due to limitations on the APRS.fi API
30-
31-
* 12/09/2020 - Minor update
32-
- Fixed Bug: fixed error in setup.py. Named the config file wrong in variable. (Found by [Alex Bowman, KN4KNG](https://github.com/KN4KNG))
33-
34-
* 11/15/2020 - Version 3.0 Release
35-
- Added/New Features:
36-
- Added a requirements.txt file to make installing libraries easier for end users
37-
- Added checks to make sure all python libraries needed are installed already and notify the user if not and how to install
38-
- Created and added new interactive bot functionality, APRSBot
39-
- Updates/Changes:
40-
- Changed from urllib to requests library to parse json. This makes it easier to use the same url for different purposes
41-
- Removed the aprs and msg url variables and combined into aprsfi_url variable for use with new library
42-
- Fixed bug: added srccall variable instantiation. This fixes a bug where if the srccall is not pulled properly the script bombs
43-
- Removed using Google Geocoder for Reverse geocoding. Only using OpenStreetMaps now
44-
- Updated README.md and Configuration.md files
45-
46-
* 08/20/2020
47-
- Updates to the ReadMe file
48-
49-
* 07/06/2020 - Version 2.0 Release
50-
- Added/New Features:
51-
- Ability to choose between Metric and Imperial units
52-
- Ability to turn off WX Information and not include it in the status message.
53-
- Now sends notification if someone sends the user a message on APRS (requires Telegram bot for this to work).
54-
- Sends map image of the packet location to Telegram (requires Telegram bot for this to work).
55-
- Updates:
56-
- Fixed: If there is not a speed entry in the JSON payload from APRS.FI, the script assumes it's a fixed station and does not include speed in the status message. In Ver. 1.0 this was a bug that would cause the script to fail if there was not a speed entry in the JSON payload.
57-
- Updated the config file to include switches for new features.
58-
- Updated the configuration walkthrough in this repo.
59-
- Updated Setup.py to include switches for new features. Will also update an existing config.py file to the new version.
60-
- NOTE: If you are running version 1, when updating to Version 2 of the script, make sure to run setup.py to update your existing config.py file to the correct config version.
61-
- Reworked and tighten up code in the main script
62-
63-
* 02/29/2020 - Initial Release 1.0
64-
- Combined functionality of APRSTweet and APRSTelegram
65-
- Added: Ability to choose to send to Twitter, Telegram or All
66-
- Added: Ability to choose between OpenStreetMaps and Google Geocoding API for reverse geocoding of packet location
67-
- Added: Added the hashtag #APRS to the end of the status message for Twitter
68-
- Added: Finds the Maidenhead Grid Square based on packet location and includes it in the status message
69-
- Added: Created setup utility to help in config file creation.
70-
- Update: Fixed URL for aprs.fi in the status message from http:// to https://
1+
* 05/29/2025
2+
* Refactoring/Refining of the code base to bring it up to better programming and Database Standards.
3+
* Update of Documentation
4+
* Added Support for Multiple Database Systems
5+
* Update to configuration json file.
6+
* Changed script to support multiple user modes in one script.

docs/configure_database.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Configure Database
2+
3+
For this to run and work, there is a database component to this that loads some data on a regular basis. So the first thing we need to do is setup the database on your database server.
4+
5+
Note that for this step, you should already have a supported Database System installed and configured. The installation and configuration is out side the scope of this documentation and can be found online.
6+
7+
You also should be a little familiar with Databases and SQL in general to do this part. If not, find a friend who is capable and ask them to help with it (note I didn't say do it for you).
8+
9+
## Create the Database
10+
11+
To create the database, SSH into where you cloned the repo and make sure you are in the scripts directory.
12+
13+
```bash
14+
cd dapnet_paging_gateway
15+
16+
cd scripts
17+
```
18+
19+
Then run the ```install.py``` script. This will create the database, the tables and any local directories needed for data downloading and processing.
20+
21+
```bash
22+
python3 install.py
23+
```
24+
25+
## Preload some of the data - Multi-User Only
26+
27+
If you are going to use the script in Multi-User mode, you will need to preload some data to the database. These are extensions that people could be calling from, so that the script can pair their extension with the correct Callsign. An example of this would be, say you have multiple Hams at home that could potentially use this system, you will need to add their extension and callsign to the database manually so that the gateway knows what callsign to associate with that extension.
28+
29+
To do this, run the following (modified of course to fix your situation) in your Database Server:
30+
31+
```sql
32+
insert into dapnet.dbo.ext_data (extension,callsign)
33+
values('101','W1ABC'),
34+
('102','WA2ABD')
35+
```
36+
37+
Make sure to add as many extensions as needed for your PBX.
38+
39+
40+
## Test the Scripts
41+
42+
Now you have everything installed and configured, let's try running the script.
43+
44+
Using your DMR ID run the following (making sure you are in the scripts folder):
45+
46+
Replace the following the command first:
47+
* ```myDMR```: your DMR ID. If you have multiple ones, just choose one, it does not matter.
48+
* ```test_ext```: If you are in Single user Mode, set this to 12345. If you are in Multi-User Mode, set this to an extension you added earlier.
49+
50+
```bash
51+
python3 dapnet_paging_gateway.py myDMR 8675309 test_ext
52+
```
53+
54+
You should get a page on your pager, or check Pi-Star, or check the DAPNET website and you should see a message to you formatted Simliar to ```N8ACL: Call me at 8675309``` but it should be your callsign.
55+
56+
If you get the message, you have everything configured correctly thus far.
57+
58+
Now it's time to [configure FreePBX/Asterisk](https://n8acl.github.io/dapnet_paging_gateway/configure_freepbx/).

docs/configure_freepbx.md

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Configure FreePBX/Asterisk
22

3-
Now that we have the scripts configured and the database built, the last step before we can run anything is to configure FreePBX and Asterisk.
3+
Now that we have the scripts configured and the database built, the last step before we are done is to configure FreePBX and Asterisk.
44

55
Note that you should already have a FreePBX/Asterisk instance installed and configured. That is outside the scope of this document/project. There are plenty of guides online to help you do that.
66

@@ -29,48 +29,18 @@ mkdir /var/lib/asterisk/sounds/custom/dapnet_gateway
2929

3030
cd dapnet_paging_gateway
3131

32-
cp /scripts/* /var/lib/asterisk/scripts/dapnet/*
32+
cp -R /scripts/* /var/lib/asterisk/scripts/dapnet/*
3333

3434
cp /sounds/dapnet_gateway/* /var/lib/asterisk/sounds/custom/dapnet_gateway/*
3535
```
3636

37-
Verify your work.
37+
Verify your work. Make sure all the scripts are in the Asterisk dapnet Scripts folder and that there is a directory called src with 4 scripts in it in the dapnet folder and the sounds are in the sounds folder and the
3838

3939
## Modify the extensions_custom.conf
4040

4141
Next, we need to modify the ```extensions_custom.conf``` file. Open that in your editor.
4242

43-
Next copy one of the following stanzas into that file:
44-
45-
If you are using the Single User script use:
46-
47-
```bash
48-
49-
;# // BEGIN DAPNET
50-
exten => 327638,1,Answer
51-
exten => 327638,n,Wait(1)
52-
exten => 327638,n,Set(TIMEOUT(digit)=8)
53-
exten => 327638,n,Set(TIMEOUT(response)=10)
54-
exten => 327638,n,Set(VOLUME(TX)=10)
55-
exten => 327638,n,Playback(/var/lib/asterisk/sounds/custom/dapnet_gateway/dpg_welcome)
56-
exten => 327638,n,Wait(1)
57-
exten => 327638,n,Playback(/var/lib/asterisk/sounds/custom/dapnet_gateway/dpg_enter_dmrid)
58-
exten => 327638,n,Set(VOLUME(TX)=0)
59-
exten => 327638,n,Read(RIC,beep,8)
60-
exten => 327638,n,Set(VOLUME(TX)=10)
61-
exten => 327638,n,Playback(/var/lib/asterisk/sounds/custom/dapnet_gateway/dpg_enter_callback)
62-
exten => 327638,n,Set(VOLUME(TX)=0)
63-
exten => 327638,n,Read(CALLBACK,beep,12)
64-
exten => 327638,n,System(python3 /var/lib/asterisk/scripts/dapnet/dapnet_paging_gateway.py ${RIC} ${CALLBACK})
65-
exten => 327638,n,Set(VOLUME(TX)=10)
66-
exten => 327638,n,Playback(/var/lib/asterisk/sounds/custom/dapnet_gateway/dpg_thank_you)
67-
exten => 327638,n,Wait(1)
68-
exten => 327638,n,Hangup
69-
;# // END DAPNET
70-
71-
```
72-
73-
If you are using the Multi User Script, use:
43+
Next copy the following stanza into that file:
7444

7545
```bash
7646
;# // BEGIN DAPNET
@@ -112,4 +82,4 @@ Now we need to tell FreePBX about this new extension. It will not pick it up aut
11282
* Click ```Submit```
11383
* Click ```Apply Changes```
11484

115-
Almost there. Now we can finally run everything.
85+
That should do it. Now we should be able to [send a page to a user](https://n8acl.github.io/dapnet_paging_gateway/using_the_gateway/).

docs/configure_mysql.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/configure_scripts.md

Lines changed: 42 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,55 @@
11
# Configure the Scripts
22

3-
Once you have your all the credentials you need, have cloned the repo and installed everything, you can now start configuring the scripts.
3+
Once you have your all the credentials you need, have cloned the repo and installed all the libraries, you now need to configuring the scripts.
44

5-
## Configure DAPNET.json
5+
## Configure config.json
66

7-
First, open the ```dapnet.json``` file in the editor of your choice.
7+
First, open the ```config.json``` file in the editor of your choice.
88

99
In this file you will see the following:
1010

1111
```json
1212
{
13-
"my_creds":
14-
{
15-
"username": "DAPNET USERNAME HERE",
16-
"password": "DAPNET PASSWORD HERE",
17-
"tx_group": "all"
18-
}
19-
}
13+
"dapnet": {
14+
"username": "DAPNET USER NAME",
15+
"password": "DAPNET PASSWORD",
16+
"tx_group": "all"
17+
},
18+
"database": {
19+
"rdbms_type": "DB SERVER TYPE",
20+
"credentials": {
21+
"username": "DB SERVER USERNAME",
22+
"password": "DB SERVER PASSWORD",
23+
"host": "FQDN or IP ADDRESS OF DB INSTANCE",
24+
"db": "DAPNET"
25+
}
26+
},
27+
"gateway_mode": 1
28+
}
2029
```
2130

22-
Put your DAPNET Username and Passwords into the correct fields and save the file and close it.
23-
24-
## Configure dapnet_callsign_data_load.py
25-
26-
Next, open the ```dapnet_callsign_data_load.py``` file in the editor of your choice. Scroll down till you find a section like so:
27-
28-
```python
29-
#############################
30-
##### Define Variables
31-
32-
# define mysql connection variables
33-
mysql_host = 'MYSQL HOST IP ADDRESS'
34-
mysql_user = 'MYSQL USERNAME'
35-
mysql_password = 'MYSQL PASSWORD'
36-
```
37-
38-
Enter the MySQL IP Address, Username and password as asked in the appropriate places. Do NOT change anything below the line marked:
39-
40-
```python
41-
#############################
42-
##### DO NOT CHANGE BELOW
43-
```
44-
45-
If you do, you will break your script. Remember the Disclaimer on the front page of the Wiki.
46-
47-
## Configure dapnet_paging_gateway_*.py
48-
49-
Next, open one of the paging gateway scripts files in the editor of your choice.
50-
51-
* If you want to set this up for just yourself, use ```dapnet_paging_gateway_su.py```
52-
* If you want to set this up for multiple people, use ```dapnet_paging_gateway_mu.py```
53-
54-
Scroll down till you find a section like so:
55-
56-
```python
57-
#############################
58-
##### Define Variables
59-
60-
# define mysql connection variables
61-
mysql_host = 'MYSQL HOST IP ADDRESS'
62-
mysql_user = 'MYSQL USERNAME'
63-
mysql_password = 'MYSQL PASSWORD'
64-
```
65-
66-
Just like with the callsign data loader, enter the MySQL IP Address, Username and password as asked in the appropriate places. Do NOT change anything below the line marked:
67-
68-
```python
69-
#############################
70-
##### DO NOT CHANGE BELOW
71-
```
72-
73-
If you do, you will break your script. Remember the Disclaimer on the front page of the Wiki.
31+
***Settings Definitions***:
32+
* ```dapnet``` - This section is your DAPNET Credentials
33+
* ```username```: This is your DAPNET Username, usually your callsign.
34+
* ```password```: This is your DAPNET Password.
35+
* ```tx_group```: This is the DAPNET tx_group to send the messages to. This is usually a regional setting. You will need to look this up on DAPNET to find out where the best place to send the messages is. Try to avoid the ```all``` group to keep from hitting every transmitter connected to DAPNET.
36+
* ```database``` - This section is your Database Server credentials.
37+
* ```rdbms_type```: This is the type of Database Server you are using.
38+
* Supported Types
39+
* ```mssql``` - MS SQL Server
40+
* ```mysql``` - MySQL/MariaDB
41+
* ```postgresql``` - PostgreSQL
42+
* ```sqlite``` - SQLite (built in Python DB)
43+
* ```credentials```: These are the credentials for your DB Instance
44+
* ```username```: Database Username
45+
* ```password```: Database Password
46+
* ```host```: FQDN or IP address of your Database Instance
47+
* ```db```: Always needs to be DAPNET - ***DO NOT CHANGE THIS***. If you change this, it will break things.
48+
* ```gateway_mode```: This is the mode that the gateway should work in. This defines whether it is in Single-User (personal) or Multi-User (many users like a Cloud PBX) mode.
49+
* ```1```: Single-User Mode
50+
* ```2```: Multi-User Mode
51+
52+
Make your settings changes and then save the file.
7453

7554
## Set Callsign Data load for automatic loading
7655

@@ -96,4 +75,4 @@ Because this can take a while to run, I would suggest setting up a cron job to r
9675

9776
This will fire my script every day at 2:00 am and do the data load then.
9877

99-
Next we need to configure FreePBX/Asterisk.
78+
Next we need to [configure the Database](https://n8acl.github.io/dapnet_paging_gateway/configure_database/).

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Yeah. This is a tricky question as there really is no straight answer. There are some ways to do this:
1717

1818
* First off, the easiest way is to ask the person you are wanting to send pages to.
19-
* If you are a DAPNET Subscriber yourself, you can login to the DAPNET website and do a search for the person. If they come up, they are a subscriber. However, they need to have everything setup and configured for it to go through.
19+
* If you are a DAPNET Subscriber yourself, you can login to the DAPNET website and do a search for the person. If they come up, they are a subscriber. However, they need to have everything setup and configured for the message to go through.
2020

2121
Otherwise, there really isn't a straight forward way
2222

0 commit comments

Comments
 (0)