How to create extensions in asterisk-pbx?

A SIP extension is configured in the SIP channel driver configuration file, called sip.conf. (This file resides in the Asterisk configuration directory, which is typically /etc/asterisk.)
Open sip.conf with your favorite text editor, scroll to the bottom of the file, and add a section for your extension. You’ll need to choose your own unique password for each account, and change the permit line to match the settings for your local network.

How to setup SIP trunks in Asterisk?

Edit sip.conf (/etc/asterisk/sip.conf) in your favourite editor and add the following example configuration: [didforsale_1] type=peer host= nat=no canreinvite=no disallow=all allow=ulaw allow=g729 dtmfmode=rfc2833 insecure=very context=from-trunk...