开发者

IVR Programming Library for C#

I want to write a program that responds to calls. After a welcome message it must tell the client to: press 1 for enter your account number, or 2 for speak with an operator. If the client presses 1 then tell him or her to enter your account number and after he or she enters the account number the number开发者_Go百科 must saved in the database.

Is this possible in c#? If it is, I want an IVR library for c#. If not, I need a great IVR library for c++.


Microsoft has the Microsoft Speech API (SAPI) however if you want simple IVR it is better not to reinvent the wheel and customize an Asterisk implementation (which i guess falls under the "great IVR library for c++" category (it's c not c++ but if you know c++ you should be able to understand the c).) Using AsteriskNow you may not even need to write any custom code, it may do what you want already.


I don't know of a free IVR library for C#, but I do know of a couple that are fairly inexpensive:

http://www.voiceelements.com/

http://www.componentsource.com/products/velocity/index.html


Ricky from the Twilio crew here.

We have a tutorial on building an IVR with C#, taking a look at this may be helpful in getting an idea in how to build this type of application.

Whenever a phone call comes into our phone number, a request is made to our server where we can respond with some basic instructions, using TwiML, on what to do with the call:

        public TwiMLResult Welcome()
        {
            var response = new TwilioResponse();
            response.BeginGather(new {action = Url.Action("Show", "Menu"), numDigits = "1"})
                .Play("http://howtodocs.s3.amazonaws.com/et-phone.mp3", new {loop = 3})
                .EndGather();

            return TwiML(response);
        }

Since we're using the verb, when the user presses a digit a new HTTP request will be made to another route on our server where we can take action based on what digit(s) the user pressed:

    public TwiMLResult Show(string digits)
    {
        var selectedOption = digits;
        var optionActions = new Dictionary<string, Func<TwiMLResult>>()
        {
            {"1", ReturnInstructions},
            {"2", Planets}
        };

        return optionActions.ContainsKey(selectedOption) ?
            optionActions[selectedOption]() :
            RedirectWelcome();
    }

Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜