Below 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.