On Mon, Apr 16, 2007 at 04:27:58PM +0400, Dmitry Akindinov wrote:
> Тект программы:
В тект программы вкралось несколько ошибок, поэтому Дима их исправил, и вот, что получилось (debug с syslog(...parameters) можно потОм закомментировать):
// S:<100> = callinorder{10,101,102,103}#postmaster
function callNumber(phoneNumber,timeOut) forward; function callerLeg(parameters,callPending) external; function bridgedLoopHash(peerLeg) external;
entry main is
group = Vars().startParameter;
timeOut = 20;
if not isArray(group) or else Length(group) < 2 then
syslog("Expecting the array of extensions, timeout as the first value"); RejectCall("500-Invalid parameters");end if;
timeOut = Number(group[0]); RemoveElement(group, 0);
count = Length(group);
called = false;
if count > 0 then
index = 0; //shift = RandomNumber() % count; shift = 0; while index < count loop member = group[(index + shift) % count]; started = LocalTime(); called = callNumber(member, timeOut); exitif called; index = index + 1; end loop;
function callNumber(phoneNumber,timeOut) is
parameters = NewDictionary();
if FindSubString(phoneNumber, "@") == -1 then
phoneNumber = phoneNumber + "@" + MyDomain();
end if;
parameters.("") = "sip:" + phoneNumber + ";services=no"; parameters.activeSide = false; parameters.From = RemoteURI(); parameters.("Expires") = isNumber(timeOut) ? timeOut : 10; parameters.bridgedCall = true; parameters.("Call-ID") = PendingRequestData("Call-ID") + ".gr_ser"; parameters.("Max-Forwards") = PendingRequestData("Max-Forwards")-1;
syslog("Params: " + ObjectToString(parameters)); peerLeg = callerLeg(parameters,true); if not IsTask(peerLeg) then
//PlayFile("Failure"); return false; else syslog("Result: " + ObjectToString(peerLeg));end if;
Этот архив был сгенерирован hypermail 2.1.8 : Wed 25 Apr 2007 - 22:14:51 MSD