Search code examples
c#asteriskasteriskamiasternet

How do I get the UniqueId and Channel Name from a call I have just originated?


I am trying to upgrade to the latest version of AsterNet from an old copy of Asterisk.Net. We used to originate calls with AsteriskManager.OriginateCall(), which returned a Call object. That call object had a UniqueId and ChannelName.

Now I'm originating calls with SendAction() and sending it an OriginateAction. So my first question is: is that the right way to do it? Because in the result I get, the UniqueId is null and it doesn't have a ChannelName. I thought channel name might be in an attribute, but Attributes is null, too.

So how do I get the channel name and unique id of a call I have just originated?


Solution

  • Here is how I did it: I created an OriginateAction. In the OriginateAction I set Asynch to true. Then I sent it with SendEventGeneratingAction() with a timeout. I check that the ResponseEvents I get back is not null, that responseEvents.Events.Count > 0, and that responseEvents.Events[0] is OriginateResponseEvent. responseEvents.Events[0] then has all the information I need.