Skip to main content



mod_hiredis implements an interface for running basic redis commands on configured servers and also deprecated old mod_redis implementing the limit backend.

Click here to expand Table of Contents


Once you have installed FreeSWITCH from packages, configure FreeSWITCH to load mod_hiredis in autoload_configs/modules.conf.xml by uncommenting the line:

<load module="mod_hiredis"/>


Edit the redis server connection configuration in autoload_configs/hiredis.conf.xml and set the hostname, password, and port as applicable.

Configuration example:

<configuration name="hiredis.conf" description="mod_hiredis">
<profile name="default">
<connection name="primary">
<param name="hostname" value=""/>
<param name="password" value="redis"/>
<param name="port" value="6379"/>
<param name="timeout_ms" value="500"/>
<connection name="secondary">
<param name="hostname" value="localhost"/>
<param name="password" value="redis"/>
<param name="port" value="6380"/>
<param name="timeout_ms" value="500"/>
<param name="ignore-connect-fail" value="true"/>

Connection parameters:

  • hostname: DNS hostname or IP address of the server (default: localhost)
  • port: TCP port where Redis server is listening (default: 6379)
  • password: if set, the AUTH command is sent to the server (default: no authentication)
  • timeout_ms: timeout waiting for the server connection, in milliseconds (default: 500)
  • max-connections: the module keeps a pool of simultaneously open connections, and this sets their limit (default: 3)

Profile parameters:

  • ignore-connect-fail: if set to true, a socket connection error is ignored and the call processing continues; otherwise the call is set to error status (default: false)
  • ignore_error: if set to true, Redis command execution error is ignored, and the call processing continues; otherwise the call is set to error status (default: false)

After configuring the module. apply the changes in fs_cli:

reload mod_hiredis


Limit interface

<action application="limit" data="hiredis realm id 10 limit_exceeded" />

See also: Limit.

Dialplan application

In both the dialplan application and the API function, the Redis command is preceded with the profile name. See also: Redis command reference.

<action application="hiredis_raw" data="default LPUSH Callers ${effective_caller_id_number}" />

API function

hiredis_raw default set test 01
hiredis_raw default get test

Channel variables

hiredis_raw_response is set after the Redis command execution.