How to add Voip features (ring group, virtual receptionist) into Cisco SIP PBX in C#?

P

PatientCarePro

Hi there,

We run a standard medical center and I we're planning to improve our VoIP based telephone system in order to build a more effective way of communication between nurses and patients.

We have an Cisco Unified CM PBX and we would like to add some new features into that.

The most important one is the 'virtual receptionist'. Its main objective would be the automated receiving of incoming calls. So it would play in different greetings for different time of the day allowing that calls get routed appropriately during the lunch hour, and it would manage call groups to route calls to the correct department properly.

To tell the truth I am not too experienced in VoIP development... I presume we will need a Voip toolset.

Now I'm there that I have found a Voip toolset (Ozeki Voip SDK - voip-sip-sdk.com) that is compatible with our Cisco Unified CM. By using the code example below I'm working on the implementation of an auto answer system. But I have no idea how to implement the ring group feature. I'm sure I was inattentive, but I kindly ask you please send me a short code snippet that helps me to get started with this ring group project!


Code:
namespace Auto_Answer
{
    class Program
    {
        static ISoftPhone mySoftphone;
        static IPhoneLine phoneLine;
        static IPhoneCall call;
 
        private static void Main(string[] args)
        {
            mySoftphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000, 5060);
 
            // SIP account registration data, (supplied by your VoIP service provider)    
            var registrationRequired = true;  
            var userName = "sipusername";
            var displayName = "sipdisplayname";
            var authenticationId = "authenticationid";
            var registerPassword = "password";
            var domainHost = "pbxip.voipprovider.com";
            var domainPort = 5060; 
 
            mySoftphone_Register(mySoftphone, registrationRequired, displayName, userName, authenticationId, registerPassword,
                             domainHost, domainPort);
            // prevents the termination of the application    
            while (true) Thread.Sleep(10);
        }
 
 
        static void mySoftphone_Register(ISoftPhone softphone, bool registrationRequired, string displayName, string userName,
        string authenticationId, string registerPassword, string domainHost, int domainPort)
        {
            try
            {
                var account = new SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, domainPort);
                var natConfiguration = new NatConfiguration(NatTraversalMethod.None);
                phoneLine = softphone.CreatePhoneLine(account, natConfiguration);
                softphone.IncomingCall += softphone_IncomingCall;   // subscribing to the event to get notified about incoming calls  
                phoneLine.PhoneLineStateChanged += mySoftphone_PhoneLineStateChanged;
                softphone.RegisterPhoneLine(phoneLine);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error during SIP registration: " + ex.ToString());
            }
        }
 
        // this method is being called, when an incoming call is being noticed  
        static void softphone_IncomingCall(object sender, VoIPEventArgs<IPhoneCall> e)
        {
            call = e.Item;  // initializes the call  
            call.CallStateChanged += call_CallStateChanged; // subscribes to the event to get notified about the call's states  
            call.CallErrorOccured += call_CallErrorOccured; // subscribes to the event to get notified about the errors during the call  
            call.Accept();  // accepts the call (sends back the 200 OK SIP message)  
        }
 
        private static void Auto_Answer_Method()    // implementation of the Auto Answerer's job goes here
        {
            Console.WriteLine("Auto Answer does its job."); // implement your task here
        }
 
        static void mySoftphone_PhoneLineStateChanged(object sender, VoIPEventArgs<PhoneLineState> e)
        {
            if (e.Item == PhoneLineState.RegistrationTimedOut || e.Item == PhoneLineState.RegistrationFailed)
                Console.WriteLine("Registration failed!");
 
            if (e.Item == PhoneLineState.RegistrationSucceeded || e.Item == PhoneLineState.NoRegNeeded)
                Console.WriteLine("Registration succeeded - Online!");
        }
 
 
        static void call_CallStateChanged(object sender, VoIPEventArgs<CallState> e)
        {
            Console.WriteLine("Call state: {0}.", e.Item);
            if (e.Item == CallState.Answered)
                Auto_Answer_Method();   // the call is being answered, the Auto Answerer can begin it's function
        }
 
 
        static void call_CallErrorOccured(object sender, VoIPEventArgs<CallError> e)
        {
            Console.WriteLine("Error occured during the call: {0}.", e.Item);
        }
    }  
}

(Soruce: voip-sip-sdk.com/p_354-how-to-implement-auto-answer-using-csharp-voip.html)

I?m looking forward to your solutions here or even in e-mail ([email protected])! Many thanks in advance!

Regards,
Cliff
 

Stijloor

Leader
Super Moderator
Re: How to add Voip features (ring group, virtual receptionist) into Cisco SIP PBX in

A Quick Bump!

Can someone help?

Thank you very much!!
 
Top Bottom