Ozeki VoIP SDK - Product Guide
Developers Guide
VoIP PBX Dial Plans
Explanation
Prerequisities
Ozeki VoIP SIP SDK makes it possible to include remarkable functions into your PBX system such as VoIP PBX dial planning. This article explains how you can define call routing rules in your PBX system when you use Ozeki SIP SDK.
![]() |
Download: | 03_CustomDialplan.zip |
Introduction
Please be informed that PBX development support is available in Ozeki VoIP SIP SDK from version 10.0. You can download the latest Ozeki SIP SDK version from the download page.
A Private Branch Exchange (PBX) establishes phone lines between communication hardware and software through SIP account registration and SIP messages. The basic communication is done between two end-points, however, calling methods can be extended to make them more sophisticated.
This example program shows how you can define call routing rules in a PBX system. Ozeki VoIP SIP SDK provides all the background and tools for implementing PBX functionalities. If you wish you can redefine any PBX behavior to customize the program according to your needs.
The default dialing protocol of a PBX is that if an end point calls a certain number, the end point attached to that number will ring. This is implemented in Ozeki VoIP SIP SDK. If you want to use some other rules, for example, you want to ring more than one end point at the same time, you need to override some methods in your PBX program. The following code shows how to do so.
The following program code uses the background support of Ozeki VoIP SIP SDK, therefore you will need to download and install the SDK on your computer before starting to use the program code. You will also need to have Visual Studio 2010 or compatible IDE and .NET Framework installed on your system, as the program code below is written in C# language.
The PBX project in this example program is a console application just like the previous ones and it also uses Ozeki VoIP SIP SDK as a reference.
This example project consists of two classes, one for the actual PBX and another for the dial plan. The PBX class is basically the same as in the default sample program introduced in the Simple PBX implementation article, it is only extended with three code lines.
For the dial plan settings, you need to extend the PBX class with a new using line that is the 3rd line in Code 1. This namespace contains the tools for the call managers and the dial plan providers that are neccessary for this example.
using Ozeki.Network; using Ozeki.VoIP.PBX; using Ozeki.VoIP.PBX.Services;
Code 1 - The dial plan settings need a new namespace to use
The dial plan setting needs a new object in the PBX class that is a call manager (Code 2). The Ozeki VoIP SIP SDK provides a default implementation for this tool and this example program will use that implementation, you only need to create a new object from that class.
The call manager works with the actual dial plans. The SDK provides default dial plans too, but in this case, the example program redefines that behavior. For this purpose you need to call the SetDialplanProvider method of the call manager and give a dial plan provider object as a parameter. The dial plan provider is the other class defined in this example project that redefines the standard dial plan behavior of Ozeki SIP SDK.
The call manager and dial plan provider settings need to be done in the OnStart method of the PBX class. These two code lines are the only change in the default PBX implementation in this class.
protected override void OnStart()
{
Console.WriteLine("PBX started.");
SetListenPort(TransportType.Udp, 5060);
var callManager = GetService<ICallManager>();
callManager.SetDialplanProvider(new MyDialplanProvider());
...
Console.WriteLine("Listened port: 5060(UDP)");
base.OnStart();
}
Code 2 - The OnStart method needs to be extended with two lines
When defining a dial plan provider, you need to use the namespaces shown in Code 3. These using lines ensure that you will not have to label the tools you use in the dial plan provider class.
using Ozeki.VoIP; using Ozeki.VoIP.PBX; using Ozeki.VoIP.PBX.PhoneCalls; using Ozeki.VoIP.PBX.RoutingRules; using Ozeki.VoIP.SDK.RoutingRules;
Code 3 - Namespaces to use for the dial plan definition
The dial plan behavior is defined in the Ozeki VoIP SIP SDK by the IDialplanProvider interface. Ozeki VoIP SIP SDK provides a professional implementation of this behavior that rings the number you called. There is a possibility to extend this behavior: you need to write a class derived from this interface (Code 4).
class MyDialplanProvider : IDialplanProvider
Code 4 - The dial plan provider implements an SDK inbuilt interface
In the dial plan provider class you only need to redefine a single method that sets the dial plan rules. In this example the dial plan will be a simple one that will ensure that when you call the extension "200", the extensions in range 100 to 109 will ring at the same time.
Code 5 shows how you can define the dial plan rules. In case you want to call more than one extension at the same time, you need to set a group routing rule in the GetRoutingRule method. The group routing rule is a set of single routing rules as you can see in the code.
The group routing rule can be set to call the group at the same time or even one after the other. These rules can be set as complex as you wish, this example program only demonstrates a simple dial plan.
public RoutingRule GetRoutingRule(ISIPCall caller, DialInfo callee, SingleRoutingRule.CalleeState calleeState)
{
if(calleeState != SingleRoutingRule.CalleeState.Calling)
return null;
if (callee.UserName == "200")
{
var groupRoutingRule = new GroupRoutingRule(RingingStrategy.RingAll);
for (int i = 0; i < 10; i++)
{
var singleRoutingRule = new SingleRoutingRule(string.Format("10{0}", i), 30);
groupRoutingRule.AddRule(singleRoutingRule);
}
return groupRoutingRule;
}
return new SingleRoutingRule(caller.OtherParty.UserName);
}
Code 5 - Setting the dial plan for the PBX
At this point your PBX system is ready to use with a custom dial plan setting. Now you can see the concept for defining dial plans in the PBX and you can write you own solution with the call routing rules you need using Ozeki SIP SDK.
If you have any question or need assistance, please contact us at info@voip-sip-sdk.com
You can select a suitable Ozeki VoIP SIP SDK license for PBX development on licensing information page
Related Pages
- Overview for PBX development: PBX development guides
- Setup Ozeki VoIP SIP SDK in minutes with the Quick start guide
- Download Ozeki VoIP SIP SDK form the Ozeki VoIP SIP SDK download page
- You can find licensing information of Ozeki VoIP SIP SDK on Pricing and licensing information page
| Operating system: | Windows 8, Windows 7, Vista, 200x, XP |
| System memory: | 512 MB+ |
| Free disk space: | 100 MB+ |
| Development environment: | Visual Studio 2010 (Recommended), Visual Studio 2008, Visual Studio 2005 |
| Programming language: | C#.NET |
| Supported .NET framework: | .NET Framework 4.5, .NET Framework 4.0, .NET Framework 3.5 SP1 |
| Software development kit: | OZEKI VoIP SIP SDK(Download) |
| VoIP connection: | 1 SIP account |
INTERMEDIATE
VoIP technology walkthrough
Softphone development
Webphone development
Mobile development
Voice recording
GETTING AROUND
Sitemap
Search the manual
API documentation
FAQ
Appendix


