mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Update security document, work on threading with pbx.c and small SIP fixes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
6
SECURITY
6
SECURITY
@@ -25,15 +25,15 @@ the "default" context within other private contexts by using:
|
|||||||
in the appropriate section. A well designed PBX might look like this:
|
in the appropriate section. A well designed PBX might look like this:
|
||||||
|
|
||||||
[longdistance]
|
[longdistance]
|
||||||
exten => _91NXXNXXXXXX,1,Dial,Tor/g2/BYEXTENSION
|
exten => _91NXXNXXXXXX,1,Dial(Zap/g2/${EXTEN:1})
|
||||||
include => local
|
include => local
|
||||||
|
|
||||||
[local]
|
[local]
|
||||||
exten => _9NXXNXXX,1,Dial,Tor/g2/BYEXTENSION
|
exten => _9NXXNXXX,1,Dial(Zap/g2/${EXTEN:1})
|
||||||
include => default
|
include => default
|
||||||
|
|
||||||
[default]
|
[default]
|
||||||
exten => 6123,Dial,Tor/1
|
exten => 6123,Dial(Zap/1)
|
||||||
|
|
||||||
|
|
||||||
DON'T FORGET TO TAKE THE DEMO CONTEXT OUT OF YOUR DEFAULT CONTEXT. There
|
DON'T FORGET TO TAKE THE DEMO CONTEXT OUT OF YOUR DEFAULT CONTEXT. There
|
||||||
|
@@ -5885,6 +5885,7 @@ restartsearch:
|
|||||||
|
|
||||||
static int restart_monitor(void)
|
static int restart_monitor(void)
|
||||||
{
|
{
|
||||||
|
pthread_attr_t attr;
|
||||||
/* If we're supposed to be stopped -- stay stopped */
|
/* If we're supposed to be stopped -- stay stopped */
|
||||||
if (monitor_thread == AST_PTHREADT_STOP)
|
if (monitor_thread == AST_PTHREADT_STOP)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -5901,8 +5902,10 @@ static int restart_monitor(void)
|
|||||||
/* Wake up the thread */
|
/* Wake up the thread */
|
||||||
pthread_kill(monitor_thread, SIGURG);
|
pthread_kill(monitor_thread, SIGURG);
|
||||||
} else {
|
} else {
|
||||||
|
pthread_attr_init(&attr);
|
||||||
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
/* Start a new monitor */
|
/* Start a new monitor */
|
||||||
if (pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
|
if (pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
|
||||||
ast_mutex_unlock(&monlock);
|
ast_mutex_unlock(&monlock);
|
||||||
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
|
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -6701,26 +6704,34 @@ static char *descrip_dtmfmode = "SIPDtmfMode(inband|info|rfc2833): Changes the d
|
|||||||
static char *app_dtmfmode = "SIPDtmfMode";
|
static char *app_dtmfmode = "SIPDtmfMode";
|
||||||
static int sip_dtmfmode(struct ast_channel *chan, void *data)
|
static int sip_dtmfmode(struct ast_channel *chan, void *data)
|
||||||
{
|
{
|
||||||
struct sip_pvt *p = chan->pvt->pvt;
|
struct sip_pvt *p;
|
||||||
char *mode;
|
char *mode;
|
||||||
if (chan->type != type) {
|
|
||||||
ast_log(LOG_WARNING, "Call this application only on SIP incoming calls\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (data)
|
if (data)
|
||||||
mode = (char *)data;
|
mode = (char *)data;
|
||||||
else {
|
else {
|
||||||
ast_log(LOG_WARNING, "This application requires the argument: info, inband, rfc2833\n");
|
ast_log(LOG_WARNING, "This application requires the argument: info, inband, rfc2833\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!strcasecmp(mode,"info"))
|
ast_mutex_lock(&chan->lock);
|
||||||
p->dtmfmode = SIP_DTMF_INFO;
|
if (chan->type != type) {
|
||||||
else if (!strcasecmp(mode,"rfc2833"))
|
ast_log(LOG_WARNING, "Call this application only on SIP incoming calls\n");
|
||||||
p->dtmfmode = SIP_DTMF_RFC2833;
|
ast_mutex_unlock(&chan->lock);
|
||||||
else if (!strcasecmp(mode,"inband"))
|
return 0;
|
||||||
p->dtmfmode = SIP_DTMF_INBAND;
|
}
|
||||||
else
|
p = chan->pvt->pvt;
|
||||||
ast_log(LOG_WARNING, "I don't know about this dtmf mode: %s\n",mode);
|
if (p) {
|
||||||
|
ast_mutex_lock(&p->lock);
|
||||||
|
if (!strcasecmp(mode,"info"))
|
||||||
|
p->dtmfmode = SIP_DTMF_INFO;
|
||||||
|
else if (!strcasecmp(mode,"rfc2833"))
|
||||||
|
p->dtmfmode = SIP_DTMF_RFC2833;
|
||||||
|
else if (!strcasecmp(mode,"inband"))
|
||||||
|
p->dtmfmode = SIP_DTMF_INBAND;
|
||||||
|
else
|
||||||
|
ast_log(LOG_WARNING, "I don't know about this dtmf mode: %s\n",mode);
|
||||||
|
ast_mutex_unlock(&p->lock);
|
||||||
|
}
|
||||||
|
ast_mutex_unlock(&chan->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
pbx.c
5
pbx.c
@@ -4044,7 +4044,10 @@ int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *
|
|||||||
if (appdata)
|
if (appdata)
|
||||||
strncpy(as->appdata, appdata, sizeof(as->appdata) - 1);
|
strncpy(as->appdata, appdata, sizeof(as->appdata) - 1);
|
||||||
as->timeout = timeout;
|
as->timeout = timeout;
|
||||||
if (pthread_create(&as->p, NULL, async_wait, as)) {
|
/* Start a new thread, and get something handling this channel. */
|
||||||
|
pthread_attr_init(&attr);
|
||||||
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
|
if (pthread_create(&as->p, &attr, async_wait, as)) {
|
||||||
ast_log(LOG_WARNING, "Failed to start async wait\n");
|
ast_log(LOG_WARNING, "Failed to start async wait\n");
|
||||||
free(as);
|
free(as);
|
||||||
ast_hangup(chan);
|
ast_hangup(chan);
|
||||||
|
Reference in New Issue
Block a user