Skip to content

Phils Blog and Stuff

TELECOMS. VIRTUALIZATION. IT. CODING. and more…

Menu
  • Home
  • Resources
    • Subnet Mask Cheat Sheet
    • Easy Dmarc+Email
    • MX Tool Box
    • LOAD BALANCING & SRE
  • SHOP
  • SOLUTIONS
  • SERVICES
  • Contact Me
Menu

Simple Asterisk Phone System…

Posted on 10/03/201308/03/2023 by Phil

asterisk-by-digiumBelow I detail how to set up a basic asterisk dial plan with 2 extensions, a SIP Trunk provider, and incoming calls ringing both extensions.

in /etc/asterisk/sip.conf add:

[100] ; extension 100
username=100
secret=100
host=dynamic
nat=yes
type=friend
qualify=yes
context=phones

[101] ; extension 101
username=101
secret=101
host=dynamic
nat=yes
type=friend
qualify=yes
context=phones

[SIP-PROVIDER] ; Trunk to/from SIP Provider
type=friend
host=IP-OF-SIP-PROVIDER
port=5060
username=USERNAME-FOR-TRUNK
secret=PASSWORD-FOR-TRUNK
callerid=CLI
nat=yes
qualify=yes
dtmfmode=rfc2833
disallow=all
allow=g722
allow=alaw
allow=ulaw
allow=gsm
allow=ilbc
deny=0.0.0.0/0.0.0.0
permit=IP-OF-SIP-PROVIDER
context=from-pstn
language=en_GB

In /etc/asterisk/extensions.conf, add:

[to-pstn] ; Any number dialled with 9XXX will go out this trunk as xxxxx
exten => 9|X.,1,Dial(SIP/${EXTEN}@SIP-PROVIDER,1000)
exten => 9|X.,2,hangup

[from-pstn] ; Any Incoming call from the trunk should call both ext 100 & 101
exten = _X.,1,Dial(SIP/100&SIP/100,120)
exten = _X.,2,hangup

[phones] ; container for phones
exten = 100,1,Dial(SIP/100,120)
exten = 100,2,hangup
exten = 101,1,Dial(SIP/101,120)
exten = 101,2,hangup

include => to-pstn

reload asterisk

asterisk -rx "reload"

program some sip phones with the details above IE username=100, Password =100, IP=IP-OF-ASTERISK, and make calls.

POSTS

  • Home Assistant. Add water meter with PHP+MQTT+YML.
  • Automating your home with Home Assistant. Initial install and config (Hyper-V).
  • The importance of setting up email security correctly.
  • Automate Debian installations with Seed, DHCP and Nginx.
  • A simple link shortener.. Fun little project…

WORD CLOUD

3CX 3CX Phone System Apache Asterisk Cacti CentOS CRM DHCP DNS Email Fail over Failover File System Firewall FreeBSD FreeNAS FXO IAX install IP IP PBX Linux M0n0wall Nottingham Open Source PBX PFSense PHP Router Server SIP snom SSH TrixBox ubuntu VLAN Voice VoIP VPN vyatta WAN Website WiFi yealink ZFS

© 2025 Phils Blog and Stuff | Powered by Superbs Personal Blog theme