-
Notifications
You must be signed in to change notification settings - Fork 0
/
launchservices.sh
executable file
·47 lines (34 loc) · 1.18 KB
/
launchservices.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# get the $PHONE_NUMBER_ID in the .env file
source .env
get_ngrok_url() {
echo $(curl http://127.0.0.1:4040/api/tunnels | sed -nE 's/.*public_url":"(https:..[^"]*).*/\1/p')
}
updatwilio(){
url="$(get_ngrok_url)$1"
twilio phone-numbers:update $TWILIO_PHONE_NUMBER_ID --voice-url=$url
}
# Start NGROK in background
$NGROK_EXECUTABLE http 3000 &
sleep 4
echo ""
echo "--------------------------------------------"
echo "| STARTING MONGODB |"
echo "--------------------------------------------"
# Sleep while NGROK initializes a connection
sleep 1
echo "Please only type your password when ngrok has initialized the webhook URLs."
# Start MongoDB service
sudo systemctl start mongod
echo ""
echo "--------------------------------------------"
echo "| UPDATING TWILIO API WITH NGROK URL |"
echo "--------------------------------------------"
# Update the Twilio voice URL with the new NGROK link
updatwilio $WEBHOOK_PATH
echo ""
echo "--------------------------------------------"
echo "| NGROK PID |"
echo "--------------------------------------------"
# Display the PID of NGROK for convenience
ps ax | grep $NGROK_EXECUTABLE