Documentation for outbound route setup using GraphQL API

Hello,
I would like to know if there is any document like this for CoreModuleGraphQLAPIs-AddInboundRoute for outbound routes. If not, how can I get the field to create a mutation for my integration to FreePBX?

I am not sure outbound routes is supported via GraphQL as of this moment.

So his there any other way like cli or rest api?

am going to try this and tel you if it work
public async Task AddOutboundRouteAsync(string name, string matchPattern, string prependDigits, string prefix, bool matchPatternAutoPrefix, bool matchPatternEscapePattern, string trunkId)
{
FreePBXValidateAccessToken freePBXValidateAccessToken = new FreePBXValidateAccessToken(_apiConfigurationRepository);
GetAPIConfiguration getAPIConfiguration = new GetAPIConfiguration(_apiConfigurationRepository);
var _apidata = await getAPIConfiguration.GetAPIConfigAsync(“GraphQLURL”);

        await freePBXValidateAccessToken.TokenValidationService();

        var endPoint = new Uri(_apidata.BaseUrl);
        var graphQLClient = FreePBXGraphQLHttpClient.GetInstance(endPoint);

        var query = @"
        mutation CreateOutboundRoute($route: OutboundRouteInput!) {
          createOutboundRoute(route: $route) {
            id
            name
            description
            trunk_name
            trunk_sequence {
              trunk_name
              trunk_sequence
            }
            dialpatterns {
              match_pattern
              prepend_digits
              prefix
              match_pattern_auto_prefix
              match_pattern_escape_pattern
            }
          }
        }
        ";

        var variables = new
        {
            route = new
            {
                name,
                dialpatterns = new[]
                {
                new
                {
                    match_pattern = matchPattern,
                    prepend_digits = prependDigits,
                    prefix = prefix,
                    match_pattern_auto_prefix = matchPatternAutoPrefix,
                    match_pattern_escape_pattern = matchPatternEscapePattern
                }
            },
                trunks = new[]
                {
                new
                {
                    trunk_sequence = new[]
                    {
                        new
                        {
                            trunk_id = trunkId
                        }
                    }
                }
            }
            }
        };





        graphQLClient.HttpClient.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", SharedSession.tokenSession.AccessToken);
        //var response = await graphQLClient.HttpClient.SendMutationAsync<Root>(request, cancellationToken: default);
        var content = new StringContent(JsonConvert.SerializeObject(new { query, variables }), System.Text.Encoding.UTF8, "application/json");
        var response = await graphQLClient.HttpClient.HttpClient.PostAsync(endPoint, content);
        if (!response.IsSuccessStatusCode)
        {
            throw new HttpRequestException($"Request failed with status code {response.StatusCode}");
        }

        var responseJson = await response.Content.ReadAsStringAsync();
        var responseObj = JsonConvert.DeserializeObject<GraphQL.GraphQLResponse<OutboundRoute>>(responseJson);
        //return responseObj.Data.createOutboundRoute;


        
    }

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.