[asterisk-app-dev] SimpleConf Conference written in ARI / C#

Ben Merrills b.merrills at mersontech.co.uk
Wed Feb 19 08:13:56 CST 2014


Matt: Thanks for the suggestions, I've improve the bridge handling.

I've also added a rest api to allow you to control the conferences (kick, add, remove, start/stop moh/recordings/ play file into conference etc etc).

I'll keep making improvements, and hope someone else gets some benefit from it :)

Skrusty

> -----Original Message-----
> From: asterisk-app-dev-bounces at lists.digium.com [mailto:asterisk-app-dev-
> bounces at lists.digium.com] On Behalf Of Matthew Jordan
> Sent: 05 February 2014 23:31
> To: Asterisk Application Development discussion
> Subject: Re: [asterisk-app-dev] SimpleConf Conference written in ARI / C#
> 
> On Tue, Feb 4, 2014 at 8:54 AM, Ben Merrills <b.merrills at mersontech.co.uk>
> wrote:
> > Hi Guys,
> >
> >
> >
> > Just wanted to let you know I'd finished the first, very rough,
> > version of my conference samples, written in C# using the AsterNET.ARI
> framework.
> >
> > https://asternetari.codeplex.com/SourceControl/latest#AsterNET.ARI.Sim
> > pleConfExample/Program.cs
> >
> >
> > It's pretty basic at the moment, and there are a few issues I've not
> > tracked down the root cause of yet (i.e. ARI or me). But feel free to
> > play, comment etc. It's mostly written for fun, to test ARI and
> > AsterNET.ARI framework, so don't be critical on functionality just yet
> > J
> >
> 
> Very cool!
> 
> One thing I noticed is that the only way a conference is destroyed is through
> a key press. Another way of doing this, of course, would be to handle the
> case in your OnChannelLeftBridgeEvent handler:
> 
>         private void c_OnChannelLeftBridgeEvent(object sender,
> ChannelLeftBridgeEvent e)
>         {
>             // left conf
>             // play announcement
>             _endPoint.Bridges.Play(Confbridge.Id, "recording:" +
> string.Format("conftemp-{0}", e.Channel.Id), "en", 0, 0);
>             _endPoint.Bridges.Play(Confbridge.Id,
> "sound:conf-hasleft", "en", 0, 0);
> 
>             if (ConferenceUsers.Count() == 1) {
>                 _endPoint.Bridges.StartMoh(Confbridge.Id, "default");
>             } else if (ConferenceUsers.Count() == 0) {
>                _endPoint.Bridges.Destroy(Confbridge.Id);
>             }
> 
>             _endPoint.Recordings.DeleteStored(string.Format("conftemp-{0}-{1}",
> ConferenceName, e.Channel));
>         }
> 
> Not that you *have* to do that addition, but one thing I've noticed is that an
> easy trap to fall into is not destroyed Bridges in all of the necessary code
> paths. (My first holding bridge in Python once littered about 10 holding
> bridges... whoops)  Once you lose that handle to the bridge, it also gets a bit
> tough to destroy.
> 
> Just a thought - and this doesn't work very well for holding bridges - but is it
> worth letting someone set a flag during the bridge creation that says "when
> the last channel leaves the bridge, go ahead and destroy it"?
> 
> There's issues with this of course: you now have Asterisk managing a
> resource that was created via ARI. You'd have to write your code to be very
> cognizant of this fact, and you'd definitely want to handle the
> BridgeDestroyed event.
> 
> Food for thought, and I'd be curious what you run into when managing the
> lifetimes of the bridges.
> 
> 
> --
> Matthew Jordan
> Digium, Inc. | Engineering Manager
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at:
> http://digium.com & http://asterisk.org
> 
> _______________________________________________
> asterisk-app-dev mailing list
> asterisk-app-dev at lists.digium.com
> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev



More information about the asterisk-app-dev mailing list