Add definitions for Kamailio KEMI Framework

This commit is contained in:
bonan
2019-03-17 14:33:57 +01:00
parent 706d838bd3
commit 7dd9133ef8
4 changed files with 1351 additions and 0 deletions
+1294
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,33 @@
import * as KSR from "kamailio-kemi";
function ksr_request_route() {
if (KSR.maxfwd.process_maxfwd(16) < 0) {
KSR.sl.send_reply(483, "Too Many Hops");
return;
}
const reqURI = KSR.pv.get('$ru');
const reqMethod = KSR.pv.get('$rm');
if (KSR.isflagset(31)) {
KSR.hdr.append_to_reply("Retry-After: 60");
KSR.sl.send_reply(503, "Service Unavailable");
return;
}
if (KSR.is_OPTIONS()) {
KSR.sl.send_reply(200, "OK");
return;
}
KSR.dbg(`IN ksr_request_route(): ${reqMethod} ${reqURI}`);
KSR.pv.sets('$du', "sip:127.0.0.1:5080;transport=tcp");
KSR.tm.t_on_branch("ksr_branch_route");
KSR.tm.t_on_reply("ksr_onreply_route");
KSR.tm.t_on_failure("ksr_failure_route");
if (KSR.tm.t_relay() < 0) {
KSR.sl.send_reply(500, "Server error");
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"kamailio-kemi-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }