[asterisk-commits] murf: branch murf/bug_7638 r52242 - in
/team/murf/bug_7638: ./ apps/ channels...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jan 25 11:32:06 MST 2007
Author: murf
Date: Thu Jan 25 12:32:05 2007
New Revision: 52242
URL: http://svn.digium.com/view/asterisk?view=rev&rev=52242
Log:
Merged revisions 52025,52050,52053,52086,52108,52159,52161,52168,52209,52211,52240 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r52025 | file | 2007-01-24 11:04:47 -0700 (Wed, 24 Jan 2007) | 10 lines
Merged revisions 52016 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r52016 | file | 2007-01-24 12:59:55 -0500 (Wed, 24 Jan 2007) | 2 lines
Fix changing channel formats when joint capability changes and there are no audio formats... I didn't break it originally! (issue #8535 reported by ivoc)
........
................
r52050 | file | 2007-01-24 11:23:07 -0700 (Wed, 24 Jan 2007) | 10 lines
Merged revisions 52049 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r52049 | file | 2007-01-24 13:20:05 -0500 (Wed, 24 Jan 2007) | 2 lines
Merge in dialing API and the app_page that uses it. (issue #BE-118)
........
................
r52053 | murf | 2007-01-24 11:39:49 -0700 (Wed, 24 Jan 2007) | 17 lines
Merged revisions 52052 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r52052 | murf | 2007-01-24 11:26:22 -0700 (Wed, 24 Jan 2007) | 9 lines
Merged revisions 52002 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r52002 | murf | 2007-01-24 10:43:50 -0700 (Wed, 24 Jan 2007) | 1 line
updated check_expr via 8322 (refactoring of expression checking impl); elfring contributed a nice code reorg, I contributed some time to get it working again, better messages
........
................
................
r52086 | murf | 2007-01-24 13:35:54 -0700 (Wed, 24 Jan 2007) | 1 line
As per bug 8859 (Add option to revert old ChanIsAvail() with 's' option behavior), this update makes the 't' option available, which calls ast_parse_device_state instead of ast_device_state. This option will not dive into the channel driver to find the status of the device (which could be good if sip devicestate isn't returning full status, for various reasons).
................
r52108 | russell | 2007-01-24 14:43:22 -0700 (Wed, 24 Jan 2007) | 11 lines
Merged revisions 52107 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r52107 | russell | 2007-01-24 15:42:47 -0600 (Wed, 24 Jan 2007) | 3 lines
Fix the formatting of doxygen comments to properly indicate that the comment
documents the previous entity, as opposed to the next one.
........
................
r52159 | russell | 2007-01-24 18:07:07 -0700 (Wed, 24 Jan 2007) | 11 lines
Blocked revisions 52158 via svnmerge
........
r52158 | russell | 2007-01-24 19:05:46 -0600 (Wed, 24 Jan 2007) | 4 lines
Remove libnsl as a required lib for libiksemel to work. This change was
already made in the trunk.
(issue #8762)
........
................
r52161 | russell | 2007-01-24 18:38:05 -0700 (Wed, 24 Jan 2007) | 10 lines
Merged revisions 52160 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r52160 | russell | 2007-01-24 19:37:16 -0600 (Wed, 24 Jan 2007) | 2 lines
By suggestion from kpfleming last week, change "vmpassword" to "vmsecret".
........
................
r52168 | file | 2007-01-24 18:54:39 -0700 (Wed, 24 Jan 2007) | 18 lines
Merged revisions 52163 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r52163 | file | 2007-01-24 20:51:35 -0500 (Wed, 24 Jan 2007) | 10 lines
Merged revisions 52162 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r52162 | file | 2007-01-24 20:48:52 -0500 (Wed, 24 Jan 2007) | 2 lines
Add another note about audio files being played back to each bridged party. (issue #8718 reported by ppyy)
........
................
................
r52209 | file | 2007-01-25 10:17:56 -0700 (Thu, 25 Jan 2007) | 10 lines
Merged revisions 52208 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r52208 | file | 2007-01-25 12:14:53 -0500 (Thu, 25 Jan 2007) | 2 lines
Decrement onHold count if we are hung up on and still on hold. (issue #8909 reported by alexh42)
........
................
r52211 | file | 2007-01-25 10:51:35 -0700 (Thu, 25 Jan 2007) | 10 lines
Merged revisions 52210 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r52210 | file | 2007-01-25 12:49:39 -0500 (Thu, 25 Jan 2007) | 2 lines
Drop out variables I accidentally put in.
........
................
r52240 | file | 2007-01-25 11:10:18 -0700 (Thu, 25 Jan 2007) | 2 lines
Use atomic operation functions for use/ringing/hold manipulation.
................
Added:
team/murf/bug_7638/include/asterisk/dial.h
- copied unchanged from r52240, trunk/include/asterisk/dial.h
team/murf/bug_7638/main/dial.c
- copied unchanged from r52240, trunk/main/dial.c
Modified:
team/murf/bug_7638/ (props changed)
team/murf/bug_7638/UPGRADE.txt
team/murf/bug_7638/apps/app_chanisavail.c
team/murf/bug_7638/apps/app_mixmonitor.c
team/murf/bug_7638/apps/app_page.c
team/murf/bug_7638/apps/app_voicemail.c
team/murf/bug_7638/channels/chan_sip.c
team/murf/bug_7638/configs/users.conf.sample
team/murf/bug_7638/main/Makefile
team/murf/bug_7638/utils/Makefile
team/murf/bug_7638/utils/check_expr.c
Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
automerge = yes
Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 25 12:32:05 2007
@@ -1,1 +1,1 @@
-/trunk:1-52022
+/trunk:1-52241
Modified: team/murf/bug_7638/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/UPGRADE.txt?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/UPGRADE.txt (original)
+++ team/murf/bug_7638/UPGRADE.txt Thu Jan 25 12:32:05 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/murf/bug_7638/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_chanisavail.c?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/apps/app_chanisavail.c (original)
+++ team/murf/bug_7638/apps/app_chanisavail.c Thu Jan 25 12:32:05 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/murf/bug_7638/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_mixmonitor.c?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/apps/app_mixmonitor.c (original)
+++ team/murf/bug_7638/apps/app_mixmonitor.c Thu Jan 25 12:32:05 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/murf/bug_7638/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_page.c?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/apps/app_page.c (original)
+++ team/murf/bug_7638/apps/app_page.c Thu Jan 25 12:32:05 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/murf/bug_7638/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_voicemail.c?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/apps/app_voicemail.c (original)
+++ team/murf/bug_7638/apps/app_voicemail.c Thu Jan 25 12:32:05 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/murf/bug_7638/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_sip.c?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/channels/chan_sip.c (original)
+++ team/murf/bug_7638/channels/chan_sip.c Thu Jan 25 12:32:05 2007
@@ -3126,6 +3126,7 @@
if (option_debug > 2)
ast_log(LOG_DEBUG, "Updating call counter for %s call\n", outgoing ? "outgoing" : "incoming");
+
/* Test if we need to check call limits, in order to avoid
realtime lookups if we do not need it */
if (!ast_test_flag(&fup->flags[0], SIP_CALL_LIMIT))
@@ -3153,28 +3154,26 @@
switch(event) {
/* incoming and outgoing affects the inUse counter */
case DEC_CALL_LIMIT:
- if ( *inuse > 0 ) {
- if (ast_test_flag(&fup->flags[0], SIP_INC_COUNT))
- (*inuse)--;
- } else {
+ /* Decrement inuse count if applicable */
+ if (inuse && ast_test_flag(&fup->flags[0], SIP_INC_COUNT))
+ ast_atomic_fetchadd_int(inuse, -1);
+ else
*inuse = 0;
- }
- if (inringing) {
- if (ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
- if (*inringing > 0)
- (*inringing)--;
- else
- ast_log(LOG_WARNING, "Inringing for peer '%s' < 0?\n", fup->peername);
- ast_clear_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
- }
- }
- if (option_debug > 1 || sipdebug) {
+ /* Decrement ringing count if applicable */
+ if (inringing && ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
+ ast_atomic_fetchadd_int(inringing, -1);
+ ast_clear_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
+ }
+ /* Decrement onhold count if applicable */
+ if (ast_test_flag(&fup->flags[1], SIP_PAGE2_CALL_ONHOLD) && global_notifyhold)
+ sip_peer_hold(fup, FALSE);
+ if (option_debug > 1 || sipdebug)
ast_log(LOG_DEBUG, "Call %s %s '%s' removed from call limit %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *call_limit);
- }
break;
case INC_CALL_RINGING:
case INC_CALL_LIMIT:
+ /* If call limit is active and we have reached the limit, reject the call */
if (*call_limit > 0 ) {
if (*inuse >= *call_limit) {
ast_log(LOG_ERROR, "Call %s %s '%s' rejected due to usage limit of %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *call_limit);
@@ -3187,12 +3186,12 @@
}
if (inringing && (event == INC_CALL_RINGING)) {
if (!ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
- (*inringing)++;
+ ast_atomic_fetchadd_int(inringing, +1);
ast_set_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
}
}
/* Continue */
- (*inuse)++;
+ ast_atomic_fetchadd_int(inuse, +1);
ast_set_flag(&fup->flags[0], SIP_INC_COUNT);
if (option_debug > 1 || sipdebug) {
ast_log(LOG_DEBUG, "Call %s %s '%s' is %d out of %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *inuse, *call_limit);
@@ -3200,14 +3199,9 @@
break;
case DEC_CALL_RINGING:
- if (inringing) {
- if (ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
- if (*inringing > 0)
- (*inringing)--;
- else
- ast_log(LOG_WARNING, "Inringing for peer '%s' < 0?\n", p->name);
- ast_clear_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
- }
+ if (inringing && ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
+ ast_atomic_fetchadd_int(inringing, -1);
+ ast_clear_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
}
break;
@@ -5290,7 +5284,7 @@
if (option_debug > 3)
ast_log(LOG_DEBUG, "We have an owner, now see if we need to change this call\n");
- if (!(p->owner->nativeformats & p->jointcapability & AST_FORMAT_AUDIO_MASK) && (p->jointcapability & AST_FORMAT_AUDIO_MASK)) {
+ if (!(p->owner->nativeformats & p->jointcapability) && (p->jointcapability & AST_FORMAT_AUDIO_MASK)) {
if (debug) {
char s1[BUFSIZ], s2[BUFSIZ];
ast_log(LOG_DEBUG, "Oooh, we need to change our audio formats since our peer supports only %s and not %s\n",
@@ -8225,9 +8219,9 @@
/* If they put someone on hold, increment the value... otherwise decrement it */
if (hold)
- peer->onHold++;
+ ast_atomic_fetchadd_int(&peer->onHold, +1);
else
- peer->onHold--;
+ ast_atomic_fetchadd_int(&peer->onHold, -1);
/* Request device state update */
ast_device_state_changed("SIP/%s", peer->name);
Modified: team/murf/bug_7638/configs/users.conf.sample
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/configs/users.conf.sample?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/configs/users.conf.sample (original)
+++ team/murf/bug_7638/configs/users.conf.sample Thu Jan 25 12:32:05 2007
@@ -28,7 +28,7 @@
;
; Set voicemail mailbox 6000 password to 1234
;
-vmpassword = 1234
+vmsecret = 1234
;
; Create SIP Peer
;
Modified: team/murf/bug_7638/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/main/Makefile?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/main/Makefile (original)
+++ team/murf/bug_7638/main/Makefile Thu Jan 25 12:32:05 2007
@@ -27,6 +27,7 @@
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
strcompat.o threadstorage.o ../pbx/ael/ael_lex.o ../pbx/ael/ael.tab.o
+ strcompat.o threadstorage.o dial.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/murf/bug_7638/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/Makefile?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/utils/Makefile (original)
+++ team/murf/bug_7638/utils/Makefile Thu Jan 25 12:32:05 2007
@@ -13,7 +13,8 @@
.PHONY: clean all uninstall
-ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted conf2ael
+# 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
@@ -89,7 +90,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/murf/bug_7638/utils/check_expr.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/check_expr.c?view=diff&rev=52242&r1=52241&r2=52242
==============================================================================
--- team/murf/bug_7638/utils/check_expr.c (original)
+++ team/murf/bug_7638/utils/check_expr.c Thu Jan 25 12:32:05 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,8 +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 */
{
@@ -72,7 +86,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);
@@ -81,67 +95,71 @@
global_varlist = t;
}
-int check_expr(char *buffer, char *error_report);
-
-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;
}
@@ -149,11 +167,9 @@
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;
@@ -231,7 +247,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) {
@@ -313,13 +329,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;
@@ -333,4 +359,5 @@
/* parse command args for x=y and set varz */
parse_file(argv[1]);
-}
+ return 0;
+}
More information about the asterisk-commits
mailing list