Asterisk cmd RealTime

RealTime

Synopsis

Realtime Data Lookup

Description

Use the RealTime config handler system to read data into channel variables.

RealTime(<family>|<colmatch>|<value>[|<prefix>[|<assigment>]])

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}.
The assignment parameter is used in the return value of the function and defaults to '='.

For example assume the following:

In extconfig.conf:

sipusers => mysql,asterisk,asterisk_sip

In extensions.conf:

exten => 11223344,1,RealTime(sipusers|name|12023243260|var_)
exten => 11223344,n,NoOp(RealTime variable containing data from the column field is '${var_column}')

This will execute the following SQL on the asterisk_sip table in the asterisk database:
Select * from asterisk_sip where name = 12023243260

The variable ${var_column} will contain the contents of the column field from the matching record

Return Value

(accurate as of 1.6.1)

In addition to setting the channel variables as described above, a string representing the result is also returned by the function call. The format is a little screwy:

key1<assignment>val1<prefix>key2<assignment>val2<prefix>...

This means that this call:

RealTime(foo|id|12023243260|var_|:)

will return a string formatted like this:

id:12023243260var_name:foovar_password:barvar_

The return value is really only useful if you use a prefix that also works well as a separator. For example, this call

RealTime(foo|id|12023243260|:|:)

will return

id:12023243260:name:foo:password:bar:

which can easily be parsed using the CUT() function.

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

RealTime

Synopsis

Realtime Data Lookup

Description

Use the RealTime config handler system to read data into channel variables.

RealTime(<family>|<colmatch>|<value>[|<prefix>[|<assigment>]])

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}.
The assignment parameter is used in the return value of the function and defaults to '='.

For example assume the following:

In extconfig.conf:

sipusers => mysql,asterisk,asterisk_sip

In extensions.conf:

exten => 11223344,1,RealTime(sipusers|name|12023243260|var_)
exten => 11223344,n,NoOp(RealTime variable containing data from the column field is '${var_column}')

This will execute the following SQL on the asterisk_sip table in the asterisk database:
Select * from asterisk_sip where name = 12023243260

The variable ${var_column} will contain the contents of the column field from the matching record

Return Value

(accurate as of 1.6.1)

In addition to setting the channel variables as described above, a string representing the result is also returned by the function call. The format is a little screwy:

key1<assignment>val1<prefix>key2<assignment>val2<prefix>...

This means that this call:

RealTime(foo|id|12023243260|var_|:)

will return a string formatted like this:

id:12023243260var_name:foovar_password:barvar_

The return value is really only useful if you use a prefix that also works well as a separator. For example, this call

RealTime(foo|id|12023243260|:|:)

will return

id:12023243260:name:foo:password:bar:

which can easily be parsed using the CUT() function.

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: kjcsb, Last modification: Wed 10 of Feb, 2010 (18:16 UTC) by diepiapaopolopo
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+