Making Calendar work with Nextcloud and Owncloud

If you get a 400 Bad Request on the CalDAV calendar request from the Asterisk server that is trying to fetch the calendar from the Cloud server, then there mainly is a parameter missing in the HTTP header of the calendar request. This may not be needed on version 13.18 or above. Have not checked this on lower version.

Here ist the solution:

 

You will need to make three changes to res/res_calendar_caldav.c

 

Find the correct locations in res/res_calendar_caldav.c.

 

 

Around line 160:

Add this line:

ne_add_request_header(req, "Depth", "1");

After this line:

ne_add_request_header(req, "Content-type", ast_strlen_zero(content_type) ? "text/xml" : content_type);

 

Around line 482:

change this line:

if (!xmlStrcasecmp(fullname, BAD_CAST "C:calendar-data")) {

To this:

if (!xmlStrcasecmp(fullname, BAD_CAST "cal:calendar-data")) {

 

Around line 497:

Change this line:

if (xmlStrcasecmp(name, BAD_CAST "C:calendar-data")) {

To this:

if (xmlStrcasecmp(name, BAD_CAST "cal:calendar-data")) {