Solved CRM Integration Not Work after V20 Update

Status
Not open for further replies.

andrea.selea

Gold Partner
Advanced Certified
Joined
Jan 14, 2022
Messages
5
Reaction score
2
Hi,

I have a problem with a custom CRM integration that has worked fine until the update from V18 to V20.

Looking up at the 3cx logs i see that the system do the correct contact lookup and the http call for call journaling, but at this point return this error:

2024/10/14 16:00:48.782|0044|Erro| [Integration.Crm.Engine.CrmProcessor] CRM: Exception during call reporting
System.ArgumentException: The value cannot be an empty string or composed entirely of whitespace. (Parameter 'mediaType')

If i try to input manually the same http string (ex. in the browser) the call is correctly saved in the CRM.


What is this 'mediaType' parameter?
I need to configure it in some ways?

Thank you!
 
Check that your template sets the post format properly.
 
It looks like you're trying to set a variable mediaType to an empty value. If you could share your template, or at least the part doing the call journaling, which is failing, that would help us helping you.
 
Hi!
Thank you all for the replies

Today I did further testing and reviewed the logs and noticed that there is a previous error.

2024/10/15 09:27:35.293|0029|Erro| Call type is invalid or not specified Unknown
2024/10/15 09:27:35.310|0029|Erro| [Integration.Crm.Engine.CrmProcessor] CRM: Exception during call reporting
System.ArgumentException: The value cannot be an empty string or composed entirely of whitespace. (Parameter 'mediaType')

at System.ArgumentException.ThrowNullOrWhiteSpaceException(String argument, String paramName)
at System.ArgumentException.ThrowIfNullOrWhiteSpace(String argument, String paramName)
at System.Net.Http.Headers.MediaTypeHeaderValue.CheckMediaTypeFormat(String mediaType, String parameterName)
at System.Net.Http.StringContent..ctor(String content, Encoding encoding, String mediaType)
at Integration.Crm.Engine.ScenarioProcessorBase.CreateStringContent(Boolean authScenario, ScenarioRequest request, String requestString, IValueManager customManager)
at Integration.Crm.Engine.ScenarioProcessorBase.ProcessRequest(Boolean authScenario, ScenarioRequest request, IValueManager customManager, HttpClient client, CancellationToken token)
at Integration.Crm.Engine.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
at Integration.Crm.Engine.ScenarioProcessorBase.Execute(ProtocolScenario scenario, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
at Integration.Crm.Engine.CrmProcessor.ExecuteScenarioByName(String scenarioName, IEnumerable`1 parameters, Boolean useNoAuthProvider, CancellationToken token)
at Integration.Crm.Engine.CrmProcessor.ExecuteScenarioWithRetries(String scenarioId, Dictionary`2 parameters, CancellationToken token)
at Integration.Crm.Engine.CrmProcessor.ReportCall(CallEndedEvent callEndedEvent, CancellationToken token)

I have to admit that with V18 I was better off checking the 3cxSystemService.log
For example, with the current version I don't see the final strings that 3cx processes.
Maybe I don't know where to check now.

This below is the code from the Report Call scenario.


</Scenario>
<Scenario Id="ReportCall" Type="REST" EntityId="" EntityOrder="">
<Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Inbound,True,False)])]" Url="[UrlCRM]/centralino/registra_telefonata/?CallType=Inbound&amp;Duration=[[[DurationTimespan].get_TotalSeconds()].ToString(F0)]&amp;Agent=[Agent]&amp;Number=[Number]" MessagePasses="0" Message="" RequestContentType="" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json" />
<Variables />
<Outputs Next="ReportCallMissed" AllowEmpty="true" />
</Scenario>
<Scenario Id="ReportCallMissed" Type="REST" EntityId="" EntityOrder="">
<Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Missed,True,False)])]" Url="[UrlCRM]/centralino/registra_telefonata/?CallType=InboundMissed&amp;Duration=[[[DurationTimespan].get_TotalSeconds()].ToString(F0)]&amp;Agent=[Agent]&amp;Number=[Number]" MessagePasses="0" Message="" RequestContentType="" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json" />
<Variables />
<Outputs Next="ReportCallOutbound" AllowEmpty="true" />
</Scenario>
<Scenario Id="ReportCallOutbound" Type="REST" EntityId="" EntityOrder="">
<Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Outbound,True,False)])]" Url="[UrlCRM]/centralino/registra_telefonata/?CallType=Outbound&amp;Duration=[[[DurationTimespan].get_TotalSeconds()].ToString(F0)]&amp;Agent=[Agent]&amp;Number=[Number]" MessagePasses="0" Message="" RequestContentType="" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json" />
<Variables />
<Outputs Next="ReportCallNotanswered" AllowEmpty="true" />
</Scenario>
<Scenario Id="ReportCallNotanswered" Type="REST" EntityId="" EntityOrder="">
<Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Notanswered,True,False)])]" Url="[UrlCRM]/centralino/registra_telefonata/?CallType=OutboundMissed&amp;Duration=[[[DurationTimespan].get_TotalSeconds()].ToString(F0)]&amp;Agent=[Agent]&amp;Number=[Number]" MessagePasses="0" Message="" RequestContentType="" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json" />

<Variables />
<Outputs AllowEmpty="false" />
</Scenario>
</Scenarios>
 
I think the problem is this attribute:
RequestContentType=""

If you're sending URL encoded data, that should be set to:
RequestContentType="application/x-www-form-urlencoded"
 
I think the problem is this attribute:
RequestContentType=""

If you're sending URL encoded data, that should be set to:
RequestContentType="application/x-www-form-urlencoded"

Hi Edo!
it's working!
Thank you for the solution!
 
Status
Not open for further replies.