[Home]

Summary:ASTERISK-19738: Calendar EWS does not attempt to extract the Body element in a CalendarItem and populate the description event field
Reporter:Dmitry Burilov (netaskd)Labels:calendar
Date Opened:2012-04-17 09:06:49Date Closed:2012-10-31 09:35:52
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_calendar_ews
Versions:1.8.11.0 Frequency of
Occurrence
Related
Issues:
is a clone ofASTERISK-19712 Retrieve of fields from Calendar EWS
Environment:Linux r1 2.6.32-131.17.1.el6.x86_64 #1 SMP Wed Oct 5 17:19:54 CDT 2011 x86_64 x86_64 x86_64 GNU/LinuxAttachments:( 0) calendar_ews_body_2012_10_29.diff
( 1) calendar_ews_body.diff
Description:Hello,

I'm trying to retrieve field "Description" from Calendar(ex) EWS through function CALENDAR_QUERY_RESULT and CALENDAR_EVENT in dialplan. When i do the same thing from Google Calendar(ghelix), everything works fine and the log is:

log query from gmail (successful):

Executing [25@calendar:30] Set("SIP/316-00001007", "id=490f610a36e89c7b43fb220b5b61acb5") in new stack
Executing [25@calendar:31] NoOp("SIP/316-00001007", "getnum=1") in new stack
Executing [25@calendar:32] NoOp("SIP/316-00001007", "summary=rgw") in new stack
Executing [25@calendar:33] NoOp("SIP/316-00001007", "description=wergwergwergwer\ng\nwer\ng\nwerg\nwe\nrg\nwe\nrg\nwer\ngw") in new stack
Executing [25@calendar:34] NoOp("SIP/316-00001007", "organizer=") in new stack
Executing [25@calendar:35] NoOp("SIP/316-00001007", "location=ergwerg") in new stack
Executing [25@calendar:36] NoOp("SIP/316-00001007", "categories=") in new stack
Executing [25@calendar:37] NoOp("SIP/316-00001007", "priority=0") in new stack
Executing [25@calendar:38] NoOp("SIP/316-00001007", "calendar=ghelix") in new stack
Executing [25@calendar:39] NoOp("SIP/316-00001007", "uid=rq1a9bwefwefqergrudj3s@google.com") in new stack
Executing [25@calendar:40] NoOp("SIP/316-00001007", "start=1333709340") in new stack
Executing [25@calendar:41] NoOp("SIP/316-00001007", "end=1333712940") in new stack
Executing [25@calendar:42] NoOp("SIP/316-00001007", "busystate=2") in new stack

when i'm doing the same thing but from Calendar EWS, i get this:

log query from exchange (unsuccessful):

Executing [25@calendar:15] Set("SIP/316-00001007", "id=30e4bf842037c9c4093bb2a106c2bbb7") in new stack
Executing [25@calendar:16] NoOp("SIP/316-00001007", "getnum=1") in new stack
Executing [25@calendar:17] NoOp("SIP/316-00001007", "summary=test0.5") in new stack
Executing [25@calendar:18] NoOp("SIP/316-00001007", "description=") in new stack
Executing [25@calendar:19] NoOp("SIP/316-00001007", "organizer=Бурилов Дмитрий Андреевич") in new stack
Executing [25@calendar:20] NoOp("SIP/316-00001007", "location=location 0.5") in new stack
Executing [25@calendar:21] NoOp("SIP/316-00001007", "categories=Anniversary") in new stack
Executing [25@calendar:22] NoOp("SIP/316-00001007", "priority=5") in new stack
Executing [25@calendar:23] NoOp("SIP/316-00001007", "calendar=ex") in new stack
Executing [25@calendar:24] NoOp("SIP/316-00001007", "uid=AAATAGFzc2tlckBzcGIuaGVsaXgucnUARgAAAAAA0PpBZh85k0ao7P9o8ppT/AcAWBJq690AM0aLUB7apKHobQBpgBPSXAAA7uq74+NoH0OyS5xytWfDuwCBT2Bu5gAA") in new stack
Executing [25@calendar:25] NoOp("SIP/316-00001007", "start=1333709340") in new stack
Executing [25@calendar:26] NoOp("SIP/316-00001007", "end=1333712940") in new stack
Executing [25@calendar:27] NoOp("SIP/316-00001007", "busystate=2") in new stack

Field "description" is empty even though it exists in calendar event.

Here is a piece of my dialplan configuration:

same => n,Set(id=${CALENDAR_QUERY(ex,${EPOCH},${EPOCH})})
same => n,NoOp(getnum=${CALENDAR_QUERY_RESULT(${id},getnum)})
same => n,NoOp(summary=${CALENDAR_QUERY_RESULT(${id},summary)})
same => n,NoOp(description=${CALENDAR_QUERY_RESULT(${id},description)})
same => n,NoOp(organizer=${CALENDAR_QUERY_RESULT(${id},organizer)})
same => n,NoOp(location=${CALENDAR_QUERY_RESULT(${id},location)})
same => n,NoOp(categories=${CALENDAR_QUERY_RESULT(${id},categories)})
same => n,NoOp(priority=${CALENDAR_QUERY_RESULT(${id},priority)})
same => n,Set(calendar=${CALENDAR_QUERY_RESULT(${id},calendar)})
same => n,NoOp(uid=${CALENDAR_QUERY_RESULT(${id},uid)})
same => n,NoOp(start=${CALENDAR_QUERY_RESULT(${id},start)})
same => n,NoOp(end=${CALENDAR_QUERY_RESULT(${id},end)})
same => n,NoOp(busystate=${CALENDAR_QUERY_RESULT(${id},busystate)}) ;0=FREE, 1=TENTATIVE, 2=BUSY

I suppose it is a bug. Is there any patch or way to fix this problem?

If you need more info, please let me know, i will send you debug information.

Thanks in advance,
Dmitry
Comments:By: Eric Person (eperson) 2012-04-17 15:50:56.020-0500

I am also experiencing this issue.

By: Terry Wilson (twilson) 2012-05-29 15:17:51.264-0500

Attached is a patch that *may* fix the issue. I don't have access to an Exchange box to test with.

If it doesn't work, you might try looking at the line:
{noformat}
} else if (!strcmp(name, "Body") /* state == XML_EVENT_DESCRIPTION */) {
{noformat}

and replacing the !strcmp with the state==XML_EVENT_DESCRIPTION that is commented out. The XML parsing code in startelm initially purposely skipped "Body" as something that was on the way to getting to CalendarItem, so it is possible that the Body element is re-used and something we don't want gets put there, but I'm just not sure. You could also try !strcmp(name, "Body") && state == XML_EVENT_DESCRIPTION.

Please let me know if this works. If it doesn't, <hint>it would be very helpful if I had a test account available on an Exchange server</hint>. :-)

By: Rusty Newton (rnewton) 2012-06-29 18:02:00.897-0500

Dmitriy, did the patch work? Are you still experiencing the issue?

By: Dmitry Burilov (netaskd) 2012-07-02 03:32:42.011-0500

No, it doesn't work. I tried all options described by Terry Wilson. after applying the patch and compile asterisk falls.

By: Matt Jordan (mjordan) 2012-10-29 21:41:56.826-0500

I've attached a patch that provides a *small* tweak to the patch that Terry provided.  If this patch does not correct the issue, please provide a DEBUG 3 log or greater illustrating the {{res_calendar_ews}} module processing an XML DOM containing the {{<Body>}} element that is not being handled properly.  Alternatively, as Terry suggested, having an Exchange server with a configured calendar to point an instance of Asterisk at would make this much easier to solve.

By: Dmitry Burilov (netaskd) 2012-10-30 05:08:34.646-0500

Yes, Matt, now Body element working!
This log from my test query:

   -- Executing [ews@test:1] NoOp("Local/ews@test-0fe1;2", "Test calendar") in new stack
   -- Executing [ews@test:2] Set("Local/ews@test-0fe1;2", "id=6f046c07241424b741b0119556794291") in new stack
   -- Executing [ews@test:3] NoOp("Local/ews@test-0fe1;2", "getnum=1") in new stack
   -- Executing [ews@test:4] NoOp("Local/ews@test-0fe1;2", "summary=test subject line") in new stack
   -- Executing [ews@test:5] NoOp("Local/ews@test-0fe1;2", "description=<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>body test line 1</div>
<div>body test line 2</div>
<div>body test line 3</div>
<div>body test line 4</div>
<div>body test line 5</div>
<div>body test line 6</div>
<div>&nbsp;</div>
</span></font>
</body>
</html>
") in new stack
   -- Executing [ews@test:6] NoOp("Local/ews@test-0fe1;2", "organizer=Dmitry Burilov") in new stack
   -- Executing [ews@test:7] NoOp("Local/ews@test-0fe1;2", "location=test location line") in new stack
   -- Executing [ews@test:8] NoOp("Local/ews@test-0fe1;2", "categories=") in new stack
   -- Executing [ews@test:9] NoOp("Local/ews@test-0fe1;2", "priority=5") in new stack
   -- Executing [ews@test:10] Set("Local/ews@test-0fe1;2", "calendar=ews") in new stack
   -- Executing [ews@test:11] NoOp("Local/ews@test-0fe1;2", "uid=AAAaAERtaXRyeS5CdXJpbG92QGRhdGFhcnQuY29tAEYAAAAAAGyPRktF3lxIlqyFvvYAEqsHANpM3QS3AoNLvdLq1rrGRAYAAABrPgQAALj2djTXmYdJpnRuuRUMPoQAqV4vBBQAAA==") in new stack
   -- Executing [ews@test:12] NoOp("Local/ews@test-0fe1;2", "start=1351590960") in new stack
   -- Executing [ews@test:13] NoOp("Local/ews@test-0fe1;2", "end=1351592760") in new stack
   -- Executing [ews@test:14] NoOp("Local/ews@test-0fe1;2", "busystate=2") in new stack

This patch will be added to the trunk?
In any case, thanks everybody for the help!

Dmitry.

By: Dmitry Burilov (netaskd) 2012-10-31 04:52:54.583-0500

described in the comment

By: Matt Jordan (mjordan) 2012-10-31 06:46:40.078-0500

Actually, this is a bug, so it will be committed to 1.8, 10, 11, and trunk.  Thanks for testing!