Skip to content

Commit

Permalink
Merge pull request #190 from mwolff44/develop
Browse files Browse the repository at this point in the history
pks-admin 1.2.1 + install updates
  • Loading branch information
mwolff44 committed Apr 16, 2024
2 parents 7b564fa + 359c29c commit 9e5f6c7
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"workbench.colorTheme": "Default Light+ Experimental"
"workbench.colorTheme": "Better Solarized Light"
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM debian:bookworm-slim
LABEL org.opencontainers.image.authors Mathias WOLFF <mathias@celea.org>

ENV REFRESHED_AT 2024-03-05
ENV VERSION 4.0.1
ENV VERSION 4.1.0

ENV DEBIAN_FRONTEND noninteractive

Expand Down
3 changes: 1 addition & 2 deletions src/sip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ La liste des commandes ci-dessous permet d'effectuer les opérations de modifica

## Support

L'utilisation des issues de Gitlab est une bonne pratique permettant une traçabilité des demandes et liées celles-ci à des modifications de code.
L'utilisation des issues de Github est une bonne pratique permettant une traçabilité des demandes et liées celles-ci à des modifications de code.

## Roadmap

Expand All @@ -156,4 +156,3 @@ Please make sure to update tests as appropriate.
## License

Le projet est soumis à la license AGPL.

63 changes: 63 additions & 0 deletions src/sip/api_tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# API Requests

## SIP proxy status

```bash
# curl -I "http://localhost:8064/status"

HTTP/1.1 200 OK
Sia: SIP/2.0/TCP 127.0.0.1:55960
Content-Type: text/plain
Server: kamailio (5.7.4 (x86_64/linux))
Content-Length: 0
```

## Reload dispatcher

```bash
# curl -X POST "http://localhost:8064/rpc" -d '{"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}'

{
"jsonrpc": "2.0",
"result": "Ok. Dispatcher successfully reloaded.",
"id": 1
}
```

## Reload dialplan

```bash
# curl -X POST "http://localhost:8064/rpc" -d '{"jsonrpc": "2.0", "method": "dialplan.reload", "id": 1}'

{
"jsonrpc": "2.0",
"result": {
},
"id": 1
}
```

## Reload permissions

```bash
# curl -X POST "http://localhost:8064/rpc" -d '{"jsonrpc": "2.0", "method": "permissions.addressReload", "id": 1}'

{
"jsonrpc": "2.0",
"result": "Reload OK",
"id": 1
}
```

## Reload tenant table

```bash
# curl -X POST "http://localhost:8064/rpc" -d '{"jsonrpc": "2.0", "method": "htable.reload", "params": "tenantmap", "id": 1}'

{
"jsonrpc": "2.0",
"result": {
},
"id": 1
}
```
17 changes: 17 additions & 0 deletions src/sip/docker-compose.fs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
pks-fs-1:
container_name: pks-fs-1
hostname: fs1.pks.local
build:
context: ./tests/freeswitch
dockerfile: Dockerfile
restart: unless-stopped
logging:
options:
max-size: 50m
volumes:
- ./tests/freeswitch/conf:/usr/local/freeswitch/conf:ro
networks:
main:
aliases:
- pks-fs-1
4 changes: 2 additions & 2 deletions src/sip/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
pks-sip:
container_name: pks-sip
hostname: sip.pks.local
image: mwolff44w/pks-sipproxy:v4.0.1
image: mwolff44w/pks-sipproxy:v4.1.0
restart: unless-stopped
volumes:
- pks-db-data:/etc/kamailio/db:ro
Expand Down Expand Up @@ -132,7 +132,7 @@ services:
pks-admin:
container_name: pks-admin
hostname: admin.pks.local
image: mwolff44w/pks-admin:v1.1.0
image: mwolff44w/pks-admin:v1.2.1
restart: unless-stopped
depends_on:
pks-db:
Expand Down
71 changes: 45 additions & 26 deletions src/sip/kamailio.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!KAMAILIO
#
# Kamailio SIP Server v5.7 - P-KISS-SBC
# Version : 4.0.1
# Version : 4.1.0
#

####### Include Local Config If Exists #########
Expand Down Expand Up @@ -40,9 +40,9 @@ import_file "kamailio-local.cfg"
#!define REDIS "name=srv8;addr=localhost;port=6379;db=8"
#!endif

#!ifndef LISTEN_XHTTP
#!define LISTEN_XHTTP tcp:eth0:9600
#!endif
#!substdef "!HTTP_PORT!8091!g"
#!define LISTEN_XHTTP tcp:lo:HTTP_PORT
listen=LISTEN_XHTTP

#!ifndef DISPATCHER_ALG
#!define DISPATCHER_ALG "0"
Expand Down Expand Up @@ -82,7 +82,7 @@ listen=udp:LISTEN_PRIVATE name "private"

# *** Value defines - IDs used later in config
#!ifdef WITH_DEBUG
#!define DBGLEVEL 3
#!define DBGLEVEL 4
#!else
#!define DBGLEVEL 2
#!endif
Expand Down Expand Up @@ -133,11 +133,8 @@ log_prefix="{$mt $hdr(CSeq) $ci} "
* - value inherited by tcp_children and sctp_children when not set explicitely */
children=8

/* uncomment the next line to disable TCP (default on) */
disable_tcp=yes

/* number of SIP routing processes for all TCP/TLS sockets */
# tcp_children=8
#tcp_children=8

/* uncomment the next line to disable the auto discovery of local aliases
* based on reverse DNS on IPs (default on) */
Expand All @@ -150,10 +147,7 @@ tcp_connection_lifetime=3605
/* upper limit for TCP connections (it includes the TLS connections) */
tcp_max_connections=2048

#!ifdef WITH_JSONRPC
tcp_accept_no_cl=yes
#!endif


/* set it to yes to enable sctp and load sctp.so module */
enable_sctp=no
Expand All @@ -172,18 +166,15 @@ enable_sctp=no
/* set paths to location of modules */
# mpath="/usr/local/lib/kamailio/modules/"


#!ifdef WITH_JSONRPC
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "xhttp.so"
#!endif
loadmodule "jsonrpcs.so"
loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "textopsx.so"
Expand Down Expand Up @@ -236,12 +227,10 @@ loadmodule "debugger.so"
# ----- jsonrpcs params -----
modparam("jsonrpcs", "pretty_format", 1)
/* set the path to RPC fifo control file */
# modparam("jsonrpcs", "fifo_name", "/run/kamailio/kamailio_rpc.fifo")
modparam("jsonrpcs", "fifo_name", "/run/kamailio/kamailio_rpc.fifo")
/* set the path to RPC unix socket control file */
# modparam("jsonrpcs", "dgram_socket", "/run/kamailio/kamailio_rpc.sock")
#!ifdef WITH_JSONRPC
modparam("jsonrpcs", "transport", 7)
#!endif
modparam("jsonrpcs", "transport", 1)

# ----- ctl params -----
/* set the path to RPC unix socket control file */
Expand All @@ -265,12 +254,18 @@ modparam("rr", "enable_full_lr", 1)
modparam("rr", "append_fromtag", 0)

# ----- acc params -----
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "detect_direction", 0)
modparam("acc", "db_insert_mode", 2)
modparam("acc", "db_url", DBURL)
modparam("acc", "db_flag", FLT_ACC)
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
modparam("acc", "acc_extra_nullable", 1)
modparam("acc", "multi_leg_info", "leg_src=$avp(src);leg_dst=$avp(dst)")
modparam("acc", "db_extra", "user_agent=$hdr(User-Agent)")

# ----- db_text params -----
#!ifdef WITH_DBTEXT
Expand Down Expand Up @@ -336,6 +331,9 @@ modparam("dispatcher", "ds_default_sockname", "public")
modparam("rtpengine", "rtpengine_sock", RTPENGINE_LIST)
modparam("rtpengine", "mos_average_pv", "$avp(mos_average)")

# ----- xhttp params -----
modparam("xhttp", "url_skip", "^/RPC2")

#!ifdef WITH_DEBUG
# ----- debugger params -----
modparam("debugger", "cfgtrace", 1)
Expand Down Expand Up @@ -1010,3 +1008,24 @@ route[MSG_RECV_EXTERNAL] {
}
return -1;
}

event_route[xhttp:request] {
if ($Rp != "HTTP_PORT") {
xwarn("HTTP request received on $Rp from $si");
xhttp_reply("403", "Forbidden", "", "");
exit;
}
$var(x) = $(hu{url.path});
xinfo("received request [$hu] [$var(x)]");
if ($hu =~ "^/RPC") {
xinfo("jsonrpc dispatch [$hu] [$var(x)]");
jsonrpc_dispatch();
return;
}
else if ($hu == "/status") {
xhttp_reply("200", "OK", "text/plain", "");
exit;
}
xhttp_reply("404", "Not Found", "application/javascript", "{\"$var(y)\"}\n\r");
return;
}

0 comments on commit 9e5f6c7

Please sign in to comment.