# Asterisk basic sever

Features
* Calling other connected/internal phones
* Extension that plays an audio message
* Extension that sends a http request (Node-Red for example) and plays an audio message
* Extension that forwards the call the the Homeassistent 'Assistent' 
* Extension with a IVR menu that will send the chosen option as a http request (Node-Red for example) and  plays an audio message


## Installing Packages
**Alpine Linux**

```
apk add asterisk asterisk-curl asterisk-opus asterisk-sounds-en asterisk-sounds-moh asterisk-speex asterisk-tds
```

## Configuring
(Re)move the default asterisk config (`/etc/asterisk`).  
Download the config files from here [Here](../Config-Examples/Asterisk-basic-server) and put them in the config directory `/etc/asterisk`.  
Set the permissions `chown -R asterisk: /etc/asterisk`.  
Edit the configuration files to suit your needs,  
make sure to change the credentials, and check the module list 

**Alpine Linux**
```
chown -R asterisk: /etc/asterisk
rc-update add asterisk
service asterisk start
```

# Asterisk bluetooth bridge
[Source](https://hotkey404.com/connect-your-phone-to-raspbx-via-bluetooth-with-chan_mobile/)  
Features
* Bridge a mobile phone to a voip phone/pbx


## Installing Packages
**Alpine Linux**

```
apk add asterisk asterisk-opus asterisk-mobile udev bluez hidapi
```

## Configuring
(Re)move the default asterisk config (`/etc/asterisk`).  
Download the config files from here [Here](../Config-Examples/Asterisk-BT_bridge) and put them in the config directory `/etc/asterisk`.  
Set the permissions `chown -R asterisk: /etc/asterisk`.  
Edit the credentials for your (soft)phone in `/etc/asterisk/pjsip.conf`  
Pair the phone using `bluetoothctl`
Edit the phone and adapter bluethooth mac address  in `/etc/asterisk/chan_mobile.conf`  
(Re)start Asterisk 
Connect to Asterisk CLI `asterisk -r`  
Make sure the phone is discoverable/in pairing mode  
In Asterisk CLI run `mobile search`  
Change the port to the port from mobile scan in `/etc/asterisk/chan_mobile.conf`  
Restart Asterisk 

**Alpine Linux**
```
chown -R asterisk: /etc/asterisk
modprobe btusb
modprobe uhid
rc-update add asterisk
rc-update add bluetooth
service asterisk start
```  

**bluetoothctl**
```
#Open the bluetoothCLI
bluetoothctl
scan on
pair <Mac Of phone>
```