12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- function chiamaEsterno(_trunks)
- return function (context, ext)
- app.noop(ext)
- app.noop(context)
- if ext:sub(1,1) == "0" then
- num = ext:sub(2) -- butta via lo 0 iniziale
- trunks = _trunks;
- else
- num = ext:sub(3) -- butta via l'*1 o *2
- trunks = { _trunks[tonumber(ext:sub(2,2))] };
- end
- if context == "from-regia" then
- -- qui NON ci va il doppio underscore: solo chi chiama puo' usare questa feature
- app.set("DYNAMIC_FEATURES=mandainondaChiamante")
- -- XXX: vogliamo che #9 non faccia proprio niente se sei un interno non di regia?
- -- o vorremmo tipo che facendo #9 da from-interni inoltrasse la chiamata alla regia?
- end
- to_dial = ""
- for i, trunk in ipairs(trunks) do
- if i > 1 then
- to_dial = to_dial .. "&"
- end
- dial_s = string.format("%s%s@%s", SIP, num, trunk)
- app.dial(dial_s, nil, "g")
- app.noop("DIALSTATUS=" .. channel.DIALSTATUS.value)
- if channel.DIALSTATUS.value ~= "CHANUNAVAIL" then
- app.noop("esco ciao")
- break
- end
- end
- end
- end
- function chiamaDaEsterno(_interni)
- return function()
- to_dial = ""
- for _, num in ipairs(INTERNI) do
- if #to_dial > 0 then
- to_dial = to_dial .. "&"
- end
- to_dial = to_dial .. SIP .. num
- end
- app.set("__DYNAMIC_FEATURES=mandainondaRicevente")
- app.dial(to_dial)
- end
- end
|