Asterisk config prepaid.conf

prepaid.conf


[global]
hostname=localhost
dbname=prepaid
password=asterisk
user=asterisk
;port=3306
;sock=/tmp/pgsql.sock

[sql]
authentication is passed username and userpass, returns
credit (in cents), tariff, activated
authentication=SELECT * FROM asterisk_authenticate('%s','%s') AS authenticate(credit integer, tariff text, activated bool)

authorization is passed tariff and destination, returns
rate ( in cents per minute ), tech, prefix, ipaddress.
authorization=SELECT * FROM asterisk_authorize('%s','%s') AS authorize(rate integer, tech text, prefix text, ipaddress text)

; acct start is passed cdr details (uniqueid, sessionid, username, nasipaddress, starttime) before call is connected
acct_start=SELECT asterisk_acct_start('%s','%s','%s','%s','%s')

; acct stop is passed cdr details (uniqueid, sessionid, username, calledstation, rate, sessiontime, terminatecause, stoptime),
; updates the acct start record and bills the card
acct_stop=SELECT asterisk_acct_stop('%s','%s','%s','%s','%i','%i','%s','%s')

; simulcount is passed username, checks for active calls, if this returns anything but 0 then authentication is denied with 'card-in-use' message
simulcount=SELECT COUNT(*) FROM call WHERE username='%s' AND stoptime IS NULL


Go back to Asterisk callingcard

prepaid.conf


[global]
hostname=localhost
dbname=prepaid
password=asterisk
user=asterisk
;port=3306
;sock=/tmp/pgsql.sock

[sql]
authentication is passed username and userpass, returns
credit (in cents), tariff, activated
authentication=SELECT * FROM asterisk_authenticate('%s','%s') AS authenticate(credit integer, tariff text, activated bool)

authorization is passed tariff and destination, returns
rate ( in cents per minute ), tech, prefix, ipaddress.
authorization=SELECT * FROM asterisk_authorize('%s','%s') AS authorize(rate integer, tech text, prefix text, ipaddress text)

; acct start is passed cdr details (uniqueid, sessionid, username, nasipaddress, starttime) before call is connected
acct_start=SELECT asterisk_acct_start('%s','%s','%s','%s','%s')

; acct stop is passed cdr details (uniqueid, sessionid, username, calledstation, rate, sessiontime, terminatecause, stoptime),
; updates the acct start record and bills the card
acct_stop=SELECT asterisk_acct_stop('%s','%s','%s','%s','%i','%i','%s','%s')

; simulcount is passed username, checks for active calls, if this returns anything but 0 then authentication is denied with 'card-in-use' message
simulcount=SELECT COUNT(*) FROM call WHERE username='%s' AND stoptime IS NULL


Go back to Asterisk callingcard

Created by: nix, Last modification: Fri 11 of Jun, 2004 (13:37 UTC) by JustRumours
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+