|
Page 4 of 4 Outgoing connections To allow users in the office to make an outgoing call, you must first add them to the outgoing context. To do this, edit extensions.conf, and under the [office] context, add include => outgoing. Now that telephone calls from the outside world can be delivered into the Asterisk controlled PBX network, there needs to be a method to allow the extensions in the office context to call out, perhaps to order a pizza. To do this, define a new context labeled "outgoing". This will ensure that outbound phone calls are separate in access from the rest of your dial plan. Figure D shows what the edits look like. This is different than what you've done so far. First, you're going to notice the underscore (_) before the context. The underscore tells Asterisk to match the extension against the pattern that is going to follow the underscore. The format for the pattern is simple, and contains attributes close to a lightweight implementation of regular expressions: - X references any digit from 0-9
- Z references any digit from 1-9
- N references any digit from 2-9
There are other matching methods also, but are closer to regular expressions pattern matching functionality. In the example, you can see that there is a dial plan for seven- and 10-digit telephone numbers, and the pattern should match any telephone number in the United States. The dial command uses the context variable ${EXTEN} which is the dialed extension that matches the pattern. The dial function dials the first group on the Zap channel we configured earlier and attempts to connect to the extension across that channel. At this point, the extension being dialed is an outside telephone number and an actual call is going to be made. As with any extension in Asterisk, you have complete control over the dial plan. So in this dial plan, if someone decides they want to dial a (900) adult phone line, the call will be immediately disconnected. Using the above matching methods, you can control who has access make long-distance phone calls, or create a process that requires a PIN number in order to make a long-distance call. That's it Now everything is put together. You've configured your Zaptel drivers, the Asterisk Zap channel, and modified the dial plan to allow incoming and outgoing telephone calls. Now you'll want to reload Asterisk by running /etc/init.d/asterisk restart. Alternatively, you can access the Asterisk console by running asterisk -vvvvcr on the command line and enter the restart gracefully command at the asterisk*CLI> prompt. The gracefully command will instruct Asterisk to wait until all open channels are closed before shutting down, and then start itself up again.
|