AsterNET / AsterNET

AsterNET is an open source .NET framework for Asterisk AMI and FastAGI. AsterNET allows you to talk to Asterisk AMI from any .NET application and create FastAGI applications in any .NET language.
http://www.xdev.net/projects/asternet/
MIT License
184 stars 127 forks source link

Announce Channel in AsterNET not Available in ParkAction #228

Open nirzaf opened 4 years ago

nirzaf commented 4 years ago

We have up to 5 Parameters Available in Asterisk Check the link below for more details

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerAction_Park

Action: Park
ActionID: <value>
Channel: <value>
[TimeoutChannel:] <value>
[AnnounceChannel:] <value>
[Timeout:] <value>
[Parkinglot:] <value>

but in AsterNET ParkAction has only 4 Parameters and [AnnounceChannel:] <value> is not available to provide, http://asternet.github.io/AsterNET/html/M_AsterNET_Manager_Action_ParkAction__ctor_1.htm

Parameters

  • channel
    • Type: System.String
    • Set the Channel which should be parked
  • channel2
    • Type: System.String
    • Set the Channel where the Call will end up after the timeout is reached.
  • timeout
    • Type: System.String
    • Timeout in msec, after timeout is reached call will come back to channel2
  • parkinglot
    • Type: System.String
    • Set the Parking lot.

because of this issue when I park the call, person in the opponent side hears the parking announcement, Please help if someone knows how to hack this issue

Deantwo commented 4 years ago

Looks like the Park action's parameters changed a lot. Should be an easy fix code side.

But assuming you are using the NuGet package, you'll have to do a workaround to write the command manually. And I don't remember how to do that with AsterNET, but I assume it is possible.

nirzaf commented 4 years ago

I downloaded the source code and tried to modify it and rebuilt the nuget package locally, All the references are working except Event Handlers image Please refer the image above Please help what could be the issue causing these errors, any idea?

nirzaf commented 4 years ago

I created an Additional Function Which will support to Add the "AnnounceChannel" Channel as Parameter, please review & merge if that helps, Thank you

Deantwo commented 4 years ago

I downloaded the source code and tried to modify it and rebuilt the nuget package locally, All the references are working except Event Handlers

You downloaded the "master" branch I assume.

Why are you even newing event handlers? Try just assigning the methods instead, let .Net do the event handlers.

_ami.NewChannel += NewChannel;
_ami.NewExten += ProcessChannel;
_ami.BridgeEnter += BridgeEvent;
_ami.NewState += NewState;
Deantwo commented 4 years ago

I created and Additional Function Which will support to Add the "AnnounceChannel" Channel as Parameter, please review & merge if that helps, Thank you

You only created a constructor and you are attempting to assign to properties that don't exist. You need to rename the Channel2 property to TimeoutChannel and add the AnnounceChannel property.

Feel free to make a pull request when you have it working.

Edit: Just saw your other commit too. Looks good. Create the pull request and I can review it better.

Deantwo commented 4 years ago

I can see that ParkAction was changed between Asterisk v11 and v12. I am not sure if we need to support the earlier version too, or how we would support both.

Anyway, make the pull request and we can review it better.

nirzaf commented 4 years ago

I found we had 2 methods with 4 string parameters,

public ParkAction(string channel, string channel2, string timeout, string parkinglot)
{
    Channel = channel;
    Channel2 = channel2;
    Timeout = timeout;
    Parkinglot = parkinglot;
}

And

public ParkAction(string callerChannel, string calleeChannel, string announceChannel, string timeout)
{
    Channel = callerChannel;
    TimeoutChannel = calleeChannel;
    AnnounceChannel = announceChannel;
    Timeout = timeout;
}

Since we can't have both methods together, I removed one with the Variable Name Channel2 since it is supporting older version, Is there any way to solve this, or is there any mistake in my understanding?