team-telnyx / telnyx-java

Java SDK for the Telnyx API
10 stars 19 forks source link

CallControlApplicationsApi.createCallControlApplication always complains about an invalid anchorsite_override value #44

Closed moribvndvs closed 12 months ago

moribvndvs commented 2 years ago

The following (Kotlin) assumes a callControlApplicationsApi of type CallControlApplicationsAPi.

            val connectionRequest = CreateCallControlApplicationRequest()
            val outbound = CallControlApplicationOutbound()
            outbound.outboundVoiceProfileId = customer.telnyxConfig.outboundVoiceProfileId
            connectionRequest.active = true
            connectionRequest.applicationName = "test"
            connectionRequest.outbound = outbound
            connectionRequest.webhookApiVersion = CreateCallControlApplicationRequest.WebhookApiVersionEnum._2
            connectionRequest.webhookEventUrl = urlGenerator.pmxVoiceWebhook().toString()

            val res = callControlApplicationsApi.createCallControlApplication(connectionRequest)

Results in an error:

{
  "errors": [
    {
      "code": "10015",
      "title": "Bad Request",
      "detail": "is not included in the list",
      "source": { "pointer": "/anchorsite_override" },
      "meta": {
        "url": "https://developers.telnyx.com/docs/overview/errors/10015"
      }
    }
  ]
}

Even specifying the anchorsiteOverride explicitly results in the same. Looks like the issue is CreateCallControlApplicationRequest.WebhookApiVersionEnum._2 enum values contain literal double quotes in the strings.

ADandyGuyInSpace commented 12 months ago

Can you try with latest version and report back ^^ If it still persists, feel free to open another issue.

If it persists can you also try doing: "\"Ashburn, VA\""

and see if it passes. Need to look into if Kotlin is not seeing the escape characters