Listeners in Yate
Contents |
What is a listener in Yate
Using the default configuration from ysipchan.conf file, Yate will behave as a SIP server, that will listen on all interface. A set of listeners can be set so that Yate will listen to that interfaces.
How to set listeners in Yate
In Yate the advantage is that you can set on which interface he will listen and that it is done configuring your own listeners by creating sections like [listener your_listener_name] that will have the IP address, port and the type of the listener. If the type is invalid or is not set the an UDP listener will be build by default.
Parameters that can be set for each listener that is configured in a section:
- type: the type values allowed:
- - udp - build a UDP listener
- - tcp - build a TCP listener
- - tls - build a TLS listener ( that is a encrypted TCP)
- enable: Enable or disable this listener
- default:used only for UDP to specify if this is the default transport to use when none specified
- udp_force_bind: UDP only, if is set Yate will try to use a random port if failed to bind on configured one
- addr: is the IP address to bind to
- port: is 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.
- 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 that is UDP then you can set it like default listener in section [listener general] that will build a UDP listener that will have the parameters used only for UDP.
How to use listeners in routing
In a routing module: parameter oconnection_id it can be used to set on which IP to send outbound call legs for routing. We will choose the listener created above to set on which IP to send outbound call legs and create a sip channel like this:
regexroute.conf
[default] ; Set on which IP to send outbound call legs .*=;oconnection_id=your_listener_name ; call an sip channel extension=sip/sip:user@ip:port.
What does it means a listener for Yate
For the internal structure of Yate a Listener is a way to make good scalling to the system.