Mod hash

From FreeSWITCH Wiki
Jump to: navigation, search



mod_hash implements an API and application interface for manipulating a hash table. It also provides a limit backend.


Realm and key are arbitrary strings. Consider realm as a container for keys.

The insert_ifempty and delete_ifmatch perform thread-safe test-and-set operations on the hash table.

Dialplan Application

Insert a value into the hash:

<action application="hash" data="insert/realm/key/value"/>

Insert a value into the hash only if there is not a value associated with the key already:

<action application="hash" data="insert_ifempty/realm/key/value"/>

Delete an entry from the hash:

<action application="hash" data="delete/realm/key"/>

Delete an entry from the hash only if the value associated with the key is the value given:

<action application="hash" data="delete_ifmatch/realm/key/value"/>

Retrieve a value from the hash:

<action application="set" data="var=${hash(select/realm/key)}"/>


hash insert/realm/key/value
hash insert_ifempty/realm/key/value
hash delete/realm/key
hash delete_ifmatch/realm/key/value
hash select/realm/key


The hash backend for limit provides a non-persistent datastore for limit data. This data is specific to a particular FreeSWITCH instance.

Note: This backend does support rate based limits.