originate static method

Future originate({
  1. String? endpoint,
  2. String? extension,
  3. String? context,
  4. String? priority,
  5. String? label,
  6. String? app,
  7. List<String>? appArgs,
  8. String? callerId,
  9. num? timeout,
  10. String? channelId,
  11. String? otherChannelId,
  12. String? originator,
})

Implementation

static Future<dynamic> originate(
    {String? endpoint,
    String? extension,
    String? context,
    String? priority,
    String? label,
    String? app,
    List<String>? appArgs,
    String? callerId,
    num? timeout,
    String? channelId,
    String? otherChannelId,
    String? originator}) async {
  // params: {
  //     'endpoint':,
  //     'extension':,
  //     'context':,
  //     'priority':,
  //     'label':,
  //     'app':,
  //     'appArgs':,
  //     'callerId':,
  //     'timeout':,
  //     'channelId':,
  //     'otherChannelId':,
  //     'originator':,
  //     'formats': [].concat(formats).join(","),
  //   },
  //   data: { variables },
  var uri = Uri(
      scheme: "http",
      userInfo: "",
      host: "10.44.0.55",
      port: 8088,
      path: "ari/channels",
      //Iterable<String>? pathSegments,
      query: "",
      queryParameters: {
        'api_key': api_key,
        'endpoint': endpoint ?? "",
        'extension': extension ?? "",
        'context': context ?? "",
        'priority': priority ?? "",
        'label': label ?? "",
        'app': app ?? "",
        'appArgs': appArgs != null ? appArgs.join(",") : "",
        'callerId': callerId ?? "",
        'timeout': timeout ?? "",
        'channelId': channelId ?? "",
        'otherChannelId': otherChannelId ?? "",
        'originator': originator ?? "",
      }
      //String? fragment
      );

  //dsvar uri = Uri.http(baseUrl, '/channels', qParams);
  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);
}