Listeners in Yate
This page describes the role of a listener in Yate.
Contents |
What is a Listener in Yate
A listener is a way of telling Yate on which network interfaces to listen.
Yate supports 3 types of listeners: TCP, TLS, UDP and allows you to bind Yate one one ore more network interfaces on different ports.
Using the default configuration from ysipchan.conf file, Yate will behave as a SIP server, that will listen on all interface.
IMPORTANT Starting with Rev. 5310 the SIP listener 'general' configuration is done in 'general' section of ysipchan.conf. The 'listener general' section was removed. This change will affect those who used this section: if Yate is updated move the 'general' listener config to 'general' section. Also in 'general' section the listener can be an UDP/TCP/TLS listener.
How to set Listeners in Yate
A big advantage of using Yate is setting on which interface to listen.
That it is done by configuring your own listeners in ysipchan.conf. You have to create sections like [listener your_listener_name] that will have the IP address, port and the type of the listener and other useful parameters. If the type is invalid or is not set, an UDP listener will be build by default.
Parameters defining listeners:
- type: the type values allowed:
- - udp - build a UDP listener
- - tcp - build a TCP listener
- - tls - build a TLS listener (encrypted TCP)
- enable: Enable or disable this listener
- default: UDP only: specifiy if this is the default transport to use when none specified
- udp_force_bind: UDP only, if set Yate will try to use a random port when binding on configured one failed
- addr: IP address to bind to
- port: the port to bind to. Defaults to 5060 for UDP and TCP, 5061 for TLS listeners
- rtp_localip: the IP address to bind local RTP to
- backlog: the maximum length of the queue of pending connections.This parameter is ignored for UDP listeners.
- sslcontext: SSL context if this is an encrypted connection. Required for TLS listeners. This can be set in openssl.conf.
- thread: the listener thread priority. Can be one of: lowest, low, normal, high, highest.
Here is an example to set a UDP listener in ysipchan.conf.
[listener your_listener_name] type=udp addr=x.x.x.x port=5060
If you have only one listener in your system then you can set it like default listener in section [general] that will build a UDP/TCP/TLS listener.
How to use Listeners in routing
To specify on which IP to send outbound call legs when routing, set parameter oconnection_id to the name of the listener.
We'll use the listener created above:
regexroute.conf
[default] ; Set on which IP to send outbound call legs .*=;oconnection_id=your_listener_name ; call an sip channel ; extension match rule=sip/sip:user@ip:port. ^100$=sip/sip:100@ip:port
Other benefits of Listeners
Because of the internal structure of Yate a Listener is a way to make good scalling to the system.
Increase security by clearly specify to the interface to listen on a specific address and port.