AsterNet comand

656 views Asked by At

I'm sending the command below using C # and AsterNet.

The command executes, but only returns the last line of the command's response.

CommandAction cmdAction = new CommandAction ();
cmdAction.Command = "core show channels";
var response = manager.SendAction(cmdAction);

Does anyone know how to return all lines of response from the command?

1

There are 1 answers

0
Vasu Inukollu On

You should be sending the CoreShowChannelsAction action and not a CommandAction. The following link has the documentation on CoreShowChannels AMI action.

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

This code should give you an example.

var cmdAction = new CoreShowChannelsAction();
var response = manager.SendAction(cmdAction);

However, the response will NOT contain the list of channels. It will only confirm that the action request has been sent successfully.

To get the list of channels, you will have to register the callbacks for CoreShowChannel and CoreShowChannelsComplete events.

To the best of my knowledge, the AsterNet library does not raise these events. I think you will need to fork and add these events to the library code base.

Best of luck.