[Freeswitch-users] How to create IVR application in C#?

Yitzchok adminjew at gmail.com
Thu Mar 3 08:18:16 MSK 2011


I uploaded a while ago some helpers for Freeswitch in .net you can find it
on github @ https://github.com/Yitzchok/FreeSwitchUtilitiesDotNet


<https://github.com/Yitzchok/FreeSwitchUtilitiesDotNet>

public class VoiceQuestionnaireServiceSample : IAppPlugin
    {
        public ManagedSession Session { get; set; }
        private const string PhraseStart = "phrase:sample_ivr_";
        private const string InvalidAudioFile = PhraseStart + "invalid";
        private const string RecordLocation =
"/usr/local/freeswitch/recordings/";

        public void Run(AppContext context)
        {
            Session = context.Session;
            Session.Answer();
            Session.SetTtsParameters("flite", "kal");
            Session.sleep(1000, 0);

            var questionnaireService = new VoiceQuestionnaireService(
                                            Session, InvalidAudioFile,
                                            PhraseStart, RecordLocation);

            var phoneNumber = questionnaireService
                .AskAndVerifyQuestion(
                9, 11, 3, 10000, "#", "enter_phone_number",
                x => "you_entered_phone_number:" + x, "\\d+", _ => true);

            var nameRecordingFile = questionnaireService
                    .AskRecordAndVerifyQuestion(
                    "record_name", x => "verify_recording:" + x,
                    string.Format("{0}_{1}_{2}", Session.Uuid,
DateTime.UtcNow.ToString("MMddyyyy"), phoneNumber));

        }
    }

Hope this helps.

Yitzchok


On Thu, Mar 3, 2011 at 12:03 AM, Frankie Yiu <frankie.k.yiu at gmail.com>wrote:

> Hi Bob or anyone can help,
>
> I would like to know if you have used the function
> "switch_ivr_menu_init(*SWIGTYPE_ p_p_switch_ivr_menu*  new_menu,.......) "
> in your C# code?  If so, how did you call this function specially on the
> first parameter?  It crashes on me because on the C code side, it is a
> pointer to pointer type and if I just passed in a :
>
> *SWIGTYPE_ p_p_switch_ivr_menu*  new_menu = null;
>
> and it does not work, and there is no other way to initialize it, as I see
> it right now.
>
> Please let me know how to resolve this kind of problem (related to "*SWIGTYPE_
> p_p"* type).  Or is there other functions that I can use and get a new *switch_ivr_menu
> *type back?
>
> Thank you!!!
>
> Frankie
>
> ---------- Forwarded message ----------
>
>> From: Bob Coleman <bobc at devassert.com>
>> To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
>> Date: Wed, 2 Mar 2011 18:34:14 +1300
>> Subject: Re: [Freeswitch-users] How to create IVR application in C#?
>> Another easy way is to use mod event socket
>>
>> When you download the source, there is a libs/esl/managed folder that
>> has the ESL project for .NET
>>
>> You can use this wrapper to talk to FreeSWITCH and write an IVR app
>> without much trouble.
>>
>> The event socket route is really nice, I have built a complete windows
>> ivr stack using FreeSWITCH and help from the guys here, very reliable
>> and no maintenance.
>>
>> Bob
>>
>> On Wed, Mar 2, 2011 at 10:01 AM, Frankie Yiu <frankie.k.yiu at gmail.com>
>> wrote:
>> > Hi there,
>> >
>> > I am newbie to FreeSwitch and I have question about creating an IVR
>> > application in C#, with a possibly of using VoiceXML.  Could someone
>> please
>> > points me to how I can get started or any example that I can look at?
>> >
>>
>>
>>
>>
>>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110303/5bd72f14/attachment-0001.html 


More information about the FreeSWITCH-users mailing list