Skip to main content

Voice Menu - voice menu interface

voice menu interface

Interface Description:

Initiate a call to a certain target number. After the call is connected, the voice content will be played automatically.After playing, the call will be transferred to the extension group according to the user's button or no button. The system will according to the status of the extension and the background The configured extension status callback address sends the corresponding callback data.

Request method: POST, form-data format

request parameters

parameter name type Is it necessary illustrate
service string yes App.Sip_Call.PlayVoice
token string yes The token obtained through the authorization interface
destnumber string yes target number
voicetype int yes The audio file type to play. 1: offline voice file, 2: online voice (url)
voicefile string yes Offline audio file name or online voice url address
chengshudu string yes 1
userid string yes Example of the button for the user to transfer to the agent and the extension group name of the transferred agent:”1@extGroup-1”
disnumber string no Caller ID, if left blank, a random caller ID will be selected
customuuid string no Customer-defined data, returned as it is in the callback data after the call ends

Interface request example(PHP)

<?php
    $apiUrl = 'http://127.0.0.1:8080';
    $postFields = [
        'service'   => 'App.Sip_Call.PlayVoice',
        'token'     => 'ABCDEFG',
        'voicetype'  => 2,
        'destnumber'  => '13333333333',
        'voicefile'  => 'wwww.baidu.com/test.mp3',
        'chengshudu'  => 1,
        'userid'  => '1@extGroup-1',
        'disnumber'  => '13333333333',
        'customuuid'  => '13333333333'
    ];
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $apiUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($curl);
    $curlError = curl_error($curl);
    curl_close($curl);
    var_dump($response);
?>

return data structure example

{
    "ret": 200,
    "data": {
        "status": 0,
        "desc": "Play command sent successfully",
        "reqtime": 1581307099,
        "rsptime": 1581307099
    },
    "msg": ""
}

Example of extension status callback data

{
    "buuid":"f4ffad68-4a0f-11ea-812d-fbc8753285b6",
    "callee":"85322888486",
    "caller":"20280003",
    "companycode":"2028",
    "direction":"callout",
    "disnumber":"2120280001",
    "extnumber":"20280003",
    "isbleg":"true",
    "method":"2",
    "starttime":"1581124302",
    "status":"ring",
    "uuid":"f4ee8e7a-4a0f-11ea-8126-fbc8753285b6",
    "ip":"149.129.249.47"
}

Callback field description

field type illustrate
buuid string Unique id on side B
callee string Called number (user number)
caller string Call Number (extension)
companycode string company code
direction string Call direction callin incoming call, callout outgoing call
disnumber string display number
extnumber string Ext
isbleg string Is it B side
method string Call mode, 1 extension, 2 manual, 3 interface, 4 double call, 5 prediction
starttime string call start time
status string Extension status ring ringing answer answer hangup hangup
uuid string call unique id
ip string ip

Interface return description

After the interface request, it will call the target number, and the content in the voice file will be played directly after the target number is connected. After the call ends, the call result will be notified to the callback address of the call details configured in the background in the form of a callback.

Callback data structure example

{
    "answertime":"2020-02-09 12:32:51",
    "hangupcause":10001,
    "duration":13,
    "id":220739,
    "extnumber":"",
    "uuid":"3418035c-4af5-11ea-afb2-fbc8753285b6",
    "downloadip":"149.129.249.47",
    "customuuid":"110001168",
    "chengshudu":"0",
    "callmethod":6,
    "recordfilename":"1111.mp3",
    "companycode":9017,
    "memberid":"0",
    "hangupdirection":10040,
    "billsec":10,
    "endtime":"2020-02-09 12:33:01",
    "starttime":"2020-02-09 12:32:38",
    "type":"callout",
    "disnumber":"2190170001",
    "crmid":"0",
    "userkey":"",
    "destnumber":"85781218893"
}

Callback data field description

field type illustrate
answertime string answering time
hangupcause string hang up reason
duration string waiting time
id string bill id
extnumber string Ext
uuid string call unique id
downloadip string download ip
customuuid string Custom parameters
chengshudu string Custom parameters
callmethod string call method
recordfilename string call file name
companycode string company code
memberid string Custom parameters
hangupdirection string hang up directions
billsec string call time
endtime string Hang up time
starttime string call time
type string call method
disnumber string calling number
crmid string agent id
userkey string user button
destnumber string target number