NEventSocket icon indicating copy to clipboard operation
NEventSocket copied to clipboard

BridgeTo does not return BridgeResult

Open mguerrieri opened this issue 9 years ago • 3 comments

Is there a reason that the BridgeTo method swallows the result of the bridge instead of returning it? This makes getting the results of the bridge attempt challenging.

mguerrieri avatar Sep 21 '16 07:09 mguerrieri

This is what I use:

if (!channel.IsBridged)
{
  ColorConsole.WriteLine("Bridge Failed - {0}"
       .Fmt(channel.GetVariable("last_bridge_hangup_cause")).Red());
  await channel.Play("ivr/ivr-call_rejected.wav");
  await channel.Hangup(HangupCause.NormalTemporaryFailure);
}

The idea that by keeping all the state accessible via the channel object your code will be more succinct.

danbarua avatar Sep 21 '16 08:09 danbarua

I'm considering there may be a case for strongly typed access to the most commonly-used channel vars eg channel.Variables.BridgeHangupCause

danbarua avatar Sep 21 '16 08:09 danbarua

ColorConsole.WriteLine("Bridge Failed - {0}".Fmt(channel.Variables.BridgeHangupCause).Red());

^ that's a bit better.

I've been going around around on this trying to make this API usable as you can see here: https://github.com/danbarua/NEventSocket/issues/18

danbarua avatar Sep 21 '16 08:09 danbarua