S
S
SteepNET2019-12-25 15:18:51
Bitrix24
SteepNET, 2019-12-25 15:18:51

Get information about a call in a case via REST API?

Good afternoon! I get information about the case associated with the lead through the REST API

$activity = $bx::activityGet($_REQUEST['data']['FIELDS']['ID']) ; 
    $activity = $activity['result'];
    $LEAD_ID  =  $activity['OWNER_ID']; 
    $leadData  = $bx::leadGet($LEAD_ID);
    $LEAD_DATA = $leadData['result'];

Through a function
const   activityGet       = self::url . "crm.activity.get";
public static function activityGet($id){
        $data = [
            'id'=> $id
        ];
        return parent::curlStart(self::activityGet, $data);
    }

const   leadGet           = self::url . 'crm.lead.get';
public static  function leadGet($id){
        $data = array(
            'id'    => $id,
        );
        return parent::curlStart(self::leadGet, $data);
    }

The result comes but without information about the call, that is, about its status, whether it was successful or not...
As a result, there is a parameter
[ORIGIN_ID] => VI_externalCall.63004490eae137ef0219e50f07c67f7c.1577194070
This is information about the call ..
And then I stopped, I need to get given ID the call status. It seems to be necessary to use the only method voximplant.statistic.get
But I can’t compose the function correctly .., I do it like this
const   voximplantGet           = self::url. "voximplant.statistic.get" ;    
    public static  function voximplantGet($id){
            $data = array(
            'id'    => $id,
        );
            return parent::curlStart(self::voximplantGet, $data);
        }

$VOXI_ID   = $activity['ORIGIN_ID'];
$voxiData = $bx::voximplantGet($VOXI_ID); 
$VOXI_DATA = $voxiData['result'];

I throw out the whole bunch without filtering by ID
spoiler

Array
(
    [0] => Array
        (
            [ID] => 1
            [PORTAL_USER_ID] => 1
            [PORTAL_NUMBER] => sip1
            [PHONE_NUMBER] => 9622777777
            [CALL_ID] => 5f658dfdcd13e257.1442585207.572803
            [EXTERNAL_CALL_ID] => 
            [CALL_CATEGORY] => external
            [CALL_DURATION] => 25
            [CALL_START_DATE] => 2015-09-18T17:06:48+03:00
            [CALL_VOTE] => 0
            [COST] => 0.0000
            [COST_CURRENCY] => RUR
            [CALL_FAILED_CODE] => 304
            [CALL_FAILED_REASON] => Skipped call
            [CRM_ENTITY_TYPE] => 
            [CRM_ENTITY_ID] => 
            [CRM_ACTIVITY_ID] => 
            [REST_APP_ID] => 
            [REST_APP_NAME] => 
            [TRANSCRIPT_ID] => 
            [TRANSCRIPT_PENDING] => 
            [SESSION_ID] => 
            [REDIAL_ATTEMPT] => 
            [COMMENT] => 
            [RECORD_FILE_ID] => 
            [CALL_TYPE] => 2
        )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
ReaverJS, 2019-12-25
@SteepNET

voximplant.statistic.get
ID is the ID of the call in /telephony/detail.php. Those. a separate entity from the case.
To get info by call, you need to filter by CRM_ACTIVITY_ID.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question