[ASTPPCOM-54] Inbound calls from provider should not be rated through origination rates Created: 12/Aug/16  Updated: 01/Apr/21  Resolved: 01/Apr/21

Status: Done
Project: ASTPP Community
Component/s: None
Affects Version/s: None
Fix Version/s: v3.5

Type: New Feature
Reporter: fozzygo4 Assignee: Samir Doshi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Calls that are inbound via a provider should not get rated using the origination rates. These calls should only get rated via the DID table.

Further more the CDR for inbound is inserting 2 records into the table and should only insert the CDR for the customer and not the provider.

This is causing inaccurate reporting for the provider and customers.



 Comments   
Comment by fozzygo4 [ 12/Aug/16 ]

I have made the following changes in /html/fs/lib/astpp.cdr.php that prevents the outbound CDR entry being added to CDR of the provider when the call is inbound from provider. Please let me know if this makes sense.

At line: 118

+ if($account_type != 3)
+   {
    $query = "INSERT INTO cdrs (uniqueid,accountid,type,callerid,callednum,billseconds,trunk_id,trunkip,callerip,disposition,callstart,debit,cost,provider_id,pricelist_id,package_id,pattern,notes,rate_cost,reseller_id,reseller_code,reseller_code_destination,reseller_cost,provider_code,provider_code_destination,provider_cost,provider_call_cost,call_direction,calltype,profile_start_stamp,answer_stamp,bridge_stamp,progress_stamp,progress_media_stamp,end_stamp,billmsec,answermsec,waitmsec,progress_mediamsec,flow_billmsec)  values ($cdr_string)";
    $logger->log($query);
    $db->run($query);
+   }
Comment by fozzygo4 [ 12/Aug/16 ]

I have further modified the IF statement as follows:
if($account_type == 0 && $dataVariable['provider_id'] != 0)

This now works correctly on CDR reports. It does the following:

  • If the call is inbound from provider, the CDR record is entered into the DB as 1 record for the customer.
  • If the call is inbound from customer A to customer B using a DID, the same applies to the CDR record as above.
  • No CDR record of outbound is sent to the DB if the call is a DID call.

This now works well on the basis that one does not bill customer A to customer B. Not sure how one would implement that.

Also I have noticed that the balance of customer A is effected with call charge even though it is a free DID call.

Comment by fozzygo4 [ 14/Aug/16 ]

After doing some further testing I have come to the following conclusion and some scenarios:

I now understand the principle of the inbound call being rated through origination rates based on the fact that if a provider charges for inbound calls then you would want to pass that charge onto the customer. If not then you can simply add the DID to the origination rate and the call will not be billed but this still adds extra records to the CDR table which still makes the duration total inaccurate. The solution to this is to remove the extra DID entry from the CDR table but the record for the CDR from the provider will have a disposition of "STANDARD" and not DID. This also adds room for error if one adds a DID to a customer and forgets to add the DID to all the origination rates. So my conclusion is this is not practical.

Another scenario and this is more practical but I feel needs extra work done on the DID rating system else it does not give the ability to have inbound charges calculated to the provider.
As mentioned in the above posts I feel the inbound calls should not be rated through an origination rate and rather be rated through the DID entry.

Currently you can add a per min charge and intervals to the DID but this will bill the customer who owns the DID. perhaps add a cost field to the DID for the provider or a checkbox to enable or disable billing of the provider.

Hope this makes sense to everyone. At this point as we are not charging for inbound calls in my country, I have made the following changes the the astpp.cdr.php file that makes my scenario work for me.

    // *** Function by Fozzy ***
    if($account_type == 0 && $dataVariable['provider_id'] != 0)
    {
    $query = "INSERT INTO cdrs (uniqueid,accountid,type,callerid,callednum,billseconds,trunk_id,trunkip,callerip,disposition,callstart,debit,cost,provider_id,pricelist_id,package_id,pattern,notes,rate_cost,reseller_id,reseller_code,reseller_code_destination,reseller_cost,provider_code,provider_code_destination,provider_cost,provider_call_cost,call_direction,calltype,profile_start_stamp,answer_stamp,bridge_stamp,progress_stamp,progress_media_stamp,end_stamp,billmsec,answermsec,waitmsec,progress_mediamsec,flow_billmsec)  values ($cdr_string)";
    $logger->log($query);
    $db->run($query);
    } // End Function by Foz
    //Update customer balance
    //if($debit > 0 && $dataVariable['calltype'] != "FREE") 

// Function modified my Fozzy 
    if($debit > 0 && $dataVariable['calltype'] != "FREE" && $account_type == 0 && $dataVariable['provider_id'] != 0)
    {
        update_balance($accountid, $debit, 0, $logger, $db);
    }
Comment by Samir Doshi [ 05/Sep/17 ]

We made it configurable. If you want to avoid it then you need to set variable INB_FREE="true" in /var/lib/astpp/astpp.lua. That will avoid billing of DID calls for provider.

Update to ASTPP 3.5 and test it out.

Comment by Frank (Inactive) [ 02/Mar/18 ]

i have same issue as fuzzy, i need to know my COST from provider on the DID...

right now inbound call never show any cost in /reports/customerReport/

Comment by Samir Doshi [ 05/Mar/18 ]

We do not have DID buy rate option at the moment. Becuase of that you will not be able to get any value in COST field in DID calls.

If you want to know the cost for the provider then you can create origination rate with DID prefix and define the amount in that. Then assign that rate group to provider. So whenever, we will get call from that provider, system will check origination rates and then route the call to DID.

That way you will get 2 entries. 1 with provider account with debit value and 2nd with customer to whom DID is assigned.

Note: Make sure you do not have INB_FREE configured in astpp-config.lua.

Comment by Frank (Inactive) [ 11/Mar/18 ]

i did that put the full DID in the originator rate, i get this as cdr

http://prntscr.com/ipo08k

and astpp logs

`
action application="set" data="fax_enable_t38_request=true"/>
<action application="set" data="origination_rates_did=ID:5|CODE:^.1418xxxxxx.*|DESTINATION:1418xxxxxx|CONNECTIONCOST:0.00000|INCLUDEDSECONDS:0|COST:0.01875|INC:0|INITIALBLOCK:0|RATEGROUP:0|MARKUP:150|ACCID:5"/>
<action application="set" data="origination_rates=ID:371167|CODE:^1418xxxxxx.*|DESTINATION:DID|CONNECTIONCOST:0.00000|INCLUDEDSECONDS:0|COST:0.0125|INC:6|INITIALBLOCK:6|RATEGROUP:1|MARKUP:150|ACCID:4"/>`

but doesnt show in cost still.. any other idea ?

hard to figure my costs when all inbound shows no cost

Comment by Samir Doshi [ 12/Mar/18 ]

Again, for DID calls, you will never get cost field. Cost field will have
value when call will be routed via any trunk / carrier. For inbound calls,
we are not routing call via trunk / carrier, so that field will never get
populated.

<https://mailtrack.io/> Sent with Mailtrack
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality&>

Best Regards

Samir Doshi
iNextrix Technologies Pvt. Ltd.
http://www.inextrix.com

Disclaimer:
The information contained in this communication is confidential and may be
legally privileged. It is intended solely for the use of the individual or
entity to whom it is addressed and others authorized to receive it. If you
are not the intended recipient you are hereby notified that any disclosure,
copying, distribution or taking action in reliance on the contents of this
information is strictly prohibited and may be unlawful. Please notify the
sender immediately and destroy all copies of this message and any
attachments contained in it.

On Sun, Mar 11, 2018 at 6:57 PM, Frank <notifications@github.com> wrote:

> i did that put the full DID in the originator rate, i get this as cdr
>
> http://prntscr.com/ipo08k
>
> and astpp logs
>
> action application="set" data="fax_enable_t38_request=true"/>
>
> but doesnt show in cost still.. any other idea ?
>
> hard to figure my costs when all inbound shows no cost
>
> —
> You are receiving this because you modified the open/close state.
> Reply to this email directly, view it on GitHub
> <https://github.com/iNextrix/ASTPP/issues/54#issuecomment-372115550>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AA6gcU4Kne2uRrvjBM2SVqZyaD5Q1SYkks5tdSZSgaJpZM4Ji29j>
> .
>

Comment by Frank (Inactive) [ 29/Mar/18 ]

its a call from trunk..

landline --> telco --> pri -->provider SIP as 14185551212@astppIP (astpp) gets this from trunk provider aka gateway carrier etc

Generated at Sat Feb 10 07:13:46 CET 2024 using Jira 8.13.3#813003-sha1:22ebedbb75c99b147c66f14e031dd8a2d214753a.