Re: Написал sppr для конференций без пинов и лидеров - суть, голосовые комнаты. Возможно, кому то пригодится.

От: Sergey Kronshtadtov <CGatePro_at_mx_ru>
Дата: Sun 20 Dec 2009 - 19:21:11 MSK

Новая версия скрипта. В 5.3 грузится, исправлены ошибки. Стало лучше чем было.

файл svkconferenceroom.sppr:



//
// Сonference Room v.1.02
//
// You can contact me at svk@arm.ru
//

procedure playMenu (promptFile, optionValue) external; procedure playSine (freq, msec) external;

entry Main is

if AcceptCall () != null then stop; end if;

thePassword = Vars().startParameter[0];

parameter = NewDictionary ();
parameter.isOpen = true;

void (CreateMeeting (null, thePassword, parameter));

isNew = true;

ClearDTMF ();

PlayFile ("ConferenceEntry");

ClearDTMF ();

if ActivateMeeting (null, thePassword) != null then

    isNew = false;

    meetingInfo = FindMeeting (null, thePassword);

    if meetingInfo != null then

        void (SendEvent (meetingInfo.id, "getPartyIntros", null));

        input = readInput (5);

        if IsDictionary (input) and then input.what == "partyIntros" then

            ClearDTMF ();
            PlayFile ("ConferenceMembers");

            index = 0;

            while index < length (input.parameter)
            loop
                playSine (2000, 50);
                Play (input.parameter.(input.parameter[index]));
                index = index + 1;
            end loop;

            playSine (2000, 500);

        end if;

    end if;

else

    PlayFile ("ConnectingNow");

end if;

ClearDTMF ();

if RemoteAuthentication () != null then

    Intro = ReadSiteFile ("~" + RemoteAuthentication () + "/myname.wav"); end if;

if Intro == null then

    PlayFile ("IntroduceYourself");
    PlayFile ("FinishByPound");
    ClearDTMF ();
    PlayFile ("RecordingBeep");
    ClearDTMF ();
    Intro = record (5);
end if;

ClearDTMF ();

// playMenu ("ToMuteYourLine", "*6");
// playMenu ("ToUnmute", "*7");
// playMenu ("ToDisconnect", "#");

PlayFile ("JoiningConference");

ClearDTMF ();

if !isNew then

    meetingInfo = FindMeeting (null, thePassword);

    if meetingInfo != null then

        void (SendEvent (meetingInfo.id, "partyName", Intro));
        void (SendEvent (meetingInfo.id, "partyAddr", SIPURIToEmail 
(RemoteURI ())));
        if StartBridge (meetingInfo.id) != null then
            ClearDTMF ();
            PlayFile ("Failure");
            stop;
        end if;





loop

input = readInput (60);

if input == "*" then

    input = readInput (5);
    if input == null then input = "*";
    elif IsDigit (input) then input = "*" + input;     end if;
end if;

exitif input != null and then (input == "#" or not IsString (input));

if input == "*5" then

    void (SendEvent (meetingInfo.id, "playPartyList", null));

elif input == "*6" then

    void (SendEvent (meetingInfo.id, "mute", true));

elif input == "*7" then

    void (SendEvent (meetingInfo.id, "mute", false));

end if;

end loop;

        if not IsBreakBridgeEvent (input) then void (BreakBridge()); end if;

        if IsDisconnectEvent (input) then stop; end if;

        ClearDTMF ();
        PlayFile ("DisconnectedConference");

    else

        ClearDTMF ();
        PlayFile ("Failure");

    end if;

    stop;

else

    meetingInfo = FindMeeting (null, thePassword);

    if meetingInfo != null then

        void (SendEvent (meetingInfo.id, "partyName", Intro));
        void (SendEvent (meetingInfo.id, "partyAddr", SIPURIToEmail 
(RemoteURI ())));
        playBeeps = false;
        playMusic = true;

        partyIntros = NewDictionary ();
        partyAddrs = NewDictionary ();





loop

if playMusic then

    PlayFileInLoop ("HoldMusic", 300000);     input = ReadInput (0);
else

    input = ReadInput (60);
end if;

if input == "*" then

    input = ReadInput (5);
    if input == null then input = "*";
    elif IsDigit (input) then input = "*" + input;     end if;
end if;

exitif IsDisconnectEvent (input) or else input == "#";

if IsStartBridgeEvent (input) then

    if AttachMixer (input) == null then

        ClearDTMF ();
        Play (partyIntros.(String (input.sender)));
        PlayFile ("JoinedConference");
        playMusic = false;
    else
        partyIntros.(String (input.sender)) = null;
        partyAddrs.(String (input.sender)) = null;
    end if;

elif IsBreakBridgeEvent (input) then

    ClearDTMF ();
    Play (partyIntros.(String (input.sender)));     PlayFile ("LeftConference");
    partyIntros.(String (input.sender)) = null;     partyAddrs.(String (input.sender)) = null;     if Length (partyAddrs) <= 1 then playMusic = true; end if;

elif IsDictionary (input) and then input.what == "partyName" then

    partyIntros.(String (input.sender)) = input.parameter;

elif IsDictionary (input) and then input.what == "partyAddr" then

    partyAddrs.(String (input.sender)) = input.parameter;

elif IsDictionary (input) and then input.what == "getPartyList" then

    void (SendEvent (input.sender, "partyList", ObjectToString (partyAddrs)));

elif IsDictionary (input) and then input.what == "getPartyIntros" then

    void (SendEvent (input.sender, "partyIntros", partyIntros));

elif IsDictionary (input) and then input.what == "playPartyList" then

    ClearDTMF ();
    PlayFile ("ConferenceMembers");

    index = 0;

    while index < length (partyIntros)
    loop

        playSine (2000, 50);
        Play (partyIntros.(partyIntros[index]));
        index = index + 1;

    end loop;

    playSine (2000, 500);

elif IsDictionary (input) and then input.what == "mute" then

    muteMixer (input.sender, input.parameter);

elif IsDictionary (input) then

    SysLog ("unexpected event: " + input.what);

elif input == "*1" then

    void (MixerThreshold ((MixerThreshold (null) + 3) * 3 / 2));

elif input == "*2" then

    void (MixerThreshold (MixerThreshold (null) * 2 / 3));

elif input == "*3" then

    void (MixerDelay (MixerDelay (null) + 50));

elif input == "*4" then

    void (MixerDelay (MixerDelay (null) - 50));

elif input == "*5" then

    void (SendEvent (meetingInfo.id, "playPartyList", null));

elif input == "*6" then

    MuteMixer (null, true);

elif input == "*7" then

    MuteMixer (null, false);

elif input == "*8" then

    playMusic = not playMusic;

elif input == "*9" then

    playBeeps = not playBeeps;

elif input == null then

    if playBeeps then playSine (3000, 200); end if;

else

    playSine (300,100); playSine (500,100);

end if;

end loop;

        void (DetachMixer (null));

        void (DeactivateMeeting (null, thePassword));

        if IsDisconnectEvent (input) then stop; end if;

        ClearDTMF ();
        PlayFile ("DisconnectedConference");

    else

        ClearDTMF ();
        PlayFile ("Failure");

    end if;

    stop;

end if;

end entry;


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4693 (20091216) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com Получено Sun Dec 20 16:19:16 2009

Этот архив был сгенерирован hypermail 2.1.8 : Sun 20 Dec 2009 - 20:15:16 MSK