Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-19828

camel-twilio: conversion to PhoneNumber, .. fails after recent general converter change

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.x
    • 4.2.0
    • camel-core, camel-twilio
    • None
    • Unknown

    Description

      When adopting the latest Camel into camel-quarkus I noticed an error.

      NoTypeConversionAvailableException: No type converter available to convert from type: java.lang.String to the required type: com.twilio.type.Endpoint
      

      Problem is caused by this change: https://github.com/apache/camel/pull/11225/commits/e4007f2b1dfc982e5ea6a45427cbec8835ea58a5

      As you can see here, 2 converters are registered (i.e. String -> PhoneNumber). Unfortunately the Twilio API uses common interface `com.twilio.type.Endpoint`. See this line.

      Therefore the mechanism for selection converters is not able to find converter `String -> Endpoint`.

      The behavior could be simply tested by following code added into `TwilioEndpointTest`:

              te = context.getEndpoint(
                      "twilio://call/create?from=RAW(+15005550006)&to=RAW(+14108675310)&url=http://demo.twilio.com/docs/voice.xml",
                      TwilioEndpoint.class);
      
              Assertions.assertTrue(te.getConfiguration() instanceof CallEndpointConfiguration);
              CallEndpointConfiguration cee = (CallEndpointConfiguration) te.getConfiguration();
              Assertions.assertEquals("+15005550006", cee.getFrom().getEndpoint());
              Assertions.assertEquals("+14108675310", cee.getTo().getEndpoint());
      

      I'm not sure how it was possible, but the test wold succeed before the change introduced by e4007f2b1dfc982e5ea6a45427cbec8835ea58a5.

      I think that the conversion before the change might not be correct in this twilio case (the conversion was probably possible because of the fallback conversion and was depending on the order of the registered converters - I don't see a way how to decide which conversion should be used `PhoneNumber` or `Sip` from the registered converters from the link above)

      Attachments

        Activity

          People

            jondruse Jiri Ondrusek
            jondruse Jiri Ondrusek
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: