merge up to branch 1.2 and re-enable automerge

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@53671 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Kevin P. Fleming 19 years ago
parent 03161d7a82
commit dd0edc0f9c

@ -53,7 +53,7 @@ AST_MUTEX_DEFINE_STATIC(modlock);
#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"

@ -80,7 +80,7 @@ static char *descrip =
" 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 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
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 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
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 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
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;
}

@ -107,10 +107,10 @@ static int macro_exec(struct ast_channel *chan, void *data)
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;
@ -138,6 +138,13 @@ static int macro_exec(struct ast_channel *chan, void *data)
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");
LOCAL_USER_REMOVE(u);
@ -252,7 +259,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
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;

@ -862,6 +862,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
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);

@ -135,6 +135,7 @@ static void launch_page(struct ast_channel *chan, const char *meetmeopts, const
ast_log(LOG_WARNING, "Unable to create paging thread: %s\n", strerror(errno));
free(cd);
}
pthread_attr_destroy(&attr);
}
}

@ -562,6 +562,7 @@ static int statechange_queue(const char *dev, int state, void *ign)
ast_log(LOG_WARNING, "Failed to create update thread!\n");
free(sc);
}
pthread_attr_destroy(&attr);
return 0;
}

@ -1521,6 +1521,7 @@ pthread_attr_t attr;
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 @@ static int function_autopatchup(struct rpt *myrpt, char *param, char *digitbuf,
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 @@ char cmd[MAXDTMF+1] = "";
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_t attr;
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_t attr;
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);
}

@ -1746,7 +1746,7 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
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 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
} 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);

@ -956,6 +956,7 @@ void ast_cdr_submit_batch(int shutdown)
if (option_debug)
ast_log(LOG_DEBUG, "CDR multi-threaded batch processing begins now\n");
}
pthread_attr_destroy(&attr);
}
}

@ -1642,9 +1642,11 @@ static int restart_monitor(void)
/* 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);

@ -2634,8 +2634,10 @@ static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in
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,11 +2663,12 @@ static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in
}
tmp = tmp->next;
}
if (!peer)
return NULL;
ast_variables_destroy(var);
if (!peer)
return NULL;
if (ast_test_flag((&globalflags), IAX_RTCACHEFRIENDS)) {
ast_copy_flags(peer, &globalflags, IAX_RTAUTOCLEAR|IAX_RTCACHEFRIENDS);
if (ast_test_flag(peer, IAX_RTAUTOCLEAR)) {
@ -2725,11 +2728,12 @@ static struct iax2_user *realtime_user(const char *username)
}
user = build_user(username, var, !ast_test_flag((&globalflags), IAX_RTCACHEFRIENDS));
if (!user)
return NULL;
ast_variables_destroy(var);
if (!user)
return NULL;
if (ast_test_flag((&globalflags), IAX_RTCACHEFRIENDS)) {
ast_set_flag(user, IAX_RTCACHEFRIENDS);
ast_mutex_lock(&userl.lock);
@ -4925,15 +4929,12 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
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 @@ static void spawn_dp_lookup(int callno, char *context, char *callednum, char *ca
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 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2)
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;

@ -2963,6 +2963,7 @@ static void handle_hd_hf(struct mgcp_subchannel *sub, char *ev)
/*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)

@ -412,7 +412,6 @@ static int restart_monitor(void);
/*! \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 @@ struct sip_auth {
#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 @@ static struct sip_pvt {
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 @@ static int sip_call(struct ast_channel *ast, char *dest, int timeout)
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 */
@ -2155,6 +2155,12 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner)
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 @@ static int update_call_counter(struct sip_pvt *fup, int event)
/* 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 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
&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 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
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 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
}
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 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
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;

@ -2977,6 +2977,7 @@ static void *accept_thread(void *ignore)
ast_verbose("killing accept thread\n");
}
close(as);
pthread_attr_destroy(&attr);
return 0;
}

@ -3668,9 +3668,6 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
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;
p->subs[index].f.datalen = 0;
@ -4199,6 +4196,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
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 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* 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 @@ static int handle_init_event(struct zt_pvt *i, int event)
"interface %d\n", i->channel);
}
}
pthread_attr_destroy(&attr);
return 0;
}
@ -6838,10 +6839,12 @@ static int restart_monitor(void)
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 @@ static void *pri_dchannel(void *vpri)
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 @@ static void *pri_dchannel(void *vpri)
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 @@ static void *pri_dchannel(void *vpri)
pri->pvts[chanpos]->call = NULL;
}
}
pthread_attr_destroy(&attr);
} else {
ast_mutex_unlock(&pri->lock);
/* Release PRI lock while we create the channel */

@ -28,18 +28,18 @@ ifneq ($(wildcard g723.1b/coder2.c),)
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)

@ -241,7 +241,7 @@ static struct ast_translator_pvt *zap_new_alawtog723(void)
{
/* 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 @@ static struct ast_translator_pvt *zap_new_ulawtog723(void)
{
/* 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 @@ static struct ast_translator_pvt *zap_new_g723toalaw(void)
{
/* 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 @@ static struct ast_translator_pvt *zap_new_g723toulaw(void)
{
/* 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 @@ static struct ast_translator_pvt *zap_new_alawtog729(void)
{
/* 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 @@ static struct ast_translator_pvt *zap_new_ulawtog729(void)
{
/* 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 @@ static struct ast_translator_pvt *zap_new_g729toalaw(void)
{
/* 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 @@ static struct ast_translator_pvt *zap_new_g729toulaw(void)
{
/* 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 @@ static int find_transcoders(void)
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);

@ -651,7 +651,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
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;
}

@ -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)

@ -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;

@ -773,7 +773,6 @@ static int action_status(struct mansession *s, struct message *m)
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 @@ static int action_status(struct mansession *s, struct message *m)
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 @@ static int action_originate(struct mansession *s, struct message *m)
} 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);

10
pbx.c

@ -974,8 +974,7 @@ static char *substring(const char *value, int offset, int length, char *workspac
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 @@ enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
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 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
}
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 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
if (locked_channel)
*locked_channel = chan;
}
pthread_attr_destroy(&attr);
}
} else {
ast_log(LOG_ERROR, "Out of memory :(\n");
@ -5290,11 +5294,13 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
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:

@ -799,8 +799,10 @@ static int dundi_answer_entity(struct dundi_transaction *trans, struct dundi_ies
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 @@ static int dundi_prop_precache(struct dundi_transaction *trans, struct dundi_ies
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 @@ static int dundi_answer_query(struct dundi_transaction *trans, struct dundi_ies
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));

@ -295,6 +295,7 @@ static void launch_service(struct outgoing *o)
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 @@ int load_module(void)
ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
return -1;
}
pthread_attr_destroy(&attr);
return 0;
}

@ -203,28 +203,29 @@ static int ast_moh_files_next(struct ast_channel *chan)
struct moh_files_state *state = chan->music_state;
int tries;
if (state->save_pos) {
state->pos = state->save_pos;
state->save_pos = 0;
}
state->samples = 0;
/* Discontinue a stream if it is running already */
if (chan->stream) {
ast_closestream(chan->stream);
chan->stream = NULL;
state->pos++;
state->pos %= state->class->total_files;
}
if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
/* Try 20 times to find something good */
/* If a specific file has been saved, use it */
if (state->save_pos) {
state->pos = state->save_pos;
state->save_pos = 0;
} 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;
/* 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;
} 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;
state->samples = 0;
}
if (!ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {

@ -526,7 +526,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
}
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);

Loading…
Cancel
Save