externalMedia static method

Future externalMedia({
  1. required String app,
  2. dynamic variables,
  3. required String external_host,
  4. String? encapsulation,
  5. String? transport,
  6. String? connection_type,
  7. required String format,
  8. String? direction,
})

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);
}