[asterisk-commits] oej: branch oej/invitestate r48007 - in
/team/oej/invitestate: ./ apps/ cdr/ ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Nov 25 05:15:53 MST 2006
Author: oej
Date: Sat Nov 25 06:15:53 2006
New Revision: 48007
URL: http://svn.digium.com/view/asterisk?view=rev&rev=48007
Log:
Update to 1.2 trunk
Modified:
team/oej/invitestate/ (props changed)
team/oej/invitestate/apps/app_cut.c
team/oej/invitestate/apps/app_db.c
team/oej/invitestate/apps/app_dial.c
team/oej/invitestate/apps/app_directory.c
team/oej/invitestate/apps/app_voicemail.c
team/oej/invitestate/cdr/Makefile
team/oej/invitestate/channel.c
team/oej/invitestate/channels/chan_local.c
team/oej/invitestate/channels/chan_misdn.c
team/oej/invitestate/channels/chan_sip.c
team/oej/invitestate/channels/misdn/ (props changed)
team/oej/invitestate/channels/misdn/isdn_lib.c
team/oej/invitestate/channels/misdn_config.c
team/oej/invitestate/config.c
team/oej/invitestate/doc/README.cdr
team/oej/invitestate/frame.c
team/oej/invitestate/include/asterisk/config.h
Propchange: team/oej/invitestate/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Nov 25 06:15:53 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-47658
+/branches/1.2:1-48006
Modified: team/oej/invitestate/apps/app_cut.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/apps/app_cut.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/apps/app_cut.c (original)
+++ team/oej/invitestate/apps/app_cut.c Sat Nov 25 06:15:53 2006
@@ -48,7 +48,7 @@
static char *cut_synopsis = "Splits a variable's contents using the specified delimiter";
static char *cut_descrip =
-" Cut(newvar=varname,delimiter,fieldspec): This applicaiton will split the\n"
+" Cut(newvar=varname,delimiter,fieldspec): This application will split the\n"
"contents of a variable based on the given delimeter and store the result in\n"
"a new variable.\n"
"Parameters:\n"
@@ -66,7 +66,7 @@
" Sort(newvar=key1:val1[,key2:val2[[...],keyN:valN]]): This application will\n"
"sort the list provided in ascending order. The result will be stored in the\n"
"specified variable name.\n"
-" This applicaiton has been deprecated in favor of the SORT function.\n";
+" This application has been deprecated in favor of the SORT function.\n";
STANDARD_LOCAL_USER;
Modified: team/oej/invitestate/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/apps/app_db.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/apps/app_db.c (original)
+++ team/oej/invitestate/apps/app_db.c Sat Nov 25 06:15:53 2006
@@ -63,7 +63,7 @@
" This application has been deprecated in favor of the DB function.\n";
static char *d_descrip =
-" DBdel(family/key): This applicaiton will delete a key from the Asterisk\n"
+" DBdel(family/key): This application will delete a key from the Asterisk\n"
"database.\n";
static char *dt_descrip =
Modified: team/oej/invitestate/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/apps/app_dial.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/apps/app_dial.c (original)
+++ team/oej/invitestate/apps/app_dial.c Sat Nov 25 06:15:53 2006
@@ -65,7 +65,7 @@
static char *descrip =
" Dial(Technology/resource[&Tech2/resource2...][|timeout][|options][|URL]):\n"
-"This applicaiton will place calls to one or more specified channels. As soon\n"
+"This application will place calls to one or more specified channels. As soon\n"
"as one of the requested channels answers, the originating channel will be\n"
"answered, if it has not already been answered. These two channels will then\n"
"be active in a bridged call. All other channels that were requested will then\n"
Modified: team/oej/invitestate/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/apps/app_directory.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/apps/app_directory.c (original)
+++ team/oej/invitestate/apps/app_directory.c Sat Nov 25 06:15:53 2006
@@ -61,7 +61,7 @@
"the calling channel with a directory of extensions from which they can search\n"
"by name. The list of names and corresponding extensions is retrieved from the\n"
"voicemail configuration file, voicemail.conf.\n"
-" This applicaiton will immediate exit if one of the following DTMF digits are\n"
+" This application will immediately exit if one of the following DTMF digits are\n"
"received and the extension to jump to exists:\n"
" 0 - Jump to the 'o' extension, if it exists.\n"
" * - Jump to the 'a' extension, if it exists.\n\n"
Modified: team/oej/invitestate/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/apps/app_voicemail.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/apps/app_voicemail.c (original)
+++ team/oej/invitestate/apps/app_voicemail.c Sat Nov 25 06:15:53 2006
@@ -935,8 +935,13 @@
fd = -1;
continue;
}
- if (fd > -1)
- fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (fd > -1) {
+ if ((fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == -1) {
+ ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ goto yuck;
+ }
+ }
}
if (fdm) {
memset(fdm, 0, fdlen);
@@ -3277,12 +3282,11 @@
return res;
}
-static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vmfts,
- char *context, signed char record_gain)
+static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vmfmts,
+ char *context, signed char record_gain, long *duration)
{
int cmd = 0;
int retries = 0;
- int duration = 0;
signed char zero_gain = 0;
while ((cmd >= 0) && (cmd != 't') && (cmd != '*')) {
@@ -3290,15 +3294,66 @@
retries = 0;
switch (cmd) {
case '1':
- /* prepend a message to the current message and return */
+ /* prepend a message to the current message, update the metadata and return */
{
- char file[200];
- snprintf(file, sizeof(file), "%s/msg%04d", curdir, curmsg);
+ char msgfile[PATH_MAX];
+ char textfile[PATH_MAX];
+ int prepend_duration = 0;
+ struct ast_config *msg_cfg;
+ char *duration_str;
+
+ make_file(msgfile, sizeof(msgfile), curdir, curmsg);
+ strcpy(textfile, msgfile);
+ strncat(textfile, ".txt", sizeof(textfile) - 1);
+ *duration = 0;
+
+ /* if we can't read the message metadata, stop now */
+ if (!(msg_cfg = ast_config_load(textfile))) {
+ cmd = 0;
+ break;
+ }
+
if (record_gain)
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
- cmd = ast_play_and_prepend(chan, NULL, file, 0, vmfmts, &duration, 1, silencethreshold, maxsilence);
+
+ cmd = ast_play_and_prepend(chan, NULL, msgfile, 0, vmfmts, &prepend_duration, 1, silencethreshold, maxsilence);
if (record_gain)
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
+
+
+ if ((duration_str = ast_variable_retrieve(msg_cfg, "message", "duration")))
+ *duration = atoi(duration_str);
+
+ if (prepend_duration) {
+ struct ast_variable *var, *prev = NULL, *varlist;
+ struct ast_category *msg_cat;
+
+ *duration += prepend_duration;
+ msg_cat = ast_category_get(msg_cfg, "message");
+ varlist = ast_category_detach_variables(msg_cat);
+ for (var = varlist; var; prev = var, var = var->next) {
+ if (!strcmp(var->name, "duration")) {
+ if (!prev)
+ varlist = var->next;
+ else
+ prev->next = var->next;
+ free(var);
+ break;
+ }
+ }
+ /* need enough space for a maximum-length message duration */
+ duration_str = alloca(12);
+ snprintf(duration_str, 11, "%ld", *duration);
+ if ((var = ast_variable_new("duration", duration_str))) {
+ ast_variable_append(msg_cat, varlist);
+ ast_variable_append(msg_cat, var);
+ config_text_file_save(textfile, msg_cfg, "app_voicemail");
+ STORE(curdir, vmu->mailbox, context, curmsg);
+ }
+ }
+
+ ast_config_destroy(msg_cfg);
+
break;
}
case '2':
@@ -3509,11 +3564,13 @@
cmd = leave_voicemail(chan, mailbox, &leave_options);
} else {
/* Forward VoiceMail */
+ long duration = 0;
+
RETRIEVE(dir, curmsg);
- cmd = vm_forwardoptions(chan, sender, dir, curmsg, vmfmts, context, record_gain);
+ cmd = vm_forwardoptions(chan, sender, dir, curmsg, vmfmts, context, record_gain, &duration);
if (!cmd) {
while (!res && vmtmp) {
- copy_message(chan, sender, 0, curmsg, 0, vmtmp, fmt);
+ copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt);
saved_messages++;
vmfree = vmtmp;
Modified: team/oej/invitestate/cdr/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/cdr/Makefile?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/cdr/Makefile (original)
+++ team/oej/invitestate/cdr/Makefile Sat Nov 25 06:15:53 2006
@@ -65,7 +65,7 @@
#
# PGSQL stuff... Autoconf anyone??
#
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql)$(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),)
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),)
MODS+=cdr_pgsql.so
endif
Modified: team/oej/invitestate/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/channel.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/channel.c (original)
+++ team/oej/invitestate/channel.c Sat Nov 25 06:15:53 2006
@@ -355,8 +355,11 @@
{
struct chanlist *chan, *last=NULL;
- if (option_debug)
+ if (option_debug && tech && tech->type )
ast_log(LOG_DEBUG, "Unregistering channel type '%s'\n", tech->type);
+ else if (option_debug)
+ ast_log(LOG_DEBUG, "Unregistering channel, tech is NULL!!!\n");
+
ast_mutex_lock(&chlock);
@@ -732,43 +735,34 @@
const char *context, const char *exten)
{
const char *msg = prev ? "deadlock" : "initial deadlock";
- int retries, done;
+ int retries;
struct ast_channel *c;
for (retries = 0; retries < 10; retries++) {
+ int done;
+
ast_mutex_lock(&chlock);
for (c = channels; c; c = c->next) {
- if (!prev) {
- /* want head of list */
- if (!name && !exten)
- break;
- if (name) {
- /* want match by full name */
- if (!namelen) {
- if (!strcasecmp(c->name, name))
- break;
- else
- continue;
- }
- /* want match by name prefix */
- if (!strncasecmp(c->name, name, namelen))
- break;
- } else if (exten) {
- /* want match by context and exten */
- if (context && (strcasecmp(c->context, context) &&
- strcasecmp(c->macrocontext, context)))
- continue;
- /* match by exten */
- if (strcasecmp(c->exten, exten) &&
- strcasecmp(c->macroexten, exten))
- continue;
- else
- break;
- }
- } else if (c == prev) { /* found, return c->next */
+ if (prev) { /* look for next item */
+ if (c != prev) /* not this one */
+ continue;
+ /* found, prepare to return c->next */
c = c->next;
- break;
}
+ if (name) { /* want match by name */
+ if ((!namelen && strcasecmp(c->name, name)) ||
+ (namelen && strncasecmp(c->name, name, namelen)))
+ continue; /* name match failed */
+ } else if (exten) {
+ if (context && strcasecmp(c->context, context) &&
+ strcasecmp(c->macrocontext, context))
+ continue; /* context match failed */
+ if (strcasecmp(c->exten, exten) &&
+ strcasecmp(c->macroexten, exten))
+ continue; /* exten match failed */
+ }
+ /* if we get here, c points to the desired record */
+ break;
}
/* exit if chan not found or mutex acquired successfully */
done = (c == NULL) || (ast_mutex_trylock(&c->lock) == 0);
@@ -3511,10 +3505,11 @@
if (!ast_tvzero(nexteventts)) {
now = ast_tvnow();
to = ast_tvdiff_ms(nexteventts, now);
- if (to <= 0) {
+ if (to <= 0 && !config->timelimit) {
res = AST_BRIDGE_COMPLETE;
break;
- }
+ }
+
}
if (config->timelimit) {
@@ -3534,7 +3529,7 @@
break;
}
- if (!to) {
+ if (to <= 0) {
if (time_left_ms >= 5000) {
/* force the time left to round up if appropriate */
if (caller_warning && config->warning_sound && config->play_warning)
@@ -3546,8 +3541,11 @@
}
if (config->warning_freq) {
nexteventts = ast_tvadd(nexteventts, ast_samp2tv(config->warning_freq, 1000));
- } else
+ }
+
+ if ( (!config->warning_freq) || ( config->timelimit - ast_tvdiff_ms(nexteventts, config->start_time) < 0)) {
nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->timelimit, 1000));
+ }
}
}
@@ -3645,8 +3643,6 @@
o1nativeformats = c1->nativeformats;
}
res = ast_generic_bridge(c0, c1, config, fo, rc, nexteventts);
- if (res != AST_BRIDGE_RETRY)
- break;
}
c0->_bridge = NULL;
Modified: team/oej/invitestate/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/channels/chan_local.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/channels/chan_local.c (original)
+++ team/oej/invitestate/channels/chan_local.c Sat Nov 25 06:15:53 2006
@@ -167,6 +167,9 @@
struct local_pvt *p = ast->tech_pvt;
int isoutbound;
int res = -1;
+
+ if (!p)
+ return -1;
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
@@ -245,6 +248,9 @@
int res = -1;
int isoutbound;
+ if (!p)
+ return -1;
+
/* Just queue for delivery to the other side */
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
@@ -263,6 +269,10 @@
static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct local_pvt *p = newchan->tech_pvt;
+
+ if (!p)
+ return -1;
+
ast_mutex_lock(&p->lock);
if ((p->owner != oldchan) && (p->chan != oldchan)) {
@@ -285,6 +295,9 @@
struct ast_frame f = { AST_FRAME_CONTROL, };
int isoutbound;
+ if (!p)
+ return -1;
+
/* Queue up a frame representing the indication as a control frame */
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
@@ -301,6 +314,9 @@
struct ast_frame f = { AST_FRAME_DTMF, };
int isoutbound;
+ if (!p)
+ return -1;
+
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
f.subclass = digit;
@@ -316,6 +332,9 @@
struct ast_frame f = { AST_FRAME_HTML, };
int isoutbound;
+ if (!p)
+ return -1;
+
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
f.subclass = subclass;
@@ -334,6 +353,9 @@
int res;
struct ast_var_t *varptr = NULL, *new;
size_t len, namelen;
+
+ if (!p)
+ return -1;
ast_mutex_lock(&p->lock);
@@ -409,6 +431,9 @@
struct local_pvt *cur, *prev=NULL;
struct ast_channel *ochan = NULL;
int glaredetect;
+
+ if (!p)
+ return -1;
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
Modified: team/oej/invitestate/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/channels/chan_misdn.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/channels/chan_misdn.c (original)
+++ team/oej/invitestate/channels/chan_misdn.c Sat Nov 25 06:15:53 2006
@@ -796,8 +796,8 @@
print_bc_info(fd, help, bc);
} else {
if (help->state == MISDN_HOLDED) {
- chan_misdn_log(0, 0, "ITS A HOLDED BC:\n");
- chan_misdn_log(0,0," --> l3_id: %x\n"
+ chan_misdn_log(2, 0, "ITS A HOLDED BC:\n");
+ chan_misdn_log(2,0," --> l3_id: %x\n"
" --> dad:%s oad:%s\n"
,help->l3id
@@ -1220,8 +1220,7 @@
int port=bc->port;
- chan_misdn_log(1,port,"update_config: Getting Config\n");
-
+ chan_misdn_log(7,port,"update_config: Getting Config\n");
int hdlc=0;
misdn_cfg_get( port, MISDN_CFG_HDLC, &hdlc, sizeof(int));
@@ -1635,7 +1634,7 @@
chan_misdn_log(1, port, "* CALL: %s\n",dest);
- chan_misdn_log(1, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
+ chan_misdn_log(2, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
chan_misdn_log(3, port, " --> * adding2newbc ext %s\n",ast->exten);
if (ast->exten) {
@@ -1691,7 +1690,7 @@
return -1;
}
- chan_misdn_log(1, port, " --> * SEND: State Dialing pid:%d\n",newbc?newbc->pid:1);
+ chan_misdn_log(2, port, " --> * SEND: State Dialing pid:%d\n",newbc?newbc->pid:1);
ast_setstate(ast, AST_STATE_DIALING);
ast->hangupcause=16;
@@ -1855,12 +1854,11 @@
return -1;
}
- chan_misdn_log(1, p->bc->port, "* IND : Indication [%d] from %s\n",cond, ast->exten);
+ chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] from %s\n",cond, ast->exten);
switch (cond) {
case AST_CONTROL_BUSY:
- chan_misdn_log(1, p->bc->port, "* IND :\tbusy\n");
- chan_misdn_log(1, p->bc->port, " --> * SEND: State Busy pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(1, p->bc->port, "* IND :\tbusy pid:%d\n",p->bc?p->bc->pid:-1);
ast_setstate(ast,AST_STATE_BUSY);
p->bc->out_cause=17;
@@ -1873,41 +1871,42 @@
return -1;
break;
case AST_CONTROL_RING:
- chan_misdn_log(1, p->bc->port, " --> * IND :\tring pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(1, p->bc->port, "* IND :\tring pid:%d\n",p->bc?p->bc->pid:-1);
return -1;
break;
case AST_CONTROL_RINGING:
+ chan_misdn_log(1, p->bc->port, "* IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
switch (p->state) {
case MISDN_ALERTING:
- chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n",p->bc?p->bc->pid:-1);
break;
case MISDN_CONNECTED:
- chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n",p->bc?p->bc->pid:-1);
return -1;
break;
default:
p->state=MISDN_ALERTING;
- chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
misdn_lib_send_event( p->bc, EVENT_ALERTING);
if (p->other_ch && p->other_ch->bc) {
if (misdn_inband_avail(p->other_ch->bc)) {
- chan_misdn_log(1,p->bc->port, " --> other End is mISDN and has inband info available\n");
+ chan_misdn_log(2,p->bc->port, " --> other End is mISDN and has inband info available\n");
break;
}
if (!p->other_ch->bc->nt) {
- chan_misdn_log(1,p->bc->port, " --> other End is mISDN TE so it has inband info for sure (?)\n");
+ chan_misdn_log(2,p->bc->port, " --> other End is mISDN TE so it has inband info for sure (?)\n");
break;
}
}
- chan_misdn_log(1, p->bc->port, " --> * SEND: State Ring pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(3, p->bc->port, " --> * SEND: State Ring pid:%d\n",p->bc?p->bc->pid:-1);
ast_setstate(ast,AST_STATE_RINGING);
if ( !p->bc->nt && (p->orginator==ORG_MISDN) && !p->incoming_early_audio )
- chan_misdn_log(1,p->bc->port, " --> incoming_early_audio off\n");
+ chan_misdn_log(2,p->bc->port, " --> incoming_early_audio off\n");
else
return -1;
}
@@ -2044,10 +2043,10 @@
}
chan_misdn_log(1, bc->port, "* IND : HANGUP\tpid:%d ctx:%s dad:%s oad:%s State:%s\n",p->bc?p->bc->pid:-1, ast->context, ast->exten, AST_CID_P(ast), misdn_get_ch_state(p));
- chan_misdn_log(2, bc->port, " --> l3id:%x\n",p->l3id);
- chan_misdn_log(1, bc->port, " --> cause:%d\n",bc->cause);
- chan_misdn_log(1, bc->port, " --> out_cause:%d\n",bc->out_cause);
- chan_misdn_log(1, bc->port, " --> state:%s\n", misdn_get_ch_state(p));
+ chan_misdn_log(3, bc->port, " --> l3id:%x\n",p->l3id);
+ chan_misdn_log(3, bc->port, " --> cause:%d\n",bc->cause);
+ chan_misdn_log(2, bc->port, " --> out_cause:%d\n",bc->out_cause);
+ chan_misdn_log(2, bc->port, " --> state:%s\n", misdn_get_ch_state(p));
switch (p->state) {
case MISDN_CALLING:
@@ -2132,7 +2131,7 @@
}
- chan_misdn_log(1, bc->port, "Channel: %s hanguped new state:%s\n",ast->name,misdn_get_ch_state(p));
+ chan_misdn_log(3, bc->port, " --> Channel: %s hanguped new state:%s\n",ast->name,misdn_get_ch_state(p));
return 0;
}
@@ -2348,9 +2347,9 @@
/* got hangup .. */
if (!f)
- chan_misdn_log(1,ch1->bc->port,"Read Null Frame\n");
+ chan_misdn_log(4,ch1->bc->port,"Read Null Frame\n");
else
- chan_misdn_log(1,ch1->bc->port,"Read Frame Controll class:%d\n",f->subclass);
+ chan_misdn_log(4,ch1->bc->port,"Read Frame Controll class:%d\n",f->subclass);
*fo=f;
*rc=who;
@@ -2955,11 +2954,11 @@
return;
}
- cb_log(1,port,"hangup_chan\n");
+ cb_log(5,port,"hangup_chan called\n");
if (ch->need_hangup)
{
- cb_log(1,port,"-> hangup\n");
+ cb_log(2,port," --> hangup\n");
send_cause2ast(ch->ast,ch->bc,ch);
ch->need_hangup=0;
ch->need_queue_hangup=0;
@@ -2969,7 +2968,7 @@
}
if (!ch->need_queue_hangup) {
- cb_log(1,port,"No need to queue hangup\n");
+ cb_log(2,port," --> No need to queue hangup\n");
}
ch->need_queue_hangup=0;
@@ -2978,7 +2977,7 @@
if (ch->ast)
ast_queue_hangup(ch->ast);
- cb_log(1,port,"-> queue_hangup\n");
+ cb_log(2,port," --> queue_hangup\n");
} else {
cb_log(1,port,"Cannot hangup chan, no ast\n");
}
@@ -2998,7 +2997,7 @@
ast=ch->ast;
}
- chan_misdn_log(1, bc->port, "release_chan: bc with l3id: %x\n",bc->l3_id);
+ chan_misdn_log(5, bc->port, "release_chan: bc with l3id: %x\n",bc->l3_id);
/*releaseing jitterbuffer*/
if (ch->jb ) {
@@ -3177,7 +3176,7 @@
tmp=pbx_builtin_getvar_helper(chan,"MISDN_PID");
if (tmp) {
ch->other_pid=atoi(tmp);
- chan_misdn_log(1,bc->port,"IMPORT_PID: importing pid:%s\n",tmp);
+ chan_misdn_log(3,bc->port," --> IMPORT_PID: importing pid:%s\n",tmp);
if (ch->other_pid >0) {
ch->other_ch=find_chan_by_pid(cl_te,ch->other_pid);
@@ -3190,7 +3189,7 @@
{
char tmp[32];
- chan_misdn_log(1,bc->port,"EXPORT_PID: pid:%d\n",bc->pid);
+ chan_misdn_log(3,bc->port," --> EXPORT_PID: pid:%d\n",bc->pid);
sprintf(tmp,"%d",bc->pid);
pbx_builtin_setvar_helper(chan,"_MISDN_PID",tmp);
}
@@ -3730,15 +3729,15 @@
ast_queue_control(ch->ast, AST_CONTROL_RINGING);
ast_setstate(ch->ast, AST_STATE_RINGING);
- cb_log(1,bc->port,"Set State Ringing\n");
+ cb_log(7,bc->port," --> Set State Ringing\n");
if ( misdn_cap_is_speech(bc->capability) && misdn_inband_avail(bc)) {
cb_log(1,bc->port,"Starting Tones, we have inband Data\n");
start_bc_tones(ch);
} else {
- cb_log(1,bc->port,"We have no inband Data, the other end must create ringing\n");
+ cb_log(3,bc->port," --> We have no inband Data, the other end must create ringing\n");
if (ch->far_alerting) {
- cb_log(1,bc->port,"The other end can not do ringing eh ?.. we must do all ourself..");
+ cb_log(1,bc->port," --> The other end can not do ringing eh ?.. we must do all ourself..");
start_bc_tones(ch);
/*tone_indicate(ch, TONE_FAR_ALERTING);*/
}
@@ -4009,6 +4008,9 @@
ch->bc=bc;
ch->state = MISDN_CONNECTED;
+ ch->hold_info.port=0;
+ ch->hold_info.channel=0;
+
struct ast_channel *hold_ast=AST_BRIDGED_P(ch->ast);
if (hold_ast) {
Modified: team/oej/invitestate/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/channels/chan_sip.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/channels/chan_sip.c (original)
+++ team/oej/invitestate/channels/chan_sip.c Sat Nov 25 06:15:53 2006
@@ -1417,6 +1417,7 @@
if (sipdebug && option_debug > 3)
ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid);
ast_sched_del(sched, cur->retransid);
+ cur->retransid = -1;
}
free(cur);
res = 0;
@@ -1472,8 +1473,8 @@
if (option_debug > 3 && sipdebug)
ast_log(LOG_DEBUG, "*** SIP TIMER: Cancelling retransmission #%d - %s (got response)\n", cur->retransid, msg);
ast_sched_del(sched, cur->retransid);
+ cur->retransid = -1;
}
- cur->retransid = -1;
res = 0;
break;
}
@@ -1672,6 +1673,7 @@
}
if (peer->expire > -1)
ast_sched_del(sched, peer->expire);
+
if (peer->pokeexpire > -1)
ast_sched_del(sched, peer->pokeexpire);
register_peer_exten(peer, 0);
@@ -2276,7 +2278,7 @@
case INC_CALL_LIMIT:
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);
+ ast_log(LOG_NOTICE, "Call %s %s '%s' rejected due to usage limit of %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *call_limit);
if (u)
ASTOBJ_UNREF(u,sip_destroy_user);
else
@@ -2501,7 +2503,7 @@
/* Do we need a timer here if we don't hear from them at all? */
} else {
/* Send a new request: CANCEL */
- transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0);
+ transmit_request(p, SIP_CANCEL, p->ocseq, 1, 0);
/* Actually don't destroy us yet, wait for the 487 on our original
INVITE, but do set an autodestruct just in case we never get it. */
}
@@ -2638,6 +2640,11 @@
static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct sip_pvt *p = newchan->tech_pvt;
+ if (!p) {
+ ast_log(LOG_WARNING, "No pvt after masquerade. Strange things may happen\n");
+ return -1;
+ }
+
ast_mutex_lock(&p->lock);
if (p->owner != oldchan) {
ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner);
@@ -4309,6 +4316,7 @@
static int transmit_response_using_temp(char *callid, struct sockaddr_in *sin, int useglobal_nat, const int intended_method, struct sip_request *req, char *msg)
{
struct sip_pvt *p = alloca(sizeof(*p));
+ struct sip_history *hist = NULL;
memset(p, 0, sizeof(*p));
@@ -4333,6 +4341,11 @@
ast_copy_string(p->callid, callid, sizeof(p->callid));
__transmit_response(p, msg, req, 0);
+
+ while ((hist = p->history)) {
+ p->history = p->history->next;
+ free(hist);
+ }
return 0;
}
@@ -6117,8 +6130,10 @@
else
p->username[0] = '\0';
- if (p->expire > -1)
+ if (p->expire > -1) {
ast_sched_del(sched, p->expire);
+ p->expire = -1;
+ }
if ((expiry < 1) || (expiry > max_expiry))
expiry = max_expiry;
if (!ast_test_flag(p, SIP_REALTIME))
@@ -9670,7 +9685,7 @@
if (ast_test_flag(p, SIP_PENDINGBYE)) {
/* if we can't BYE, then this is really a pending CANCEL */
if (p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA)
- transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0);
+ transmit_request(p, SIP_CANCEL, p->ocseq, 1, 0);
/* Actually don't destroy us yet, wait for the 487 on our original
INVITE, but do set an autodestruct just in case we never get it. */
else
@@ -9869,6 +9884,7 @@
if (global_regattempts_max)
p->registry->regattempts = global_regattempts_max+1;
ast_sched_del(sched, r->timeout);
+ r->timeout = -1;
ast_set_flag(p, SIP_NEEDDESTROY);
break;
case 404: /* Not found */
@@ -9878,6 +9894,7 @@
ast_set_flag(p, SIP_NEEDDESTROY);
r->call = NULL;
ast_sched_del(sched, r->timeout);
+ r->timeout = -1;
break;
case 407: /* Proxy auth */
if ((p->authtries == MAX_AUTHTRIES) || do_register_auth(p, req, "Proxy-Authenticate", "Proxy-Authorization")) {
@@ -9892,6 +9909,7 @@
ast_set_flag(p, SIP_NEEDDESTROY);
r->call = NULL;
ast_sched_del(sched, r->timeout);
+ r->timeout = -1;
break;
case 200: /* 200 OK */
if (!r) {
@@ -11131,7 +11149,7 @@
if ((firststate = ast_extension_state(NULL, p->context, p->exten)) < 0) {
char iabuf[INET_ADDRSTRLEN];
- ast_log(LOG_ERROR, "Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension\n", p->exten, p->context, ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr));
+ ast_log(LOG_NOTICE, "Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension\n", p->exten, p->context, ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr));
transmit_response(p, "404 Not found", req);
ast_set_flag(p, SIP_NEEDDESTROY);
return 0;
@@ -11201,7 +11219,6 @@
{
/* Called with p->lock held, as well as p->owner->lock if appropriate, keeping things
relatively static */
- struct sip_request resp;
char *cmd;
char *cseq;
char *useragent;
@@ -11214,9 +11231,6 @@
int debug = sip_debug_test_pvt(p);
char *e;
int error = 0;
-
- /* Clear out potential response */
- memset(&resp, 0, sizeof(resp));
/* Get Method and Cseq */
cseq = get_header(req, "Cseq");
@@ -13412,7 +13426,9 @@
sip_destroy(iterator->call);
}
ASTOBJ_UNLOCK(iterator);
+
} while(0));
+
ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user);
ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy);
Propchange: team/oej/invitestate/channels/misdn/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Nov 25 06:15:53 2006
@@ -1,0 +1,1 @@
+chan_misdn_lib.a
Modified: team/oej/invitestate/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/channels/misdn/isdn_lib.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/channels/misdn/isdn_lib.c (original)
+++ team/oej/invitestate/channels/misdn/isdn_lib.c Sat Nov 25 06:15:53 2006
@@ -420,10 +420,10 @@
{
int i;
- cb_log(1,stack->port,"find_free_chan: req_chan:%d\n",channel);
+ cb_log(5,stack->port,"find_free_chan: req_chan:%d\n",channel);
if (channel < 0 || channel > MAX_BCHANS) {
- cb_log(4, stack->port, " !! out of bound call to find_free_chan_in_stack! (ch:%d)\n", channel);
+ cb_log(0, stack->port, " !! out of bound call to find_free_chan_in_stack! (ch:%d)\n", channel);
return 0;
}
@@ -432,14 +432,14 @@
for (i = 0; i < stack->b_num; i++) {
if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 Dchannel ;) and work with chan preselection */
if (!stack->channels[i]) {
- cb_log (1, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
+ cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
stack->channels[i] = 1;
return i+1;
}
}
}
- cb_log (4, stack->port, " !! NO FREE CHAN IN STACK\n");
+ cb_log (1, stack->port, " !! NO FREE CHAN IN STACK\n");
dump_chan_list(stack);
return 0;
@@ -1671,8 +1671,6 @@
stack;
stack=stack->next) {
- if ( !stack->ptp && !check) return 1;
-
if (stack->port == port) {
if (stack->blocked) {
@@ -1690,7 +1688,7 @@
return 0;
}
} else {
- if ( stack->l1link)
+ if ( !check || stack->l1link )
return 1;
else {
cb_log(0,port, "Port down PMP\n");
@@ -2030,7 +2028,7 @@
if (stack->ptp)
set_chan_in_stack(stack, bc->channel);
else
- cb_log(0,stack->port," --> PTMP but channel requested\n");
+ cb_log(3,stack->port," --> PTMP but channel requested\n");
} else {
@@ -3173,7 +3171,7 @@
}
cb_log(1, stack->port, "I SEND:%s oad:%s dad:%s pid:%d\n", isdn_get_info(msgs_g, event, 0), bc->oad, bc->dad, bc->pid);
- cb_log(1, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state));
+ cb_log(4, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state));
misdn_lib_log_ies(bc);
switch (event) {
@@ -4182,7 +4180,7 @@
struct misdn_stack *stack=get_stack_by_bc(bc);
- cb_log(1, stack?stack->port:0,"ec_enable\n");
+ cb_log(4, stack?stack->port:0,"ec_enable\n");
if (!misdn_cap_is_speech(bc->capability)) {
cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n");
@@ -4190,7 +4188,7 @@
}
if (bc->ec_enable) {
- cb_log(1, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
+ cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
switch (bc->ec_deftaps) {
case 4:
@@ -4222,7 +4220,7 @@
{
struct misdn_stack *stack=get_stack_by_bc(bc);
- cb_log(1, stack?stack->port:0,"ec_disable\n");
+ cb_log(4, stack?stack->port:0," --> ec_disable\n");
if (!misdn_cap_is_speech(bc->capability)) {
cb_log(1, stack?stack->port:0, " --> no speech? cannot disable EC\n");
@@ -4230,7 +4228,7 @@
}
if ( ! bc->ec_enable) {
- cb_log(1, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
+ cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
manager_ph_control(bc, ECHOCAN_OFF, 0);
}
}
@@ -4247,7 +4245,7 @@
manager_ph_control(bc, CMX_RECEIVE_OFF, 0);
manager_ph_control(bc, CMX_CONF_JOIN, conf_id);
- cb_log(1,bc->port, "Joining bc:%x in conf:%d\n",bc->addr,conf_id);
+ cb_log(3,bc->port, "Joining bc:%x in conf:%d\n",bc->addr,conf_id);
char data[16];
int len=15;
@@ -4265,13 +4263,13 @@
manager_ph_control(bc, CMX_RECEIVE_ON, 0);
manager_ph_control(bc, CMX_CONF_SPLIT, conf_id);
- cb_log(1,bc->port, "Splitting bc:%x in conf:%d\n",bc->addr,conf_id);
+ cb_log(4,bc->port, "Splitting bc:%x in conf:%d\n",bc->addr,conf_id);
}
void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2) {
int conf_id=bc1->pid +1;
- cb_log(1, bc1->port, "I Send: BRIDGE from:%d to:%d\n",bc1->port,bc2->port);
+ cb_log(4, bc1->port, "I Send: BRIDGE from:%d to:%d\n",bc1->port,bc2->port);
struct misdn_bchannel *bc_list[]={
bc1,bc2,NULL
@@ -4280,7 +4278,7 @@
for (bc=bc_list; *bc; *bc++) {
(*bc)->conf_id=conf_id;
- cb_log(1, (*bc)->port, " --> bc_addr:%x\n",(*bc)->addr);
+ cb_log(4, (*bc)->port, " --> bc_addr:%x\n",(*bc)->addr);
switch((*bc)->bc_state) {
case BCHAN_ACTIVATED:
@@ -4315,7 +4313,7 @@
void misdn_lib_echo(struct misdn_bchannel *bc, int onoff)
{
- cb_log(1,bc->port, " --> ECHO %s\n", onoff?"ON":"OFF");
+ cb_log(3,bc->port, " --> ECHO %s\n", onoff?"ON":"OFF");
manager_ph_control(bc, onoff?CMX_ECHO_ON:CMX_ECHO_OFF, 0);
}
Modified: team/oej/invitestate/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/channels/misdn_config.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/channels/misdn_config.c (original)
+++ team/oej/invitestate/channels/misdn_config.c Sat Nov 25 06:15:53 2006
@@ -91,7 +91,7 @@
{ "far_alerting", MISDN_CFG_FAR_ALERTING, MISDN_CTYPE_BOOL, "no", NONE },
{ "pmp_l1_check", MISDN_CFG_PMP_L1_CHECK, MISDN_CTYPE_BOOL, "yes", NONE },
{ "reject_cause", MISDN_CFG_REJECT_CAUSE, MISDN_CTYPE_INT, "21", NONE },
- { "block_on_alarm", MISDN_CFG_ALARM_BLOCK, MISDN_CTYPE_BOOL, "yes", NONE },
+ { "block_on_alarm", MISDN_CFG_ALARM_BLOCK, MISDN_CTYPE_BOOL, "no", NONE },
{ "hdlc", MISDN_CFG_HDLC, MISDN_CTYPE_BOOL, "no", NONE },
{ "context", MISDN_CFG_CONTEXT, MISDN_CTYPE_STR, "default", NONE },
{ "language", MISDN_CFG_LANGUAGE, MISDN_CTYPE_STR, "en", NONE },
Modified: team/oej/invitestate/config.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/config.c?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/config.c (original)
+++ team/oej/invitestate/config.c Sat Nov 25 06:15:53 2006
@@ -120,6 +120,8 @@
else
category->root = variable;
category->last = variable;
+ while (category->last->next)
+ category->last = category->last->next;
}
void ast_variables_destroy(struct ast_variable *v)
@@ -301,6 +303,7 @@
v = cat->root;
cat->root = NULL;
+ cat->last = NULL;
return v;
}
@@ -698,10 +701,13 @@
if ((f = fopen(fn, "w"))) {
#endif
if (option_verbose > 1)
- ast_verbose( VERBOSE_PREFIX_2 "Saving '%s': ", fn);
+ ast_verbose(VERBOSE_PREFIX_2 "Saving '%s': ", fn);
fprintf(f, ";!\n");
fprintf(f, ";! Automatically generated configuration file\n");
- fprintf(f, ";! Filename: %s (%s)\n", configfile, fn);
+ if (strcmp(configfile, fn))
+ fprintf(f, ";! Filename: %s (%s)\n", configfile, fn);
+ else
+ fprintf(f, ";! Filename: %s\n", configfile);
fprintf(f, ";! Generator: %s\n", generator);
fprintf(f, ";! Creation Date: %s", date);
fprintf(f, ";!\n");
@@ -731,9 +737,9 @@
}
} else {
if (option_debug)
- printf("Unable to open for writing: %s\n", fn);
+ ast_log(LOG_DEBUG, "Unable to open for writing: %s\n", fn);
if (option_verbose > 1)
- printf( "Unable to write (%s)", strerror(errno));
+ ast_verbose(VERBOSE_PREFIX_2 "Unable to write (%s)", strerror(errno));
return -1;
}
fclose(f);
Modified: team/oej/invitestate/doc/README.cdr
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/doc/README.cdr?view=diff&rev=48007&r1=48006&r2=48007
==============================================================================
--- team/oej/invitestate/doc/README.cdr (original)
+++ team/oej/invitestate/doc/README.cdr Sat Nov 25 06:15:53 2006
@@ -102,21 +102,6 @@
${CDR(userfield)} The channels uses specified field.
In addition, you can set your own extra variables by using Set(CDR(name)=value).
-
-______________________________
-cdr_csv2
-------------------------------
-
-This module is an experimental new cdr module to demonstrate the cdr vars.
-usage(
-
-*) Create a file called cdr.conf and place it in your /etc/asterisk (or wherever your config files are) in the [cdr_csv2] section.
-*) Add an entry called format to indicate any format you want for the output.
-
-The following format string will emulate the regular cdr file format:
-[cdr_csv2]
-
-format => "${CDR(clid)}","${CDR(src)}","${CDR(dst)}","${CDR(dcontext)}","${CDR(channel)}","${CDR(dstchannel)}","${CDR(lastapp)}","${CDR(lastdata)}","${CDR(start)}","${CDR(answer)}","${CDR(end)}","${CDR(duration)}","${CDR(billsec)}","${CDR(disposition)}","${CDR(amaflags)}","${CDR(accountcode)}","${CDR(uniqueid)}","${CDR(userfield)}"
-
-You can put anything you want as the value of format incuding new cdr vars you make up or any global variables.
-
+These variables can be output into a text-format CDR by using the cdr_custom
+CDR driver; see the cdr_custom.conf.sample file in the configs directory for
+an example of how to do this.
[... 39 lines stripped ...]
More information about the asterisk-commits
mailing list