Mongodb ReportCall not working

Status
Not open for further replies.

Thomas Six

Platinum Partner
Advanced Certified
Joined
May 31, 2017
Messages
133
Reaction score
44
We try to configure mongodb crm integration. The contact query is working, but call journalin isn't working. We we start verbose logging, we see this in the 3cxSystemService log file (I've removed the Number and Name for privacy reasons:

2023/07/07 10:12:32.532|9433|0088|Info|CRM: about to report 1 calls at maxConcurrency 2
2023/07/07 10:12:32.532|9433|0088|Verb|CRM: Triggering Call Journaling with values - CallType='Inbound' - PhoneNumber='Number' - ContactName='Name' - AgentExtension='805' - AgentFirstName='' - AgentLastName='' - AgentEmail='' - ContactRawData='|Contacts' - StartTime='07/07/2023 08:12:29' - EndTime='07/07/2023 08:12:32' - EstablishedTime='07/07/2023 08:12:29'
2023/07/07 10:12:32.533|9433|0088|Verb|CRM: Processing scenario 'ReportCall'.
2023/07/07 10:12:32.533|9433|0088|Verb|CRM: Skipping NoSQL database command...
2023/07/07 10:12:32.533|9433|0088|Verb|CRM: No matchings found.

What does this mean and how can we troubleshoot? Is there an extra log file? The lookup query is working:

2023/07/07 10:12:29.082|9433|0011|Verb|CRM: Not processed. Number=044444444, connection=14113, state=Dialing
2023/07/07 10:12:29.082|9433|0011|Verb|CRM: Add to processing. Number=044444444, connection=14113, state=Dialing
2023/07/07 10:12:29.082|9433|0011|Info|CRM: ProcessActiveConnections(). Attached entries to connection:
2023/07/07 10:12:29.082|9433|0011|Verb|CRM: LocalMatches=. Number=044444444, connection=14113, state=Dialing
2023/07/07 10:12:29.082|9433|0011|Info|CRM: Synchronize(...) called
2023/07/07 10:12:29.083|9433|0014|Verb|Dequeue Inserted.CONNECTION.14113
2023/07/07 10:12:29.083|9433|0088|Info|CRM: maxConcurrency=2
2023/07/07 10:12:29.083|9433|0088|Info|CRM: making request to CRM. Number=044444444
2023/07/07 10:12:29.084|9433|0088|Trac|CRM: Obtaining scenario entity order for entity ''
2023/07/07 10:12:29.084|9433|0088|Trac|CRM: Ordering configuration not found, using scenario entity order 0 for entity ''
2023/07/07 10:12:29.084|9433|0088|Verb|CRM: Processing scenario 'Default'.
2023/07/07 10:12:29.084|9433|0088|Verb|CRM: Executing Filter NoSQL Command using the Configuration:
'ConnectionString: mongodb://tel.insoldev.be:8080
NoSQLDatabase: tel
NoSQLCollection: contact
Command: { $or: [ { "Phones.Work": { $regex: "444444$" } }, { "Phones.Mobile": { $regex: "444444$" } } ] }
'.
2023/07/07 10:12:29.084|9433|0088|Verb|CRM: Filter NoSQL Json Command Data passed as text in Command Property:
'{ $or: [ { "Phones.Work": { $regex: "444444$" } }, { "Phones.Mobile": { $regex: "444444$" } } ] }'.
2023/07/07 10:12:29.105|9433|0088|Verb|CRM: The result of the Filter NoSQL Command Execution is
'[{ "_id" : "5b99567d1c9d440000d34328", "Name" : { "FirstName" : "Phil", "LastName" : "Collins" }, "Phones" : { "Work" : "+32444444444", "Mobile" : "044444444" }, "Email" : "[email protected]" }]' .
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: Unknown path element: $oid. Null value is returned.
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: Filtered variables for matching:
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: 'Mobile' = '044444444'
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: 'ContactID' = ''
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: 'LastName' = 'Collins'
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: 'FirstName' = 'Phil'
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: 'Email' = '[email protected]'
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: 'Phone' = '+32444444444'
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: Removed from processing. Number=044444444
2023/07/07 10:12:29.106|9433|0088|Info|CRM: processing of 044444444 has been finished
 
The contact lookup is not returning the entity ID, as it's not present in this field:
ContactRawData='|Contacts'

Then, the call journaling is being skipped because there is no contact associated:
2023/07/07 10:12:32.533|9433|0088|Verb|CRM: Processing scenario 'ReportCall'.
2023/07/07 10:12:32.533|9433|0088|Verb|CRM: Skipping NoSQL database command...

You should adjust your template to return the EntityId output, for example:
<Output Type="EntityId" Value="[ContactID]" />
 
Hello

The entityId output is already included in the template. Or should i change the passes="0" field? or put AllowEmpty to true?

<Scenarios>
<Scenario Type="NoSQLDatabase">
<Command DatabaseType="MongoDB" ConnectionString="[ConnectionString]" Database="[Database]" Collection="[ContactsCollection]" CommandPasses="0" CommandType="Filter" Command="{ $or: {{ { &quot;Phones.Work&quot;: { $regex: &quot;[[Number].Replace(&quot;+&quot;,&quot;&quot;)]$&quot; } }, { &quot;Phones.Mobile&quot;: { $regex: &quot;[[Number].Replace(&quot;+&quot;,&quot;&quot;)]$&quot; } } }} }" />
<Rules>
<Rule Type="Any" Ethalon="">_id</Rule>
</Rules>
<Variables>
<Variable Name="ContactID">_id.$oid<Filter /></Variable>
<Variable Name="FirstName">Name.FirstName<Filter /></Variable>
<Variable Name="LastName">Name.LastName<Filter /></Variable>
<Variable Name="Email">Email<Filter /></Variable>
<Variable Name="Phone">Phones.Work<Filter /></Variable>
<Variable Name="Mobile">Phones.Mobile<Filter /></Variable>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="FirstName" Passes="0" Value="[FirstName]" />
<Output Type="LastName" Passes="0" Value="[LastName]" />
<Output Type="Email" Passes="0" Value="" />
<Output Type="PhoneBusiness" Passes="0" Value="[Phone]" />
<Output Type="PhoneMobile" Passes="0" Value="[Mobile]" />
<Output Type="ContactUrl" Passes="0" Value="http://example.com/[ContactID]" />
<Output Type="EntityType" Passes="0" Value="Contacts" />
<Output Type="EntityId" Passes="0" Value="[ContactID]" />
</Outputs>
</Scenario>
 
2023/07/07 10:12:29.106|9433|0088|Verb|CRM: Unknown path element: $oid. Null value is returned.
OK, but _id.$oid is not being found in the response, so it's left empty. You will need to see where you have that ID and use the appropriate path when defining the variable.
 
  • Like
Reactions: Evolute IT
What does $oid mean? When remove $oid from the template (everywhere), then when we test a number (with test button). We see something in the EntityID and rawdata. Bit with $oid, this is empty.

But in de 3cxSystemService.log, we still see CRM: Unknown path element: $oid. Null value is returned with $oid removed from the template.

In attachment, you'll see the mongodb record printscreen


[
{
"UnparsedOutputs": {
"FirstName": "Phil",
"LastName": "Collins",
"Email": "[email protected]",
"PhoneBusiness": "+32477777777",
"PhoneMobile": "0477777777",
"ContactUrl": "http://example.com/5b99567d1c9d440000d34328",
"EntityType": "Contacts",
"EntityId": "5b99567d1c9d440000d34328"
},
"FirstName": "Phil",
"LastName": "Branckaerts",
"Email": "[email protected]",
"ContactUrl": "http://example.com/5b99567d1c9d440000d34328",
"CompanyName": null,
"PhotoUrl": null,
"ContactType": 0,
"PhoneBusiness": "+32477777777",
"PhoneBusiness2": null,
"PhoneHome": null,
"PhoneHome2": null,
"PhoneMobile": "0477777777",
"PhoneMobile2": null,
"PhoneOther": null,
"FaxBusiness": null,
"FaxHome": null,
"Pager": null,
"ContactRawData": "5b99567d1c9d440000d34328|Contacts"
}
]
 

Attachments

  • mongodb_record.JPG
    mongodb_record.JPG
    31.4 KB · Views: 6
The JSON response returned by MongoDB contains an object named "_id" for every object returned, and this has a child property named "$oid" which contains the unique ID of this object. This is what you should return as EntityId.

However, in your database, it seems you don't have this structure inside the "_id" field, and you have the ID directly there. So you should just remove it.

Please note that the MongoDB template we provide is just a sample, because every database has a different structure, with different collections and fields, so you will need to adjust it to your case.
 
It's solved. The id was a string in mongodb instead of an objectId. Now it's working. And for numbers not present in mongodb, you need to enable 'enable contact creation' otherwise the call is nog logged in mongodb
Thnaks for the help
 
  • Like
Reactions: edossantos
It's solved. The id was a string in mongodb instead of an objectId. Now it's working.
Good to know!

And for numbers not present in mongodb, you need to enable 'enable contact creation' otherwise the call is nog logged in mongodb
Well, this is how the sample template for MongoDB is designed, however you're free to change this and log all calls. You will just not have the contact ID in that case, as there is no contact. If that's OK with you, then you can do it. As you know, the MongoDB template is just a sample of how you can build it. As each MongoDB database is different, we can't create a single template that fits all the installations.
 
  • Like
Reactions: Evolute IT
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,292
Messages
591,740
Members
165,417
Latest member
VOIPEric