[svn-commits] kpfleming: branch 1.2-netsec r53671 - in
/branches/1.2-netsec: ./ apps/ chann...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Thu Feb 8 15:48:48 MST 2007
Author: kpfleming
Date: Thu Feb 8 16:48:47 2007
New Revision: 53671
URL: http://svn.digium.com/view/asterisk?view=rev&rev=53671
Log:
merge up to branch 1.2 and re-enable automerge
Modified:
branches/1.2-netsec/ (props changed)
branches/1.2-netsec/apps/app_chanspy.c
branches/1.2-netsec/apps/app_dial.c
branches/1.2-netsec/apps/app_macro.c
branches/1.2-netsec/apps/app_meetme.c
branches/1.2-netsec/apps/app_page.c
branches/1.2-netsec/apps/app_queue.c
branches/1.2-netsec/apps/app_rpt.c
branches/1.2-netsec/apps/app_voicemail.c
branches/1.2-netsec/cdr.c
branches/1.2-netsec/channels/chan_h323.c
branches/1.2-netsec/channels/chan_iax2.c
branches/1.2-netsec/channels/chan_mgcp.c
branches/1.2-netsec/channels/chan_sip.c
branches/1.2-netsec/channels/chan_skinny.c
branches/1.2-netsec/channels/chan_zap.c
branches/1.2-netsec/codecs/Makefile
branches/1.2-netsec/codecs/codec_zap.c
branches/1.2-netsec/config.c
branches/1.2-netsec/configs/dnsmgr.conf.sample
branches/1.2-netsec/funcs/func_strings.c
branches/1.2-netsec/manager.c
branches/1.2-netsec/pbx.c
branches/1.2-netsec/pbx/pbx_dundi.c
branches/1.2-netsec/pbx/pbx_spool.c
branches/1.2-netsec/res/res_musiconhold.c
branches/1.2-netsec/rtp.c
Propchange: branches/1.2-netsec/
------------------------------------------------------------------------------
automerge = *
Propchange: branches/1.2-netsec/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 8 16:48:47 2007
@@ -1,1 +1,1 @@
-/branches/1.2:1-52994
+/branches/1.2:1-53670
Modified: branches/1.2-netsec/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/apps/app_chanspy.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/apps/app_chanspy.c (original)
+++ branches/1.2-netsec/apps/app_chanspy.c Thu Feb 8 16:48:47 2007
@@ -53,7 +53,7 @@
#define ALL_DONE(u, ret) LOCAL_USER_REMOVE(u); return ret;
#define get_volfactor(x) x ? ((x > 0) ? (1 << x) : ((1 << abs(x)) * -1)) : 0
-static const char *synopsis = "Listen to the audio of an active channel\n";
+static const char *synopsis = "Listen to the audio of an active channel";
static const char *app = "ChanSpy";
static const char *desc =
" ChanSpy([chanprefix][|options]): This application is used to listen to the\n"
Modified: branches/1.2-netsec/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/apps/app_dial.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/apps/app_dial.c (original)
+++ branches/1.2-netsec/apps/app_dial.c Thu Feb 8 16:48:47 2007
@@ -80,7 +80,7 @@
" ANSWEREDTIME - This is the amount of time for actual call.\n"
" DIALSTATUS - This is the status of the call:\n"
" CHANUNAVAIL | CONGESTION | NOANSWER | BUSY | ANSWER | CANCEL\n"
-" DONTCALL | TORTURE\n"
+" DONTCALL | TORTURE | INVALIDARGS\n"
" For the Privacy and Screening Modes, the DIALSTATUS variable will be set to\n"
"DONTCALL if the called party chooses to send the calling party to the 'Go Away'\n"
"script. The DIALSTATUS variable will be set to TORTURE if the called party\n"
@@ -759,7 +759,7 @@
char *start_sound=NULL;
char *dtmfcalled=NULL, *dtmfcalling=NULL;
char *var;
- char status[256];
+ char status[256] = "INVALIDARGS";
int play_to_caller=0,play_to_callee=0;
int sentringing=0, moh=0;
char *outbound_group = NULL;
@@ -780,21 +780,19 @@
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
return -1;
}
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory allocation failure\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
if (!ast_strlen_zero(args.options)) {
if (ast_app_parse_options(dial_exec_options, &opts, opt_args, args.options)) {
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -802,6 +800,7 @@
if (ast_strlen_zero(args.peers)) {
ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: branches/1.2-netsec/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/apps/app_macro.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/apps/app_macro.c (original)
+++ branches/1.2-netsec/apps/app_macro.c Thu Feb 8 16:48:47 2007
@@ -107,10 +107,10 @@
int oldpriority;
char pc[80], depthc[12];
char oldcontext[AST_MAX_CONTEXT] = "";
- char *offsets, *s;
+ char *offsets, *s, *inhangupc;
int offset, depth = 0, maxdepth = 7;
int setmacrocontext=0;
- int autoloopflag, dead = 0;
+ int autoloopflag, dead = 0, inhangup = 0;
char *save_macro_exten;
char *save_macro_context;
@@ -137,6 +137,13 @@
} else {
depth = 0;
}
+
+ /* Used for detecting whether to return when a Macro is called from another Macro after hangup */
+ if (strcmp(chan->exten, "h") == 0)
+ pbx_builtin_setvar_helper(chan, "MACRO_IN_HANGUP", "1");
+ inhangupc = pbx_builtin_getvar_helper(chan, "MACRO_IN_HANGUP");
+ if (!ast_strlen_zero(inhangupc))
+ sscanf(inhangupc, "%d", &inhangup);
if (depth >= maxdepth) {
ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n");
@@ -252,7 +259,7 @@
break;
}
/* don't stop executing extensions when we're in "h" */
- if (chan->_softhangup && strcasecmp(oldexten,"h") && strcasecmp(chan->macroexten,"h")) {
+ if (chan->_softhangup && !inhangup) {
ast_log(LOG_DEBUG, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n",
chan->exten, chan->macroexten, chan->priority);
goto out;
Modified: branches/1.2-netsec/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/apps/app_meetme.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/apps/app_meetme.c (original)
+++ branches/1.2-netsec/apps/app_meetme.c Thu Feb 8 16:48:47 2007
@@ -862,6 +862,7 @@
ast_verbose(VERBOSE_PREFIX_4 "Starting recording of MeetMe Conference %s into file %s.%s.\n",
conf->confno, conf->recordingfilename, conf->recordingformat);
ast_pthread_create(&conf->recordthread, &conf->attr, recordthread, conf);
+ pthread_attr_destroy(&conf->attr);
}
time(&user->jointime);
Modified: branches/1.2-netsec/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/apps/app_page.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/apps/app_page.c (original)
+++ branches/1.2-netsec/apps/app_page.c Thu Feb 8 16:48:47 2007
@@ -135,6 +135,7 @@
ast_log(LOG_WARNING, "Unable to create paging thread: %s\n", strerror(errno));
free(cd);
}
+ pthread_attr_destroy(&attr);
}
}
Modified: branches/1.2-netsec/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/apps/app_queue.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/apps/app_queue.c (original)
+++ branches/1.2-netsec/apps/app_queue.c Thu Feb 8 16:48:47 2007
@@ -562,6 +562,7 @@
ast_log(LOG_WARNING, "Failed to create update thread!\n");
free(sc);
}
+ pthread_attr_destroy(&attr);
return 0;
}
Modified: branches/1.2-netsec/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/apps/app_rpt.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/apps/app_rpt.c (original)
+++ branches/1.2-netsec/apps/app_rpt.c Thu Feb 8 16:48:47 2007
@@ -1521,6 +1521,7 @@
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
+ pthread_attr_destroy(&attr);
return;
}
@@ -2153,6 +2154,7 @@
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *) myrpt);
+ pthread_attr_destroy(&attr);
return DC_COMPLETE;
}
@@ -5239,6 +5241,7 @@
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *)myrpt);
+ pthread_attr_destroy(&attr);
continue;
}
}
@@ -5781,6 +5784,7 @@
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
+ pthread_attr_destroy(&attr);
}
usleep(500000);
for(;;)
@@ -5816,6 +5820,7 @@
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
+ pthread_attr_destroy(&attr);
ast_log(LOG_WARNING, "rpt_thread restarted on node %s\n", rpt_vars[i].name);
}
Modified: branches/1.2-netsec/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/apps/app_voicemail.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/apps/app_voicemail.c (original)
+++ branches/1.2-netsec/apps/app_voicemail.c Thu Feb 8 16:48:47 2007
@@ -1746,7 +1746,7 @@
memset(passdata, 0, vmlen);
prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
pbx_substitute_variables_helper(ast,fromstring,passdata,vmlen);
- len_passdata = strlen(passdata) * 2 + 1;
+ len_passdata = strlen(passdata) * 2 + 3;
passdata2 = alloca(len_passdata);
fprintf(p, "From: %s <%s>\n", quote(passdata, passdata2, len_passdata), who);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
@@ -1754,7 +1754,7 @@
} else ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
} else
fprintf(p, "From: Asterisk PBX <%s>\n", who);
- len_passdata = strlen(vmu->fullname) * 2 + 1;
+ len_passdata = strlen(vmu->fullname) * 2 + 3;
passdata2 = alloca(len_passdata);
fprintf(p, "To: %s <%s>\n", quote(vmu->fullname, passdata2, len_passdata), vmu->email);
Modified: branches/1.2-netsec/cdr.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/cdr.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/cdr.c (original)
+++ branches/1.2-netsec/cdr.c Thu Feb 8 16:48:47 2007
@@ -956,6 +956,7 @@
if (option_debug)
ast_log(LOG_DEBUG, "CDR multi-threaded batch processing begins now\n");
}
+ pthread_attr_destroy(&attr);
}
}
Modified: branches/1.2-netsec/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/channels/chan_h323.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/channels/chan_h323.c (original)
+++ branches/1.2-netsec/channels/chan_h323.c Thu Feb 8 16:48:47 2007
@@ -1642,9 +1642,11 @@
/* Start a new monitor */
if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
+ pthread_attr_destroy(&attr);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
}
+ pthread_attr_destroy(&attr);
}
ast_mutex_unlock(&monlock);
Modified: branches/1.2-netsec/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/channels/chan_iax2.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/channels/chan_iax2.c (original)
+++ branches/1.2-netsec/channels/chan_iax2.c Thu Feb 8 16:48:47 2007
@@ -2634,8 +2634,10 @@
peer = build_peer(peername, var, ast_test_flag((&globalflags), IAX_RTCACHEFRIENDS) ? 0 : 1);
- if (!peer)
+ if (!peer) {
+ ast_variables_destroy(var);
return NULL;
+ }
tmp = var;
while(tmp) {
@@ -2661,10 +2663,11 @@
}
tmp = tmp->next;
}
+
+ ast_variables_destroy(var);
+
if (!peer)
return NULL;
-
- ast_variables_destroy(var);
if (ast_test_flag((&globalflags), IAX_RTCACHEFRIENDS)) {
ast_copy_flags(peer, &globalflags, IAX_RTAUTOCLEAR|IAX_RTCACHEFRIENDS);
@@ -2725,10 +2728,11 @@
}
user = build_user(username, var, !ast_test_flag((&globalflags), IAX_RTCACHEFRIENDS));
+
+ ast_variables_destroy(var);
+
if (!user)
return NULL;
-
- ast_variables_destroy(var);
if (ast_test_flag((&globalflags), IAX_RTCACHEFRIENDS)) {
ast_set_flag(user, IAX_RTCACHEFRIENDS);
@@ -4925,15 +4929,12 @@
key++;
}
}
- if (!family || !key || ast_db_get(family, key, iaxs[callno]->secret, sizeof(iaxs[callno]->secret))) {
+ if (!family || !key || ast_db_get(family, key, iaxs[callno]->secret, sizeof(iaxs[callno]->secret)))
ast_log(LOG_WARNING, "Unable to retrieve database password for family/key '%s'!\n", user->dbsecret);
- if (ast_test_flag(user, IAX_TEMPONLY)) {
- destroy_user(user);
- user = NULL;
- }
- }
} else
ast_copy_string(iaxs[callno]->secret, user->secret, sizeof(iaxs[callno]->secret));
+ if (ast_test_flag(user, IAX_TEMPONLY))
+ destroy_user(user);
res = 0;
}
ast_set2_flag(iaxs[callno], iax2_getpeertrunk(*sin), IAX_TRUNK);
@@ -6224,6 +6225,7 @@
if (ast_pthread_create(&newthread, &attr, dp_lookup_thread, dpr)) {
ast_log(LOG_WARNING, "Unable to start lookup thread!\n");
}
+ pthread_attr_destroy(&attr);
} else
ast_log(LOG_WARNING, "Out of memory!\n");
}
@@ -6304,8 +6306,11 @@
memset(d, 0, sizeof(*d));
d->chan1 = chan1m;
d->chan2 = chan2m;
- if (!ast_pthread_create(&th, &attr, iax_park_thread, d))
+ if (!ast_pthread_create(&th, &attr, iax_park_thread, d)) {
+ pthread_attr_destroy(&attr);
return 0;
+ }
+ pthread_attr_destroy(&attr);
free(d);
}
return -1;
Modified: branches/1.2-netsec/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/channels/chan_mgcp.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/channels/chan_mgcp.c (original)
+++ branches/1.2-netsec/channels/chan_mgcp.c Thu Feb 8 16:48:47 2007
@@ -2963,6 +2963,7 @@
/*ast_queue_control(sub->owner, AST_CONTROL_ANSWER);*/
}
}
+ pthread_attr_destroy(&attr);
}
static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, struct sockaddr_in *sin)
Modified: branches/1.2-netsec/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/channels/chan_sip.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/channels/chan_sip.c (original)
+++ branches/1.2-netsec/channels/chan_sip.c Thu Feb 8 16:48:47 2007
@@ -412,7 +412,6 @@
/*! \brief Codecs that we support by default: */
static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
-static int noncodeccapability = AST_RTP_DTMF;
static struct in_addr __ourip;
static struct sockaddr_in outboundproxyip;
@@ -571,8 +570,7 @@
#define SIP_CALL_LIMIT (1 << 29)
/* Remote Party-ID Support */
#define SIP_SENDRPID (1 << 30)
-/* Did this connection increment the counter of in-use calls? */
-#define SIP_INC_COUNT (1 << 31)
+#define SIP_INC_COUNT (1 << 31) /* Did this connection increment the counter of in-use calls? */
#define SIP_FLAGS_TO_COPY \
(SIP_PROMISCREDIR | SIP_TRUSTRPID | SIP_SENDRPID | SIP_DTMF | SIP_REINVITE | \
@@ -613,6 +611,7 @@
int peercapability; /*!< Supported peer capability */
int prefcodec; /*!< Preferred codec (outbound only) */
int noncodeccapability;
+ int jointnoncodeccapability;
int callingpres; /*!< Calling presentation */
int authtries; /*!< Times we've tried to authenticate */
int expiry; /*!< How long we take to expire */
@@ -2111,6 +2110,7 @@
if ( res != -1 ) {
p->callingpres = ast->cid.cid_pres;
p->jointcapability = p->capability;
+ p->jointnoncodeccapability = p->noncodeccapability;
transmit_invite(p, SIP_INVITE, 1, 2);
if (p->maxtime) {
/* Initialize auto-congest time */
@@ -2154,6 +2154,12 @@
if (m_cb)
m_cb->__sip_destroy_hook(p);
#endif
+
+ if (ast_test_flag(p, SIP_INC_COUNT)) {
+ update_call_counter(p, DEC_CALL_LIMIT);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Call did not properly clean up call counter. Call ID %s\n", p->callid);
+ }
if (dumphistory)
sip_dump_history(p);
@@ -2281,8 +2287,10 @@
/* incoming and outgoing affects the inUse counter */
case DEC_CALL_LIMIT:
if ( *inuse > 0 ) {
- if (ast_test_flag(fup,SIP_INC_COUNT))
+ if (ast_test_flag(fup, SIP_INC_COUNT)) {
(*inuse)--;
+ ast_clear_flag(fup, SIP_INC_COUNT);
+ }
} else {
*inuse = 0;
}
@@ -3760,11 +3768,11 @@
&vpeercapability, &vpeernoncodeccapability);
p->jointcapability = p->capability & (peercapability | vpeercapability);
p->peercapability = (peercapability | vpeercapability);
- p->noncodeccapability = noncodeccapability & peernoncodeccapability;
+ p->jointnoncodeccapability = p->noncodeccapability & peernoncodeccapability;
if (ast_test_flag(p, SIP_DTMF) == SIP_DTMF_AUTO) {
ast_clear_flag(p, SIP_DTMF);
- if (p->noncodeccapability & AST_RTP_DTMF) {
+ if (p->jointnoncodeccapability & AST_RTP_DTMF) {
/* XXX Would it be reasonable to drop the DSP at this point? XXX */
ast_set_flag(p, SIP_DTMF_RFC2833);
} else {
@@ -3784,9 +3792,9 @@
ast_getformatname_multiple(s4, slen, p->jointcapability));
ast_verbose("Non-codec capabilities: us - %s, peer - %s, combined - %s\n",
- ast_rtp_lookup_mime_multiple(s1, slen, noncodeccapability, 0),
+ ast_rtp_lookup_mime_multiple(s1, slen, p->noncodeccapability, 0),
ast_rtp_lookup_mime_multiple(s2, slen, peernoncodeccapability, 0),
- ast_rtp_lookup_mime_multiple(s3, slen, p->noncodeccapability, 0));
+ ast_rtp_lookup_mime_multiple(s3, slen, p->jointnoncodeccapability, 0));
}
if (!p->jointcapability) {
ast_log(LOG_NOTICE, "No compatible codecs!\n");
@@ -4710,7 +4718,7 @@
}
for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
- if (!(p->noncodeccapability & x))
+ if (!(p->jointnoncodeccapability & x))
continue;
add_noncodec_to_sdp(p, x, 8000,
@@ -10499,8 +10507,11 @@
copy_request(&d->req, req);
d->chan1 = chan1m;
d->chan2 = chan2m;
- if (!ast_pthread_create(&th, &attr, sip_park_thread, d))
+ if (!ast_pthread_create(&th, &attr, sip_park_thread, d)) {
+ pthread_attr_destroy(&attr);
return 0;
+ }
+ pthread_attr_destroy(&attr);
free(d);
}
return -1;
Modified: branches/1.2-netsec/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/channels/chan_skinny.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/channels/chan_skinny.c (original)
+++ branches/1.2-netsec/channels/chan_skinny.c Thu Feb 8 16:48:47 2007
@@ -2977,6 +2977,7 @@
ast_verbose("killing accept thread\n");
}
close(as);
+ pthread_attr_destroy(&attr);
return 0;
}
Modified: branches/1.2-netsec/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/channels/chan_zap.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/channels/chan_zap.c (original)
+++ branches/1.2-netsec/channels/chan_zap.c Thu Feb 8 16:48:47 2007
@@ -3667,9 +3667,6 @@
pthread_t threadid;
pthread_attr_t attr;
struct ast_channel *chan;
-
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
index = zt_get_index(ast, p, 0);
p->subs[index].f.frametype = AST_FRAME_NULL;
@@ -4199,6 +4196,8 @@
if (res)
ast_log(LOG_WARNING, "Unable to start dial recall tone on channel %d\n", p->channel);
p->owner = chan;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (!chan) {
ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", p->channel);
} else if (ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
@@ -4212,7 +4211,8 @@
/* Start music on hold if appropriate */
if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner))
ast_moh_start(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), NULL);
- }
+ }
+ pthread_attr_destroy(&attr);
}
} else {
/* Already have a 3 way call */
@@ -6579,6 +6579,7 @@
"interface %d\n", i->channel);
}
}
+ pthread_attr_destroy(&attr);
return 0;
}
@@ -6838,10 +6839,12 @@
if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
+ pthread_attr_destroy(&attr);
return -1;
}
}
ast_mutex_unlock(&monlock);
+ pthread_attr_destroy(&attr);
return 0;
}
@@ -8193,9 +8196,6 @@
char plancallingani[256];
char calledtonstr[10];
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
gettimeofday(&lastidle, NULL);
if (!ast_strlen_zero(pri->idledial) && !ast_strlen_zero(pri->idleext)) {
/* Need to do idle dialing, check to be sure though */
@@ -8683,6 +8683,8 @@
pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
ast_mutex_lock(&pri->lock);
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n",
@@ -8698,6 +8700,7 @@
pri->pvts[chanpos]->call = NULL;
}
}
+ pthread_attr_destroy(&attr);
} else {
ast_mutex_unlock(&pri->lock);
/* Release PRI lock while we create the channel */
Modified: branches/1.2-netsec/codecs/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/codecs/Makefile?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/codecs/Makefile (original)
+++ branches/1.2-netsec/codecs/Makefile Thu Feb 8 16:48:47 2007
@@ -28,18 +28,18 @@
LIBG723B=g723.1b/libg723b.a
endif
-# XXX Uncomment this when transcoder support is merged into zaptel 1.2 !
-#ifndef WITHOUT_ZAPTEL
-#ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/pkg/include/zaptel.h),)
-# ifeq (${OSARCH},NetBSD)
-# SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/pkg/lib
-# endif
-# ifeq (${OSARCH},FreeBSD)
-# SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
-# endif
-# CODECS+=codec_zap.so
-#endif
-#endif # WITHOUT_ZAPTEL
+ifndef WITHOUT_ZAPTEL
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/pkg/include/zaptel.h),)
+ ifeq (${OSARCH},NetBSD)
+ SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/pkg/lib
+ endif
+ ifeq (${OSARCH},FreeBSD)
+ SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
+ endif
+ CODECS+=codec_zap.so
+endif
+endif # WITHOUT_ZAPTEL
+
UI_SPEEX=$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/speex.h)
UIS_SPEEX=$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/speex/speex.h)
Modified: branches/1.2-netsec/codecs/codec_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/codecs/codec_zap.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/codecs/codec_zap.c (original)
+++ branches/1.2-netsec/codecs/codec_zap.c Thu Feb 8 16:48:47 2007
@@ -241,7 +241,7 @@
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_RESET;
+ unsigned int x = ZT_TCOP_ALLOCATE;
struct ast_translator_pvt *ztp;
struct zt_transcode_header *hdr;
int flags;
@@ -298,7 +298,7 @@
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_RESET;
+ unsigned int x = ZT_TCOP_ALLOCATE;
struct ast_translator_pvt *ztp;
struct zt_transcode_header *hdr;
int flags;
@@ -355,7 +355,7 @@
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_RESET;
+ unsigned int x = ZT_TCOP_ALLOCATE;
struct ast_translator_pvt *ztp;
struct zt_transcode_header *hdr;
int flags;
@@ -412,7 +412,7 @@
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_RESET;
+ unsigned int x = ZT_TCOP_ALLOCATE;
struct ast_translator_pvt *ztp;
struct zt_transcode_header *hdr;
int flags;
@@ -469,7 +469,7 @@
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_RESET;
+ unsigned int x = ZT_TCOP_ALLOCATE;
struct ast_translator_pvt *ztp;
struct zt_transcode_header *hdr;
int flags;
@@ -526,7 +526,7 @@
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_RESET;
+ unsigned int x = ZT_TCOP_ALLOCATE;
struct ast_translator_pvt *ztp;
struct zt_transcode_header *hdr;
int flags;
@@ -583,7 +583,7 @@
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_RESET;
+ unsigned int x = ZT_TCOP_ALLOCATE;
struct ast_translator_pvt *ztp;
struct zt_transcode_header *hdr;
int flags;
@@ -640,7 +640,7 @@
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_RESET;
+ unsigned int x = ZT_TCOP_ALLOCATE;
struct ast_translator_pvt *ztp;
struct zt_transcode_header *hdr;
int flags;
@@ -856,6 +856,11 @@
ast_log(LOG_NOTICE, "No Zaptel transcoder support!\n");
return 0;
}
+
+ ast_mutex_lock(&channelcount);
+ totalchannels = 0;
+ ast_mutex_unlock(&channelcount);
+
for (info.tcnum = 0; !(res = ioctl(fd, ZT_TRANSCODE_OP, &info)); info.tcnum++) {
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Found transcoder '%s'.\n", info.name);
Modified: branches/1.2-netsec/config.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/config.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/config.c (original)
+++ branches/1.2-netsec/config.c Thu Feb 8 16:48:47 2007
@@ -651,7 +651,7 @@
if (process_buf) {
char *buf = ast_strip(process_buf);
if (!ast_strlen_zero(buf)) {
- if (process_text_line(cfg, &cat, buf, lineno, filename)) {
+ if (process_text_line(cfg, &cat, buf, lineno, fn)) {
cfg = NULL;
break;
}
Modified: branches/1.2-netsec/configs/dnsmgr.conf.sample
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/configs/dnsmgr.conf.sample?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/configs/dnsmgr.conf.sample (original)
+++ branches/1.2-netsec/configs/dnsmgr.conf.sample Thu Feb 8 16:48:47 2007
@@ -2,4 +2,4 @@
;enable=yes ; enable creation of managed DNS lookups
; default is 'no'
;refreshinterval=1200 ; refresh managed DNS lookups every <n> seconds
- ; default is 300 (5 minutes)
+ ; default is 300 (5 minutes)
Modified: branches/1.2-netsec/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/funcs/func_strings.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/funcs/func_strings.c (original)
+++ branches/1.2-netsec/funcs/func_strings.c Thu Feb 8 16:48:47 2007
@@ -41,15 +41,18 @@
static char *function_fieldqty(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
- char *varname, *varval, workspace[256];
+ char *varname, *varsubst, varval[8192] = "", *varval2 = varval;
char *delim = ast_strdupa(data);
int fieldcount = 0;
if (delim) {
varname = strsep(&delim, "|");
- pbx_retrieve_variable(chan, varname, &varval, workspace, sizeof(workspace), NULL);
+ varsubst = alloca(strlen(varname) + 4);
+
+ sprintf(varsubst, "${%s}", varname);
+ pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1);
if (delim) {
- while (strsep(&varval, delim))
+ while (strsep(&varval2, delim))
fieldcount++;
} else if (!ast_strlen_zero(varval)) {
fieldcount = 1;
Modified: branches/1.2-netsec/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/manager.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/manager.c (original)
+++ branches/1.2-netsec/manager.c Thu Feb 8 16:48:47 2007
@@ -773,7 +773,6 @@
long elapsed_seconds=0;
int all = ast_strlen_zero(name); /* set if we want all channels */
- astman_send_ack(s, m, "Channel status will follow");
if (!ast_strlen_zero(id))
snprintf(idText,256,"ActionID: %s\r\n",id);
if (all)
@@ -785,6 +784,7 @@
return 0;
}
}
+ astman_send_ack(s, m, "Channel status will follow");
/* if we look by name, we break after the first iteration */
while(c) {
if (c->_bridge)
@@ -1077,6 +1077,7 @@
} else {
res = 0;
}
+ pthread_attr_destroy(&attr);
}
} else if (!ast_strlen_zero(app)) {
res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL);
Modified: branches/1.2-netsec/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/pbx.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/pbx.c (original)
+++ branches/1.2-netsec/pbx.c Thu Feb 8 16:48:47 2007
@@ -974,8 +974,7 @@
return ret;
}
-/*! \brief pbx_retrieve_variable: Support for Asterisk built-in variables and
- functions in the dialplan
+/*! \brief pbx_retrieve_variable: Support for Asterisk built-in variables
---*/
void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
{
@@ -2541,8 +2540,10 @@
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (ast_pthread_create(&t, &attr, pbx_thread, c)) {
ast_log(LOG_WARNING, "Failed to create new channel thread\n");
+ pthread_attr_destroy(&attr);
return AST_PBX_FAILED;
}
+ pthread_attr_destroy(&attr);
return AST_PBX_SUCCESS;
}
@@ -5125,8 +5126,10 @@
}
ast_hangup(chan);
res = -1;
+ pthread_attr_destroy(&attr);
goto outgoing_exten_cleanup;
}
+ pthread_attr_destroy(&attr);
res = 0;
}
outgoing_exten_cleanup:
@@ -5228,6 +5231,7 @@
if (locked_channel)
*locked_channel = chan;
}
+ pthread_attr_destroy(&attr);
}
} else {
ast_log(LOG_ERROR, "Out of memory :(\n");
@@ -5290,11 +5294,13 @@
ast_mutex_unlock(&chan->lock);
ast_hangup(chan);
res = -1;
+ pthread_attr_destroy(&attr);
goto outgoing_app_cleanup;
} else {
if (locked_channel)
*locked_channel = chan;
}
+ pthread_attr_destroy(&attr);
res = 0;
}
outgoing_app_cleanup:
Modified: branches/1.2-netsec/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/pbx/pbx_dundi.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/pbx/pbx_dundi.c (original)
+++ branches/1.2-netsec/pbx/pbx_dundi.c Thu Feb 8 16:48:47 2007
@@ -799,8 +799,10 @@
memset(&ied, 0, sizeof(ied));
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
dundi_send(trans, DUNDI_COMMAND_EIDRESPONSE, 0, 1, &ied);
+ pthread_attr_destroy(&attr);
return -1;
}
+ pthread_attr_destroy(&attr);
} else {
ast_log(LOG_WARNING, "Out of memory!\n");
memset(&ied, 0, sizeof(ied));
@@ -1030,8 +1032,10 @@
memset(&ied, 0, sizeof(ied));
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
dundi_send(trans, DUNDI_COMMAND_PRECACHERP, 0, 1, &ied);
+ pthread_attr_destroy(&attr);
return -1;
}
+ pthread_attr_destroy(&attr);
} else {
ast_log(LOG_WARNING, "Out of memory!\n");
memset(&ied, 0, sizeof(ied));
@@ -1122,8 +1126,10 @@
memset(&ied, 0, sizeof(ied));
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
dundi_send(trans, DUNDI_COMMAND_DPRESPONSE, 0, 1, &ied);
+ pthread_attr_destroy(&attr);
return -1;
}
+ pthread_attr_destroy(&attr);
} else {
ast_log(LOG_WARNING, "Out of memory!\n");
memset(&ied, 0, sizeof(ied));
Modified: branches/1.2-netsec/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/pbx/pbx_spool.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/pbx/pbx_spool.c (original)
+++ branches/1.2-netsec/pbx/pbx_spool.c Thu Feb 8 16:48:47 2007
@@ -295,6 +295,7 @@
ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
free_outgoing(o);
}
+ pthread_attr_destroy(&attr);
}
static int scan_service(char *fn, time_t now, time_t atime)
@@ -426,6 +427,7 @@
ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
return -1;
}
+ pthread_attr_destroy(&attr);
return 0;
}
Modified: branches/1.2-netsec/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/res/res_musiconhold.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/res/res_musiconhold.c (original)
+++ branches/1.2-netsec/res/res_musiconhold.c Thu Feb 8 16:48:47 2007
@@ -203,28 +203,29 @@
struct moh_files_state *state = chan->music_state;
int tries;
+ /* Discontinue a stream if it is running already */
+ if (chan->stream) {
+ ast_closestream(chan->stream);
+ chan->stream = NULL;
+ }
+
+ /* If a specific file has been saved, use it */
if (state->save_pos) {
state->pos = state->save_pos;
state->save_pos = 0;
- }
-
- state->samples = 0;
- if (chan->stream) {
- ast_closestream(chan->stream);
- chan->stream = NULL;
+ } else if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
+ /* Get a random file and ensure we can open it */
+ for (tries = 0; tries < 20; tries++) {
+ state->pos = rand() % state->class->total_files;
+ if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0)
+ break;
+ }
+ state->samples = 0;
+ } else {
+ /* This is easy, just increment our position and make sure we don't exceed the total file count */
state->pos++;
state->pos %= state->class->total_files;
- }
-
- if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
- /* Try 20 times to find something good */
- for (tries = 0; tries < 20; tries++) {
- state->pos = rand() % state->class->total_files;
-
- /* check to see if this file's format can be opened */
- if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0)
- break;
- }
+ state->samples = 0;
}
if (!ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {
Modified: branches/1.2-netsec/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/rtp.c?view=diff&rev=53671&r1=53670&r2=53671
==============================================================================
--- branches/1.2-netsec/rtp.c (original)
+++ branches/1.2-netsec/rtp.c Thu Feb 8 16:48:47 2007
@@ -526,7 +526,7 @@
}
if(rtp_debug_test_addr(&sin))
- ast_verbose("Got RTP packet from %s:%d (type %d, seq %d, ts %d, len %d)\n"
+ ast_verbose("Got RTP packet from %s:%u (type %d, seq %u, ts %u, len %d)\n"
, ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp,res - hdrlen);
rtpPT = ast_rtp_lookup_pt(rtp, payloadtype);
More information about the svn-commits
mailing list