VoIP Cookbook: Attaching context

From OnnoWiki
Jump to navigation Jump to search

A context containing extensions can be incorporated into or associated with others. For example, consider the following context:

Context "default":
	Extension		Note
	101			Mark Spencer 
	102			Will Meadows 
	0			Operator 
Context "local": 
	Extension		Note
	_9NXXXXXX	Local calls 
	include => "default" 
Context "longdistance": 
	Extension		Note 
	_91NXXNXXXXXX	Long distance calls 
	include => "local" 

We have defined three extensions:

  • Operator. Default context allows us to dial 3 telephone extensions: Mark, Will and the operator
  • Local context has only one extension that allows us to dial 7-digit number. In addition, if we incorporate the default context into the local one, we can also dial Mark, Will and the operator.
  • The long distance context has an extension pattern allowing us to place a long distance call. This context also includes localcontext, and thus also allows us to call a local number or even the extension of Mark, Wil and the operator.

Using context in the extension, we can carefully regulate who can have access to a larger network. Be careful. If there is more than one pattern that match the dialed number, Asterisk may not use the numbers we want.

See Also