Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow post-paid clients to set unlimited calls (No credit limit) #231

Closed
wants to merge 29 commits into from

Conversation

FozzyGo4
Copy link

The following code allows the admin to set a post-paid customer credit limit to 0 which then allows the post paid customer to make unlimited calls. The code is in /freeswitch/scripts/astpp/lib/astpp.functions.lua

function get_balance(userinfo)
	balance = (userinfo['balance']) + (userinfo['credit_limit'] * userinfo['posttoexternal']);    
-- Override balance if call is DID / inbound and coming from provider to avoid provider balance checking upon DID call. 
    if (userinfo['type'] == '3' and call_direction == 'inbound') then            
            balance = 10000
    end   
    -- Make Postpaid calls unlimited if credit limit set to 0. 
    if (userinfo['posttoexternal'] == '1' and userinfo['credit_limit'] == '0.00000') then            
	 balance = 10000
    end   

    return balance
end

@smrdoshi
Copy link
Contributor

@FozzyGo4

Thanks for your code contribution but setting default balance when postpaid customer have 0 balance might create unexpected behaviour for some system admins as they will think system is skipping balance checking for postpaid customers. So we cannot directly merge this request.

However we can use the idea and give option to admin if they want to allow to postpaid customer to make unlimited calls without balance checking, If they select yes then only skip balance checking else not.

What do you think?

@FozzyGo4
Copy link
Author

Thats actually what I want to do. Add a checkbox to the customer profile to allow unlimited calls. If checked then it should grey out (disable and set to 0) the credit limit text box. Also this should only be available to post-paid customers.

@FozzyGo4
Copy link
Author

Perhaps the code behind would be:

if (userinfo['posttoexternal'] == '1' and userinfo['no_limit'] == '1') then            
	 balance = 10000
    end

Add a no limit checkbox. code behind uses userinfo['no_limit']

@smrdoshi
Copy link
Contributor

smrdoshi commented Sep 15, 2017 via email

…etch database information), Add table name into join query select fields as well as into where condition to get proper output.
@smrdoshi smrdoshi closed this Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants