Solved Help with integration

Status
Not open for further replies.

andrea.selea

Gold Partner
Advanced Certified
Joined
Jan 14, 2022
Messages
5
Reaction score
2
Hi, I'm trying to integrate a crm system with 3cx but I'm a bit new to this.
This crm to save calls accepts a url complete of all the data (ex: https://crm-ip/reportcall/?Calltype=Inbound&Duration=120&Agent=100)
I've some problems with the duration of the calls.
Using the variable [DurationSeconds] transmits null value and using the string [[[DurationTimespan].get_TotalSeconds()].ToString("F0")] the url is not formatted correctly.
The rest of the call is correctly received by the crm.
Where am I doing wrong?

This is the xml section that i'm trying.

<Scenario Id="ReportCall" Type="REST">
<Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]==&quot;&quot;,True,[IIf([CallType]!=Inbound,True,False)])]" Url="https://crmurl/record_call/?CallType=Inbound&amp;Duration=[DurationSeconds]&amp;Agent=[Agent]&amp;Number=[Number]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json" />
</Request>
<Variables />
<Outputs Next="ReportCallMissed" AllowEmpty="true" />
</Scenario>

Thanks for any help.
 
Here you have the available variables:
https://www.3cx.com/docs/server-side-crm-template-xml-description/#h.vcivldjsa1lz

As you can see, [DurationSeconds] is not valid. The following expression is correct and will give you the number of seconds as a string with no decimals:
[[[DurationTimespan].get_TotalSeconds()].ToString("F0")]

If this causes a malformed URL, then you're probably doing something wrong elsewhere. I would like to see the full URL with static text and variables that you're using, and also the final URL after the variables are replaced (you can see this in the 3cxSystemService.log file in verbose mode).
 
  • Like
Reactions: Evolute IT
Hi @edossantos ,
Thanks for reply.

I think I've (finally) solved the problem.
Trying I found that, by formatting the url without the " near F0, the resultant string is correct:

[UrlCRM]/record_call/?CallType=Inbound&amp;Duration=[[[DurationTimespan].get_TotalSeconds()].ToString(F0)]&amp;Agent=[Agent]&amp;Number=[Number]

https://crmurl/record_call/?CallType=Inbound&Duration=11&Agent=100&Number=3999999

The call is reported correctly with the Timespan duration.

Previously I had tried various combinations with:

[UrlCRM]/record_call/?CallType=Inbound&amp;Duration=[[[DurationTimespan].get_TotalSeconds()].ToString("F0")]&amp;Agent=[Agent]&amp;Number=[Number]

and with

[UrlCRM]/register_call/?CallType=Inbound&amp;Duration=[[[DurationTimespan].get_TotalSeconds()].ToString(^^F0^^)]&amp;Agent=[Agent]&amp;Number=[Number]

but in the 3cxSystemService.log I found this

https://crmurl/register_call/?CallType=Inbound&Duration="F11"&Agent=100&Number=3999999

https://crmurl/register_call/?CallType=Inbound&Duration=^F11^&Agent=100&Number=3999999

so with formatting without the " i noticed it works
 
  • Like
Reactions: edossantos
Glad to know that it's working. This is probably an XML escaping issue. Instead of " you might probably need to use &quot;.
 
  • Like
Reactions: Evolute IT
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,973
Messages
590,075
Members
164,895
Latest member
jasonkkrause