...
Depending on the version of Asterisk that you are using, You may have two channels drivers that you could use in order to create a peer that you could use to place and receive calls
Digium SIP trunking with chan_sip
To configure Asterisk's older chan_sip-based SIP channel driver, to work with Digium's SIP Trunking service, you should configure two objects:
...
Here, in the sip peer object, we're setting our host to sip.digiumcloud.net, we're setting the default user and the fromuser options to our Digium username, secret is set to our Digium password, we've set an option called insecure to invite (because the Digium's SIP Trunking servers don't reverse authenticate when sending calls to you), we've enabled trustrpid and sendrpid for Caller ID forwarding, we've set the inbound Dialplan context to from-digium-siptrunk, we've explicitly disabled directmedia, and, by virtue of disallowing first, we've enabled the G.722, G.711 u-law and G.729a audio codecs (if you have purchase the G.729 codec license and have installed on your Asterisk system)
Asterisk Dialplan Configuration
Asterisk uses a configuration of numbers and patterns matched with specific actions, called dialplan, and configured in extensions.conf, typically located in /etc/asterisk in order to determine what to do with incoming calls. In order to complete your setup with Digium's SIP Trunking service, you will need to properly configure your Asterisk dialplan. To learn more about Asterisk's dialplan, please see the Dialplan wiki page, as well as its children, available on the Asterisk wiki.
...