[asterisk-commits] dlee: branch dlee/stasis-http r383783 - in /team/dlee/stasis-http: ./ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 25 16:16:52 CDT 2013


Author: dlee
Date: Mon Mar 25 16:16:49 2013
New Revision: 383783

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383783
Log:
Replaced functions lost in the merge from trunk
........

Merged revisions 383781 from http://svn.asterisk.org/svn/asterisk/team/dlee/stasis-app

Modified:
    team/dlee/stasis-http/   (props changed)
    team/dlee/stasis-http/main/json.c

Propchange: team/dlee/stasis-http/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Mar 25 16:16:49 2013
@@ -1,1 +1,1 @@
-/team/dlee/stasis-app:1-383779 /trunk:1-383765
+/team/dlee/stasis-app:1-383782 /trunk:1-383765

Modified: team/dlee/stasis-http/main/json.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/main/json.c?view=diff&rev=383783&r1=383782&r2=383783
==============================================================================
--- team/dlee/stasis-http/main/json.c (original)
+++ team/dlee/stasis-http/main/json.c Mon Mar 25 16:16:49 2013
@@ -27,6 +27,7 @@
  */
 
 /*** MODULEINFO
+	<depend>jansson</depend>
 	<support_level>core</support_level>
  ***/
 
@@ -35,10 +36,12 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/json.h"
+#include "asterisk/localtime.h"
 #include "asterisk/module.h"
 #include "asterisk/utils.h"
 
 #include <jansson.h>
+#include <time.h>
 
 /*!
  * \brief Function wrapper around ast_malloc macro.
@@ -501,6 +504,37 @@
 	return (struct ast_json *)json_deep_copy((json_t *)value);
 }
 
+struct ast_json *ast_json_name_number(const char *name, const char *number)
+{
+	return ast_json_pack("{s: s, s: s}",
+			     "name", name,
+			     "number", number);
+}
+
+struct ast_json *ast_json_dialplan_cep(const char *context, const char *exten, int priority)
+{
+	return ast_json_pack("{s: o, s: o, s: o}",
+			     "context", context ? ast_json_string_create(context) : ast_json_null(),
+			     "exten", exten ? ast_json_string_create(exten) : ast_json_null(),
+			     "priority", priority != -1 ? ast_json_integer_create(priority) : ast_json_null());
+}
+
+struct ast_json *ast_json_timeval(const struct timeval *tv, const char *zone)
+{
+	char buf[AST_ISO8601_LEN];
+	struct ast_tm tm = {};
+
+	if (tv == NULL) {
+		return NULL;
+	}
+
+	ast_localtime(tv, &tm, zone);
+
+	ast_strftime(buf, sizeof(buf),AST_ISO8601_FORMAT, &tm);
+
+	return ast_json_string_create(buf);
+}
+
 void ast_json_init(void)
 {
 	/* Setup to use Asterisk custom allocators */




More information about the asterisk-commits mailing list