externalMedia static method
Implementation
static Future<dynamic> externalMedia({
required String app, //: string;
dynamic variables, //?: Containers;
required String external_host, //: string;
String? encapsulation, //?: string;
String? transport, //?: string;
String? connection_type, //?: string;
required String format, //: string;
String? direction, //?: string;
}) async {
// params: {
// 'endpoint':,
// 'extension':,
// 'context':,
// 'priority':,
// 'label':,
// 'app':,
// 'appArgs':,
// 'callerId':,
// 'timeout':,
// 'channelId':,
// 'otherChannelId':,
// 'originator':,
// 'formats': [].concat(formats).join(","),
// },
// data: { variables },
//POST /channels/externalMedia?app=MyApp&external_host=127.0.0.1%3A60000&format=ulaw
print(variables);
var uri = Uri(
scheme: "http",
userInfo: "",
host: "10.44.0.55",
port: 8088,
path: "ari/channels/externalMedia",
//Iterable<String>? pathSegments,
query: "",
queryParameters: {
'api_key': api_key,
'app': app,
'variables': jsonEncode(variables),
'external_host': external_host,
'encapsulation': encapsulation,
'transport': transport,
'connection_type': connection_type,
'format': format,
'direction': direction
},
//String? fragment
);
HttpClientRequest request = await client.postUrl(uri);
HttpClientResponse response = await request.close();
print(response);
final String stringData = await response.transform(utf8.decoder).join();
print(response.statusCode);
//print(stringData);
return (statusCode: response.statusCode, resp: stringData);
}