Skip to content

Accounts

juha-h edited this page Mar 28, 2024 · 23 revisions

Accounts

Baresip creates its initial User-Agents from the accounts file in the configuration path. Module accounts processes the accounts file on startup and creates one User-Agent per account. Each line in the accounts file represents one account and finally one User-Agent.

You find an example for the accounts file in the repository in:

docs/examples/accounts

The top of the example tells:

# Displayname <sip:user:password@domain;uri-params>;addr-params
#
#  uri-params:
#    ;transport={udp,tcp,tls}
#
#  addr-params:
#    ;100rel={yes,no,required}
#    ;answermode={manual,early,auto,early-audio,early-video}
#    ;answerdelay=0
#    ;audio_codecs=opus/48000/2,pcma,...
#    ;audio_source=alsa,default
#    ;audio_player=alsa,default
#    ;autelev_pt=101
#    ;sip_autoanswer={yes, no}
#    ;sip_autoanswer_beep={on, off, local}
#    ;dtmfmode={rtpevent, info, auto}
#    ;auth_user=username
#    ;auth_pass=password
#    ;call_transfer=no
#    ;cert=cert.pem
#    ;mediaaf={ipv4,ipv6,auto}
#    ;mediaenc={srtp,srtp-mand,srtp-mandf,dtls_srtp,zrtp}
#    ;medianat={stun,turn,ice}
#    ;mwi=no
#    ;outbound="sip:primary.example.com;transport=tcp"
#    ;outbound2=sip:secondary.example.com
#    ;ptime={10,20,30,40,...}
#    ;regint=3600
#    ;fbregint=120
#    ;prio={0,1,2,3,...}
#    ;rwait=90
#    ;pubint=0 (publishing off)
#    ;regq=0.5
#    ;sipnat={outbound}
#    ;stunuser=STUN/TURN/ICE-username
#    ;stunpass=STUN/TURN/ICE-password
#    ;stunserver=stun:[user:pass]@host[:port]
#    ;inreq_allowed={yes, no}  # default: no
#    ;video_codecs=h264,h263,...
#    ;extra="extra parameters"

All parameters listed are optional.

Note: URI parameters (currently there is only transport) are put inside the angle brackets where as the address parameters are put after the right angle bracket: <...;uri-params>;addr-params

The accounts can be split into two main groups that are separated by the address parameter regint.

  • regint=n accounts with a positive n will create a User-Agent for the registration at a SIP-registrar. Thus the User-Agent starts to send SIP REGISTER packets periodically. Default: 3600 seconds (plus a random value between 0-255 seconds)
  • regint=0 accounts are local accounts. The created User-Agent will not start registration requests. Local accounts can be used for peer-to-peer calls between two SIP clients.

transport

values: udp,tcp,tls

The transport protocol that should be used for SIP.

default: udp

100rel

values: yes,no,required

  • yes: If the peer supports reliable provisional responses, send 1xx responses reliable. Otherwise just indicate support for them.
  • no: Reliable provisional responses are not supported.
  • required: Requires the use of reliable provisional responses. If the peer does not support them, no call can be set up.

default: no

Note: 100rel does not work if call gets parallel forked (e.g. by a SIP proxy). Reason: baresip does not support SIP forking where one SIP session can have multiple dialogs.

answermode

values: manual,early,early-audio,early-video,auto

The answer mode for incoming calls. See also answerdelay and sip_autoanswer!

  • manual: The user has to answer the call and the device is ringing.
  • early: The user has to answer the call. The device is not ringing, instead early media audio+video will be requested from the peer.
  • early-audio: The user has to answer the call. The device is not ringing, instead early audio will be requested from the peer.
  • early-video: The user has to answer the call. The device is ringing and early video will be requested from the peer.
  • auto: The call is answered immediately. (For this mode answerdelay or sip_autoanswer have no influence.)

default: manual

answerdelay

values: 0,100,200,... in [ms]

Except for mode auto it is possible to specify additionally an answerdelay. An incoming call will be answered after the specified delay. A value of zero disables the delayed answer. If specified, the user is still able to answer the call before the answer delay elapsed.

default: 0 (disabled)

audio_codecs

  • value: <codec>/<srate>/<channels>,...
  • typical value: opus/48000/2,pcma,...

Where:

  • codec is the name of the codec,
  • srate is the sample rate,
  • channels is the number of channels 1,2.

You may specify multiple codecs separated by comma. Specify the codecs to restrict the supported audio codecs (offered in SDP).

default: All available audio codecs are offered in SDP.

audio_source

value: <module, device>

Selects the audio source (the microphone) for the specified account. This override the setting audio_source in the config file.

default: not set

audio_player

value: <module, device>

Selects the audio player (the speaker) for the specified account. This override the setting audio_player in the config file.

default: not set

autelev_pt

value: int

Payload type for telephone-event.

default: 101

sip_autoanswer

value: yes, no

A yes turns the User-Agent into an "intercom device". More concretely an incoming SIP INVITE will be checked for a header that informs our User-Agent to automatically answer the incoming call immediately or after a specified delay.

Before the call is answered a beep tone is played in order to avoid unauthorized surveillance by the remote. The beep tone can be turned of by setting address parameter sip_autoanswer_beep=no.

Note: If answermode=auto then this setting is ignored.

default: no

sip_autoanswer_beep

value: off, on, local

Decides if a local beep should be played before a call with a SIP auto answer header is answered automatically.

  • off: No local beep is played. This setting is useful if the SIP proxy plays the start beep inbound.
  • on: A beep tone is played before the call is answered automatically. The locally configured audio file can be overwritten with the SIP Alert-Info header URL.
  • local: The locally configured beep tone is played.

default: on

dtmfmode

value: rtpevent, info, auto

The DTMF mode used by this User-Agent for outgoing DTMF keys.

  • rtpevent: The DTMF keys are sent inbound the RTP (RFC-4733).
  • info: The DTMF keys are sent via a SIP INFO packet.
  • auto: It depends on the remote SDP which method is used. If there is an SDP format with name "telephone-event" then inbound DTMF is used, otherwise SIP INFO.

default: rtpevent

auth_user

value: <username>

The optional authorization user name. If not specified the user in the SIP URI will be used for the authorization at a SIP registrar.

auth_pass

value: <password>

The authorization password used for registration at a SIP registrar.

default: not set

call_transfer

value: yes, no

Call transfer allowed flag. If yes:

  • REFER is put into the Allowed header,
  • "Refer-To" headers are handled

default: yes

cert

value:

The SIP TLS client certificate+keyfile for the account.

default: not set

mediaaf

values: ipv4,ipv6,auto

The preferred media address family of the account.

default: auto which means same address family like the SIP registration, or ipv4 for registrar-less accounts if ipv4 is available.

mediaenc

values: srtp,srtp-mand,srtp-mandf,dtls_srtp,zrtp

The media encryption method specifies how outgoing RTP packets should be encrypted.

default: not set

medianat

values: stun,turn,ice

The method that should be used for media NAT traversal.

default: not set

mwi

values: yes, no

Optional MWI enabled flag. Is used by module mwi that implements Message Waiting Indication RFC-3842.

default: yes

outbound

  • value: <sip-uri>
  • typical value: sip:primary.example.com;transport=tcp

SIP outbound proxy. Adds a Route header to the SIP REGISTER dialog. If also sipnat=outbound is set, then the User-Agent starts to send NAT keep alive packets to the outbound.

default: not set

outbound2

value: <sip-uri>

The second optional SIP outbound proxy is used if also sipnat=outbound is set. If both outbound are specified periodic SIP REGISTER dialogs are started for both outbound proxies. The SIP UAS is able to match both registrations to the single User-Agent if both registrations reach the UAS.

default: not set

ptime

  • value: int in [ms]
  • typical value: 10,20,30,40,...

The packet time for the audio stream. Sets the SDP media ptime attribute.

default: 20

regint

value: 0 or a positive integer in [s]

The registration interval when the User-Agent should register to a SIP registrar. Zero means that the User-Agent will not register. Non-registration accounts or local accounts are used for peer-to-peer calls from one UAC to another UAC without the need of a UAS.

default: 0

fbregint

value: 0 or a positive integer in [s]

Fallback registration interval. In the so called "Cisco Mode" REGISTER packets with expiry=0 are sent to SIP registrars to detect if it is available. Since the expiry parameter is set to zero, the User-Agent is not registered at the registrar. The fbregint is the interval of the REGISTER with expiry zero packets.

See parameter prio for a description when fallback registrations are sent.

prio

values: 0,1,2,3,...

Prio 0 accounts are main accounts that create User-Agent which immediately start their registration on startup.

Module serreg handles accounts with prio > 0.

Prio 1 accounts are first level fallback accounts. If none of the main accounts with prio 0 is available, module serreg switches to register to all prio=1 accounts.

Prio 2 accounts are second level fallback accounts, and so on.

By means of fbregint setting it is possible to activate fallback registrations to SIP registrars the User-Agent is currently not registered to. This enables module serreg to switch immediately to the next available fallback SIP registrar when the connection to the current SIP registrar is lost. Thus switching to fallback accounts is much faster.

With fbregint module serreg is also able to switch back to the main accounts SIP registrar if it becomes available again.

default: 0, the User-Agent starts registration on startup

rwait

value: 5-95 in [%]

Relative wait delay for the re-registration in percent to the expiry time reported back from SIP-registrar in case of a successful registration.

default: 90

pubint

value: d in [s]

Publish interval in seconds for module presence.

default: 0, publishing off

regq

value: string

Registration Q-value. A string for the SIP REGISTER parameter ;q=%s. See RFC-4596!

default: not set

sipnat

value: outbound

If sipnat=outbound SIP extensions "path" and "outbound" are added and REGISTER packets are sent for outbound and outbound2. Additionally keep alive packets are sent to hold the NAT tunnels open.

default: not set

stunuser

value: <user>

The username for STUN/TURN/ICE.

default: not set

stunpass

value: <password>

The password for STUN/TURN/ICE.

default: not set

stunserver

value: <stun:[user:pass]@host[:port]>

The STUN server used for stun, turn, ice which can be chosen with parameter medianat.

inreq_allowed

values: yes, no

  • yes: Incoming MESSAGE requests can be accepted.
  • no: Incoming MESSAGE requests are denied.

default: no

video_codecs

value: <vcodec1>,<vcodec2>,...

You may specify multiple codecs separated by comma. Specify the codecs to restrict the supported video codecs (offered in SDP).

In order to disable video for the account, specify an empty value:

;video_codecs=

default: All available video codecs are offered in SDP.

extra

  • value: string
  • typical value: param1=value1,param2=value2,...

Extra account parameters. The format of the value is free, but must not contain any ; because this is the separator for the addr-params.

default: not set

Clone this wiki locally