B.93. RealTime()

Gets configuration information from the realtime configuration database.
RealTime(family,column,value[,prefix])
Retrieves configuration settings from the realtime configuration database into channel variables. All unique column names are set as channel variables. Optionally, the argument prefix is prepended to the column name to form the variable name (in the example in the internal help, the prefix var_ to the column name test results in the variable ${var_test}).
Sets the channel variable REALTIMECOUNT to the number of values read.
In extconfig.conf:
; Family => DBMS,database,table
sipusers => mysql,asterisk,sip_users
In extensions.conf:
exten => 123,1,RealTime(sipusers,ext,5678,var_)
This executes the following SQL query in the database asterisk:
SELECT * FROM sip_users WHERE ext = 5678
Assuming the table has the columns firstname and lastname, we can print those values to the CLI this way:
exten => 123,n,NoOp(The first name of the user at ext. 5678 is: ${var_firstname})
exten => 123,n,NoOp(The last name of the user at ext. 5678 is: ${var_lastname})

Note

Internal help for this application in Asterisk 1.4:
  -= Info about application 'RealTime' =- 

[Synopsis]
Realtime Data Lookup

[Description]
Use the RealTime config handler system to read data into channel variables.
RealTime(<family>|<colmatch>|<value>[|<prefix>])

All unique column names will be set as channel variables with optional prefix
to the name.  For example, a prefix of 'var_' would make the column 'name'
become the variable ${var_name}.  REALTIMECOUNT will be set with the number
of values read.
diff output to internal help in Asterisk 1.2:
11,14c11,13
< All unique column names will be set as channel variables with optional prefix
< to the name.  For example, a prefix of 'var_' would make the column 'name'
< become the variable ${var_name}.  REALTIMECOUNT will be set with the number
< of values read.
---
> All unique column names will be set as channel variables with optional prefix to the name.
> e.g. prefix of 'var_' would make the column 'name' become the variable ${var_name}
>