|
@@ -1,4 +1,3 @@
|
|
-
|
|
|
|
The Ctl Module
|
|
The Ctl Module
|
|
|
|
|
|
Andrei Pelinescu-Onciul
|
|
Andrei Pelinescu-Onciul
|
|
@@ -6,7 +5,7 @@ Andrei Pelinescu-Onciul
|
|
iptelorg GmbH
|
|
iptelorg GmbH
|
|
|
|
|
|
Copyright © 2009 iptelorg GmbH
|
|
Copyright © 2009 iptelorg GmbH
|
|
- _________________________________________________________________
|
|
|
|
|
|
+ __________________________________________________________________
|
|
|
|
|
|
Table of Contents
|
|
Table of Contents
|
|
|
|
|
|
@@ -39,9 +38,9 @@ Andrei Pelinescu-Onciul
|
|
1.4. Set user parameter
|
|
1.4. Set user parameter
|
|
1.5. Set group parameter
|
|
1.5. Set group parameter
|
|
1.6. Set fifo parameter
|
|
1.6. Set fifo parameter
|
|
- 1.7. Set the autoconversion parameter
|
|
|
|
- 1.8. Set the binrpc_max_body_size parameter
|
|
|
|
- 1.9. Set the binrpc_struct_max_body_size parameter
|
|
|
|
|
|
+ 1.7. Set the autoconversion parameter
|
|
|
|
+ 1.8. Set the binrpc_max_body_size parameter
|
|
|
|
+ 1.9. Set the binrpc_struct_max_body_size parameter
|
|
1.10. print usage
|
|
1.10. print usage
|
|
1.11. ctl.connections usage
|
|
1.11. ctl.connections usage
|
|
1.12. ctl.who usage
|
|
1.12. ctl.who usage
|
|
@@ -71,20 +70,20 @@ Chapter 1. Admin Guide
|
|
|
|
|
|
1. Overview
|
|
1. Overview
|
|
|
|
|
|
- This module implements the binrpc transport interface for Kamailio
|
|
|
|
|
|
+ This module implements the binrpc transport interface for Kamailio
|
|
RPCs. It supports various transports over which it speaks binrpc: Unix
|
|
RPCs. It supports various transports over which it speaks binrpc: Unix
|
|
datagram sockets, Unix stream sockets, UDP and TCP. It also supports a
|
|
datagram sockets, Unix stream sockets, UDP and TCP. It also supports a
|
|
- backward compatible FIFO interface (using the old Kamailio FIFO
|
|
|
|
|
|
+ backward compatible FIFO interface (using the old Kamailio FIFO
|
|
protocol).
|
|
protocol).
|
|
|
|
|
|
By default (if no parameters are changed in the config file) it uses a
|
|
By default (if no parameters are changed in the config file) it uses a
|
|
- Unix stream socket under /tmp: /tmp/ser_ctl. This socket is also the
|
|
|
|
- default for kamcmd.
|
|
|
|
|
|
+ Unix stream socket under /var/run/kamailio:
|
|
|
|
+ /var/run/kamailio/kamailio_ctl. This socket is also the default for
|
|
|
|
+ kamcmd.
|
|
|
|
|
|
In general it's used in conjunction with kamcmd. kamcmd is a Unix tool
|
|
In general it's used in conjunction with kamcmd. kamcmd is a Unix tool
|
|
- for invoking Kamailio RPC functions. It can be used both in
|
|
|
|
- interactive mode (supports tab-completion and history) or command line
|
|
|
|
- mode.
|
|
|
|
|
|
+ for invoking Kamailio RPC functions. It can be used both in interactive
|
|
|
|
+ mode (supports tab-completion and history) or command line mode.
|
|
|
|
|
|
Example 1.1. kamcmd example usage
|
|
Example 1.1. kamcmd example usage
|
|
$ kamcmd ps
|
|
$ kamcmd ps
|
|
@@ -104,11 +103,11 @@ $ kamcmd ps
|
|
|
|
|
|
2. BINRPC
|
|
2. BINRPC
|
|
|
|
|
|
- binrpc is a ser proprietary binary protocol for invoking rpcs. It was
|
|
|
|
- designed such that it would minimize the packet sizes and it would be
|
|
|
|
|
|
+ binrpc is a ser proprietary binary protocol for invoking rpcs. It was
|
|
|
|
+ designed such that it would minimize the packet sizes and it would be
|
|
very fast to parse (as opposed to XML-rpc).
|
|
very fast to parse (as opposed to XML-rpc).
|
|
|
|
|
|
- The binrpc encoding format is fully documented inside
|
|
|
|
|
|
+ The binrpc encoding format is fully documented inside
|
|
modules/ctl/binrpc.h.
|
|
modules/ctl/binrpc.h.
|
|
|
|
|
|
3. Parameters
|
|
3. Parameters
|
|
@@ -124,19 +123,19 @@ $ kamcmd ps
|
|
|
|
|
|
3.1. binrpc (string)
|
|
3.1. binrpc (string)
|
|
|
|
|
|
- Specifies the transport used for the binrpc protocol. The following
|
|
|
|
- transport protocol are supported: Unix datagram sockets, Unix stream
|
|
|
|
|
|
+ Specifies the transport used for the binrpc protocol. The following
|
|
|
|
+ transport protocol are supported: Unix datagram sockets, Unix stream
|
|
sockets, UDP and TCP.
|
|
sockets, UDP and TCP.
|
|
|
|
|
|
The format is: [ protocol:] address_port|path .
|
|
The format is: [ protocol:] address_port|path .
|
|
|
|
|
|
* For Unix sockets: [unixd|unixs|unix]:path where "unixd" means Unix
|
|
* For Unix sockets: [unixd|unixs|unix]:path where "unixd" means Unix
|
|
- datagram sockets and "unix" "unixs" mean Unix stream sockets.
|
|
|
|
- Examples: "unixd:/tmp/unix_dgram", "unixs:/tmp/unix_stream",
|
|
|
|
|
|
+ datagram sockets and "unix" "unixs" mean Unix stream sockets.
|
|
|
|
+ Examples: "unixd:/tmp/unix_dgram", "unixs:/tmp/unix_stream",
|
|
"unix:/tmp/unix_stream".
|
|
"unix:/tmp/unix_stream".
|
|
- * For UDP or TCP sockets: [udp|tcp]:address:port. If the address is
|
|
|
|
|
|
+ * For UDP or TCP sockets: [udp|tcp]:address:port. If the address is
|
|
"*" or missing, it will bind to all the local addresses (0.0.0.0).
|
|
"*" or missing, it will bind to all the local addresses (0.0.0.0).
|
|
- Examples: "udp:localhost:2046", "tcp:localhost:2046", "tcp:3012",
|
|
|
|
|
|
+ Examples: "udp:localhost:2046", "tcp:localhost:2046", "tcp:3012",
|
|
"udp:*:3012".
|
|
"udp:*:3012".
|
|
|
|
|
|
If the protocol part is missing and the address/path part looks like a
|
|
If the protocol part is missing and the address/path part looks like a
|
|
@@ -145,18 +144,19 @@ $ kamcmd ps
|
|
* "/tmp/unix_test" - equivalent to "unixs:/tmp/unix_test".
|
|
* "/tmp/unix_test" - equivalent to "unixs:/tmp/unix_test".
|
|
* "localhost:3000" - equivalent to "udp:localhost:3000".
|
|
* "localhost:3000" - equivalent to "udp:localhost:3000".
|
|
|
|
|
|
- Multiple transports / listen addresses can be specified, just by
|
|
|
|
|
|
+ Multiple transports / listen addresses can be specified, just by
|
|
setting the parameter multiple times.
|
|
setting the parameter multiple times.
|
|
|
|
|
|
- Default:"unix:/tmp/ser_ctl" (Unix stream socket). The default value is
|
|
|
|
- used only if no binrpc parameter is found in the config file.
|
|
|
|
|
|
+ Default: "unix:/var/run/kamailio/kamailio_ctl" (Unix stream socket).
|
|
|
|
+ The default value is used only if no binrpc parameter is found in the
|
|
|
|
+ config file.
|
|
|
|
|
|
Example 1.2. Set binrpc parameter
|
|
Example 1.2. Set binrpc parameter
|
|
loadmodule "ctl"
|
|
loadmodule "ctl"
|
|
# optional listen addresses, if no one is specified,
|
|
# optional listen addresses, if no one is specified,
|
|
# ctl will listen on unixs:/tmp/ser_ctl
|
|
# ctl will listen on unixs:/tmp/ser_ctl
|
|
|
|
|
|
-modparam("ctl", "binrpc", "unix:/tmp/ser_ctl") # default
|
|
|
|
|
|
+modparam("ctl", "binrpc", "unix:/tmp/kamailio_ctl") # default
|
|
modparam("ctl", "binrpc", "udp:localhost:2046")
|
|
modparam("ctl", "binrpc", "udp:localhost:2046")
|
|
modparam("ctl", "binrpc", "tcp:localhost:2046")
|
|
modparam("ctl", "binrpc", "tcp:localhost:2046")
|
|
modparam("ctl", "binrpc", "unixd:/tmp/unix_dgram") # unix datagram
|
|
modparam("ctl", "binrpc", "unixd:/tmp/unix_dgram") # unix datagram
|
|
@@ -197,13 +197,12 @@ modparam("ctl", "group", 100)
|
|
3.5. fifo (integer)
|
|
3.5. fifo (integer)
|
|
|
|
|
|
fifo used for the obsolete fifo protocol. The fifo protocol can be run
|
|
fifo used for the obsolete fifo protocol. The fifo protocol can be run
|
|
- over a real fifo, over UDP or over TCP. Format:
|
|
|
|
- [protocol:]path|address. If no protocol is specified the default is
|
|
|
|
- "fifo". Examples: "fifo:/tmp/ser_fifo", "/tmp/ser_fifo2",
|
|
|
|
- "udp:*:2050", "tcp:localhost:2050". For more details on the UDP and
|
|
|
|
- TCP formats see binrpc. Multiple fifos or fifo transports can be used
|
|
|
|
- in the same time (just by setting the fifo parameter multiple times in
|
|
|
|
- the config).
|
|
|
|
|
|
+ over a real fifo, over UDP or over TCP. Format:
|
|
|
|
+ [protocol:]path|address. If no protocol is specified the default is
|
|
|
|
+ "fifo". Examples: "fifo:/tmp/ser_fifo", "/tmp/ser_fifo2", "udp:*:2050",
|
|
|
|
+ "tcp:localhost:2050". For more details on the UDP and TCP formats see
|
|
|
|
+ binrpc. Multiple fifos or fifo transports can be used in the same time
|
|
|
|
+ (just by setting the fifo parameter multiple times in the config).
|
|
|
|
|
|
Default: not set (no fifo will be used).
|
|
Default: not set (no fifo will be used).
|
|
|
|
|
|
@@ -216,8 +215,8 @@ modparam("ctl", "fifo", "tcp:*:2050") # fifo over tcp
|
|
|
|
|
|
3.6. autoconversion (integer)
|
|
3.6. autoconversion (integer)
|
|
|
|
|
|
- Enable or disable automatic type conversion globally, for all the
|
|
|
|
- methods parameters. If on, a type mismatch in a method parameter will
|
|
|
|
|
|
+ Enable or disable automatic type conversion globally, for all the
|
|
|
|
+ methods parameters. If on, a type mismatch in a method parameter will
|
|
not cause a fault if it is possible to automatically convert it to the
|
|
not cause a fault if it is possible to automatically convert it to the
|
|
expected type.
|
|
expected type.
|
|
|
|
|
|
@@ -225,30 +224,30 @@ modparam("ctl", "fifo", "tcp:*:2050") # fifo over tcp
|
|
|
|
|
|
It is recommended to leave this parameter to its default off value and
|
|
It is recommended to leave this parameter to its default off value and
|
|
fix instead the client application (which should use the proper types)
|
|
fix instead the client application (which should use the proper types)
|
|
- or to modify the target rpc to accept any type (see the rpc scan '.'
|
|
|
|
|
|
+ or to modify the target rpc to accept any type (see the rpc scan '.'
|
|
modifier).
|
|
modifier).
|
|
|
|
|
|
- Example 1.7. Set the autoconversion parameter
|
|
|
|
|
|
+ Example 1.7. Set the autoconversion parameter
|
|
modparam("ctl", "autoconversion", 1)
|
|
modparam("ctl", "autoconversion", 1)
|
|
|
|
|
|
3.7. binrpc_max_body_size (integer)
|
|
3.7. binrpc_max_body_size (integer)
|
|
|
|
|
|
- Set the size of binrpc buffer for RPC reply. Value represents
|
|
|
|
|
|
+ Set the size of binrpc buffer for RPC reply. Value represents
|
|
kilobytes.
|
|
kilobytes.
|
|
|
|
|
|
Default: 4 (meaning 4KB);
|
|
Default: 4 (meaning 4KB);
|
|
|
|
|
|
- Example 1.8. Set the binrpc_max_body_size parameter
|
|
|
|
|
|
+ Example 1.8. Set the binrpc_max_body_size parameter
|
|
modparam("ctl", "binrpc_max_body_size", 10)
|
|
modparam("ctl", "binrpc_max_body_size", 10)
|
|
|
|
|
|
3.8. binrpc_struct_max_body_size (integer)
|
|
3.8. binrpc_struct_max_body_size (integer)
|
|
|
|
|
|
- Set the size of binrpc structure buffer for RPC reply. Value
|
|
|
|
- represents kilobytes.
|
|
|
|
|
|
+ Set the size of binrpc structure buffer for RPC reply. Value represents
|
|
|
|
+ kilobytes.
|
|
|
|
|
|
Default: 1 (meaning 1KB);
|
|
Default: 1 (meaning 1KB);
|
|
|
|
|
|
- Example 1.9. Set the binrpc_struct_max_body_size parameter
|
|
|
|
|
|
+ Example 1.9. Set the binrpc_struct_max_body_size parameter
|
|
modparam("ctl", "binrpc_struct_max_body_size", 3)
|
|
modparam("ctl", "binrpc_struct_max_body_size", 3)
|
|
|
|
|
|
4. SIP-router RPC Functions
|
|
4. SIP-router RPC Functions
|
|
@@ -263,7 +262,7 @@ modparam("ctl", "binrpc_struct_max_body_size", 3)
|
|
|
|
|
|
Example 1.10. print usage
|
|
Example 1.10. print usage
|
|
$ kamcmd -f"[%v] %v:%v %v\n" ctl.listen
|
|
$ kamcmd -f"[%v] %v:%v %v\n" ctl.listen
|
|
-[binrpc] unix_stream:/tmp/ser_ctl
|
|
|
|
|
|
+[binrpc] unix_stream:/tmp/kamailio_ctl
|
|
|
|
|
|
# note: the above command is equivalent with kamcmd listen
|
|
# note: the above command is equivalent with kamcmd listen
|
|
|
|
|
|
@@ -281,6 +280,6 @@ modparam("ctl", "binrpc_struct_max_body_size", 3)
|
|
|
|
|
|
Example 1.12. ctl.who usage
|
|
Example 1.12. ctl.who usage
|
|
$ kamcmd -f"[%v] %v: %v %v -> %v %v\n" ctl.who
|
|
$ kamcmd -f"[%v] %v: %v %v -> %v %v\n" ctl.who
|
|
-[binrpc] unix_stream: <anonymous unix socket> -> /tmp/ser_ctl
|
|
|
|
|
|
+[binrpc] unix_stream: <anonymous unix socket> -> /tmp/kamailio_ctl
|
|
|
|
|
|
# note the above command is equivalent to kamcmd who
|
|
# note the above command is equivalent to kamcmd who
|