======FreePBX 17 and Asterisk on Virtual Box/OCI, Hams Over IP, Cisco SPA504G======
----
====Basic FreePBX 17 and Asterisk install====
====Virtual box setup====
NAT and Bridged required.
[[https://sangomakb.atlassian.net/wiki/spaces/FP/pages/295403538/Step+By+Step+Debian+12+Installationk|Debian 12 Install]]
Setup with opensource only switch. Much better!
==== Oracle Cloud Infrastructure PBX Server Setup====
# Copy down private key, store and set security on it
cd keys
sudo chmod 60 ssh-key-2025-07-19.key
# ssh on to cloud instance
sudo ssh -i ./keys/ssh-key-2025-07-19.key ubuntu@xx.xx.xx.xx
sudo apt update
sudo apt full-upgrade
sudo apt install nano
sudo apt install cron
sudo systemctl start cron
sudo systemctl enable cron
sudo apt install ufw
sudo apt install net-tools
===UFW install===
Revised to install UFW, use this instead of directly changing iptables
sudo ufw status
sudo ufw allow http
sudo ufw allow ssh
sudo ufw allow 5060:5061/udp
sudo ufw allow 10000:20000/udp
sudo ufw enable
===Asterisk / FreePBX on Ubuntu===
https://www.atlantic.net/vps-hosting/how-to-install-asterisk-and-freepbx-on-ubuntu/
===FreePBX Config===
Load User and other modules - Admin, Check Online, Select then process.
if you need to Unlock the admin page
sudo fwconsole unlock s231lcov0fbdsnhaiidchantu4 (highlighted PHP session text)
User Ext Setup
Had to change SIP port directly in asterisk - FreePBX ad restart did not work
sudo nano /etc/asterisk/sip_general_additional.conf
Revise
sudo nano /etc/php/*/apache2/php.ini
; Maximum amount of memory a script may consume
; https://php.net/memory-limit
memory_limit = 256M
SIP TCP Port Min: 560 - 580 updated
5081
===Asterisk Security===
https://computingpost.medium.com/secure-asterisk-and-freepbx-from-voip-fraud-and-brute-force-attacks-118af5b31e41
----
====Hams Over IP install====
https://hamsoverip.github.io/wiki/endpoints/hard_phones/cisco504g/
Manual provisioning following sign up email
Check in Advanced for HOIP EXT that SIP is over UDP
----
====Cisco SPA504G IP Phone====
===Firmware update for Cisco SPA504G IP Phone===
https://www.cisco.com/c/dam/en/us/td/docs/voice_ip_comm/csbpipp/ip_phones/user/guide/50X_sip_user_guide_source/500_SIP_user.pdf
https://software.cisco.com/download/home/282724650/type/282582477/release/7.5.6
Virtual box windows instance in network bridge mode then on same network as SPA.
7.5.2b then 7.6.2 then 7.6.2SR6 Using the firmware updater from each release.
SR7 did not have a firmware updater.
===Connect Ext 2 to Local Asterisk PBX===
UDP must be enabled. PBX on different IP so can use default port.
Ext 2 tab - Line enable AND Phone tab - Line key 2 enabled.
===Connect using a different SIP port===
In EXT change the SIP port and add the port number to the proxy address 141.147.xx.xx:portnumber
===Change background image on phone===
The picture need to be of a specific size. If size is not correct, it will not show up on your phone. 128 x 48 pixels and 1-bit Deep Convert any picture to this size using any graphic editing tool, then upload to a web server and use it's URL to set-up the picture on your SPA 504G.
===Tips and tricks===
https://wiki.hamshackhotline.com/doku.php?id=tt:tips.and.tricks:spare.line.key.functions
https://hamsoverip.github.io/wiki/endpoints/hard_phones/cisco504g/#make-a-test-call
===Reboot===
http://192.168.0.126/admin/reboot
===Spare ext 4 button - To send an HTTP request===
This might be the only (roundabout) way to get web interaction on the 504G.
From a Programmable Soft Key - Call a URL to perform a task, that returns an XML result. No support of HTML or RSS on the 504 phone.
The PHP example on this link is confusing/missing.
[[https://community.cisco.com/t5/voice-systems-and-accessories-small-business/programmable-soft-key-help-how-to-solved-answered/m-p/3274669]]
Setup on spare ext 4 button
fnc=xml;url=http://192.168.0.186/test.php;nme=TeaPlease!
PHP script
';
echo 'Tea Status';
echo 'Thanks!';
echo 'Your Tea Request Was Successful!';
echo '';
?>
Key thing is only Cisco "SPA50x" XML objects can be used for the reply.
The URL can be called directly - as above, or an XML file can be used to define the URL and handling of response.
The best "Doc" found so far. Obviously only a few of these XML objects apply to the older SPA50x.
[[https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cuipph/all_models/xsi/9-1-1/CUIP_BK_P82B3B16_00_phones-services-application-development-notes/CUIP_BK_P82B3B16_00_phones-services-application-development-notes_appendix_01011.html]]
===Enable SPA50x Debug===
SPA504G Configuration Utility
Voice, System, Optional Network Configuration
Syslog Server
sudo nano /etc/rsyslog.conf‎
include UDP/TCP
sudo service rsyslog restart
sudo tail -f /var/log/syslog
===Programmable Softkey for DTMF TX/RX===
TBA
----
====Using AllStar====
===Connecting===
https://freestar.network/connect/
Via HamShackHotline 94107
===10 Second Bleeps Off! - Thanks M7TLB and G5SRO===
SPA504G Configuration Utility
Advanced, Voice ,Text Message From 3rd Party: No, Text Message: No, No Text Alert: Yes, Submit all changes
===Configure Soft Key for DTMF TX RX===
*99 to key up and # to drop the key
[[https://help.webex.com/en-us/article/ny1ibtz/Programmable-softkeys-configuration]]
===Change colours and flashing of line LED's===
[[https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/csbpipp/ip_phones/administration/guide/frame_source/500-series-7-5-7/ip_phone_admin/LEDs.html]]
SPA504G Configuration Utility
Admin,Advanced,Voice,Phone
Switch off Line 1 LED
c=o