Open Kezzy1996 opened 2 weeks ago
Lab 3.2 Building a PBX part II
Step 1: Configuring the extensions
Move the current file extensions.conf to extensions.conf.sample
mv extensions.conf extensions.conf.sample
Use your favorite editor to edit a new file /etc/asterisk/extensions.conf
[from-internal] exten=>6000,1,dial(SIP/zoiper,20) exten=>6001,1,dial(SIP/xlite,20)
After the configuration, type the following command in the Asterisk Console to reload the dialplan
CLI>dialplan reload
Step 2: Dial between phones
Now test a call between 6000 and 6001
Step 3: Dialing to the public network
Let's create a route in this exercise. Access the route by dialing "9" first
exten=>_9.,1,dial(SIP/siptrunk/${EXTEN:1},20,r)
Reload the dialplan again
CLI>dialplan reload
Test the route dialing 9 and any specific number
Step 4: Receiving calls from the operator
Now let's create some new contexts in the dialplan. The context globals should be the first context in the file. There you can create global variables. Then we will create a new context called [from-siptrunk], this context will be used to handle incoming calls.
[globals] OPERATOR=SIP/xlite [from-siptrunk] exten=9999,1,dial(${OPERATOR},20)
Step 4 - Testing incoming calls
To test incoming calls is a little harder. We will need to simulate an incoming call. I have in my server a click to call application. To generate an incoming call, go to:
Generate an incoming call from the page, it should ring your SIP phone.
Include your name and the extension you have registered (e.g Flavio 1010)
cd /etc/asterisk/ vi sip.conf [general] register=>1010:supersecret@sip.flagonc.com:5600/9999
[siptrunk] type=peer defaultuser=1010 remotesecret=supersecret port=5600 insecure=invite host=sip.flagonc.com fromuser=1010 fromdomain=sip.flagonc.com context=from-siptrunk
Step 5: Check the creation of the extensions and trunks using
sip reload sip show peers sip show registry