[asterisk-dev] [Code Review] Calendaring API for Asterisk
Russell Bryant
russell at digium.com
Tue Dec 2 21:58:34 CST 2008
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/58/#review170
-----------------------------------------------------------
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment301>
I have a thought on another way to handle this. How about you handle configuration loading each time a calendar technology registers itself? At that time, you could load the config for any calendar that matches the type of the technology being registered.
That way, you don't have to do this waiting hack for when Asterisk starts up. Also, it elegantly handles the issue in case a module gets loaded later.
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment300>
There is a lot of code in this else block. I think it's a good candidate for a helper function, build_calendar() or something
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment302>
How about:
strcpy(buf, calendar_is_busy(cal) ? "1" : "");
Also, do you really want an empty string as the result? How about "0"?
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment303>
missing spaces
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment304>
You're missing channel locking here
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment305>
coding guidelines
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment307>
You can do this with a single ao2_callback() call.
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment308>
Nothing ever tries to cancel this thread, so I would just remove both instances of testcancel() here.
If we end up making the calendar core a loadable module, we'll have to revisit this, but if so, I'd go about it a different way.
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment309>
check for allocation failure
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment310>
check for allocation failure
/trunk/main/calendar.c
<http://reviewboard.digium.com/r/58/#comment311>
Check for failure here, too
/trunk/res/res_caldav.c
<http://reviewboard.digium.com/r/58/#comment312>
You can do this with an ao2_callback() call
/trunk/res/res_caldav.c
<http://reviewboard.digium.com/r/58/#comment313>
coding guidelines
/trunk/res/res_caldav.c
<http://reviewboard.digium.com/r/58/#comment314>
check allocation failure
/trunk/res/res_caldav.c
<http://reviewboard.digium.com/r/58/#comment315>
remove commented out code
/trunk/res/res_caldav.c
<http://reviewboard.digium.com/r/58/#comment317>
coding guidelines
/trunk/res/res_caldav.c
<http://reviewboard.digium.com/r/58/#comment316>
coding guidelines
/trunk/res/res_caldav.c
<http://reviewboard.digium.com/r/58/#comment318>
coding guidelines
- Russell
On 2008-11-25 16:49:05, Terry Wilson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/58/
> -----------------------------------------------------------
>
> (Updated 2008-11-25 16:49:05)
>
>
> Review request for Asterisk Developers.
>
>
> Summary
> -------
>
> Calendaring integration for Asterisk--currently supporting iCalendar files (hosted over HTTP/HTTPS), CalDAV, and Microsoft Exchange. Features available: dialplan functions for querying and writing (if the calendar technology supports it like CalDAV and Exchange do) calendar event information, a device state provider for phone BLF support, and calendar event notification through executing dialplan apps or context/exten.
>
> The overall structure is that the res_* calendar modules register as a calendar tech to main/calendar.c, and after all modules are loaded, main/calendar.c parses calendar.conf and calls the calendar_load callback for each register calendar tech based on the "type" field for that calendar in calendars.conf. Currently each calendar runs in its own thread downloading and refreshing the remote calendar data as necessary as to avoid serializing downloads.
>
> Eventually it would probably be a good idea for me to implement a thread pool and honor a maximum number of downloads per host:port as well as a global maximum number of simultaneous downloads--perhaps with a min/max refresh value so I could randomize the time for refreshing a bit so as not to be refreshing all of the calendars at once. Also, there was a request to add support for the dialplan functions to query calendars that aren't in calendar.conf i.e. CALENDAR_QUERY(ical/http://www.google.com/calendar/ical/nkt5atdq7cdbes3ehdfpendpnc%40group.calendar.google.com/public/basic.ics,${EPOCH},$[${EPOCH} + 3600]), etc.
>
> Currently I don't have any support for querying/setting attendees, mostly because it is a list of results whereas all of the others are individual fields. Writing gets especially ugly for them because of the current format of CALENDAR_WRITE(calendar,${HASHKEYS(calendar)})=${HASH(calendar)}. I suppose I could add a ...,${HAHSKEYS(attendees)})=...,${HASH(attendees)} to the end...it is just getting a little ugly.
>
>
> Diffs
> -----
>
> /trunk/build_tools/menuselect-deps.in 159315
> /trunk/configs/calendar.conf.sample PRE-CREATION
> /trunk/configure.ac 159315
> /trunk/include/asterisk/_private.h 159315
> /trunk/include/asterisk/autoconfig.h.in 159315
> /trunk/include/asterisk/calendar.h PRE-CREATION
> /trunk/main/Makefile 159315
> /trunk/main/asterisk.c 159315
> /trunk/main/calendar.c PRE-CREATION
> /trunk/main/loader.c 159315
> /trunk/makeopts.in 159315
> /trunk/res/res_caldav.c PRE-CREATION
> /trunk/res/res_exchangecal.c PRE-CREATION
> /trunk/res/res_icalendar.c PRE-CREATION
>
> Diff: http://reviewboard.digium.com/r/58/diff
>
>
> Testing
> -------
>
> I have tested all three calendar modules by adding, deleting, and moving events and verifying that notifications occur. I have tested writing to Exchange, and Zimbra and Google Calendar through CalDAV. I have run with MALOC_DEBUG looking for leaks and dropped references to astobj2 objects.
>
>
> Thanks,
>
> Terry
>
>
More information about the asterisk-dev
mailing list