You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jiri Ondrusek (Jira)" <ji...@apache.org> on 2023/09/04 14:14:00 UTC
[jira] [Comment Edited] (CAMEL-19828) camel-twilio: conversion to PhoneNumber, .. fails after recent general converter change
[ https://issues.apache.org/jira/browse/CAMEL-19828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17761840#comment-17761840 ]
Jiri Ondrusek edited comment on CAMEL-19828 at 9/4/23 2:13 PM:
---------------------------------------------------------------
I already tested this code and it works. I see it as a workaround, because it can not convert to a Sip.
I can create a PR with it.
Perhaps some better solution can be implemented (in twilio comp) to allow conversion to i.e Sip. I can try to propose something later (as this will be a very small severity)
was (Author: jondruse):
I already test this code and it works. I see it as a workaround, because it can not convert to a Sip.
I can create a PR with it.
Perhaps some better solution can be implemented (in twilio comp) to allow conversion to i.e Sip. I can try to propose something later (as this will be a very small severity)
> camel-twilio: conversion to PhoneNumber, .. fails after recent general converter change
> ---------------------------------------------------------------------------------------
>
> Key: CAMEL-19828
> URL: https://issues.apache.org/jira/browse/CAMEL-19828
> Project: Camel
> Issue Type: Bug
> Components: camel-core, camel-twilio
> Affects Versions: 4.x
> Reporter: Jiri Ondrusek
> Assignee: Jiri Ondrusek
> Priority: Major
>
> When adopting the latest Camel into camel-quarkus I noticed an error.
> {code:java}
> NoTypeConversionAvailableException: No type converter available to convert from type: java.lang.String to the required type: com.twilio.type.Endpoint
> {code}
> Problem is caused by this change: [https://github.com/apache/camel/pull/11225/commits/e4007f2b1dfc982e5ea6a45427cbec8835ea58a5]
> As you can see [here|https://github.com/apache/camel/blob/main/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioConverter.java], 2 converters are registered (i.e. String -> PhoneNumber). Unfortunately the Twilio API uses common interface `com.twilio.type.Endpoint`. See this [line|https://github.com/apache/camel/blob/main/components/camel-twilio/src/generated/java/org/apache/camel/component/twilio/CallEndpointConfiguration.java#L27].
> 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`:
> {code:java}
> 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());
> {code}
> 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)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)