[asterisk-commits] mmichelson: trunk r257851 - /trunk/funcs/func_srv.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 19 13:42:33 CDT 2010
Author: mmichelson
Date: Mon Apr 19 13:42:31 2010
New Revision: 257851
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=257851
Log:
Commit compromise I suggested on review 608.
This allows for multiple SRV queries to be done
from the dialplan for the same service on a single call while
still allowing one to bypass the call to SRVQUERY if they so
please.
Taking action since no comments had been left for a while.
This can easily be reverted if needed. External tests
still pass.
Modified:
trunk/funcs/func_srv.c
Modified: trunk/funcs/func_srv.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_srv.c?view=diff&rev=257851&r1=257850&r2=257851
==============================================================================
--- trunk/funcs/func_srv.c (original)
+++ trunk/funcs/func_srv.c Mon Apr 19 13:42:31 2010
@@ -125,6 +125,8 @@
static int srv_query_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
+ struct ast_datastore *datastore;
+
if (!chan) {
ast_log(LOG_WARNING, "%s cannot be used without a channel\n", cmd);
return -1;
@@ -134,7 +136,19 @@
ast_log(LOG_WARNING, "%s requires a service as an argument\n", cmd);
return -1;
}
-
+
+ /* If they already called SRVQUERY for this service once,
+ * we need to kill the old datastore.
+ */
+ ast_channel_lock(chan);
+ datastore = ast_channel_datastore_find(chan, &srv_result_datastore_info, data);
+ ast_channel_unlock(chan);
+
+ if (datastore) {
+ ast_channel_datastore_remove(chan, datastore);
+ ast_datastore_free(datastore);
+ }
+
if (!srv_datastore_setup(data, chan)) {
return -1;
}
More information about the asterisk-commits
mailing list