VoiceService: Get CallStatus values using new dedicated ubus call

The new ubus call has been created in asterisk to get proper CallStatus
values for line:
ubus call asterisk call_status '{ "line" : X }'
Use it to get proper values according to TR-104 definitions.
This commit is contained in:
Grzegorz Sluja 2021-09-08 11:24:24 +02:00 committed by Vivek Kumar Dutta
parent 3ad0978f8d
commit 0e101a4c48

View file

@ -247,18 +247,9 @@ static int get_ServicesVoiceServiceCallControlLine_CallStatus(char *refparam, st
char line_str[16];
snprintf(line_str, sizeof(line_str), "%d", line_num);
dmubus_call("endpt", "status", UBUS_ARGS{{"line", line_str, Integer}}, 1, &res);
dmubus_call("asterisk", "call_status", UBUS_ARGS{{"line", line_str, Integer}}, 1, &res);
if (res) {
/*
* Convert the status to a value specified in TR-104.
*
* Note that the current status provided by UBUS "endpt status" can not be mapped to those values
* specified in TR-104.
*
* TODO: the corresponding UBUS RPC will be enhanced in order to provide more TR-104 compliant values
*/
char *offhook = dmjson_get_value(res, 1, "offhook");
*value = *offhook == '1' ? "Connected" : "Idle";
*value = dmjson_get_value(res, 1, "call_status");
} else {
BBF_DEBUG("dmubus_call() failed\n");
}