private async Task <DialResponse> DialAsync(ActivityExecutionContext context) { var connectionId = string.IsNullOrWhiteSpace(ConnectionId) ? _telnyxOptions.CallControlAppId : ConnectionId; if (connectionId == null) { throw new MissingCallControlAppIdException("No Call Control ID specified and no default value configured"); } var fromNumber = context.GetFromNumber(From); var request = new DialRequest( connectionId, To, fromNumber, FromDisplayName, AnsweringMachineDetection, AnsweringMachineDetectionConfig, ClientState, CommandId, CustomHeaders, SipAuthUsername, SipAuthPassword, TimeLimitSecs, TimeoutSecs, WebhookUrl, WebhookUrlMethod ); try { var response = await _telnyxClient.Calls.DialAsync(request, context.CancellationToken); return(response.Data); } catch (ApiException e) { throw new WorkflowException(e.Content ?? e.Message, e); } }