[svn-commits] russell: branch russell/smdi-1.4 r93043 - /team/russell/smdi-1.4/res/res_smdi.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Dec 14 12:49:21 CST 2007
Author: russell
Date: Fri Dec 14 12:49:20 2007
New Revision: 93043
URL: http://svn.digium.com/view/asterisk?view=rev&rev=93043
Log:
Add skeletons for SMDI dialplan functions
Modified:
team/russell/smdi-1.4/res/res_smdi.c
Modified: team/russell/smdi-1.4/res/res_smdi.c
URL: http://svn.digium.com/view/asterisk/team/russell/smdi-1.4/res/res_smdi.c?view=diff&rev=93043&r1=93042&r2=93043
==============================================================================
--- team/russell/smdi-1.4/res/res_smdi.c (original)
+++ team/russell/smdi-1.4/res/res_smdi.c Fri Dec 14 12:49:20 2007
@@ -47,6 +47,7 @@
#include "asterisk/stringfields.h"
#include "asterisk/linkedlists.h"
#include "asterisk/app.h"
+#include "asterisk/pbx.h"
/* Message expiry time in milliseconds */
#define SMDI_MSG_EXPIRY_TIME 30000 /* 30 seconds */
@@ -419,7 +420,7 @@
}
/* store c in md_msg->fwd_st */
- if ( i >= iface->msdstrip)
+ if (i >= iface->msdstrip)
*cp++ = c;
}
@@ -468,7 +469,7 @@
cp = &mwi_msg->fwd_st[0];
for (i = 0; i < SMDI_MAX_STATION_NUM_LEN + 1; i++) {
if ((c = fgetc(iface->file)) == ' ') {
- *cp = '\0';
+ *cp = '\0';
break;
}
@@ -874,6 +875,57 @@
return res;
}
+/*! In seconds */
+#define SMDI_RETRIEVE_TIMEOUT_DEFAULT 3
+
+static int smdi_msg_retrieve_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+ if (chan)
+ ast_autoservice_start(chan);
+
+ /* XXX */
+
+ if (chan)
+ ast_autoservice_stop(chan);
+
+ return 0;
+}
+
+static int smdi_msg_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+ return 0;
+}
+
+static struct ast_custom_function smdi_msg_retrieve_function = {
+ .name = "SMDI_MSG_RETRIEVE",
+ .synopsis = "Retrieve an SMDI message.",
+ .syntax = "SMDI_MSG_RETRIEVE(<smdi port>,<terminal>[,timeout])",
+ .desc =
+ " This function is used to retrieve an incoming SMDI message. It returns\n"
+ "an ID which can be used with the SMDI_MSG() function to access details of\n"
+ "the message. Note that this is a destructive function in the sense that\n"
+ "once an SMDI message is retrieved using this function, it is no longer in\n"
+ "the global SMDI message queue, and can not be accessed by any other Asterisk\n"
+ "channels. The timeout for this function is optional, and the default is\n"
+ "3 seconds.\n"
+ "",
+ .read = smdi_msg_retrieve_read,
+};
+
+static struct ast_custom_function smdi_msg_function = {
+ .name = "SMDI_MSG",
+ .synopsis = "Retrieve details about an SMDI message.",
+ .syntax = "SMDI_MSG(<message_id>,<component>)",
+ .desc =
+ " This function is used to access details of an SMDI message that was\n"
+ "pulled from the incoming SMDI message queue using the SMDI_MSG_RETRIEVE()\n"
+ "function.\n"
+ " Valid message components are:\n"
+ " XXX TODO\n"
+ "",
+ .read = smdi_msg_read,
+};
+
static int load_module(void)
{
int res;
@@ -884,6 +936,9 @@
ast_mutex_init(&mwi_monitor.lock);
ast_cond_init(&mwi_monitor.cond, NULL);
+
+ ast_custom_function_register(&smdi_msg_retrieve_function);
+ ast_custom_function_register(&smdi_msg_function);
/* load the config and start the listener threads*/
res = smdi_load(0);
@@ -912,6 +967,9 @@
pthread_join(mwi_monitor.thread, NULL);
+ ast_custom_function_unregister(&smdi_msg_retrieve_function);
+ ast_custom_function_unregister(&smdi_msg_function);
+
return 0;
}
More information about the svn-commits
mailing list