ParkAction

Feb 3, 2014 at 11:23 AM
Edited Feb 3, 2014 at 11:24 AM
Dear All

I have added the missing ParkAction.

For all which are intrested here is the Code:

using System;

namespace AsterNET.Manager.Action
{
/// <summary>
/// The ParkAction allows to send a Channel to a Parklot.<br/>
/// A successful login is the precondition for sending for that

public class ParkAction : ManagerAction
{
    private string channel;
    private string channel2;
    private string timeout;
    private string parkinglot;

    /// <summary>
    /// Get the name of this action, i.e. "Park".
    /// </summary>
    override public string Action
    {
        get { return "Park"; }
    }
    /// <summary>
    /// Set the Channel wich should be parked</code>.</summary>
    public string Channel
    {
        get { return this.channel; }
        set { this.channel = value; }
    }
    /// <summary>
    /// Set the Channel where the Call will endup after the Timeout is reached.<br/>
    /// </summary>
    public string Channel2
    {
        get { return this.channel2; }
        set { this.channel2 = value; }
    }

    /// <summary>
    /// Timeout in msec, after timeout is reached call will come back to channel2
    /// </summary>
    public string Timeout
    {
        get { return this.timeout; }
        set { this.timeout = value; }
    }
    /// <summary>
    /// Set the Parkinglot.
    /// </summary>
    public string Parkinglot 
    {
        get { return this.parkinglot; }
        set { this.parkinglot = value; }
    }

    /// <summary>
    /// Creates a new ParkAction.
    /// </summary>
    /// <param name="channel"></param>
    /// <param name="channel2"></param>
    /// <param name="timeout"></param>
    public ParkAction(string channel, string channel2, string timeout)
    {
        this.channel = channel;
        this.channel2 = channel2;
        this.timeout = timeout;
    }

    /// <summary>
    /// Creates a new ParkAction.<br/>
    /// </summary>
    /// <param name="channel"></param>
    /// <param name="channel2"></param>
    /// <param name="timeout"></param>
    /// <param name="parkinglot"></param>
    public ParkAction(string channel, string channel2, string timeout, string parkinglot)
    {
        this.channel = channel;
        this.channel2 = channel2;
        this.timeout = timeout;
        this.parkinglot = parkinglot;
    }
}
}


After adding this to the Asterisk API in Action Container and recompiling it it can be used as followed:
        ParkAction pa = new ParkAction(activeChannelParty, activeChannelUp, "30000");
        try
        {
            ManagerResponse mr = astCon.SendAction(pa, 30000);
            Console.WriteLine("Park Call" + "\n\tResponse:" + mr.Response + "\n\tMessage:" + mr.Message);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
metzi
Feb 3, 2014 at 4:47 PM
Fancy creating a fork and making a pull request? :) Otherwise it wont be added into the source until I have some time.
Feb 17, 2014 at 2:19 PM
I don't see any pull requests yet? Are you able to contribute this?
Feb 27, 2014 at 8:03 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.