如何将Voip功能(振铃组,虚拟接待员)添加到C#中的Cisco SIP PBX中? [英] How to add Voip features (ring group, virtual receptionist) into a Cisco SIP PBX in C#?

查看:126
本文介绍了如何将Voip功能(振铃组,虚拟接待员)添加到C#中的Cisco SIP PBX中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我们运营标准医疗中心,我们计划改进基于Voip的电话系统,以便建立更有效的方式护士与患者之间的沟通。



我们有 Cisco Unified CM PBX,我们想在其中添加一些新功能。最重要的是虚拟接待员。其主要目标是自动接收来电。所以它会在一天中的不同时间播放不同的问候语,允许在午餐时间内适当地路由呼叫,并且它将管理呼叫组以正确地将呼叫路由到正确的部门。



说实话我在VoIP开发方面经验不足......我认为我们需要一个Voip工具集。



现在我在那里我找到了与我们的Cisco Unified CM兼容的Voip工具集( Ozeki Voip SDK )。我用C#。 通过使用下面的代码示例,我正在研究自动应答系统的实现。但我不知道如何实现环组功能。我确定我不专心,但我请你们给我一个简短的代码片段,帮助我开始这个戒指小组项目!



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 a Cisco Unified CM PBX and we'd 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) that is compatible with our Cisco Unified CM. I use C#. 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!

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:http://voip-sip-sdk.com/p_354-how-to-implement-auto -answer-using-csharp-voip.html



我期待你的解决方案,甚至是电子邮件(cliff.bradshaw) @ hotmail.com)!非常感谢提前!



问候,

Cliff



(Soruce: http://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 (cliff.bradshaw@hotmail.com)! Many thanks in advance!

Regards,
Cliff

推荐答案

这篇关于如何将Voip功能(振铃组,虚拟接待员)添加到C#中的Cisco SIP PBX中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆