Skip to content

Configuration

Sebastian Reimers edited this page Nov 20, 2024 · 27 revisions

Configuration

Overview

The configuration is located by default in ~/.baresip. This can be changed by command line argument -f.

baresip -f path_to_your_config

In your config directory you find these files:

File Description
config Global configuration
accounts User-Agents that should be created
contacts Contacts (address book)
uuid Universally Unique Identifier

The file config in the configuration directory supports the following settings for the core of baresip whose code is located in the src directory. Configuration settings that are module specific can be found on the wiki pages of the specific modules.

The accounts file is documented here Accounts.

You find an example for the config file in the baresip repository in:

docs/examples/config

Core

poll_method

values: epoll, kqueue, poll, select

The polling method used.

default: baresip detects the best polling method available on the system.

SIP

sip_listen

typical value: 0.0.0.0:5060

Optionally specify the local IP address and port to listen on incoming SIP requests. For TLS the port number +1 will be applied. If not set baresip opens a UDP, a TCP socket with arbitrary port number p. Each for the local IPv4 and IPv6 address. Additionally an IPv4 and an IPv6 socket for TLS are opened onport p+1.

E.g. to bind to socket 5060 use:

sip_listen 0.0.0.0:5060

This opens UDP and TCP sockets on port 5060 for IPv4 and IPv6 on the local IP address of the network interface specified with net_interface. And this opens also two TCP socket for TLS on port 5061, one for IPv4 and one for IPv6.

default: not set.

sip_certificate

typical value: cert.pem

TLS certificate and private key used to identify this device.

default: not set.

sip_cafile

typical value: /etc/ssl/certs/ca-certificates.crt

TLS trusted certificate file that may contain multiple CA certificates in PEM format.

default: not set

sip_capath

typical value: /etc/ssl/certs

TLS trusted certificate path that may contain multiple CA certificate files in PEM format.

default: not set

sip_transports

typical value: tls,wss

A comma separated list of supported transport protocols.

default: udp,tcp,tls,ws,wss

sip_trans_def

values: udp, tcp, tls, ws, wss

The default transport protocol for outgoing peer-to-peer calls. This is used only if there are multiple local accounts (regint=0) with different transport protocols.

default: udp

sip_verify_server

values: yes, no

Set this to yes if for SIP TLS the peer certificate should be verified. A value of no means that the peer is not verified. Then SIP TLS security is reduced to only encrypt the SIP packets.

default: no

sip_tos

values: byte

Type of service field of the IPv4 header.

default: 0xa0=160

    7     6     5     4     3     2     1     0
 +-----+-----+-----+-----+-----+-----+-----+-----+
 |   PRECEDENCE    |          TOS          | MBZ |
 +-----+-----+-----+-----+-----+-----+-----+-----+
  • TOS:
    bit 4 - low delay
    bit 3 - high throughput
    bit 2 - high reliability
    bit 1 - low cost
  • MBZ:
    bit 0 - zero

Call

call_local_timeout

values in seconds.

Local timeout for incoming calls.

default: 120

call_max_calls

values: positive integer

Maximum number of calls allowed. Used to reject incoming calls.

default: 4

call_hold_other_calls

values: yes, no

Ensures that only one call can be active (established and not put on-hold locally).

default: yes

Audio

audio_path

value: <path> typical value: /usr/local/share/baresip

Optionally you may specify the path where the audio files for the ring, ringback and error tones are located.

default: depends on the build target system

audio_player

value: <module>,<device>

The baresip module and the speaker device used for audio playback of incoming speech and the ring, ringback and error tones.

default: alsa,default

audio_source

value: <module>,<device>

The baresip module and the microphone device used for audio recording of the local speech.

default: alsa,default

audio_alert

value: <module>,<device>

The baresip module and the speaker device used for audio playback of the signal tone for an incoming SIP text message.

default: alsa,default

ausrc_srate

typical values: 16000, 32000, 48000, ...

Optionally bind the audio sample rate for the microphone recording to a specified value. If not set, the sample rate is chosen to fit the codecs sample rate. Thus no re-sampling has to be done.

default: not set

auplay_srate

typical values: 16000, 32000, 48000, ...

Optionally bind the audio sample rate for the audio player to a specified value. If not set, the sample rate is chosen to fit the codecs sample rate. Thus no re-sampling has to be done.

default: not set

ausrc_channels

typical values: 0, 1, 2

Optionally set the number of channels of the microphone. A value of zero means that the channel number is chosen to fit the codecs channel number. Thus no re-sampling has to be done.

default: 0

auplay_channels

typical values: 0, 1, 2

Optionally set the number of channels of the speaker device. A value of zero means that the channel number is chosen to fit the codecs channel number. Thus no re-sampling has to be done.

default: 0

audio_txmode

values: poll, thread

The RTP transmission mode for audio.

  • poll: The microphone read thread also does RTP sending. Should be used for low latency sending.
  • thread: A separate thread for RTP sending reduces the jitter for outgoing audio RTP packets. Should be used if the audio source device (the microphone) has too high jitter.

default: poll

audio_level

values: yes, no

Enables client-to-mixer audio level RTP Header Extension. The audio volume is computed and sent with the RTP packet.

default: no

ausrc_format

values: s16, float, s24_3le

Sample format of the microphone device.

default: s16

auplay_format

values: s16, float, s24_3le

Sample format of the speaker device.

default: s16

auenc_format

values: s16, float, s24_3le

Sample format of the audio encoder.

default: s16

audec_format

values: s16, float, s24_3le

Sample format of the audio decoder.

default: s16

audio_buffer

values: <min>-<max>

Optionally change the default audio buffer for the remote speech located before the speaker device. The audio buffer has to be chosen large enough to compensate the expected network jitter, except the jitter buffer is used.

Note: See also settings jitter_buffer_type and jitter_buffer_delay!

default: 20-160 # ms

audio_buffer_mode

value: fixed, adaptive

This settings configures the mode of the RX audio buffer. This audio buffer compensates the network jitter. The two modes are:

  • fixed: The audio buffer has fixed size. The minimum value has to be chosen large enough to compensate expected network jitter.
  • adaptive: The audio buffer has a dynamic size which depends on the computed network jitter.

default: fixed

audio_silence

values: float in [dB]

The audio level for silence as negative dB value. The adaptive audio buffer only does its latency adjustment during periods of silence. This avoids unwanted audio artifacts. Set this value to 0.0 in order to disable the silence detection.

Note: If this value is chosen lower than the remote microphone noise floor, than the latency can't be adjusted according to the network jitter in adaptive mode.

default: -35.0

audio_telev_pt

values: int

Payload type for telephone-event.

default: 101

Video

video_source

  • value: <module>,<device>
  • typical value: v4l2,/dev/video0

The camera module and device used for SIP video calls.

default: not set

video_display

  • value: <module>,<device>
  • typical value: x11,-

The video display module and device used for SIP video calls.

default: not set

video_size

value: <width>,<height>

The camera resolution. Is also used for video filters and depends on the filter module how it is used.

default: 640,480

video_bitrate

value: a integer in [bit/s]

The upper limit for bit rate of the outgoing video stream used by the encoder.

default: 1000000

video_sendrate

value: a integer in [bit/s]

Bandwidth limit bitrate. Needs to be bigger than video_bitrate since packetization/fragmentation adds a overhead.

default: 0

video_fps

value: a float in [frames/s]

The video frame rate that will be offered during the SDP handshake. It will also be used if no frame rate was handled out during SDP handshake for:

  • the camera frame rate
  • the encoder frame rate
  • for optional video filters

default: 30

video_fullscreen

values: yes, no

Full screen flag for the video display.

default: yes

videnc_format

values: yuv420p,yuyv422,uyvy422,rgb32,argb,rgb565,rgb555,nv12,nv21,yuv444p

Video camera and encoding pixel format. Also used for optional video filters. If, however the camera pixel format does not match the configured value, then a software pixel format conversion is applied before encoding.

default: yuv420p

AVT - Audio/Video Transport

rtp_tos

Type Of Service (TOS) setting for audio RTP socket

default: 0xb8=184

rtp_video_tos

Type Of Service (TOS) setting for video RTP socket

default: 0x88=136

rtp_ports

value: <min>-<max>

The port range for RTP listen sockets.

default: 1024-49152

rtp_bandwidth

  • value: <min>,<max> in [kbit/s]
  • typical value: 512-1024

Optionally you may specify the RTP bandwidth that will be put in the SDP media as bandwidth field for audio and video. If specified then the bandwidth for audio is set to a fixed value of 128 kbit/s. The video gets the bandwidth rtp_bandwidth - 128 kbit/s.

default: not set

jitter_buffer_type

value: off, fixed, adaptive

The jitter buffer does packet reordering and thus have to be large enough to put RTP packets into correct order.

Select the type of jitter buffer used for incoming RTP audio.

  • off: No jitter buffer is used.
  • fixed: The jitter buffer has fixed size.
  • adaptive: The jitter buffer has a dynamic size which depends on the frequency of too late packets.

Note: See also settings audio_buffer_mode!

default: fixed

jitter_buffer_delay

value: <min>-<max> in number of packets

The size of the jitter buffer. If a fixed jitter buffer type is used then most of the time there will be min or min + 1 packets in the jitter buffer. After a packet is put into the jitter buffer immediately one packet is taken out of it and decoded. Re-ordering can be done only if enough packets are in the buffer. So min has to be big enough.

If the adaptive jitter buffer is used, then the min value can be 1 to have a low latency. If the incoming RTP packets have a high jitter, then the number of packets will be increased up to max.

Note: After the jitter buffer packets are decoded they are put into an audio buffer. If the fixed jitter buffer is used or none, then this audio buffer should be chosen big enough to compensate the network jitter. If the adaptive jitter buffer is used, the audio buffer can be chosen minimal for a low audio latency.

default: 5-10

jitter_buffer_wish

value: integer for the number of packets

The optional wish size of the jitter buffer is used in the adaptive jitter buffer mode. It waits at the start of the RTP stream until the specified number of packets had been collected before the first packet is provided to the audio decoder.

This value should be in the range of the jitter_buffer_delay. This setting can be specified if the network or the incoming RTP stream is expect to have a high jitter. In this case buffer underruns at the beginning can be avoided by an adequate value for this setting.

A value of zero means that jitter_buffer_delay min is used also for the wish size.

default: 0

rtp_stats

values: yes, no

Flag for an optional RTP statistics output at the end of the call.

default: no

rtp_timeout

value: integer in [s]

A optional timeout for incoming RTP packets after which a call should be terminated. A value of zero means that there is no timeout and a call without incoming RTP is kept running until terminated manually.

default: 0

rtp_rxmode

values: main, thread

Selects if incoming RTP packets should be processed in the main thread or in a separate thread. This is currently used only for audio streams.

default: main

Network

dns_server

value: <IP>:<port>

Optionally specify up to four static DNS server. If not specified they are retrieved from the system (e.g. /etc/resolv.conf)

default: not specified

dns_fallback

value: <IP>:<port>

If no dns server is detected/available the dns_fallback is used (extends the system ones).

default: not specified

dns_getaddrinfo

value: yes or no

Use async getaddrinfo for A and AAAA records and considers /etc/hosts

default: no

net_af

  • value: ipv4 or ipv6

Optionally you may specify the address family (IPv4 or IPv6) that baresip is using.

default: If not specified, baresip uses IPv4 if only IPv4 is available, IPv6 if only IPv6 is available, and both if both are available.

net_interface

  • value: a string
  • typical value: eth0

Optionally you may specify the network interface used. If not specified baresip will detect the network interface that is connected to the internet.

default: not specified

Play tones

file_ausrc

value: <module> typical values: gst,aufile, or any audio source that reads from a file

Optionally you may specify a module that should be used to read and decode an audio file in order to play ring or other tones. If not specified the internal WAV file reader that is provided by the library rem is used.

Note: If the internal WAV file reader is used, then the whole WAV file is read and hold in RAM. Then the playback is done. Where as if file_ausrc is set, then reading and decoding of samples is done in junks which are written to the audio speaker immediately.

default: not specified

file_srate

typical values: 8000,16000,32000,...

Optional sample rate for tones played with module defined with file_ausrc. It depends on the module used if this setting is used or not. E.g.

  • module aufile is able to read the sample rate form the WAV header and use this for the playback,
  • in contrast to module gst. This uses 16000 as default sample rate which can be overwritten by this setting. If the sample rate of the file does not match this setting, gstreamer will do re-sampling.

file_channels

values: 1, 2

Optional number of channels for tones played with module specified with file_ausrc. Similar statements as for file_srate apply also here.

Loading modules

There are three different kinds of modules

  • normal modules: Are loaded and initialized first and hold in a module list. These kind of modules implement baresip audio/video sources, filter, codecs and player. They may also register User-Interfaces or media encryption processors. Sometimes they also register commands.

  • temporary modules: Are loaded at startup and after initialization immediately unloaded. They are not kept in the module list.

  • application modules: Are loaded and initialized last and also put in the module list. They contain application specific functions. The main purpose of an application module is to register commands that define the API to the user or an external application process. These commands can be called via a User-Interface module by the user or by a module that provides an interprocess communication channel.

module_path

value: typical value: /usr/local/lib/baresip/modules

Optionally specify the path where your module libraries are located.

default: depends on the build target system

module

value: .so

Loads a normal module.

module_tmp

value: .so

Loads a temporary module.

module_app

value: .so

Loads an application module.

Clone this wiki locally