How to send action with AsterNET, C#?

835 views Asked by At

I'm working with AsterNET and C#, I need to get the status of all the extensions, specifically the result of Action: ExtensionStateList but the library doesn't have this action, I'm trying to create it but I can't get it. I hope someone can guide me. Attached is the code.

    ResponseEvents re;
    try
    {
        re = manager.SendEventGeneratingAction(new ExtensionStateListAction());
    }
    catch (EventTimeoutException e)
    {
        re = e.PartialResult;
    }
    foreach (ManagerEvent e in re.Events)
    {
        foreach (KeyValuePair<string, string> d in e.Attributes)
        {
            Console.WriteLine(e);
        }
    }

using System;
using AsterNET.Manager.Event;
namespace AsterNET.Manager.Action
{
    public class ExtensionStateListAction : ManagerActionEvent
    {

        public override string Action
        {
            get { return "ExtensionStateList"; }
        }

        public override Type ActionCompleteEventClass()
        {
            return typeof (ExtensionStateListCompleteEvent);
        }
    }
}

namespace AsterNET.Manager.Event
{
    public class ExtensionStateListCompleteEvent : ResponseEvent
    {
        private int listItems;

        public int ListItems
        {
            get { return this.listItems; }
            set { this.listItems = value; }
        }

        public ExtensionStateListCompleteEvent(ManagerConnection source) 
            : base(source)
        {
        }
    }
}
1

There are 1 answers

0
arheops On BEST ANSWER

Result of this command will come in set of events "ExtensionState" and final "ExtensionStateCompleate"

It will be asyncronous.

You should setup event listener and parse that.