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-URIfor the legB SIP dialog. callprofile MUST haveruriordisconnect_code_idset.- from (string. default: empty)
Fromfor the legB SIP dialog. will use value from the original INVITE if not set.- to (string. default: empty)
Tofor the legB SIP dialog. will use value from the original INVITE if not set.- call_id (string. default: empty)
set
Call-IDfor legB SIP dialog. will generate value byAmSession::getNewId()if not set.if set and contains
%uuidplaceholder, then placeholder will be replaced with value generated byAmSession::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_reswill be checked once for the first callprofile.legb_reswill 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 methodyeti.show.resource.types)- single resource format:
for capacity resources:
type:id:limit:takesfor 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:1means: 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:1means: 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 reachedand 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\nseparated list for SIP headers to be appended to the initial legB INVITE- append_headers_req, aleg_append_headers_req (string. dfefault: empty)
\r\nseparated list for SIP headers to be appended for all SIP requests- aleg_append_headers_reply (string. default: empty)
\r\nseparated 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_*_overridekeys 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_timerseconds- 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_redirectsfor 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_transfersREFERS 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_hostfrom the gateway cache for legB as URI-host andtransfer_append_headers_reqto 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)
Also, if To-host is set to
unknown.invalidit will be replaced by Binding-host- enable_auth, enable_aleg_auth (boolean. default: false)
enable
uac_uathmodule hook for session. souac_authwill 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_uathmodule- radius_auth_profile_id (integer. default: 0)
profile id with parameters for RADIUS Auth request (see:
radius_authorization_profileskey 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_profileskey at Entities caching){routing.lega_gw_cache_key}/orig_gw_id (string. default: empty)Points to the origination gateway cache entry (see:
gateways_cachekey 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_cachekey 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_transferscallprofile field
SST
- enable_session_timer (boolean. default: false)
- enable
timermoule session hook for legB - enable_aleg_session_timer (boolean. default: enable_session_timer)
- enable
timermoule session hook for legA - session_expires, aleg_session_expires (string. default: 300)
- set
expirevalue 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::receivingflag 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
- 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_groupskey 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
defaultvalue will use media iface with index 0 (the first described in configuration)if set will skip media interface usage set in
default-media-interfacefor 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:
sensorskey 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_idvalues 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:
callprofileskey 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 name | SQL to reload | Description | RPC method to check loaded data |
|---|---|---|---|
| ip_auth | SELECT * FROM load_ip_auth({node_id}, {pop_id}) | Cache to match incoming gateways by subnets longest match | yeti.show.ip-auth |
| trusted_lb | SELECT * FROM load_trusted_lb() | Cache to check for trusted balancers addresses | yeti.show.trusted-balancers |
| sensors | SELECT * FROM load_sensor() | Sensors parameters cache. see: aleg_sensor_id, bleg_sensor_id callprofile fields | yeti.show.sensors |
| translations.dc_rerouting | SELECT * FROM load_disconnect_code_rerouting() | Global mapping for SIP disconnect codes whether to try rerouting to another callprofile/gateway | yeti.show.configuration | translator.hunting |
| translations.dc_rewrite | SELECT * FROM load_disconnect_code_rewrite() | Global mapping for SIP disconnect codes with rewrites for aleg code/reason and CDR values | yeti.show.configuration | translator.response_translations |
| translations.dc_refuse | SELECT * FROM load_disconnect_code_refuse() | Global mapping for internal disconnect codes with behavior settings and rewrites to SIP code/reasons | yeti.show.configuration | translator.internal_translations |
| translations.dc_rerouting_override | SELECT * FROM load_disconnect_code_rerouting_overrides() | Per-callprofile mappings override for translations.dc_rerouting | yeti.show.configuration | translator.overrides.hunting |
| translations.dc_rewrite_override | SELECT * FROM load_disconnect_code_rewrite_overrides() | Per-callprofile mappings override for translations.dc_rewrite | yeti.show.configuration | translator.overrides.response_translations |
| translations.dc_refuse_override | SELECT * FROM load_disconnect_code_refuse_overrides() | Per-callprofile mappings override for translations.dc_refuse | yeti.show.configuration | translator.overrides.internal_translations |
| codec_groups | SELECT * FROM load_codec_groups() or SELECT * FROM load_codecs() | Codec groups cache. see: aleg_codecs_group_id,bleg_codecs_group_id callprofile fields | yeti.show.configuration | codecs_groups |
| registrations | SELECT * FROM load_registrations_out({node_id}, {pop_id}) | Outgoing registrations list. uses registrar_client module | registrar-client.listRegistrations |
| radius_authorization_profiles | SELECT * FROM load_radius_profiles() | Radius autorization profiles cache. see: radius_auth_profile_id callprofile field | yeti.show.radius.authorization.profiles |
| radius_accounting_profiles | SELECT * FROM load_radius_accounting_profiles() | Radius accounting profiles cache. see: aleg_radius_acc_profile_id, bleg_radius_acc_profile_id callprofile fields | yeti.show.radius.accounting.profiles |
| auth_credentials | SELECT * FROM load_incoming_auth() | Credentials cache for SIP Digest/JWT auth | yeti.show.auth.credentials.all |
| options_probers | SELECT * FROM load_sip_options_probers({node_id}) | Probers list to send OPTIONS. usess options_prober module | options-prober.show.probers |
| gateways_cache | SELECT * FROM load_gateway_attributes_cache() | Gateways parameters cache. see $routing.lega_gw_cache_key, $routing.legb_gw_cache_key callprofile fields | yeti.show.gateways-cache |
| callprofiles | SELECT * FROM load_callprofiles() | Callprofiles templates cache. see cache_id callprofile field | - |
Internal Enums
Internal disconnect codes
| Code | Description |
|---|---|
| 114 | From parsing failed |
| 115 | To parsing failed |
| 116 | Contact parsing failed |
| 117 | No Prepared statement to get callprofiles in DB |
| 118 | Empty response from routing DB |
| 119 | Failed to read callprofiles from routing DB |
| 120 | Failed to evaluate/validate callprofiles |
| 121 | No routing DB connection |
| 122 | NOT USED. was DB broken exception |
| 123 | NOT USED. was DB conversion exception |
| 124 | NOT USED. was DB base exception |
| 125 | legA RTP timeout |
| 126 | ACK timeout |
| 127 | PRACK timeout |
| 128 | Session timeout (SST) |
| 129 | Internal Error from CallLeg |
| 130 | SIP Transaction timeout |
| 131 | Gateway is not registered. see: registered_aor_id callprofile field |
| 132 | legB RTP timeout |
| 133 | Failure rate throttling |
| 140 | Codec group not found. see: aleg_codecs_group_id,bleg_codecs_group_id callprofile fields |
| 141 | SDP offer codecs not matched with assigned codecs group |
| 142 | No suitable media streams |
| 143 | Invalid media transport (failed to match RTP profile) |
| 145 | reINVITE error reply |
| 146 | finalized (usually BYE) before DB response |
| 1500 | SDP generic exception |
| 1501 | SDP parsing failed |
| 1502 | Empty/No SDP answer |
| 1503 | Wrong streams count in SDP answer |
| 1504 | Wrong streams types in SDP answer |
| 1505 | Ringing timeout. see ringing_timeout callprofile field |
| 1600 | Resources cache error |
| 1601 | Unknown resource type |
Dump level id
Dump level is a bitmask so flags can be combined
| Flag | Description |
|---|---|
| 1 | log SIP |
| 2 | log RTP |
Rel100 Modes
| Value | Description |
|---|---|
| 0 | Disabled. Never announce, reject if received |
| 1 | Supported. Announce and enable if received |
| 2 | SupportedNotAnnounced. Do not announce and enable if received |
| 3 | Require. Always announce fail if not received |
| 4 | Ignored. Do not process |
Transport protocol id
| Value | Description |
|---|---|
| 1 | UDP |
| 2 | TCP |
| 3 | TLS |
DNS Priority id
| Value | Description |
|---|---|
| 0 | IPv4_only. use A entries only |
| 1 | IPv6_only. use AAAA entries only |
| 3 | Dualstack. use A and AAAA entries. do not sort |
| 4 | IPv4_pref. use A and AAAA entries. prioritize A entries |
| 5 | IPv6_pref. use A and AAAA entries. prioritize AAAA entries |
Registered AoR mode id
| Value | Description |
|---|---|
| 1 | REGISTERED_AOR_MODE_AS_IS Use registration binding as RURI |
| 2 | REGISTERED_AOR_MODE_REPLACE_RURI_TRANSPORT_INFO Use registration binding as RURI but merge with callprofile RURI URI-params |
SST Refresh method id
| Value | Description |
|---|---|
| 1 | REFRESH_METHOD_INVITE: use INVITE for SST |
| 2 | REFRESH_METHOD_UPDATE: use UPDATE for SST |
| 3 | REFRESH_METHOD_UPDATE_FALLBACK_INVITE: use UPDATE for SST. fallback to INVITE if UPDATE tag is not listed in Allow |
Connection location id
| Value | Description |
|---|---|
| 0 | BOTH: normalize SDP so c-line presented both at media and stream levels |
| 1 | SESSION_ONLY: normalize SDP so c-line presented at session level only |
| 2 | MEDIA_ONLY: normalize SDP so c-line presented at media level only |
DTMF TX Mode id
| Value | Description |
|---|---|
| 0 | DTMF_TX_MODE_DISABLED Avoid sending |
| 1 | DTMF_TX_MODE_RFC2833: telephone-event RTP payload |
| 2 | DTMF_TX_MODE_INFO_DTMF_RELAY SIP INFO with application/dtmf-relay body |
| 4 | DTMF_TX_MODE_INFO_DTMF SIP INFO with application/dtmf body |
| 8 | DTMF_TX_MODE_INBAND inband DTMF |
DTMF RX Mode id
DTMF RX Mode id is a bitmask so flags can be combined
| Flag | Description |
|---|---|
| 1 | DTMF_RX_MODE_RFC2833 telephone-event RTP payload |
| 2 | DTMF_RX_MODE_INFO: SIP INFO (both application/dtmf-relay and application/dtmf) |
| 4 | DTMF_RX_MODE_INBAND detect inband DTMF (WARN: forces transcoding mode) |
Encryption mode id
| Value | Description |
|---|---|
| 0 | RTP/AVP and RTP/AVPF |
| 1 | RTP/SAVP and RTP/SAVPF (SRTP SDES) |
| 2 | UDP/TLS/RTP/SAVP and UDP/TLS/RTP/SAVPF (SRTP DTLS) |
| 3 | RTP/AVP and RTP/AVPF but use/check for zrtp_hash SDP a-line |