Upgrade 3CX to v18 and get it hosted free!

Asterisk config prepaid.conf

Author image

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


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.
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.