aboutsummaryrefslogtreecommitdiffstats
path: root/configs/func_odbc.conf.sample
blob: c9f9d5d7f63924a4b2c8fc31ec8abf40aae1e5bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;
; func_odbc.conf
;
; Each context is a separately defined function.  By convention, all
; functions are entirely uppercase, so the defined contexts should also
; be all-uppercase, but there is nothing that enforces this.  All functions
; are case-sensitive, however.
;
; For substitution, you have ${ARG1}, ${ARG2} ... ${ARGn}
; for the arguments to each SQL statement.
;
; In addition, for write statements, you have ${VAL1}, ${VAL2} ... ${VALn}
; parsed, just like arguments, for the values.  In addition, if you want the
; whole value, never mind the parsing, you can get that with ${VALUE}.
;
;
; If you have data which may potentially contain single ticks, you may wish
; to use the dialplan function SQL_ESC() to escape the data prior to its
; inclusion in the SQL statement.


; ODBC_SQL - Allow an SQL statement to be built entirely in the dialplan
[SQL]
dsn=mysql1
read=${ARG1}

; ODBC_ANTIGF - A blacklist.
[ANTIGF]
dsn=mysql1
read=SELECT COUNT(*) FROM exgirlfriends WHERE callerid='${SQL_ESC(${ARG1})}'

; ODBC_PRESENCE - Retrieve and update presence
[PRESENCE]
dsn=mysql1
read=SELECT location FROM presence WHERE id='${SQL_ESC(${ARG1})}'
write=UPDATE presence SET location='${SQL_ESC(${VAL1})}' WHERE id='${SQL_ESC(${ARG1})}'
;prefix=OFFICE		; Changes this function from ODBC_PRESENCE to OFFICE_PRESENCE
;escapecommas=no	; Normally, commas within a field are escaped such that each
			; field may be separated into individual variables with ARRAY.
			; This option turns that behavior off [default=yes].