Upgrade 3CX to v18 and get it hosted free!

Asterisk cmd RealTime

Author image

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


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.