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
cnxcc: remove duplicated entries with a same CID value #2383
Conversation
I guess the function was supposed to be called only for the initial INVITE, the one that creates the call. Overall, I do not use that much the module to have an opinion of this is good to have or someone also wants to charge a call twice (e.g., incoming leg and outgoing leg). The initial developer of the module is not active lately in the project, maybe @linuxmaniac can give his opinion as I saw some commits to this module from him rather recently. As a further remark, the protection could be good, but if there are cases to charge a call many times, then it should be made a modparam to control the behaviour. |
Sure. It supposed to be called only for the initial INVITE but there are a check in the code for that (which log message was fixed yesterday by @linuxmaniac). The problem is that this check only print a message and has no control the insertion of the new record. I've found the problem in some calls where '100 Trying' takes 1 second and origin sends another INVITE message |
The t_precheck_trans() and t_check_trans() should help filtering out such retransmissions. Anyhow, again, the only concern is about the case when one wants to charge a call twice (or even more), either from same billing account or from different accounts... not sure how the PR affects such cases. |
You are right. If you want I can prepare a modparam to control the behaviour. Only one CID o multiples CIDs |
AFAICT module just supports one record per call-id since |
I've been reviewing the code another time. There are 3 different functions to control credit, time and channels: __set_max_credit(), __set_max_time() and __set_max_channels(). All of them do the same: function __set_max_money(): function __set_max_time(): function __set_max_channel(): If credit is exhausted, the function __terminate_all() is called to kill all active calls for this client. This works fine: __terminate_all(pointer_client_id) -> ki_terminate_all(client_id) -> terminate_all_calls(credit_data): On the other hand, when a dialog is finished, the function called is __stop_billing(): __dialog_terminated_callback() -> __stop_billing(callid) -> __delete_call(call, credit_data) -> __free_call(call) In this case, there is no loop to delete and free all calls for this client with a same CID. Only remove the first match found. However, if you think that this feature could be important (being able to charge the same call more than once), it will be necessary to fix that, because currently it doesn't work. |
8d19463
to
c4f075c
Compare
My comments were to be sure it doesn't break scenarios expected to work. If not, then it can be merged from my point of view. |
I've squashed the commits and reworked the commit messages |
Pre-Submission Checklist
in
doc/
subfolder, the README file is autogenerated)Type Of Change
Checklist:
Description
When cnxcc receives a message wih a registered CID (for example in a re-INVITE) it saves as a new call and this is a problem:
An example: