Skip to content

Module yeti internals

NOTE: This section is for developers. it describes basic internals and documents things to be used by the DB layer.

Callprofile fields

DB layer controls yeti module's call processing behavior by returning callprofiles list.

Each callprofile configures single legB(termination) attempt.

Yeti module will try to connect call for the first callprofile and failover to the next ones depending on hunting configuration.

Last callprofile MUST have disconnect_code_id set.

signalling/routing fields

disconnect_code_id (integer. default: 0)

internal disconnect code id. causes callprofile reject if set.

failover will be performed depending on hunting configuration for the code (see: translator.* keys at Entities caching)

ruri (string. default: empty)

R-URI for the legB SIP dialog. callprofile MUST have ruri or disconnect_code_id set.

from (string. default: empty)

From for the legB SIP dialog. will use value from the original INVITE if not set.

to (string. default: empty)

To for the legB SIP dialog. will use value from the original INVITE if not set.

call_id (string. default: empty)

set Call-ID for legB SIP dialog. will generate value by AmSession::getNewId() if not set.

if set and contains %uuid placeholder, then placeholder will be replaced with value generated by AmSession::getNewId()

aleg_outbound_proxy, outbound_proxy (string. default: empty)

set outbound proxy URI for related SIP dialog.

adds specified URI as topmost Route-Set entry on requests sending

aleg_force_outbound_proxy, force_outbound_proxy (boolean. default: false)

specifies whether to force outbound proxy usage for in-dialog requests (with remote_tag set)

aleg_route_set, bleg_route_set (string. default: empty)

comma-separated URIs to force Route-Set for dialogs

bleg_force_cancel_routeset (boolean. default: false)

override force_cancel_route_set for legB

next_hop, aleg_next_hop (string. default: empty)

override transport next_hop for dialog (skip standard next_hop resolving by Route-Set or RURI)

it allows to send request to destination not specified in Route headers or RURI

next_hop_1st_req (boolean. default: false)

whether to override next_hop for initial request only

patch_ruri_next_hop (boolean. default: false)

patch RURI-host with IP-address of the transport endpoint

dlg_nat_handling (boolean. default: false)

if enabled, automatically set next_hop for legA dialog to the endpoint from initial INVITE received

outbound_interface, aleg_outbound_interface (string. default: empty)

set signalling interface name configured in signaling-interfaces

will skip signalling interface lookup by src IP address for next_hop after OS routing.

lega_res, legb_res (string. default: empty)

configuration for capacity and rate limiting

lega_res will be checked once for the first callprofile. legb_res will be checked for each call_profile before an attempt to create related legB.

resources can have two algorithms: capacity limit and rate limit. resource algorithm is specified for each resource type. resource types are loaded once on node start by SELECT * FROM load_resource_types() routing DB query (can be checked by RPC method yeti.show.resource.types)

single resource format:

for capacity resources: type:id:limit:takes

for ratelimit resources: type:id:limit:wsize

WHERE:
type
resource type id for mapping loaded by load_resource_types()
id
resource id. (type/id combination is supposed to be unique)
limit
allowed sumiltaneous resource usage count
takes
how much resource one get() operation takes for capacity resources
wsize
sliding-window size in seconds for ratelimit resources
resource atom format:

resources can be combined using | separator to perform failover. this will work like lazy-evaluated logical OR.

for example 1:42:100:1|2:314:100:1 means: try to grab resource with type:1 id:42 which is limited by 100 and takes 1 for call. if resources is not available then failover to resource with type:2 and id:314

resources spec format:

full resources spec contains resource atoms separated by semicolons (;). specified resources are grabbed as all-or-nothing so semicolons works as logical AND.

for example 1:42:100:1|2:314:100:1;3:111:10:1 means: try to grab ((1:42 OR 2:314) AND 3:111) resources

time_limit (integer. default: 0)

specifies maximum call duration in seconds if set. node will terminate call with internal code/reason 200/Call duration limit reached and send BYE to both legs`

ringing_timeout(integer. default: 0)

set timeout for Ringing state (after 18x). on timeout will terminate call with internal code 1505

trusted_hdrs_gw (boolean. default: false)

whether to parse and save legb_response_cdr_headers on 200OK from termination gateway.

transit_headers_a2b, transit_headers_b2a (string. default: empty)

comma-separated whitelist for additional SIP headers to transit between legs. Default behavior is to filter-out everything (empty whiltelist)

append_headers (string. default: empty)

\r\n separated list for SIP headers to be appended to the initial legB INVITE

append_headers_req, aleg_append_headers_req (string. dfefault: empty)

\r\n separated list for SIP headers to be appended for all SIP requests

aleg_append_headers_reply (string. default: empty)

\r\n separated list for SIP headers to be appended for all 200,18x legA replies

aleg_policy_id, bleg_policy_id (integer. default: 0)

Disconnect codes/hunting overrides (see: translator.dc_*_override keys at Entities caching)

aleg_rel100_mode_id, bleg_rel100_mode_id (integer: default: 4/Ignored)

rel100 processing mode. see Rel100 Modes

aleg_relay_options, bleg_relay_options (boolean. default: false)

whether to relay OPTIONS requests to the another leg. a/b means leg which received request

aleg_relay_update, bleg_relay_update (boolean. default: false)

whether to relay UPDATE requests to the another leg. a/b means leg which received request

aleg_relay_reinvite, bleg_relay_reinvite (boolean. default: true)

whether to relay reINVITE requests to the another leg. a/b means leg which received request

aleg_relay_hold, bleg_relay_hold (boolean. default: true)

whether to relay hold/unhold reINVITes requests to the another leg when related aleg_relay_reinvite/bleg_relay_reinvite is disabled. a/b means leg which received request

filter_noaudio_streams (boolean. default: false)

enable workaround mode which removes image(T38) streams

allow_1xx_wo2tag (boolean. default: false)

compatibility option. Do not ignore 1xx replies without To-tag. will patch reply internally with saved To-tag value for dialog before processing

invite_timeout (integer. default: TIMER_B)

invite transaction timeout override in seconds

srv_failover_timeout (integer. default: TIMER_M)

override timeout between DNS SRV entries failover in seconds

fake_180_timer (integer. default: 0)

generate 180 reply for originator after no 18x replies in fake_180_timer seconds

bleg_transport_protocol_id (integer. default: 0)

patch RURI transport with specified Transport protocol id

aleg_outbound_proxy_transport_protocol_id, bleg_outbound_proxy_transport_protocol_id (integer. default: 0)

patch related outbound proxies transport with specified Transport protocol id

bleg_protocol_priority_id (integer. default: 0/IPv4_only)

set DNS resolver IPv4/IPv6 priority for legB

bleg_max_30x_redirects (integer. default: 0)

allow max bleg_max_30x_redirects for the call if set.

uses callprofile which received redirect with RURI patched with Contact from 30x

bleg_max_transfers (integer. default: 0)

allow max bleg_max_transfers REFERS for the call if set.

uses callprofile which received redirect with RURI patched with Refer-To from REFER

if Refer-To contains tel-URI then uses transfer_tel_uri_host from the gateway cache for legB as URI-host and transfer_append_headers_req to add additional headers to the new INVITE

aleg_auth_required (boolean. default: false)

stop request processing and send auth challenge if set. used by DB layer when auth can not be offloaded to the yeti module

registered_aor_id (integer. default: 0)

registration id (usually it's termination gateway id) to resolve before processing

registered_aor_mode_id (integer. default: 1/REGISTERED_AOR_MODE_AS_IS)

set Registered AoR mode

Also, if To-host is set to unknown.invalid it will be replaced by Binding-host

enable_auth, enable_aleg_auth (boolean. default: false)

enable uac_uath module hook for session. so uac_auth will handle 401/407 auth challenges and perform SIP Digest auth

auth_user, auth_aleg_user, auth_pwd, auth_aleg_pwd (string. default: empty)

credentials for uac_uath module

radius_auth_profile_id (integer. default: 0)

profile id with parameters for RADIUS Auth request (see: radius_authorization_profiles key at Entities caching)

aleg_radius_acc_profile_id, bleg_radius_acc_profile_id (integer. default: 0)

profile id with parameters for RADIUS Accounting requests (see: radius_accounting_profiles key at Entities caching)

{routing.lega_gw_cache_key}/orig_gw_id (string. default: empty)

Points to the origination gateway cache entry (see: gateways_cache key at Entities caching).

Unused for now

{routing.legb_gw_cache_key}/term_gw_id (string. default: empty)

Points to the termination gateway cache entry (see: gateways_cache key at Entities caching).

Termination gateway cache entry is used for:

  • gateways throttling (we skip gateway with probability which depends from preconfigured reply codes count for it)

  • tel-URI redirects processing. see bleg_max_transfers callprofile field

SST

enable_session_timer (boolean. default: false)
enable timer moule session hook for legB
enable_aleg_session_timer (boolean. default: enable_session_timer)
enable timer moule session hook for legA
session_expires, aleg_session_expires (string. default: 300)
set expire value to be announced for SST
minimum_timer, aleg_minimum_timer (string. default: 90)
set minimum allowed expire value
maximum_timer, aleg_maximum_timer (string. default: 1800)
set maximum allowed expire value
accept_501_reply, aleg_accept_501_reply (string. default: false)
do not terminate session on 501 replies for SST reINVITE/UPDATEs
session_refresh_method_id, aleg_session_refresh_method_id (integer. default: 1)
set how to perform SST session refreshing. see SST Refresh method id

media fields

enable_rtprelay (boolean. default: false)

whether to relay/transcode RTP via node. false means do not touch SDP body so media will go directly between originatior/terminator

rtprelay_dtmf_filtering (boolean. default: false)

DEPRECATED. Unused

rtprelay_dtmf_detection (boolean. default: false)

force DTMF detection when stream was put on hold (AmRtpStream::receiving flag and is false / local SDP has recvonly/inactive attribute)

rtprelay_force_dtmf_relay (boolean. default: true)

DEPRECATED. Unused

aleg_force_symmetric_rtp, bleg_force_symmetric_rtp (boolean. default: false)

force SymmetricRTP mode for media connections

aleg_symmetric_rtp_nonstop, bleg_symmetric_rtp_nonstop (boolean. default: false)

never leave passive mode so SymmetricRTP will woork even after a remote endpoint learned

aleg_rtp_ping, bleg_rtp_ping (boolean. default: false)

send RTP ping packet after the stream initialization

aleg_sdp_c_location_id, bleg_sdp_c_location_id (integer. default: 0)

set SDP c-line location normalization. see Connection location id

dead_rtp_time (integer. default: sems.conf:general.dead_rtp_time)

override RTP timeout value. see SEMS configuration / media processing/ dead_rtp_time

rtp_relay_timestamp_aligning (boolean. default: false)

DEPRECATED. Unused

rtp_force_relay_cn (boolean. default: false)

force CN/13 (RFC 3389) RTP payload relay

aleg_dtmf_send_mode_id, bleg_dtmf_send_mode_id (integer. default: 1. TODO: add see enums)

set DTMF sending format. see: DTMF TX Mode id

aleg_dtmf_recv_modes, bleg_dtmf_recv_modes (integer. default: 7. TODO: add see enums)

set allowed incoming DTMF formats. see: DTMF RX Mode id

aleg_rtp_filter_inband_dtmf, bleg_rtp_filter_inband_dtmf (boolean. default: false)

set to filter out detected inband dtmf from the outgoing audio stream

needed to avoid events duplication if other side detects inband together with another methods usage

suppress_early_media (boolean. default: false)

clear body from 18x legB replies and replace all 18x codes with 180

force_one_way_early_media (boolean. default: false)

disable RTP receiving from the originator in early media state

aleg_media_encryption_mode_id, bleg_media_encryption_mode_id (integer. default: 0)

RTP media profile to match for incoming SDP offers

RTP media profile to use for outgoung SDP offers

see Encryption mode id

aleg_rtp_acl, bleg_rtp_acl (array of strings. default: empty)

subnets list to use as whitelist for incoming RTP

aleg_codecs_group_id, bleg_codecs_group_id (integer. default: 0)

set codec group to use ((see: codec_groups key at Entities caching)).

codec group specifies allowed codecs list and ptime

aleg_single_codec_in_200ok, bleg_single_codec_in_200ok (boolean. default : false)

reduce codecs for SDP answers in 200ok to single payload (except of telephone-event ones)

try_avoid_transcoding (boolean. default: false)

affects codecs ordering for Bleg. increases chance to setup relay mode instead of transcoding

rtprelay_interface, aleg_rtprelay_interface (string. default: empty)

set media interface name configured in media-interfaces

default value will use media iface with index 0 (the first described in configuration)

if set will skip media interface usage set in default-media-interface for the resolved signalling interface

other fields

record_audio (boolean. default: false)

enable call recording to MP3,RSR files

dump_level_id (integer. default: 0)

set PCAP file dump level. see: Dump level id

0 - means do not write file

aleg_sensor_id, bleg_sensor_id (integer. default: -1)

enabled sensor for the certain leg to mirror call traffic (see: sensors key at Entities caching)

aleg_sensor_level_id, bleg_sensor_level_id (integer. default: 0)

set dump level for sensors set by aleg_sensor_id/bleg_sensor_id

values are the same as for dump_level_id. see: Dump level id

global_tag (string. default: empty)

set transparent call identifier for tracking between systems

cache_id (string. default: empty)

set callprofile template id to be merged into callprofile returned by DB. (see: callprofiles key at Entities caching)

...dynamic fields...

all fields returned by SELECT * FROM {routing.schema}.load_interface_out() will be saved to CDR transparently

Entities caching

yeti module performs in-memory caching for multiple entities.

Caches are invalidated by timer interval set in db_refresh_interval option.

Timer calls SELECT * FROM check_states() function for configured routing DB connection and compares entities versions from DB reply against local ones, then reloads updates entities if necessary.

RPC method to check local/DB states: yeti.show.db-states

Supported entities table:

Key nameSQL to reloadDescriptionRPC method to check loaded data
ip_authSELECT * FROM load_ip_auth({node_id}, {pop_id})Cache to match incoming gateways by subnets longest matchyeti.show.ip-auth
trusted_lbSELECT * FROM load_trusted_lb()Cache to check for trusted balancers addressesyeti.show.trusted-balancers
sensorsSELECT * FROM load_sensor()Sensors parameters cache. see: aleg_sensor_id, bleg_sensor_id callprofile fieldsyeti.show.sensors
translations.dc_reroutingSELECT * FROM load_disconnect_code_rerouting()Global mapping for SIP disconnect codes whether to try rerouting to another callprofile/gatewayyeti.show.configuration | translator.hunting
translations.dc_rewriteSELECT * FROM load_disconnect_code_rewrite()Global mapping for SIP disconnect codes with rewrites for aleg code/reason and CDR valuesyeti.show.configuration | translator.response_translations
translations.dc_refuseSELECT * FROM load_disconnect_code_refuse()Global mapping for internal disconnect codes with behavior settings and rewrites to SIP code/reasonsyeti.show.configuration | translator.internal_translations
translations.dc_rerouting_overrideSELECT * FROM load_disconnect_code_rerouting_overrides()Per-callprofile mappings override for translations.dc_reroutingyeti.show.configuration | translator.overrides.hunting
translations.dc_rewrite_overrideSELECT * FROM load_disconnect_code_rewrite_overrides()Per-callprofile mappings override for translations.dc_rewriteyeti.show.configuration | translator.overrides.response_translations
translations.dc_refuse_overrideSELECT * FROM load_disconnect_code_refuse_overrides()Per-callprofile mappings override for translations.dc_refuseyeti.show.configuration | translator.overrides.internal_translations
codec_groupsSELECT * FROM load_codec_groups() or SELECT * FROM load_codecs()Codec groups cache. see: aleg_codecs_group_id,bleg_codecs_group_id callprofile fieldsyeti.show.configuration | codecs_groups
registrationsSELECT * FROM load_registrations_out({node_id}, {pop_id})Outgoing registrations list. uses registrar_client moduleregistrar-client.listRegistrations
radius_authorization_profilesSELECT * FROM load_radius_profiles()Radius autorization profiles cache. see: radius_auth_profile_id callprofile fieldyeti.show.radius.authorization.profiles
radius_accounting_profilesSELECT * FROM load_radius_accounting_profiles()Radius accounting profiles cache. see: aleg_radius_acc_profile_id, bleg_radius_acc_profile_id callprofile fieldsyeti.show.radius.accounting.profiles
auth_credentialsSELECT * FROM load_incoming_auth()Credentials cache for SIP Digest/JWT authyeti.show.auth.credentials.all
options_probersSELECT * FROM load_sip_options_probers({node_id})Probers list to send OPTIONS. usess options_prober moduleoptions-prober.show.probers
gateways_cacheSELECT * FROM load_gateway_attributes_cache()Gateways parameters cache. see $routing.lega_gw_cache_key, $routing.legb_gw_cache_key callprofile fieldsyeti.show.gateways-cache
callprofilesSELECT * FROM load_callprofiles()Callprofiles templates cache. see cache_id callprofile field-

Internal Enums

Internal disconnect codes

CodeDescription
114From parsing failed
115To parsing failed
116Contact parsing failed
117No Prepared statement to get callprofiles in DB
118Empty response from routing DB
119Failed to read callprofiles from routing DB
120Failed to evaluate/validate callprofiles
121No routing DB connection
122NOT USED. was DB broken exception
123NOT USED. was DB conversion exception
124NOT USED. was DB base exception
125legA RTP timeout
126ACK timeout
127PRACK timeout
128Session timeout (SST)
129Internal Error from CallLeg
130SIP Transaction timeout
131Gateway is not registered. see: registered_aor_id callprofile field
132legB RTP timeout
133Failure rate throttling
140Codec group not found. see: aleg_codecs_group_id,bleg_codecs_group_id callprofile fields
141SDP offer codecs not matched with assigned codecs group
142No suitable media streams
143Invalid media transport (failed to match RTP profile)
145reINVITE error reply
146finalized (usually BYE) before DB response
1500SDP generic exception
1501SDP parsing failed
1502Empty/No SDP answer
1503Wrong streams count in SDP answer
1504Wrong streams types in SDP answer
1505Ringing timeout. see ringing_timeout callprofile field
1600Resources cache error
1601Unknown resource type

Dump level id

Dump level is a bitmask so flags can be combined

FlagDescription
1log SIP
2log RTP

Rel100 Modes

ValueDescription
0Disabled. Never announce, reject if received
1Supported. Announce and enable if received
2SupportedNotAnnounced. Do not announce and enable if received
3Require. Always announce fail if not received
4Ignored. Do not process

Transport protocol id

ValueDescription
1UDP
2TCP
3TLS

DNS Priority id

ValueDescription
0IPv4_only. use A entries only
1IPv6_only. use AAAA entries only
3Dualstack. use A and AAAA entries. do not sort
4IPv4_pref. use A and AAAA entries. prioritize A entries
5IPv6_pref. use A and AAAA entries. prioritize AAAA entries

Registered AoR mode id

ValueDescription
1REGISTERED_AOR_MODE_AS_IS
Use registration binding as RURI
2REGISTERED_AOR_MODE_REPLACE_RURI_TRANSPORT_INFO
Use registration binding as RURI but merge with callprofile RURI URI-params

SST Refresh method id

ValueDescription
1REFRESH_METHOD_INVITE:
use INVITE for SST
2REFRESH_METHOD_UPDATE:
use UPDATE for SST
3REFRESH_METHOD_UPDATE_FALLBACK_INVITE:
use UPDATE for SST. fallback to INVITE if UPDATE tag is not listed in Allow

Connection location id

ValueDescription
0BOTH:
normalize SDP so c-line presented both at media and stream levels
1SESSION_ONLY:
normalize SDP so c-line presented at session level only
2MEDIA_ONLY:
normalize SDP so c-line presented at media level only

DTMF TX Mode id

ValueDescription
0DTMF_TX_MODE_DISABLED
Avoid sending
1DTMF_TX_MODE_RFC2833:
telephone-event RTP payload
2DTMF_TX_MODE_INFO_DTMF_RELAY
SIP INFO with application/dtmf-relay body
4DTMF_TX_MODE_INFO_DTMF
SIP INFO with application/dtmf body
8DTMF_TX_MODE_INBAND
inband DTMF

DTMF RX Mode id

DTMF RX Mode id is a bitmask so flags can be combined

FlagDescription
1DTMF_RX_MODE_RFC2833
telephone-event RTP payload
2DTMF_RX_MODE_INFO:
SIP INFO (both application/dtmf-relay and application/dtmf)
4DTMF_RX_MODE_INBAND
detect inband DTMF (WARN: forces transcoding mode)

Encryption mode id

ValueDescription
0RTP/AVP and RTP/AVPF
1RTP/SAVP and RTP/SAVPF (SRTP SDES)
2UDP/TLS/RTP/SAVP and UDP/TLS/RTP/SAVPF (SRTP DTLS)
3RTP/AVP and RTP/AVPF but use/check for zrtp_hash SDP a-line