I would like to know how I can limit outbound calls per (total) minutes or per currency total for an extension that when the extension exceeds i.e 100 minutes (per month) of outbound calls from extension the user can no longer make outbound calls.
There is nothing built into Asterisk to provide this. There are mechanisms that could be used to write such a thing - but that would be up to you, or you’d need to find something else that can be used with Asterisk to do so.
You actually mean a device or caller ID, not an extension.
The difficult part of this is that device or things with the same caller ID, can make more than one concurrent call, wheras you need to know the remaining budget at the start of the call.
I do not want to limit the duration of a call. I want to block user from making calls once a limit for the month has been reached. Almost like pre-paid airtime for cell phones.
That should be easy to do with dialplan before you call Dial.
I’d probably use either FUNC_ODBC or the native AstDB to store the user data depending on replication and performance needs. FUNC_ODBC would have more overhead.
It is pretty straightforward use of database access and the time limit features in Asterisk.
However, as I said, the time limit is set at the beginning of the call which means that either you have to ban concurrent calls from the same user, or they can go over budget on the last call of the billing period.
Incidentally RFC 3261 does not seem to use extension in the sense of a user agent anywhere. Mostly it is the sense of additions to the specification, and otherwise it is in the sense of additions to other things, e.g. time limits.
If they are able to go over budget on their last call that is fine. I can limit at .ie 180 or whatever their need would be.
Would you be able to point me int he direction to setup this in the database as I am still new to asterisk and DB. I am skilled in linux in general but not sql.
Worth to mention. This has been setup before and was working until a few months ago. But someone changed this or maybe there was a time specified for this rule to be in place that expired. But I cannot seem to find that anywhere. How and where in th DB can I check if this has been setup there? a2billing is installed but not configured. The a2billing db is empty.
When looking at the sql history entries I found this entry that was made.
Would this mean anything?
.mysql_history:SELECT sum(billsec) AS totalminute from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘NOVEMBER’ LIMIT 1
.mysql_history:SELECT sum(billsec) AS totalminute,8 from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘NOVEMBER’ LIMIT 1
.mysql_history:SELECT sum(billsec) AS totalminute,8 from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘11’ LIMIT 1
.mysql_history:SELECT sum(billsec) AS totalminute,8 from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘11’ LIMIT 1
.mysql_history:SELECT sum(billsec) AS totalminute,* from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘11’ LIMIT 1;
.mysql_history:SELECT sum(billsec) AS totalminute,* from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘11’ LIMIT 1
.mysql_history:SELECT *,sum(billsec) AS totalminute from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘11’ LIMIT 1;
.mysql_history:SELECT * from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘10’ LIMIT 1;
.mysql_history:SELECT *,sum(billsec) AS totalminute from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘10’ LIMIT 1;
.mysql_history:SELECT *,sum(billsec) AS totalminute from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month( calldate )=‘10’ LIMIT 1;
.mysql_history:SELECT sum(billsec) AS totalminute from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month(calldate) = 11 LIMIT 1;
.mysql_history:SELECT sum(billsec) AS totalminute from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month(calldate) = 11;
.mysql_history:SELECT * from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month(calldate) = 11;
.mysql_history:SELECT * from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and year_month(calldate) = 2017-11;
.mysql_history:SELECT * from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and year_month(calldate) = ‘2017-11’;
.mysql_history:SELECT * from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month(calldate) = 11 and year(calldate) = 2017;
.mysql_history:SELECT sum(billsec) from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month(calldate) = 11 and year(calldate) = 2017;
.mysql_history:SELECT sum(billsec) from cdr WHERE disposition = ‘ANSWERED’ AND dst like ‘0%’ and src=‘728’ and month(calldate) = 11 and year(calldate) = 2017 LIMIT 1;