I am using the asl-say ip4 command to get my local eth and wifi addresses to be said over radio. What do i use to get the public ip4 address?
I intended to say public ip4 address
There’s an example on how to do just that using asl-tts
shown at ASL Text-to-Speech - AllStarLink Manual
I do it like this in the dialplan. (this is from a sub-menu)
How you reach the dialplan from a command is up to you.
[my-ip]
exten=s,1,Set(MYADDR=${CURL(https://api.ipify.org?format=json)})
exten=s,2,Wait,3
exten=s,3,SayAlpha(${MYADDR})
exten=s,4,Hangup
You can run this in your browser to see the data returned and will be played by allison carried by the var MYADDR.
https://api.ipify.org?format=json
Perhaps that is enough to get you to what you are building.
How to add DTMF commands on ASL3 to say your node’s LAN and WAN IP addresses, and turn WiFi on & off. (From this FB Post)
For nodes that have built-in WiFi but that do not have a screen, keyboard, Desktop GUI, etc. it can be useful to turn wifi on and off with a DTMF command. WiFi will generally be enabled by default when the node powers on, but when connecting an ethernet cable it is best to first disable WiFi so there are not then 2 IP addresses assigned which can greatly slow down networking. Or networking can be set up (as described in the AllScan How-To Guides) to have WiFi Off by default if you generally use wired ethernet, and in that case the below commands can be used to turn on WiFi when needed.
-
Add below under [functions] section in rpt.conf if not already there:
69 = autopatchup,context=my-ip,noct=1,farenddisconnect=1,dialtime=9000,quiet=1
-
Update below section in extensions.conf:
[my-ip]
; *690: Say LAN IP Address
exten => 0,1,AGI(getip.sh)
exten => 0,n,Wait(1)
exten => 0,n,SayAlpha(${result})
exten => 0,n,Hangup
; *691: Say WAN IP Address
exten => 1,1,Set(result=${CURL(https://api.ipify.org)})
exten => 1,n,Wait(1)
exten => 1,n,SayAlpha(${result})
exten => 1,n,Hangup
; *692: Turn Off Wi-Fi
exten => 2,1,AGI(wifidown.sh)
exten => 2,n,Wait(1)
exten => 2,n,Playback(/usr/share/asterisk/agi-bin/wifidisabled)
exten => 2,n,Hangup
; *693: Turn On Wi-Fi
exten => 3,1,AGI(wifiup.sh)
exten => 3,n,Wait(1)
exten => 3,n,Playback(/usr/share/asterisk/agi-bin/wifienabled)
exten => 3,n,Hangup
-
Create file /usr/share/asterisk/agi-bin/getip.sh with below lines and chmod file to 775:
#!/bin/bash
echo SET VARIABLE result *hostname -I*
*Note: Use backticks around hostname -I (this forum won’t show them in inline text) -
Create file /usr/share/asterisk/agi-bin/wifidown.sh with below lines and chmod file to 775:
#!/bin/bash
ifconfig mlan0 down
Note: “mlan0” is the name of the WiFi interface on Dell 3040’s. If you have some other MiniPC/RPi the name is probably different. See the How-To Guides at https://allscan.info/ for further details on how to set up WiFi. -
Create file /usr/share/asterisk/agi-bin/wifiup.sh with below lines and chmod file to 775:
#!/bin/bash
ifconfig mlan0 up
-
Update modules.conf following lines:
load => res_agi.so
load => res_speech.so
-
Install asl-tts by running the following commands:
sudo apt install asl3-tts
Test that it’s working by running the following:
sudo asl-tts -n [YOUR NODE#] -t 'AllStar is the hottest thing since sliced bread'
-
Create the wifi enabled/disabled audio files:
sudo asl-tts -n [YOUR NODE#] -t "WiFi enabled" -f /usr/share/asterisk/agi-bin/wifienabled
sudo asl-tts -n [YOUR NODE#] -t "WiFi disabled" -f /usr/share/asterisk/agi-bin/wifidisabled
Now restart Asterisk or reboot the node. The following commands can now be executed:
*690: Say LAN IP Address
*691: Say WAN IP Address
*692: Turn Off Wi-Fi
*693: Turn On Wi-Fi
These commands only affect the current power on session. WiFi will return to its default on or off state after a power cycle or reboot.