How to implement VoIP PBX Voice Mail using C#?

Ozeki VoIP SIP SDK provides professional technology to create a virtual PBX extension for voicemail purposes in your PBX system. Read this article and use the source codes to start implementing this solution efficiently.

What is Voicemail? How does it work?

Private Branch Exchange (PBX) systems are used for phone line establishment between communicating end points, regardless of wired, mobile or VoIP technology they use. The end points are registered to the PBX through a SIP account and are called extensions. The PBX can also have virtual extensions that are not attached to physical or software communication solutions but used for some special purposes.

Voicemail systems are designed to convey a caller's recorded audio message to a recipient. To do so they contain a user interface to select, play, and manage messages; a delivery method to either play or otherwise deliver the message; and a notification ability to inform the user of a waiting message.

The virtual extension definition needs some basic modification in the PBX class code. The main change is the usage of the extension container. This tool is needed for the virtual extension handling. When you got the extension handler provided by the Ozeki VoIP SIP SDK, you can add any virtual extensions to it with a specific SIP account.

When an extension does not answer a call, the PBX will redirect that to the Voicemail extension that automatically answers the call and records a voice message from the caller.

How to implement voicemail using C#?

The Voicemail is a virtual extension that needs to be defined in a class derived from the IExtension interface. The extension needs to handle the contact information as the system needs to know which extension wants to listen their messages or leave a message to the called party.

The actual voicemail calls are handled in separate classes. The call needs to be subscribed for the call state changed event that is implemented in the constructor of the class.

The event handler method of the call state change is implemented in the method. There are different cases that need to be handled in case of an incoming call (Ringing call state). In case of any problems like missing caller or callee data, the call is rejected.

The recorded audio file will be stored in a folder with the name of the called extension and the file name will contain the name of the caller.

PBX Voicemail example in C#

You can find a well-detailed step-by-step guide with an example at the Training chapter's Voicemail article. You can find there how to create a virtual voicemail extension, how to implement simple and advanced features of the application, how to handle different tasks an call states etc.


Related Pages

More information