From Yate Documentation
Jump to: navigation, search

This module works with wavefile module and a database driver, currently only MySQL.

The module is used to play or record wave sounds. The wave sounds are kept in binary database records.


Play a wave record

From a routing module you can play a wave record like this:

^1$=dbwave/play//path/to/fallback/file/audiotoplay.slin;callto_account=dbaccount;callto_query=SELECT binary_field FROM table WHERE condition

Or new syntax since Yate 3.3.3

To play a sound file and hangup the call

^1$=fork;callto.1=dbwave/play//path/to/fallback/file/audiotoplay.slin;callto.1.callto_account=dbaccount;callto.1.callto_query=SELECT binary_field FROM table WHERE condition

Record a wave file

To record a wave you can use this:

^1$=dbwave/record//path/to/file/audiorecorded.slin;callto_account=dbaccount;callto_query=INSERT INTO table(binary_field) VALUES('$($){data}')

In the example above the construction $($){data} is specific to regexroute. The raw string required is ${data}

The matching call.execute, chan.attach and chan.record messages are modified just before being received by wavefile.

For playback (parameters source, override or replace) the query is executed and the result (must be exactly 1 row, 1 column, binary) is passed to the wavefile module as a DataBlock.

For recording (parameters consumer, call or peer) a memory stream is created that executes the query after all data is collected. The query can contain two variable parameters:

  • ${data} - holds the collected binary data
  • ${length} - holds the length of the data in bytes


The name of the parameters holding the database account and the query depends on the relevant parameter of the message.

  • param - holds the desired attach or record (example: override)
  • param_account - holds the database account used (example: override_account)
  • param_query - holds the query to execute (example: override_query)

This way you can specify different accounts and queries even if you attach or record multiple data channels in the same message.

For call.execute (when routing directly to the module) the relevant parameter is callto.


To record wave data from an external module do this:

%%>message:<id>:<time>:chan.attach::consumer=dbwave/record/arbitrary.alaw:notify=myid42:single=true:consumer_account=dbaccount:consumer_query=INSERT INTO table(len,data)   

See also

Personal tools