[Freeswitch-users] avmd from mod managed

Malay Thakershi mthakershi at gmail.com
Mon Mar 24 22:40:30 MSK 2014


Hi Jeff,

Hello all. Still not able to figure out avmd in C# managed code. Please
guide me.

1. My EventReceivedFunction takes only one argument (ev). There is a
compile time error in visual studio if I pass (ev,s). My
FreeSwitch.Managed.dll version is 1.0.5. Interesting thing is the
intellisense does show as if EventReceivedFunction takes two arguments as
you've shown. dtmf function works with two arguments.

2. Now, I look at examples on this page:
http://wiki.freeswitch.org/wiki/Mod_avmd
What is C# managed equivalent? My code:
                mObjMainSession.Answer();
                mObjMainSession.Execute("avmd", "start");
                mObjMainSession.DtmfReceivedFunction = (d, t) =>
                {
                    Log.WriteLine(LogLevel.Notice, aObjCntx.Session.uuid +
"-" + "Received {0} for {1}.", d, t);
                    return "";
                };

                if (check this is an outbound call)
                {
                    mObjMainSession.EventReceivedFunction = (ev) =>
                    {
                        Log.WriteLine(LogLevel.Notice,
aObjCntx.Session.uuid + "-" + "Event type {0} / Event body {2} .",
ev.GetEventType(), ev.GetBody());

                        if (mObjMainSession.GetVariable("avmd_detect") ==
"TRUE")
                        {
                            Log.WriteLine(LogLevel.Notice,
aObjCntx.Session.uuid + "-" + "VM detected");
                        }
                        return "";
                    };
                }

If "VM detected", what do I do? Just call hang up from
EventReceivedFunction?
Do I call "mObjMainSession.Execute("avmd", "stop");" anywhere?
Tutorial also says, one must wait a few seconds after answering the call
before starting avmd. What does that mean?
How do I find out load on CPU being put by avmd? I will be making 50
concurrent outbound calls.

3. Same managed code on my extension handles inbound (uses calling system)
as well as outbound calls (system calling users). Should I only
enable/check avmd when it is an outbound call?

Please help.

Thanks.


On Sun, Mar 6, 2011 at 11:07 AM, Jeff Lenk <jeff at jefflenk.com> wrote:

> Sure,
>
> Modify this sample out of demo.csx from the source tree. maybe enough here
> to get you started.
>
> using System;
> using FreeSWITCH;
> using FreeSWITCH.Native;
>
> public class AppDemo : IAppPlugin {
>
>     ManagedSession Session;
>     public void Run(AppContext context) {
>         Session = context.Session;
>         Session.Answer();
>         Session.DtmfReceivedFunction = (d, t) => {
>             Log.WriteLine(LogLevel.Notice, "Received {0} for {1}.", d, t);
>             return "";
>         };
>
>         Session.EventReceivedFunction = (ev, s) => {
>             return "";
>         };
>
> // add your stuff here
>
>         Log.WriteLine(LogLevel.Notice, "AppDemo is finishing its run and
> will now hang up.");
>         Session.Hangup("USER_BUSY");
>     }
>
> }
>
> --
> View this message in context:
> http://freeswitch-users.2379917.n2.nabble.com/avmd-from-mod-managed-tp6092621p6094692.html
> Sent from the freeswitch-users mailing list archive at Nabble.com.
>
> _______________________________________________
> 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/20140324/8cce1013/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list