diff options
author | Terry Wilson <twilson@digium.com> | 2012-01-27 15:57:40 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2012-01-27 15:57:40 +0000 |
commit | 5bfea5fdbfca835b29e14ec9a28345c6095431b5 (patch) | |
tree | 7c7fe1f029f299bc4091504eab373a1d0ecc9f25 /res/res_calendar.c | |
parent | e0ca02fe214ec81dfac90ddfff032076000c4b4b (diff) |
Add aresult variable for CALENDAR_WRITE
This patch adds a CALENDAR_SUCCESS=1/0 variable that is set to show whether or
not CALENDAR_WRITE has passed. This patch also adds some debugging for caldav
PUT responses and no longer treats responses with no body as an error (as a PUT
gets a 201 Created with no body).
(closes issue ASTERISK-16903)
Reported by: Clod Patry
Tested by: Terry Wilson
Patches:
calendarstatus.diff uploaded by Clod Patry (License #5138), slightly modified by Terry Wilson
Review: https://reviewboard.asterisk.org/r/1692/
- This line, and those below, will be ignored--
M res/res_calendar.c
M res/res_calendar_exchange.c
M res/res_calendar_caldav.c
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352916 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_calendar.c')
-rw-r--r-- | res/res_calendar.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/res/res_calendar.c b/res/res_calendar.c index bc3689e8b..01f5f95c1 100644 --- a/res/res_calendar.c +++ b/res/res_calendar.c @@ -54,7 +54,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") <syntax> <parameter name="calendar" required="true" /> </syntax> - <description> + <description> <para>Check the specified calendar's current busy status.</para> </description> <see-also> @@ -186,6 +186,18 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") <description> <para>Example: CALENDAR_WRITE(calendar,field1,field2,field3)=val1,val2,val3</para> <para>The field and value arguments can easily be set/passed using the HASHKEYS() and HASH() functions</para> + <variablelist> + <variable name="CALENDAR_SUCCESS"> + <para>The status of the write operation to the calendar</para> + <value name="1" > + The event was successfully written to the calendar. + </value> + <value name="0" > + The event was not written to the calendar due to network issues, permissions, etc. + </value> + </variable> + </variablelist> + </description> <see-also> <ref type="function">CALENDAR_BUSY</ref> @@ -1361,7 +1373,7 @@ static int calendar_write_exec(struct ast_channel *chan, const char *cmd, char * if (!(val_dup = ast_strdup(value))) { ast_log(LOG_ERROR, "Could not allocate memory for values\n"); - return -1; + goto write_cleanup; } AST_STANDARD_APP_ARGS(fields, data); @@ -1434,6 +1446,11 @@ static int calendar_write_exec(struct ast_channel *chan, const char *cmd, char * } write_cleanup: + if (ret) { + pbx_builtin_setvar_helper(chan, "CALENDAR_SUCCESS", "0"); + } else { + pbx_builtin_setvar_helper(chan, "CALENDAR_SUCCESS", "1"); + } if (cal) { cal = unref_calendar(cal); } |