Last Updated on 2015-10-23.
Unfortunately, there is not much documentation regarding the AsterNet library, so the code snippet below might help someone who simply wants to abort an incoming or outgoing call, e.g. via a C# .Net button.
Basically this is quite simple, you only have to remember the current channel ID; it is not enough to create a HangupAction with your SIP number as parameter.
In your constructor method, create “global” ManagerConnection instance. Example:
private ManagerConnection manager = null;
        private void Connect()
        {            
            manager = new ManagerConnection(Properties.Settings.Default.host, Properties.Settings.Default.port, Properties.Settings.Default.user, Properties.Settings.Default.pw);
            manager.NewChannel += manager_NewChannel;
            manager.PingInterval = 0;
                                  
            try
            {
                manager.Login();
            }
            catch (Exception ex)
            {
                manager.Logoff();
            }
        }
Handle manager.NewChannel event (replace “userrow.number” with the personal number of the current user, you might get it via Active Directory or your preferred user database):
private String curChannel;
void manager_NewChannel(object sender, AsterNET.Manager.Event.NewChannelEvent e)
        {
            if (e.CallerIdNum != userrow.number)
                return;
            curChannel = e.Channel;
            
        }
Create a button and handle the Click event:
private void buttonDrop_Click(object sender, EventArgs e)
        {            
            if (curChannel == null)
                return;
            
            HangupAction action = new HangupAction(curChannel);
            manager.SendAction(action);
        }
 
Hi All,
Hope you are doing great.
I am new for PBX integration so sorry in advance if I ask basic/stupid question.
I am going to develop a [predictive dialer](https://en.wikipedia.org/wiki/Predictive_dialer) for [yeastar MyPbx U520](http://www.yeastar.com/Products/MyPBX-U5-Series) that will handle around 30 Agents using AsterNET but my problem is that I don’t have IP PBX Server hardware in development environment, So it there any virtual PBX server / Test Environment where I can test my application.
Thank in advance for your support