[asterisk-commits] oej: branch oej/videocaps r52207 - in
/team/oej/videocaps: ./ apps/ configs/ ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jan 25 02:33:08 MST 2007
Author: oej
Date: Thu Jan 25 03:33:08 2007
New Revision: 52207
URL: http://svn.digium.com/view/asterisk?view=rev&rev=52207
Log:
Resolve conflict, reset automerge, blame File
Added:
team/oej/videocaps/include/asterisk/dial.h
- copied unchanged from r52168, trunk/include/asterisk/dial.h
team/oej/videocaps/main/dial.c
- copied unchanged from r52168, trunk/main/dial.c
Modified:
team/oej/videocaps/ (props changed)
team/oej/videocaps/UPGRADE.txt
team/oej/videocaps/apps/app_chanisavail.c
team/oej/videocaps/apps/app_mixmonitor.c
team/oej/videocaps/apps/app_page.c
team/oej/videocaps/apps/app_voicemail.c
team/oej/videocaps/configs/users.conf.sample
team/oej/videocaps/main/Makefile
team/oej/videocaps/utils/Makefile
team/oej/videocaps/utils/check_expr.c
Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
automerge = http://edvina.net/training/
Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 25 03:33:08 2007
@@ -1,1 +1,1 @@
-/trunk:1-52038
+/trunk:1-52206
Modified: team/oej/videocaps/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/UPGRADE.txt?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/UPGRADE.txt (original)
+++ team/oej/videocaps/UPGRADE.txt Thu Jan 25 03:33:08 2007
@@ -31,3 +31,6 @@
to make them more distinguishable from 'maxmsgs', which sets folder
size. The old variables will continue to work in this version, albeit
with a deprecation warning.
+* ChanIsAvail() now has a 't' option, which allows the specified device
+ to be queried for state without consulting the channel drivers. This
+ performs mostly a 'ChanExists' sort of function.
Modified: team/oej/videocaps/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_chanisavail.c?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/apps/app_chanisavail.c (original)
+++ team/oej/videocaps/apps/app_chanisavail.c Thu Jan 25 03:33:08 2007
@@ -61,12 +61,14 @@
" ${AVAILSTATUS} - the status code for the available channel\n"
" Options:\n"
" s - Consider the channel unavailable if the channel is in use at all\n"
+" t - Simply checks if specified channels exist in the channel list\n"
+" (implies option s) \n"
" j - Support jumping to priority n+101 if no channel is available\n";
static int chanavail_exec(struct ast_channel *chan, void *data)
{
- int res=-1, inuse=-1, option_state=0, priority_jump=0;
+ int res=-1, inuse=-1, option_state=0, priority_jump=0, string_compare=0;
int status;
struct ast_module_user *u;
char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur;
@@ -90,6 +92,8 @@
if (args.options) {
if (strchr(args.options, 's'))
option_state = 1;
+ if (strchr(args.options, 't'))
+ string_compare = 1;
if (strchr(args.options, 'j'))
priority_jump = 1;
}
@@ -113,7 +117,13 @@
*number = '\0';
number++;
- if (option_state) {
+ if (string_compare) {
+ /* ast_parse_device_state checks for "SIP/1234" as a channel name.
+ ast_device_state will ask the SIP driver for the channel state. */
+
+ snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
+ status = inuse = ast_parse_device_state(trychan);
+ } else if (option_state) {
/* If the pbx says in use then don't bother trying further.
This is to permit testing if someone's on a call, even if the
channel can permit more calls (ie callwaiting, sip calls, etc). */
Modified: team/oej/videocaps/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_mixmonitor.c?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/apps/app_mixmonitor.c (original)
+++ team/oej/videocaps/apps/app_mixmonitor.c Thu Jan 25 03:33:08 2007
@@ -68,7 +68,8 @@
"Valid options:\n"
" a - Append to the file instead of overwriting it.\n"
" b - Only save audio to the file while the channel is bridged.\n"
-" Note: does not include conferences.\n"
+" Note: Does not include conferences or sounds played to each bridged\n"
+" party.\n"
" v(<x>) - Adjust the heard volume by a factor of <x> (range -4 to 4)\n"
" V(<x>) - Adjust the spoken volume by a factor of <x> (range -4 to 4)\n"
" W(<x>) - Adjust the both heard and spoken volumes by a factor of <x>\n"
Modified: team/oej/videocaps/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_page.c?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/apps/app_page.c (original)
+++ team/oej/videocaps/apps/app_page.c Thu Jan 25 03:33:08 2007
@@ -49,6 +49,7 @@
#include "asterisk/chanvars.h"
#include "asterisk/utils.h"
#include "asterisk/devicestate.h"
+#include "asterisk/dial.h"
static const char *app_page= "Page";
@@ -79,89 +80,18 @@
AST_APP_OPTION('s', PAGE_SKIP),
});
-struct calloutdata {
- char cidnum[64];
- char cidname[64];
- char tech[64];
- char resource[256];
- char meetmeopts[64];
- struct ast_variable *variables;
-};
-
-static void *page_thread(void *data)
-{
- struct calloutdata *cd = data;
-
- ast_pbx_outgoing_app(cd->tech, AST_FORMAT_SLINEAR, cd->resource, 30000,
- "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL, NULL);
-
- free(cd);
-
- return NULL;
-}
-
-static void launch_page(struct ast_channel *chan, const char *meetmeopts, const char *tech, const char *resource)
-{
- struct calloutdata *cd;
- const char *varname;
- struct ast_variable *lastvar = NULL;
- struct ast_var_t *varptr;
- pthread_t t;
- pthread_attr_t attr;
-
- if (!(cd = ast_calloc(1, sizeof(*cd))))
- return;
-
- /* Copy data from our page over */
- ast_copy_string(cd->cidnum, chan->cid.cid_num ? chan->cid.cid_num : "", sizeof(cd->cidnum));
- ast_copy_string(cd->cidname, chan->cid.cid_name ? chan->cid.cid_name : "", sizeof(cd->cidname));
- ast_copy_string(cd->tech, tech, sizeof(cd->tech));
- ast_copy_string(cd->resource, resource, sizeof(cd->resource));
- ast_copy_string(cd->meetmeopts, meetmeopts, sizeof(cd->meetmeopts));
-
- AST_LIST_TRAVERSE(&chan->varshead, varptr, entries) {
- struct ast_variable *newvar = NULL;
-
- if (!(varname = ast_var_full_name(varptr)) || (varname[0] != '_'))
- continue;
-
- if (varname[1] == '_')
- newvar = ast_variable_new(varname, ast_var_value(varptr));
- else
- newvar = ast_variable_new(&varname[1], ast_var_value(varptr));
-
- if (newvar) {
- if (lastvar)
- lastvar->next = newvar;
- else
- cd->variables = newvar;
- lastvar = newvar;
- }
- }
-
- /* Spawn thread to handle this page */
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (ast_pthread_create(&t, &attr, page_thread, cd)) {
- ast_log(LOG_WARNING, "Unable to create paging thread: %s\n", strerror(errno));
- free(cd);
- }
-
- return;
-}
+#define MAX_DIALS 128
static int page_exec(struct ast_channel *chan, void *data)
{
struct ast_module_user *u;
- char *options;
- char *tech, *resource;
- char meetmeopts[80];
+ char *options, *tech, *resource, *tmp;
+ char meetmeopts[88], originator[AST_CHANNEL_NAME];
struct ast_flags flags = { 0 };
unsigned int confid = ast_random();
struct ast_app *app;
- char *tmp;
- int res=0;
- char originator[AST_CHANNEL_NAME];
+ int res = 0, pos = 0, i = 0;
+ struct ast_dial *dials[MAX_DIALS];
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "This application requires at least one argument (destination(s) to page)\n");
@@ -186,16 +116,19 @@
if (options)
ast_app_parse_options(page_opts, &flags, NULL, options);
- snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
+ snprintf(meetmeopts, sizeof(meetmeopts), "MeetMe|%ud|%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
(ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );
+ /* Go through parsing/calling each device */
while ((tech = strsep(&tmp, "&"))) {
int state = 0;
+ struct ast_dial *dial = NULL;
/* don't call the originating device */
if (!strcasecmp(tech, originator))
continue;
+ /* If no resource is available, continue on */
if (!(resource = strchr(tech, '/'))) {
ast_log(LOG_WARNING, "Incomplete destination '%s' supplied.\n", tech);
continue;
@@ -206,9 +139,26 @@
ast_log(LOG_WARNING, "Destination '%s' has device state '%s'.\n", tech, devstate2str(state));
continue;
}
-
+
*resource++ = '\0';
- launch_page(chan, meetmeopts, tech, resource);
+
+ /* Create a dialing structure */
+ if (!(dial = ast_dial_create())) {
+ ast_log(LOG_WARNING, "Failed to create dialing structure.\n");
+ continue;
+ }
+
+ /* Append technology and resource */
+ ast_dial_append(dial, tech, resource);
+
+ /* Set ANSWER_EXEC as global option */
+ ast_dial_option_global_enable(dial, AST_DIAL_OPTION_ANSWER_EXEC, meetmeopts);
+
+ /* Run this dial in async mode */
+ ast_dial_run(dial, chan, 1);
+
+ /* Put in our dialing array */
+ dials[pos++] = dial;
}
if (!ast_test_flag(&flags, PAGE_QUIET)) {
@@ -223,6 +173,21 @@
pbx_exec(chan, app, meetmeopts);
}
+ /* Go through each dial attempt cancelling, joining, and destroying */
+ for (i = 0; i < pos; i++) {
+ struct ast_dial *dial = dials[i];
+
+ /* If the dial is already answered, then they will/should get kicked out by Meetme */
+ if (ast_dial_status(dial) != AST_DIAL_RESULT_ANSWERED)
+ ast_dial_join(dial);
+
+ /* Hangup all channels */
+ ast_dial_hangup(dial);
+
+ /* Destroy dialing structure */
+ ast_dial_destroy(dial);
+ }
+
ast_module_user_remove(u);
return -1;
Modified: team/oej/videocaps/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_voicemail.c?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/apps/app_voicemail.c (original)
+++ team/oej/videocaps/apps/app_voicemail.c Thu Jan 25 03:33:08 2007
@@ -678,9 +678,9 @@
struct ast_variable *tmp;
tmp = var;
while (tmp) {
- if (!strcasecmp(tmp->name, "vmpassword")) {
+ if (!strcasecmp(tmp->name, "vmsecret")) {
ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
- } else if (!strcasecmp(tmp->name, "secret") || !strcasecmp(tmp->name, "password")) { /* don't overwrite vmpassword if it exists */
+ } else if (!strcasecmp(tmp->name, "secret") || !strcasecmp(tmp->name, "password")) { /* don't overwrite vmsecret if it exists */
if (ast_strlen_zero(retval->password))
ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
} else if (!strcasecmp(tmp->name, "uniqueid")) {
@@ -823,7 +823,7 @@
category = NULL;
var = NULL;
/* check users.conf and update the password stored for the mailbox*/
- /* if no vmpassword entry exists create one. */
+ /* if no vmsecret entry exists create one. */
if ((cfg = ast_config_load_with_comments("users.conf"))) {
if (option_debug > 3)
ast_log(LOG_DEBUG, "we are looking for %s\n", vmu->mailbox);
@@ -831,10 +831,10 @@
if (option_debug > 3)
ast_log(LOG_DEBUG, "users.conf: %s\n", category);
if (!strcasecmp(category, vmu->mailbox)) {
- if (!(tmp = ast_variable_retrieve(cfg, category, "vmpassword"))) {
+ if (!(tmp = ast_variable_retrieve(cfg, category, "vmsecret"))) {
if (option_debug > 3)
- ast_log(LOG_DEBUG, "looks like we need to make vmpassword!\n");
- var = ast_variable_new("vmpassword", newpassword);
+ ast_log(LOG_DEBUG, "looks like we need to make vmsecret!\n");
+ var = ast_variable_new("vmsecret", newpassword);
}
new = alloca(strlen(newpassword)+1);
sprintf(new, "%s", newpassword);
@@ -844,7 +844,7 @@
break;
}
if (!var)
- ast_variable_update(cat, "vmpassword", new, NULL);
+ ast_variable_update(cat, "vmsecret", new, NULL);
else
ast_variable_append(cat, var);
}
Modified: team/oej/videocaps/configs/users.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/configs/users.conf.sample?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/configs/users.conf.sample (original)
+++ team/oej/videocaps/configs/users.conf.sample Thu Jan 25 03:33:08 2007
@@ -28,7 +28,7 @@
;
; Set voicemail mailbox 6000 password to 1234
;
-vmpassword = 1234
+vmsecret = 1234
;
; Create SIP Peer
;
Modified: team/oej/videocaps/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/main/Makefile?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/main/Makefile (original)
+++ team/oej/videocaps/main/Makefile Thu Jan 25 03:33:08 2007
@@ -26,7 +26,7 @@
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
- strcompat.o capability.o threadstorage.o
+ strcompat.o threadstorage.o dial.o capability.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static
Modified: team/oej/videocaps/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/utils/Makefile?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/utils/Makefile (original)
+++ team/oej/videocaps/utils/Makefile Thu Jan 25 03:33:08 2007
@@ -13,7 +13,8 @@
.PHONY: clean all uninstall
-ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted
+# to get check_expr, add it to the ALL_UTILS list
+ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted check_expr
UTILS:=$(ALL_UTILS)
include $(ASTTOPDIR)/Makefile.rules
@@ -85,7 +86,7 @@
ast_expr2f.o: ASTCFLAGS+=-DSTANDALONE_AEL -I../main
-check_expr: check_expr.c ast_expr2.o ast_expr2f.o
+check_expr: check_expr.o ast_expr2.o ast_expr2f.o
aelbison.c: ../pbx/ael/ael.tab.c
@cp $< $@
Modified: team/oej/videocaps/utils/check_expr.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/utils/check_expr.c?view=diff&rev=52207&r1=52206&r2=52207
==============================================================================
--- team/oej/videocaps/utils/check_expr.c (original)
+++ team/oej/videocaps/utils/check_expr.c Thu Jan 25 03:33:08 2007
@@ -23,12 +23,12 @@
#include <stdlib.h>
#include <../include/asterisk/ast_expr.h>
-int global_lineno = 1;
-int global_expr_count = 0;
-int global_expr_max_size = 0;
-int global_expr_tot_size = 0;
-int global_warn_count = 0;
-int global_OK_count = 0;
+static int global_lineno = 1;
+static int global_expr_count=0;
+static int global_expr_max_size=0;
+static int global_expr_tot_size=0;
+static int global_warn_count=0;
+static int global_OK_count=0;
struct varz
{
@@ -54,6 +54,22 @@
fflush(stdout);
va_end(vars);
}
+void ast_register_file_version(const char *file, const char *version);
+void ast_unregister_file_version(const char *file);
+
+char *find_var(const char *varname);
+void set_var(const char *varname, const char *varval);
+unsigned int check_expr(char* buffer, char* error_report);
+int check_eval(char *buffer, char *error_report);
+void parse_file(const char *fname);
+
+void ast_register_file_version(const char *file, const char *version)
+{
+}
+
+void ast_unregister_file_version(const char *file)
+{
+}
char *find_var(const char *varname) /* the list should be pretty short, if there's any list at all */
{
@@ -68,7 +84,7 @@
void set_var(const char *varname, const char *varval)
{
- struct varz *t = calloc(1,sizeof(struct varz));
+ struct varz *t = (struct varz*)calloc(1,sizeof(struct varz));
if (!t)
return;
strcpy(t->varname, varname);
@@ -77,75 +93,79 @@
global_varlist = t;
}
-int check_expr(char *buffer, char *error_report)
-{
- char *cp;
- int oplen = 0;
- int warn_found = 0;
+unsigned int check_expr(char* buffer, char* error_report)
+{
+ char* cp;
+ unsigned int warn_found = 0;
error_report[0] = 0;
- for (cp=buffer;*cp;cp++) {
-
- if (*cp == '|'
- || *cp == '&'
- || *cp == '='
- || *cp == '>'
- || *cp == '<'
- || *cp == '+'
- || *cp == '-'
- || *cp == '*'
- || *cp == '/'
- || *cp == '%'
- || *cp == '?'
- || *cp == ':'
- /* || *cp == '('
- || *cp == ')' These are pretty hard to track, as they are in funcalls, etc. */
- || *cp == '"') {
- if (*cp == '"') {
+ for (cp = buffer; *cp; ++cp)
+ {
+ switch (*cp)
+ {
+ case '"':
/* skip to the other end */
- cp++;
- while (*cp && *cp != '"')
- cp++;
- if (*cp == 0) {
- fprintf(stderr,"Trouble? Unterminated double quote found at line %d\n",
- global_lineno);
- }
- }
- else {
- if ((*cp == '>'||*cp == '<' ||*cp=='!') && (*(cp+1) == '=')) {
- oplen = 2;
- }
- else {
- oplen = 1;
- }
-
- if ((cp > buffer && *(cp-1) != ' ') || *(cp+oplen) != ' ') {
- char tbuf[1000];
- if (oplen == 1)
- sprintf(tbuf,"WARNING: line %d, '%c' operator not separated by spaces. This may lead to confusion. You may wish to use double quotes to quote the grouping it is in. Please check!\n",
- global_lineno, *cp);
- else
- sprintf(tbuf,"WARNING: line %d, '%c%c' operator not separated by spaces. This may lead to confusion. You may wish to use double quotes to quote the grouping it is in. Please check!\n",
- global_lineno, *cp, *(cp+1));
- strcat(error_report,tbuf);
-
- global_warn_count++;
- warn_found++;
- }
- }
- }
- }
+ while (*(++cp) && *cp != '"') ;
+
+ if (*cp == 0)
+ {
+ fprintf(stderr,
+ "Trouble? Unterminated double quote found at line %d\n",
+ global_lineno);
+ }
+ break;
+
+ case '>':
+ case '<':
+ case '!':
+ if ( (*(cp + 1) == '=')
+ && ( ( (cp > buffer) && (*(cp - 1) != ' ') ) || (*(cp + 2) != ' ') ) )
+ {
+ char msg[200];
+ snprintf(msg,
+ sizeof(msg),
+ "WARNING: line %d: '%c%c' operator not separated by spaces. This may lead to confusion. You may wish to use double quotes to quote the grouping it is in. Please check!\n",
+ global_lineno, *cp, *(cp + 1));
+ strcat(error_report, msg);
+ ++global_warn_count;
+ ++warn_found;
+ }
+ break;
+
+ case '|':
+ case '&':
+ case '=':
+ case '+':
+ case '-':
+ case '*':
+ case '/':
+ case '%':
+ case '?':
+ case ':':
+ if ( ( (cp > buffer) && (*(cp - 1) != ' ') ) || (*(cp + 1) != ' ') )
+ {
+ char msg[200];
+ snprintf(msg,
+ sizeof(msg),
+ "WARNING: line %d: '%c' operator not separated by spaces. This may lead to confusion. You may wish to use double quotes to quote the grouping it is in. Please check!\n",
+ global_lineno, *cp );
+ strcat(error_report, msg);
+ ++global_warn_count;
+ ++warn_found;
+ }
+ break;
+ }
+ }
+
return warn_found;
}
int check_eval(char *buffer, char *error_report)
{
- char *cp, *ep, *xp;
+ char *cp, *ep;
char s[4096];
char evalbuf[80000];
- int oplen = 0;
- int warn_found = 0;
int result;
error_report[0] = 0;
@@ -221,7 +241,7 @@
char buffer[30000]; /* I sure hope no expr gets this big! */
if (!f) {
- fprintf(stderr,"Couldn't open %s for reading... need an extensions.conf file to parse!\n");
+ fprintf(stderr,"Couldn't open %s for reading... need an extensions.conf file to parse!\n",fname);
exit(20);
}
if (!l) {
@@ -303,13 +323,23 @@
}
-main(int argc,char **argv)
+int main(int argc,char **argv)
{
int argc1;
char *eq;
if (argc < 2) {
+ printf("check_expr -- a program to look thru extensions.conf files for $[...] expressions,\n");
+ printf(" and run them thru the parser, looking for problems\n");
printf("Hey-- give me a path to an extensions.conf file!\n");
+ printf(" You can also follow the file path with a series of variable decls,\n");
+ printf(" of the form, varname=value, each separated from the next by spaces.\n");
+ printf(" (this might allow you to avoid division by zero messages, check that math\n");
+ printf(" is being done correctly, etc.)\n");
+ printf(" Note that messages about operators not being surrounded by spaces is merely to alert\n");
+ printf(" you to possible problems where you might be expecting those operators as part of a string.\n");
+ printf(" (to include operators in a string, wrap with double quotes!)\n");
+
exit(19);
}
global_varlist = 0;
@@ -323,4 +353,5 @@
/* parse command args for x=y and set varz */
parse_file(argv[1]);
-}
+ return 0;
+}
More information about the asterisk-commits
mailing list