[svn-commits] branch crichter/0.4.0 r29878 - in
/team/crichter/0.4.0: ./ apps/ channels/ ch...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue May 23 15:47:00 MST 2006
Author: crichter
Date: Tue May 23 17:46:59 2006
New Revision: 29878
URL: http://svn.digium.com/view/asterisk?rev=29878&view=rev
Log:
Merged revisions 29200,29400,29470,29519,29559,29666,29698,29738,29773,29853 via svnmerge from
https://origsvn.digium.com/svn/asterisk/team/crichter/0.3.0
........
r29200 | root | 2006-05-21 18:00:24 +0200 (Sun, 21 May 2006) | 1 line
automerge commit
........
r29400 | root | 2006-05-22 17:00:25 +0200 (Mon, 22 May 2006) | 1 line
automerge commit
........
r29470 | root | 2006-05-22 19:00:24 +0200 (Mon, 22 May 2006) | 1 line
automerge commit
........
r29519 | root | 2006-05-22 23:00:24 +0200 (Mon, 22 May 2006) | 1 line
automerge commit
........
r29559 | root | 2006-05-23 00:00:23 +0200 (Tue, 23 May 2006) | 1 line
automerge commit
........
r29666 | crichter | 2006-05-23 14:29:40 +0200 (Tue, 23 May 2006) | 11 lines
* export_ies uses now _VAR else the vars are not copied to the dest chan
* when receiving a connect from the NT Side we wait until we have the final
l3id until we queue the answer to asterisk to avoid bridging conflicts
* when not bridged to misdn we had a segfault after receiving the connect
due to a strcasecmp bug.. this didn't happen before, cause we hadn't had
the bridge before
* cleanup of the bchannels is queued now, due to possible race conditions
* added mISDN_clear_stack when cleaning the bchannel
........
r29698 | root | 2006-05-23 18:00:24 +0200 (Tue, 23 May 2006) | 1 line
automerge commit
........
r29738 | root | 2006-05-23 20:00:37 +0200 (Tue, 23 May 2006) | 1 line
automerge commit
........
r29773 | root | 2006-05-23 21:00:36 +0200 (Tue, 23 May 2006) | 1 line
automerge commit
........
r29853 | root | 2006-05-24 00:00:36 +0200 (Wed, 24 May 2006) | 1 line
automerge commit
........
Modified:
team/crichter/0.4.0/ (props changed)
team/crichter/0.4.0/apps/app_meetme.c
team/crichter/0.4.0/apps/app_sql_postgres.c
team/crichter/0.4.0/apps/app_waitforsilence.c
team/crichter/0.4.0/channels/chan_iax2.c
team/crichter/0.4.0/channels/chan_local.c
team/crichter/0.4.0/channels/chan_misdn.c
team/crichter/0.4.0/channels/chan_sip.c
team/crichter/0.4.0/channels/misdn/isdn_lib.c
team/crichter/0.4.0/dnsmgr.c
team/crichter/0.4.0/include/asterisk/linkedlists.h
team/crichter/0.4.0/include/asterisk/lock.h
team/crichter/0.4.0/pbx.c
team/crichter/0.4.0/res/res_features.c
Propchange: team/crichter/0.4.0/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May 23 17:46:59 2006
@@ -1,1 +1,1 @@
-/team/crichter/0.3.0:1-29160
+/team/crichter/0.3.0:1-29877
Modified: team/crichter/0.4.0/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_meetme.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_meetme.c (original)
+++ team/crichter/0.4.0/apps/app_meetme.c Tue May 23 17:46:59 2006
@@ -627,7 +627,7 @@
user->chan->name,
user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
- user->adminflags & ADMINFLAG_MUTED ? "(Admn Muted)" : "",
+ user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : "",
istalking(user->talking));
ast_cli(fd,"%d users in that conference.\n",cnf->users);
Modified: team/crichter/0.4.0/apps/app_sql_postgres.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_sql_postgres.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_sql_postgres.c (original)
+++ team/crichter/0.4.0/apps/app_sql_postgres.c Tue May 23 17:46:59 2006
@@ -132,7 +132,7 @@
AST_LIST_ENTRY(ast_PGSQL_id) entries;
} *ast_PGSQL_id;
-AST_LIST_HEAD(PGSQLidshead,ast_PGSQL_id) PGSQLidshead;
+static AST_LIST_HEAD_STATIC(PGSQLidshead,ast_PGSQL_id);
static void *find_identifier(int identifier,int identifier_type) {
struct PGSQLidshead *headp;
@@ -551,11 +551,6 @@
int load_module(void)
{
- struct PGSQLidshead *headp;
-
- headp=&PGSQLidshead;
-
- AST_LIST_HEAD_INIT(headp);
return ast_register_application(app, PGSQL_exec, synopsis, descrip);
}
Modified: team/crichter/0.4.0/apps/app_waitforsilence.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_waitforsilence.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_waitforsilence.c (original)
+++ team/crichter/0.4.0/apps/app_waitforsilence.c Tue May 23 17:46:59 2006
@@ -69,7 +69,7 @@
int totalsilence = 0;
int dspsilence = 0;
int gotsilence = 0;
- static int silencethreshold = 64;
+ static int silencethreshold = 128;
int rfmt = 0;
int res = 0;
struct ast_dsp *sildet; /* silence detector dsp */
Modified: team/crichter/0.4.0/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_iax2.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_iax2.c (original)
+++ team/crichter/0.4.0/channels/chan_iax2.c Tue May 23 17:46:59 2006
@@ -8089,6 +8089,7 @@
int res;
sin.sin_port = 0;
+ sin.sin_family = AF_INET;
res = check_srcaddr((struct sockaddr *) &sin, sizeof(sin));
if (res == 0) {
/* ip address valid. */
Modified: team/crichter/0.4.0/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_local.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_local.c (original)
+++ team/crichter/0.4.0/channels/chan_local.c Tue May 23 17:46:59 2006
@@ -343,6 +343,8 @@
p->chan->cid.cid_ani = strdup(p->owner->cid.cid_ani);
else
p->chan->cid.cid_ani = NULL;
+
+ p->chan->cid.cid_pres = p->owner->cid.cid_pres;
strncpy(p->chan->language, p->owner->language, sizeof(p->chan->language) - 1);
strncpy(p->chan->accountcode, p->owner->accountcode, sizeof(p->chan->accountcode) - 1);
Modified: team/crichter/0.4.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_misdn.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_misdn.c (original)
+++ team/crichter/0.4.0/channels/chan_misdn.c Tue May 23 17:46:59 2006
@@ -2979,41 +2979,41 @@
void import_ies(struct ast_channel *chan, struct misdn_bchannel *bc)
{
char *tmp;
-
+
tmp=pbx_builtin_getvar_helper(chan,"PRI_MODE");
if (tmp) bc->mode=atoi(tmp);
-
tmp=pbx_builtin_getvar_helper(chan,"PRI_URATE");
if (tmp) bc->urate=atoi(tmp);
-
+
tmp=pbx_builtin_getvar_helper(chan,"PRI_RATE");
if (tmp) bc->rate=atoi(tmp);
-
+
tmp=pbx_builtin_getvar_helper(chan,"PRI_USER1");
if (tmp) bc->user1=atoi(tmp);
-
- tmp=pbx_builtin_getvar_helper(chan,"RDNIS");
- if (tmp) ast_copy_string(bc->rad,tmp,sizeof(bc->rad));
-
-}
-
+
+ tmp=pbx_builtin_getvar_helper(chan,"PRI_PROGRESS_INDICATOR");
+ if (tmp) bc->progress_indicator=atoi(tmp);
+
+}
+
void export_ies(struct ast_channel *chan, struct misdn_bchannel *bc)
{
char tmp[32];
sprintf(tmp,"%d",bc->mode);
- pbx_builtin_setvar_helper(chan,"PRI_MODE",tmp);
-
+ pbx_builtin_setvar_helper(chan,"_PRI_MODE",tmp);
+
sprintf(tmp,"%d",bc->urate);
- pbx_builtin_setvar_helper(chan,"PRI_URATE",tmp);
-
+ pbx_builtin_setvar_helper(chan,"_PRI_URATE",tmp);
+
sprintf(tmp,"%d",bc->rate);
- pbx_builtin_setvar_helper(chan,"PRI_RATE",tmp);
+ pbx_builtin_setvar_helper(chan,"_PRI_RATE",tmp);
sprintf(tmp,"%d",bc->user1);
- pbx_builtin_setvar_helper(chan,"PRI_USER1",tmp);
-
- pbx_builtin_setvar_helper(chan,"RDNIS",bc->rad);
+ pbx_builtin_setvar_helper(chan,"_PRI_USER1",tmp);
+
+ sprintf(tmp,"%d",bc->progress_indicator);
+ pbx_builtin_setvar_helper(chan,"_PRI_PROGRESS_INDICATOR",tmp);
}
@@ -3101,6 +3101,17 @@
case EVENT_NEW_L3ID:
ch->l3id=bc->l3_id;
+ ch->addr=bc->addr;
+
+ if (bc->nt) {
+ /* OK we've got the very new l3id so we can answer
+ now */
+ start_bc_tones(ch);
+
+ ch->state = MISDN_CONNECTED;
+ ast_queue_control(ch->ast, AST_CONTROL_ANSWER);
+
+ }
break;
case EVENT_NEW_BC:
@@ -3488,15 +3499,21 @@
misdn_lib_echo(bc,0);
tone_indicate(ch, TONE_NONE);
- if (bridged && strcasecmp(bridged->tech->type,"mISDN")) {
+ if (bridged && !strcasecmp(bridged->tech->type,"mISDN")) {
struct chan_list *bridged_ch=MISDN_ASTERISK_TECH_PVT(bridged);
chan_misdn_log(1,bc->port," --> copying cpndialplan:%d and cad:%s to the A-Channel\n",bc->cpnnumplan,bc->cad);
-
- bridged_ch->bc->cpnnumplan=bc->cpnnumplan;
- ast_copy_string(bridged_ch->bc->cad,bc->cad,sizeof(bc->cad));
- }
- }
+ if (bridged_ch) {
+ bridged_ch->bc->cpnnumplan=bc->cpnnumplan;
+ ast_copy_string(bridged_ch->bc->cad,bc->cad,sizeof(bc->cad));
+ }
+ }
+ }
+
+ /*we answer when we've got our very new L3 ID from the NT stack */
+ if (bc->nt) break;
+
+ /* notice that we don't break here!*/
case EVENT_CONNECT_ACKNOWLEDGE:
{
@@ -3519,7 +3536,7 @@
send_cause2ast(ch->ast,bc);
- chan_misdn_log(0,bc->port," org:%d nt:%d, inbandavail:%d state:%d\n", ch->orginator, bc->nt, misdn_inband_avail(bc), ch->state);
+ chan_misdn_log(3,bc->port," --> org:%d nt:%d, inbandavail:%d state:%d\n", ch->orginator, bc->nt, misdn_inband_avail(bc), ch->state);
if ( ch->orginator==ORG_AST && !bc->nt && misdn_inband_avail(bc) && ch->state != MISDN_CONNECTED) {
/* If there's inband information available (e.g. a
recorded message saying what was wrong with the
@@ -3871,10 +3888,20 @@
ast_cli_register(&cli_reload);
- ast_register_application("misdn_set_opt", misdn_set_opt_exec, "misdn_set_flags",
+ ast_register_application("misdn_set_opt", misdn_set_opt_exec, "misdn_set_opt",
"misdn_set_opt(:<opt><optarg>:<opt><optarg>..):\n"
"Sets mISDN opts. and optargs\n"
"\n"
+ "The available options are:\n"
+ " d - Send display text on called phone, text is the optparam\n"
+ " n - don't detect dtmf tones on called channel\n"
+ " h - make digital outgoing call\n"
+ " c - make crypted outgoing call, param is keyindex\n"
+ " e - perform echo cancelation on this channel,\n"
+ " takes taps as arguments (32,64,128,256)\n"
+ " s - send Non Inband DTMF as inband\n"
+ " vr - rxgain control\n"
+ " vt - txgain control\n"
);
@@ -3885,7 +3912,6 @@
"Supported Facilities are:\n"
"\n"
"type=calldeflect args=Nr where to deflect\n"
- "\n"
);
Modified: team/crichter/0.4.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_sip.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_sip.c (original)
+++ team/crichter/0.4.0/channels/chan_sip.c Tue May 23 17:46:59 2006
@@ -11199,6 +11199,7 @@
int nounlock;
int recount = 0;
char iabuf[INET_ADDRSTRLEN];
+ unsigned int lockretry = 100;
len = sizeof(sin);
memset(&req, 0, sizeof(req));
@@ -11251,9 +11252,16 @@
ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n");
ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&netlock);
- /* Sleep infintismly short amount of time */
+ /* Sleep for a very short amount of time */
usleep(1);
- goto retrylock;
+ if (--lockretry)
+ goto retrylock;
+ }
+ if (!lockretry) {
+ ast_log(LOG_ERROR, "We could NOT get the channel lock for %s! \n", p->owner->name);
+ ast_log(LOG_ERROR, "SIP MESSAGE JUST IGNORED: %s \n", req.data);
+ ast_log(LOG_ERROR, "BAD! BAD! BAD!\n");
+ return 1;
}
memcpy(&p->recv, &sin, sizeof(p->recv));
if (recordhistory) {
Modified: team/crichter/0.4.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/misdn/isdn_lib.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.4.0/channels/misdn/isdn_lib.c Tue May 23 17:46:59 2006
@@ -17,6 +17,8 @@
void misdn_join_conf(struct misdn_bchannel *bc, int conf_id);
void misdn_split_conf(struct misdn_bchannel *bc, int conf_id);
+
+int queue_cleanup_bc(struct misdn_bchannel *bc) ;
struct misdn_stack* get_misdn_stack( void );
@@ -583,10 +585,14 @@
manager_ec_disable(bc);
}
+ mISDN_write_frame(stack->midev, buff, bc->layer_id|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
+
cb_log(2, stack->port, "$$$ CLEARING STACK\n");
- /*mISDN_clear_stack(stack->midev,bc->b_stid);*/
-
- mISDN_write_frame(stack->midev, buff, bc->addr|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
+ ret=mISDN_clear_stack(stack->midev,bc->b_stid);
+ if (ret<0) {
+ cb_log(-1,stack->port,"clear stack failed [%s]\n",strerror(errno));
+ }
+
bc->b_stid = 0;
bc_state_change(bc, BCHAN_CLEANED);
@@ -604,7 +610,7 @@
cb_event(EVENT_CLEANUP, &stack->bc[i], glob_mgr->user_data);
empty_chan_in_stack(stack,i+1);
empty_bc(&stack->bc[i]);
- clean_up_bc(&stack->bc[i]);
+ queue_cleanup_bc(&stack->bc[i]);
}
@@ -770,7 +776,7 @@
if (!free_chan) return -1;
bc->channel=free_chan;
- cb_log(0,stack->port, " --> found channel: %d\n",free_chan);
+ cb_log(4,stack->port, " --> found channel: %d\n",free_chan);
for (i=0; i <= MAXPROCS; i++)
if (stack->procids[i]==0) break;
@@ -978,9 +984,6 @@
bc_state_change(bc,BCHAN_SETUP);
-
- /*manager_bchannel_deactivate(bc);*/
-
return 0;
}
@@ -1476,7 +1479,7 @@
cb_log(4, stack->port, " --> lib: CLEANING UP l3id: %x\n",frm->dinfo);
empty_chan_in_stack(stack,bc->channel);
empty_bc(bc);
- clean_up_bc(bc);
+ queue_cleanup_bc(bc);
dump_chan_list(stack);
bc->pid = 0;
cb_event(EVENT_CLEANUP, bc, glob_mgr->user_data);
@@ -1514,7 +1517,7 @@
empty_chan_in_stack(stack,bc->channel);
empty_bc(bc);
}
- clean_up_bc(bc);
+ queue_cleanup_bc(bc);
}
@@ -2062,6 +2065,9 @@
/* we kill the channel later, when we received some
data. */
bc->addr= frm->addr;
+ } else if ( bc->addr < 0) {
+ cb_log(-1, stack->port,"$$$ bc->addr <0 Error:%s\n",strerror(errno));
+ bc->addr=0;
}
cb_log(4, stack->port," --> Got Adr %x\n", bc->addr);
@@ -2938,7 +2944,7 @@
empty_chan_in_stack(stack,bc->channel);
empty_bc(bc);
- clean_up_bc(bc);
+ queue_cleanup_bc(bc);
}
/** we set it up later at RETRIEVE_ACK again.**/
@@ -3010,6 +3016,9 @@
}
switch (frm->prim) {
+ case MGR_SETSTACK|INDICATION:
+ return handle_bchan(msg);
+ break;
case DL_DATA|INDICATION:
{
int port=(frm->addr&MASTER_ID_MASK) >> 8;
@@ -3137,6 +3146,32 @@
return 0;
+}
+
+
+int queue_cleanup_bc(struct misdn_bchannel *bc)
+{
+ msg_t *msg=alloc_msg(MAX_MSG_SIZE);
+ iframe_t *frm;
+ if (!msg) {
+ cb_log(-1, bc->port, "misgn_lib_get_port: alloc_msg failed!\n");
+ return -1;
+ }
+ frm=(iframe_t*)msg->data;
+
+ /* activate bchannel */
+ frm->prim = MGR_CLEARSTACK| REQUEST;
+
+ frm->addr = bc->l3_id;
+
+ frm->dinfo = bc->port;
+ frm->len = 0;
+
+ msg_queue_tail(&glob_mgr->activatequeue, msg);
+ sem_post(&glob_mgr->new_msg);
+
+ return 0;
+
}
int misdn_lib_port_restart(int port)
@@ -3238,6 +3273,27 @@
iframe_t *frm = (iframe_t*) msg->data ;
switch ( frm->prim) {
+
+ case MGR_CLEARSTACK | REQUEST:
+ /*a queued bchannel cleanup*/
+ {
+ struct misdn_stack *stack=find_stack_by_port(frm->dinfo);
+ if (!stack) {
+ cb_log(-1,0,"no stack found with port [%d]!! so we cannot cleanup the bc\n",frm->dinfo);
+ free_msg(msg);
+ break;
+ }
+
+ struct misdn_bchannel *bc=find_bc_by_l3id(stack,frm->addr);
+ if (bc) {
+ cb_log(1,bc->port,"CLEARSTACK queued, cleaning up\n");
+ clean_up_bc(bc);
+ } else {
+ cb_log(-1,stack->port,"bc could not be cleaned correctly !! addr [%x]\n",frm->addr);
+ }
+ }
+ free_msg(msg);
+ break;
case MGR_SETSTACK | REQUEST :
break;
default:
@@ -3549,8 +3605,11 @@
dact.addr = bc->addr | FLG_MSG_DOWN;
dact.dinfo = 0;
dact.len = 0;
-
- mISDN_write(stack->midev, &dact, mISDN_HEADER_LEN+dact.len, TIMEOUT_1SEC);
+ char buf[128];
+ mISDN_write_frame(stack->midev, buf, bc->addr| FLG_MSG_DOWN, DL_RELEASE|REQUEST,0,0,NULL, TIMEOUT_1SEC);
+
+ mISDN_read(stack->midev, buf, 128, TIMEOUT_1SEC);
+
clear_ibuffer(bc->astbuf);
bc_state_change(bc,BCHAN_RELEASE);
Modified: team/crichter/0.4.0/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/dnsmgr.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/dnsmgr.c (original)
+++ team/crichter/0.4.0/dnsmgr.c Tue May 23 17:46:59 2006
@@ -57,7 +57,7 @@
char name[1];
};
-static AST_LIST_HEAD(entry_list, ast_dnsmgr_entry) entry_list;
+static AST_LIST_HEAD_STATIC(entry_list, ast_dnsmgr_entry);
AST_MUTEX_DEFINE_STATIC(refresh_lock);
@@ -289,7 +289,6 @@
ast_log(LOG_ERROR, "Unable to create schedule context.\n");
return -1;
}
- AST_LIST_HEAD_INIT(&entry_list);
ast_cli_register(&cli_reload);
ast_cli_register(&cli_status);
return do_reload(1);
Modified: team/crichter/0.4.0/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/include/asterisk/linkedlists.h?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/include/asterisk/linkedlists.h (original)
+++ team/crichter/0.4.0/include/asterisk/linkedlists.h Tue May 23 17:46:59 2006
@@ -101,6 +101,23 @@
}
/*!
+ \brief Defines initial values for a declaration of AST_LIST_HEAD
+*/
+#define AST_LIST_HEAD_INIT_VALUE { \
+ .first = NULL, \
+ .last = NULL, \
+ .lock = AST_MUTEX_INIT_VALUE, \
+ }
+
+/*!
+ \brief Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK
+*/
+#define AST_LIST_HEAD_NOLOCK_INIT_VALUE { \
+ .first = NULL, \
+ .last = NULL, \
+ }
+
+/*!
\brief Defines a structure to be used to hold a list of specified type, statically initialized.
\param name This will be the name of the defined structure.
\param type This is the type of each list entry.
@@ -122,11 +139,18 @@
struct type *first; \
struct type *last; \
ast_mutex_t lock; \
-} name = { \
- .first = NULL, \
- .last = NULL, \
- .lock = AST_MUTEX_INIT_VALUE, \
-};
+} name = AST_LIST_HEAD_INIT_VALUE
+
+/*!
+ \brief Defines a structure to be used to hold a list of specified type, statically initialized.
+
+ This is the same as AST_LIST_HEAD_STATIC, except without the lock included.
+*/
+#define AST_LIST_HEAD_NOLOCK_STATIC(name, type) \
+struct name { \
+ struct type *first; \
+ struct type *last; \
+} name = AST_LIST_HEAD_NOLOCK_INIT_VALUE
/*!
\brief Initializes a list head structure with a specified first entry.
@@ -182,6 +206,12 @@
\param head This is a pointer to the list head structure
*/
#define AST_LIST_FIRST(head) ((head)->first)
+
+/*!
+ \brief Returns the last entry contained in a list.
+ \param head This is a pointer to the list tail structure
+ */
+#define AST_LIST_LAST(head) ((head)->last)
/*!
\brief Returns the next entry in the list after the given entry.
@@ -433,11 +463,13 @@
(head)->last = NULL; \
} else { \
typeof(elm) curelm = (head)->first; \
- while (curelm->field.next != (elm)) \
+ while (curelm && (curelm->field.next != (elm))) \
curelm = curelm->field.next; \
- curelm->field.next = (elm)->field.next; \
- if ((head)->last == (elm)) \
- (head)->last = curelm; \
+ if (curelm) { \
+ curelm->field.next = (elm)->field.next; \
+ if ((head)->last == (elm)) \
+ (head)->last = curelm; \
+ } \
} \
(elm)->field.next = NULL; \
} while (0)
Modified: team/crichter/0.4.0/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/include/asterisk/lock.h?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/include/asterisk/lock.h (original)
+++ team/crichter/0.4.0/include/asterisk/lock.h Tue May 23 17:46:59 2006
@@ -97,6 +97,13 @@
typedef pthread_cond_t ast_cond_t;
+static pthread_mutex_t empty_mutex;
+
+static void __attribute__((constructor)) init_empty_mutex(void)
+{
+ memset(&empty_mutex, 0, sizeof(empty_mutex));
+}
+
static inline int __ast_pthread_mutex_init_attr(const char *filename, int lineno, const char *func,
const char *mutex_name, ast_mutex_t *t,
pthread_mutexattr_t *attr)
@@ -105,14 +112,16 @@
int canlog = strcmp(filename, "logger.c");
if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
- __ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is already initialized.\n",
- filename, lineno, func, mutex_name);
- __ast_mutex_logger("%s line %d (%s): Error: previously initialization of mutex '%s'.\n",
- t->file, t->lineno, t->func, mutex_name);
-#ifdef THREAD_CRASH
- DO_THREAD_CRASH;
-#endif
- return 0;
+ if ((t->mutex) != (empty_mutex)) {
+ __ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is already initialized.\n",
+ filename, lineno, func, mutex_name);
+ __ast_mutex_logger("%s line %d (%s): Error: previously initialization of mutex '%s'.\n",
+ t->file, t->lineno, t->func, mutex_name);
+#ifdef THREAD_CRASH
+ DO_THREAD_CRASH;
+#endif
+ return 0;
+ }
}
#endif
Modified: team/crichter/0.4.0/pbx.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/pbx.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/pbx.c (original)
+++ team/crichter/0.4.0/pbx.c Tue May 23 17:46:59 2006
@@ -3706,6 +3706,7 @@
int length;
struct ast_state_cb *thiscb, *prevcb;
+ memset(&store, 0, sizeof(store));
AST_LIST_HEAD_INIT(&store);
/* it is very important that this function hold the hintlock _and_ the conlock
@@ -4064,7 +4065,7 @@
}
if (c) {
e = 0;
- while((e < 12) && strcasecmp(mon, months[e])) e++;
+ while((e < 12) && strcasecmp(c, months[e])) e++;
if (e >= 12) {
ast_log(LOG_WARNING, "Invalid month '%s', assuming none\n", c);
return 0;
Modified: team/crichter/0.4.0/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/res/res_features.c?rev=29878&r1=29877&r2=29878&view=diff
==============================================================================
--- team/crichter/0.4.0/res/res_features.c (original)
+++ team/crichter/0.4.0/res/res_features.c Tue May 23 17:46:59 2006
@@ -641,7 +641,7 @@
ast_verbose(VERBOSE_PREFIX_3 "Unable to find extension '%s' in context '%s'\n", newext, transferer_real_context);
}
if (!ast_strlen_zero(xferfailsound))
- res = ast_streamfile(transferer, xferfailsound, transferee->language);
+ res = ast_streamfile(transferer, xferfailsound, transferer->language);
else
res = 0;
if (res) {
@@ -866,7 +866,7 @@
};
-static AST_LIST_HEAD(feature_list,ast_call_feature) feature_list;
+static AST_LIST_HEAD_STATIC(feature_list,ast_call_feature);
/* register new feature into feature_list*/
void ast_register_feature(struct ast_call_feature *feature)
@@ -944,8 +944,12 @@
if (ast_test_flag(feature, AST_FEATURE_FLAG_CALLEE))
work = peer;
res = pbx_exec(work, app, feature->app_args, 1);
- if (res < 0)
- return res;
+ if (res == AST_PBX_KEEPALIVE)
+ return FEATURE_RETURN_PBX_KEEPALIVE;
+ else if (res == AST_PBX_NO_HANGUP_PEER)
+ return FEATURE_RETURN_NO_HANGUP_PEER;
+ else if (res)
+ return FEATURE_RETURN_SUCCESSBREAK;
} else {
ast_log(LOG_WARNING, "Could not find application (%s)\n", feature->app);
return -2;
@@ -1021,7 +1025,10 @@
if (!strcmp(feature->exten, code)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 " Feature Found: %s exten: %s\n",feature->sname, tok);
- res = feature->operation(chan, peer, config, code, sense);
+ if (sense == FEATURE_SENSE_CHAN)
+ res = feature->operation(chan, peer, config, code, sense);
+ else
+ res = feature->operation(peer, chan, config, code, sense);
break;
} else if (!strncmp(feature->exten, code, strlen(code))) {
res = FEATURE_RETURN_STOREDIGITS;
@@ -1426,6 +1433,9 @@
featurecode = peer_featurecode;
}
featurecode[strlen(featurecode)] = f->subclass;
+ /* Get rid of the frame before we start doing "stuff" with the channels */
+ ast_frfree(f);
+ f = NULL;
config->feature_timer = backup_config.feature_timer;
res = ast_feature_interpret(chan, peer, config, featurecode, sense);
switch(res) {
@@ -1438,10 +1448,8 @@
}
if (res >= FEATURE_RETURN_PASSDIGITS) {
res = 0;
- } else {
- ast_frfree(f);
+ } else
break;
- }
hasfeatures = !ast_strlen_zero(chan_featurecode) || !ast_strlen_zero(peer_featurecode);
if (hadfeatures && !hasfeatures) {
/* Restore backup */
@@ -2137,7 +2145,6 @@
{
int res;
- AST_LIST_HEAD_INIT(&feature_list);
memset(parking_ext, 0, sizeof(parking_ext));
memset(parking_con, 0, sizeof(parking_con));
More information about the svn-commits
mailing list