Listeners in Yate

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
 
(36 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  
=== What is a Listener in Yate ===
+
A listener is a way of telling Yate on which network interfaces to listen.<br>
 +
Yate supports 3 types of listeners: TCP, TLS, UDP and allows you to bind Yate one one ore more network interfaces on different ports.<br>
 +
Using the default configuration from ysipchan.conf file, Yate will behave as a SIP server, that will listen on all interfaces. <br>
  
Using the default configuration from ysipchan.conf file, Yate will behave as a SIP server, that will listen on all interface.
+
'''IMPORTANT'''
A set of listeners can be set so that Yate will listen to that interfaces.
+
Starting with [http://yate.null.ro/websvn/revision.php?repname=yate&path=%2Ftrunk%2F&rev=5310|SVN 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 configuration to 'general' section.
 +
Also in 'general' section the listener can be an UDP/TCP/TLS listener.
  
'''IMPORTANT''' Starting with [http://yate.null.ro/websvn/revision.php?repname=yate&path=%2Ftrunk%2F&rev=5310|SVN Rev. 5310] the SIP listener 'general' configuration is done in 'general' section of ysipchan.conf.
 
  
The 'listener general' section was removed.
+
<!--This page describes the role of a listener in Yate.
  
This change will affect those who used this section: if Yate is updated move the 'general' listener config to 'general' section.<br>
+
=== What is a Listener ===
Also in 'general' section the listener can be an UDP/TCP/TLS listener.
+
  
=== 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 in ysipchan.conf, by creating 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 the an UDP listener will be build by default.
+
-->
  
Parameters that can be set for each listener that is configured in a section:
+
=== How to set Listeners ===
 +
 
 +
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:
 
* type: the type values allowed:
 
: - udp - build a UDP listener<br>
 
: - udp - build a UDP listener<br>
 
: - tcp - build a TCP listener<br>
 
: - tcp - build a TCP listener<br>
: - tls - build a TLS listener ( that is a encrypted TCP)<br>
+
: - tls - build a TLS listener (encrypted TCP)<br>
 
* enable: Enable or disable this listener
 
* enable: Enable or disable this listener
* default:used only for UDP to specify if this is the default transport to use when none specified
+
* default: UDP only: specifiy 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
+
* udp_force_bind: UDP only, if set Yate will try to use a random port when binding on configured one failed
* addr: is the IP address to bind to
+
* addr: IP address to bind to
* port: is the port to bind to.Defaults to 5060 for UDP and TCP, 5061 for TLS listeners
+
* 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
 
* 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.
 
* 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.
+
* 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.
 
* thread: the listener thread priority. Can be one of: lowest, low, normal, high, highest.
  
 +
==== Example ====
 
Here is an example to set a UDP listener in ysipchan.conf.
 
Here is an example to set a UDP listener in ysipchan.conf.
  
Line 38: Line 47:
 
   port=5060
 
   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.
+
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 ===
 
=== 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.
+
To specify on which IP to send outbound call legs when routing, set parameter oconnection_id to the name of the listener.
We will choose the listener created above to set on which IP to send outbound call legs and create a sip channel like this:
+
 
 +
If only general listener is configured, you don't need to set oconnection_id in routing.
 +
 
 +
We'll use the listener created above:
 
   
 
   
 
regexroute.conf
 
regexroute.conf
Line 51: Line 63:
 
  .*=;oconnection_id=your_listener_name
 
  .*=;oconnection_id=your_listener_name
 
  ; call an sip channel
 
  ; call an sip channel
  extension=sip/sip:user@ip:port.
+
; 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 good way to scale the system.
 +
 
 +
Another benefit would be increased security by clearly specifing the interface to listen on.
  
=== What's a Listener for Yate ===
 
  
For the internal structure of Yate a Listener is a way to make good scalling to the system.
+
'''See also'''
 +
* [[SIP Features Module]]
 +
* [[SIP Configuration File]]

Latest revision as of 10:52, 31 May 2013

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 interfaces.

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 configuration to 'general' section.
Also in 'general' section the listener can be an UDP/TCP/TLS listener.


Contents

[edit] How to set Listeners

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.

[edit] Example

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.

[edit] 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.

If only general listener is configured, you don't need to set oconnection_id in routing.

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

[edit] Other benefits of Listeners

Because of the internal structure of Yate, a Listener is a good way to scale the system.

Another benefit would be increased security by clearly specifing the interface to listen on.


See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers