Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
userdoc:tt_asterisk-odbc [2013/03/14 16:18] abelbeck |
userdoc:tt_asterisk-odbc [2014/07/03 14:02] (current) droemel [Mass Deployment SQL Table] |
||
---|---|---|---|
Line 38: | Line 38: | ||
The first step in using func_odbc dialplan functions is to create a database with some SQL schema, for example when the AstLinux **SQL-Data** tab in the web interface is first accessed it automatically creates the following schema in file ''/ | The first step in using func_odbc dialplan functions is to create a database with some SQL schema, for example when the AstLinux **SQL-Data** tab in the web interface is first accessed it automatically creates the following schema in file ''/ | ||
- | CREATE TABLE ' | + | CREATE TABLE IF NOT EXISTS |
' | ' | ||
' | ' | ||
- | ' | + | ' |
- | ' | + | ' |
' | ' | ||
' | ' | ||
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
); | ); | ||
| | ||
- | CREATE TABLE ' | + | CREATE TABLE IF NOT EXISTS |
' | ' | ||
' | ' | ||
- | ' | + | ' |
); | ); | ||
| | ||
- | CREATE TABLE ' | + | CREATE TABLE IF NOT EXISTS |
' | ' | ||
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
' | ' | ||
); | ); | ||
!!Note ->!! The out_context table is automatically populated with id's from 0-7. | !!Note ->!! The out_context table is automatically populated with id's from 0-7. | ||
+ | |||
+ | A simple example is the best way to demonstrate how this works. | ||
+ | |||
+ | {{: | ||
Example ''/ | Example ''/ | ||
Line 89: | Line 93: | ||
same => n,Hangup() | same => n,Hangup() | ||
+ | It is very simple and very powerful! | ||
+ | |||
+ | !!Tip ->!! Teach yourself some basic SQL commands. | ||
+ | |||
+ | ===== Mass Deployment SQL Table ===== | ||
+ | |||
+ | When using the **[[userdoc: | ||
+ | |||
+ | !!Note: AstLinux 1.1.7 or later is required!! | ||
+ | |||
+ | Using the SQL-Data tab in the web interface, view an example ' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | The SQL schema is of the form: | ||
+ | |||
+ | CREATE TABLE ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | Following the examples above, adding a context to ''/ | ||
+ | |||
+ | [SIPACCOUNT] | ||
+ | dsn=asterisk | ||
+ | readsql=SELECT ${ARG1} FROM phoneprov WHERE ${ARG2}=' | ||
+ | |||
+ | In the dialplan you could then use something like this: | ||
+ | |||
+ | same => n, | ||
+ | to get the SIP account (peer-name) from a given extension (100) via SQL. | ||
+ | Detailed Mass Deployment documentation can be found here: | ||
+ | **[[userdoc: | ||
===== CDR Call Logging with SQL ===== | ===== CDR Call Logging with SQL ===== |