No edit summary |
|||
Line 2: | Line 2: | ||
The following page describes the step taken by one of the members to connect an asterisk installation running at home of the member to the instance that is running @ nurdspace | The following page describes the step taken by one of the members to connect an asterisk installation running at home of the member to the instance that is running @ nurdspace | ||
= | = Requirements = | ||
There are various things you need in order to get this working: | |||
* Some networked machine or vm on which you can run Asterisk | |||
* A [[Asterisk#Getting_Access|SIP account]] in the NURDspace asterisk server | |||
* A [[Wireguard|VPN tunnel]] that links your server to the NURDspace network | |||
To make the setup more interesting, you can get 1/more free SIP phones from NURDspace which you can hookup to your local network. | |||
= Demo setup = | |||
At home I run a setup using the following. | |||
* OS: OpenBSD 7.1 | * OS: OpenBSD 7.1 | ||
* Asterisk: 18.x | * Asterisk: 18.x | ||
Configuration of asterisk is relatively straightforward. Install the package, and modify the below two files. | |||
= pjsip.conf = | == pjsip.conf == | ||
This file is used to configure the SIP driver. SIP is the main (only) transport that will be used here, both to provide in-home telephony, but also to phone with the NURDspace asterisk setup. | |||
; ========================= | |||
; Primary transport | |||
; | |||
; It is also possible to configure (mutual) TLS encrypted+authenticated links, but this is out of scope | |||
; | |||
[transport-udp] | [transport-udp] | ||
type = transport | type = transport | ||
protocol = udp | protocol = udp | ||
bind = 0.0.0.0 | bind = 0.0.0.0 | ||
; ========================= | |||
; NURDspace trunk | |||
; | |||
; This is the 'dialin' account that your asterisk instance will use to login to the NURDspace asterisk | |||
; instance (running at 10.208.11.13). | |||
; | |||
[nurdspace-trunk] | |||
type = registration | |||
transport=transport-udp | |||
outbound_auth = nurdspace-trunk-auth | |||
server_uri = sip:10.208.11.13 | |||
client_uri = sip:r3boot@10.208.11.13 | |||
retry_interval = 5 | |||
[nurdspace-trunk-auth] | |||
type = auth | |||
auth_type = userpass | |||
username = yourusername | |||
password = PASSWORD_HERE | |||
realm = asterisk | |||
; ============================ | |||
; NURDspace endpoint | |||
; | |||
; This is the endpoint which is used to map extensions to. By adding '@nurdspace' to an extension, you can | |||
; use this endpoint to forward the calls towards that endpoint | |||
; | |||
[nurdspace] | |||
type=endpoint | |||
transport=transport-udp | |||
context = phones | |||
allow = !all,g722,ulaw | |||
outbound_auth = nurdspace-auth | |||
aors = nurdspace-aor | |||
direct_media = no | |||
[nurdspace-auth] | |||
type = auth | |||
auth_type = userpass | |||
username = YOUR_MEMBER_USERNAME | |||
password = PASSWORD_HERE | |||
realm = asterisk | |||
[nurdspace-aor] | |||
type = aor | |||
contact = sip:10.208.11.13 | |||
[nurdspace-identify] | |||
type=identify | |||
endpoint = nurdspace | |||
match = 10.208.11.13 | |||
; ================== | ; ================== | ||
; Mitel 6865i | ; Mitel 6865i Desk Phone | ||
; | ; | ||
; | ; This is a physical SIP phone. By convention, these are registered using their MAC addresses. Do | ||
; not bind this phone to an extension / user, since this is done using extensions.conf. | |||
; | ; | ||
[00085DAABBCC] | [00085DAABBCC] | ||
Line 29: | Line 98: | ||
type=auth | type=auth | ||
auth_type=userpass | auth_type=userpass | ||
password= | password=PASSWORD_HERE | ||
username=00085DAABBCC | username=00085DAABBCC | ||
Line 37: | Line 106: | ||
; ================== | ; ================== | ||
; | ; Softphone | ||
; | ; | ||
; | ; This is a SIP account which can be used by a SIP client running on your phone or laptop | ||
; | ; | ||
[ | [softphone] | ||
type=endpoint | type=endpoint | ||
transport=transport-udp | transport=transport-udp | ||
Line 47: | Line 116: | ||
disallow=all | disallow=all | ||
allow=ulaw | allow=ulaw | ||
auth= | auth=softphone | ||
aors= | aors=softphone | ||
[ | [softphone] | ||
type=auth | type=auth | ||
auth_type=userpass | auth_type=userpass | ||
password= | password=PASSWORD_HERE | ||
username= | username=USERNAME_OF_SOFTPHONE | ||
[ | [softphone] | ||
type=aor | type=aor | ||
max_contacts=1 | max_contacts=1 | ||
== extensions.conf == | |||
In this file you map extensions (numbers you can dial on your PBX) to destinations (SIP endpoints). It uses this ... weird programming language | |||
and it is somewhat flexible in what it can do. This is where you build IVR menus. | |||
[general] | [general] | ||
; Define global variables | |||
[globals] | [globals] | ||
r3boot_DeskPhone = PJSIP/00085DAABBCC | |||
r3boot_SoftPhone = PJSIP/softphone | |||
; Default extensions that came with asterisk | |||
[default] | |||
exten => *99,1,VoiceMailMain(${FILTER(0-9,${CALLERID(NUM)})}) | |||
exten => *98,1,Answer() | |||
exten => *98,n,ConfBridge(*98,c,M) | |||
exten => _XXX,1,Dial(SIP/${FILTER(0-9,${EXTEN})},12,tr) | |||
exten => _XXX,n,Voicemail(${FILTER(0-9,${EXTEN})}) | |||
exten => _XXX,n,Hangup | |||
[phones] | [phones] | ||
exten => 100,1,Dial(${ | ; ====================== | ||
exten => 101,1,Dial(${ | ; The following are extensions that are configured in my own house | ||
; 100 - Deskphone | |||
; 101 - A softphone I run on my mobile | |||
; 200 - Play a hello world sample for testing purposes | |||
; | |||
; r3boot deskphone | |||
exten => 100,1,NoOp() | |||
same => n,Dial(${r3boot_DeskPhone}, 10) | |||
same => n,HangUp() | |||
; r3boot softphone | |||
exten => 101,1,NoOp() | |||
same => n,Dial(${r3boot_SoftPhone}, 10) | |||
same => n,HangUp() | |||
exten => 200,1,Answer() | ; Test extension | ||
exten => 200,1,NoOp() | |||
same => n,Answer(.25) | |||
same => n,Playback(hello-world) | same => n,Playback(hello-world) | ||
same => n,Hangup() | same => n,Hangup() | ||
; ====================== | |||
; The following extensions are mapped to various extensions at NURDspace | |||
; | |||
; 666 - Flok | |||
; 1900 - Boots | |||
; 1111 - Flok | |||
; 2222 - NURDspace radio | |||
; 2223 - Skip naar de volgende track op NURDspace radio | |||
; 2992 - Flok | |||
; 4001 - Bar | |||
; 4200 - buZz | |||
; 4222 - Rookhok | |||
; 4300 - Niz | |||
; 4333 - Studio | |||
; 4500 - Boots | |||
; 4666 - Zaal 1 | |||
; 4667 - Zaal 3 | |||
; 4700 - r3boot | |||
; 4701 - r3boot | |||
; 9999 - Party Line | |||
; | |||
; Bar | |||
exten => 4001,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Rookhok | |||
exten => 4222,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Studio | |||
exten => 4333,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Zaal 1 | |||
exten => 4666,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Zaal 3 | |||
exten => 4667,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Party line | |||
exten => 9999,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; play hold music | |||
exten => 2222,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; skip mpd | |||
exten => 2223,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; buZz | |||
exten => 4200,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; boots | |||
exten => 1990,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
exten => 4500,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Niz | |||
exten => 4300,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; r3boot deskphone | |||
exten => 4700,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; r3boot softphone | |||
exten => 4701,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Flok 1 | |||
exten => 1111,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Flok 2 | |||
exten => 2992,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
; Flok 3 | |||
exten => 666,1,NoOp() | |||
same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) | |||
same => n,HangUp() | |||
= Verification that things are working = | = Verification that things are working = |
Revision as of 21:34, 16 August 2022
Introduction
The following page describes the step taken by one of the members to connect an asterisk installation running at home of the member to the instance that is running @ nurdspace
Requirements
There are various things you need in order to get this working:
- Some networked machine or vm on which you can run Asterisk
- A SIP account in the NURDspace asterisk server
- A VPN tunnel that links your server to the NURDspace network
To make the setup more interesting, you can get 1/more free SIP phones from NURDspace which you can hookup to your local network.
Demo setup
At home I run a setup using the following.
- OS: OpenBSD 7.1
- Asterisk: 18.x
Configuration of asterisk is relatively straightforward. Install the package, and modify the below two files.
pjsip.conf
This file is used to configure the SIP driver. SIP is the main (only) transport that will be used here, both to provide in-home telephony, but also to phone with the NURDspace asterisk setup.
; ========================= ; Primary transport ; ; It is also possible to configure (mutual) TLS encrypted+authenticated links, but this is out of scope ; [transport-udp] type = transport protocol = udp bind = 0.0.0.0 ; ========================= ; NURDspace trunk ; ; This is the 'dialin' account that your asterisk instance will use to login to the NURDspace asterisk ; instance (running at 10.208.11.13). ; [nurdspace-trunk] type = registration transport=transport-udp outbound_auth = nurdspace-trunk-auth server_uri = sip:10.208.11.13 client_uri = sip:r3boot@10.208.11.13 retry_interval = 5 [nurdspace-trunk-auth] type = auth auth_type = userpass username = yourusername password = PASSWORD_HERE realm = asterisk ; ============================ ; NURDspace endpoint ; ; This is the endpoint which is used to map extensions to. By adding '@nurdspace' to an extension, you can ; use this endpoint to forward the calls towards that endpoint ; [nurdspace] type=endpoint transport=transport-udp context = phones allow = !all,g722,ulaw outbound_auth = nurdspace-auth aors = nurdspace-aor direct_media = no [nurdspace-auth] type = auth auth_type = userpass username = YOUR_MEMBER_USERNAME password = PASSWORD_HERE realm = asterisk [nurdspace-aor] type = aor contact = sip:10.208.11.13 [nurdspace-identify] type=identify endpoint = nurdspace match = 10.208.11.13 ; ================== ; Mitel 6865i Desk Phone ; ; This is a physical SIP phone. By convention, these are registered using their MAC addresses. Do ; not bind this phone to an extension / user, since this is done using extensions.conf. ; [00085DAABBCC] type=endpoint transport=transport-udp context=phones disallow=all allow=ulaw auth=00085DAABBCC aors=00085DAABBCC [00085DAABBCC] type=auth auth_type=userpass password=PASSWORD_HERE username=00085DAABBCC [00085DAABBCC] type=aor max_contacts=1 ; ================== ; Softphone ; ; This is a SIP account which can be used by a SIP client running on your phone or laptop ; [softphone] type=endpoint transport=transport-udp context=phones disallow=all allow=ulaw auth=softphone aors=softphone [softphone] type=auth auth_type=userpass password=PASSWORD_HERE username=USERNAME_OF_SOFTPHONE [softphone] type=aor max_contacts=1
extensions.conf
In this file you map extensions (numbers you can dial on your PBX) to destinations (SIP endpoints). It uses this ... weird programming language and it is somewhat flexible in what it can do. This is where you build IVR menus.
[general] ; Define global variables [globals] r3boot_DeskPhone = PJSIP/00085DAABBCC r3boot_SoftPhone = PJSIP/softphone ; Default extensions that came with asterisk [default] exten => *99,1,VoiceMailMain(${FILTER(0-9,${CALLERID(NUM)})}) exten => *98,1,Answer() exten => *98,n,ConfBridge(*98,c,M) exten => _XXX,1,Dial(SIP/${FILTER(0-9,${EXTEN})},12,tr) exten => _XXX,n,Voicemail(${FILTER(0-9,${EXTEN})}) exten => _XXX,n,Hangup
[phones] ; ====================== ; The following are extensions that are configured in my own house ; 100 - Deskphone ; 101 - A softphone I run on my mobile ; 200 - Play a hello world sample for testing purposes ; ; r3boot deskphone exten => 100,1,NoOp() same => n,Dial(${r3boot_DeskPhone}, 10) same => n,HangUp() ; r3boot softphone exten => 101,1,NoOp() same => n,Dial(${r3boot_SoftPhone}, 10) same => n,HangUp() ; Test extension exten => 200,1,NoOp() same => n,Answer(.25) same => n,Playback(hello-world) same => n,Hangup() ; ====================== ; The following extensions are mapped to various extensions at NURDspace ; ; 666 - Flok ; 1900 - Boots ; 1111 - Flok ; 2222 - NURDspace radio ; 2223 - Skip naar de volgende track op NURDspace radio ; 2992 - Flok ; 4001 - Bar ; 4200 - buZz ; 4222 - Rookhok ; 4300 - Niz ; 4333 - Studio ; 4500 - Boots ; 4666 - Zaal 1 ; 4667 - Zaal 3 ; 4700 - r3boot ; 4701 - r3boot ; 9999 - Party Line ; ; Bar exten => 4001,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Rookhok exten => 4222,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Studio exten => 4333,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Zaal 1 exten => 4666,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Zaal 3 exten => 4667,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Party line exten => 9999,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; play hold music exten => 2222,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; skip mpd exten => 2223,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; buZz exten => 4200,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; boots exten => 1990,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() exten => 4500,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Niz exten => 4300,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; r3boot deskphone exten => 4700,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; r3boot softphone exten => 4701,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Flok 1 exten => 1111,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Flok 2 exten => 2992,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp() ; Flok 3 exten => 666,1,NoOp() same => n,Dial(PJSIP/${EXTEN}@nurdspace, 10) same => n,HangUp()
Verification that things are working
Check SIP transports
pjsip show transports
Check SIP endpoints
pjsip show endpoints