Re: SimpleConf Conference written in ARI / C#

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 4, 2014 at 8:54 AM, Ben Merrills
<b.merrills@xxxxxxxxxxxxxxxx> 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.SimpleConfExample/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@xxxxxxxxxxxxxxxx
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev




[Index of Archives]     [Asterisk SS7]     [Asterisk Announcements]     [Asterisk Users]     [PJ SIP]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Linux API]

  Powered by Linux