Jump to content
KAZOOcon: hackathon signup and details here! ×

Getting a rate from CDRs


Nick99

Recommended Posts

Hi all,

I'm having issues getting billing values when exporting a CDR, I am missing something, but can't work out what it is.

I have created rates and a service plan, applied it to an account. I can confirm the account does rate the call;

curl -v -X GET -H "X-Auth-Token: $AUTH_TOKEN" "http://localhost:8000/v2/accounts/THEACOUNTID/rates/number/0064123456789" | python -mjson.tool
{
    "auth_token": "THETOKEN",
    "data": {
        "Base-Cost": 0.25,
        "E164-Number": "+64123456789",
        "Prefix": 64,
        "Rate": "2500",
        "Rate-Increment": 60,
        "Rate-Minimum": "60",
        "Rate-Name": "NZ-641",
        "Ratedeck-ID": "ratedeck",
        "Surcharge": "0"
    },
    "node": "eLkcsM-rA51lUe1rEfAZFw",
    "request_id": "fffe0fb77cfc5988b6f61e9166ce7f59",
    "status": "success",
    "timestamp": "2018-05-31T03:00:13",
    "version": "4.2.34"
}

But when pulling the CDR, I get the rate of 0.0, a blank rate_name and call_type (using PHP and the SDK)

$sub_id = "THEACOUNTID";
$cdrdata = $sdk->Account($sub_id)->Cdrs();

string(16) "List the Billing" {"id":"201805-30077c5e4b188b3b1cb6cc6f06c7f0d5@xxx.xxx.xxx.xxx:5060","call_id":"30077c5e4b188b3b1cb6cc6f06c7f0d5@xxx.xxx.xxx.xxx:5060","caller_id_number":"9876543210","caller_id_name":"6423456789","callee_id_number":"+649876543210","callee_id_name":"NickHome","duration_seconds":"8","billing_seconds":"7","timestamp":"63694945755","hangup_cause":"NORMAL_CLEARING","other_leg_call_id":"","owner_id":"","to":"+649876543210@pbx.voip.cloud3.co.nz","from":"9876543210@xxx.xxx.xxx.xxx","direction":"inbound","request":"+649876543210@pbx.voip.cloud3.co.nz","authorizing_id":"","cost":"0","dialed_number":"+649876543210","calling_from":"9876543210","datetime":"2018-05-31 00:29:15","unix_timestamp":"1527726555","rfc_1036":"\"Thu, 31 May 2018 00:29:15 GMT\"","iso_8601":"\"2018-05-31\"","call_type":"","rate":"0.0","rate_name":"","bridge_id":"30077c5e4b188b3b1cb6cc6f06c7f0d5@103.6.28.104:5060","recording_url":"","media_recordings":[],"media_server":"sip1.voip.cloud3.co.nz","call_priority":"","reseller_cost":"0","reseller_call_type":""}

Any help would greatly be appreciated

Cheers,
Nick.

Link to comment
Share on other sites

×
×
  • Create New...