- Introduction
- VoIP Technology
- Ozeki VoIP SDK
- Developers Guide
- Softphone Development
- Basic softphone examples
- Build a softphone
- Register to a SIP PBX
- Ozeki VoIP SIP Softphone
- SIP encryption
- RTP encryption
- Ring a SIP extension
- Make a SIP voice call
- Multiple phone lines
- Voice via microphone
- Receive call via speaker
- Make conference call
- Play mp3 into call
- Use TextToSpeech
- MS Speech Platform 11
- Record voice call
- Accept incoming call
- Reject incoming call
- Bluetooth Headset
- Auto Answer
- Voice Recognition
- Forward incoming calls
- Blind Transfer
- Attended call transfer
- Do not Disturb
- Call holding
- Show message waiting
- Use DTMF signaling
- Work with SIP and SDP
- Work with RTP
- Make video calls
- Video codecs
- Google SpeechToText
- Google TextToSpeech
- Advanced examples
- Sound quality
- Direct calls among clients
- Manage NAT traversal
- Webphone Development
- Voice Recording
- IVR Development
- PBX Development
- Call Center Development
- VoIP CRM Integration
- Alert systems
- IP Camera
- Mobile phones and platforms
- Billing
- Tutorial
- Appendix
- FAQ
Ozeki brings you outstanding
SMS Gateway technology. Use our SMS Server products on Windows,Linux, or Android
C# SMS API
Developers can use our C# SMS API to send SMS from C#.Net. The C# SMS API comes with full source code
PHP SMS API
The ozeki PHP SMS gateway software can be used to send SMS from PHP and to receive SMS usig PHP on your website
SMPP SMS Gateway
SMS service providers use our SMPP gateway solution, that offers a high performance SMPP server and SMPP client gateway with amazing routing capabilities
How to manage multiple phone lines at the same time
![]() |
Download: | multiple-phone-lines.zip |
This article is a detailed guide about how to manage multiple phone lines when you use Ozeki VoIP SIP SDK. To use this example, you need to have Ozeki VoIP SIP SDK installed, and a reference to ozeki.dll should be added to your visual studio project. It's also recommended to visit the How to register to a SIP PBX article before you begin to study this functionality.
What is multiple phone lines mean? When is it needed?
Advanced VoIP communication has to include the support of multiple phone lines. (Figure 1) It's main advantage is that you can register to more than one VoIP Provider and you can even decide which one of these VoIP Providers you wish to use for the given calls. For instance, if a company has offices on different locations, at any of these locations, it will be possible to register then make calls as if you were at any of the different offices.
How to implement multiple phone lines using C#?
The phone line is directly connected to the SIP account you register to the PBX system. You can register more SIP accounts in your PBX and change them during the softphone runtime. In this case you can choose which line you wish to use for phone calls.
This example program handles two SIP accounts, therefore two phone lines can be used in it. The softphone function is similar in this example to the basic softphones, but there are some differences. The Softphone class stores the two registered phone line objects in phoneLine and phoneLineTwo properties.
Multiple phone line example in C#
using System; using System.Threading; using Ozeki.VoIP; namespace Multiple_phone_lines { class Program { static ISoftPhone softphone; // softphone object static IPhoneLine phoneLine; // phoneline object static IPhoneLine phoneLineTwo; // second phoneline object private static void Main(string[] args) { // Create a softphone object with RTP port range 5000-10000 softphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000); // SIP account registration data, (supplied by your VoIP service provider) var registrationRequired = true; var userName = "858"; var displayName = "858"; var authenticationId = "858"; var registerPassword = "858"; var domainHost = "192.168.115.100"; var domainPort = 5060; // Second SIP account registration data, (supplied by your VoIP service provider) var registrationRequiredTwo = true; var authenticationIdTwo = "859"; var userNameTwo = "859"; var displayNameTwo = "859"; var registerPasswordTwo = "859"; var domainHostTwo = "192.168.115.100"; var domainPortTwo = 5060; var account = new SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, domainPort); var accountTwo = new SIPAccount(registrationRequiredTwo, displayNameTwo, userNameTwo, authenticationIdTwo, registerPasswordTwo, domainHostTwo, domainPortTwo); // Send SIP regitration request RegisterAccount(phoneLine, account); RegisterAccount(phoneLineTwo, accountTwo); // Prevents the termination of the application while (true) Thread.Sleep(50); } static void RegisterAccount(IPhoneLine phoneLine, SIPAccount account) { try { phoneLine = softphone.CreatePhoneLine(account); phoneLine.RegistrationStateChanged += line_RegStateChanged; softphone.RegisterPhoneLine(phoneLine); } catch (Exception ex) { Console.WriteLine("Error during SIP registration: " + ex); } } static void line_RegStateChanged(object sender, RegistrationStateChangedArgs e) { if (e.State == RegState.NotRegistered || e.State == RegState.Error) Console.WriteLine("Registration failed!"); if (e.State == RegState.RegistrationSucceeded) { Console.WriteLine("Registration succeeded - Online!"); } } } }
Related Pages
More information
- How to build a softphone voip sip client
- Register to SIP PBX
- Voip softphone development
- How to encrypt voip sip calls with sip encryption
- How to encrypt voip sip calls with rtp encryption
- How to ring a sip extension csharp example for sip invite
- How to make a sip voice call using csharp
- How to send stream of voice data into call using csharp microphone
- How to receive voice from SIP voice call using csharp speaker
- How to make conference voice call using voip sip
- How to play an mp3 file into a voice call using csharp
- How to convert text to speech and play that into a call using csharp
- How to use Microsoft Speech Platform 11 for TTS and STT
- How to record voip sip voice call
- How to accept incoming call using csharp
- How to reject incoming call using csharp
- How to read Headset buttons using Bluetooth
- How to implement auto answer using csharp
- How to recognize incoming voice using speech to text conversion
- Voip forward call
- Voip blind transfer
- Voip attended transfer
- Voip do not disturb
- Voip call hold
- SIP Message Waiting Indication
- Voip DTMF signaling
- How to work with sip and sdp in voip sip calls
- How to work with rtp in voip sip calls
- How to make voip video calls in csharp
- Voip video codec
- Shows how to use SpeechToText Google API
- How to convert Text to Speech using C# and Google