if (gH323Debug)
ast_verbose(" hanging %s with cause: %d\n", p->username, q931cause);
- ast->tech_pvt = NULL;
+ ast->tech_pvt = NULL;
if (!ast_test_flag(p, H323_ALREADYGONE)) {
- ooHangCall(p->callToken,
+ ooHangCall(p->callToken,
ooh323_convert_hangupcause_asteriskToH323(q931cause), q931cause);
ast_set_flag(p, H323_ALREADYGONE);
/* ast_mutex_unlock(&p->lock); */
- } else
+ } else
ast_set_flag(p, H323_NEEDDESTROY);
/* detach channel here */
if (p->owner) {
/* Notify the module monitors that use count for resource has changed */
ast_update_use_count();
-
+
} else {
ast_debug(1, "No call to hangup\n" );
}
-
+
if (gH323Debug)
ast_verbose("+++ ooh323_hangup\n");
if (ast->_state != AST_STATE_UP) {
ast_channel_lock(ast);
ast_setstate(ast, AST_STATE_UP);
- if (option_debug)
- ast_debug(1, "ooh323_answer(%s)\n", ast->name);
+ ast_debug(1, "ooh323_answer(%s)\n", ast->name);
ast_channel_unlock(ast);
ooAnswerCall(p->callToken);
}
return res;
}
-
if (f->frametype == AST_FRAME_VOICE) {
/* sending progress for first */
if (!ast_test_flag(p, H323_OUTGOING) && !p->progsent &&
- p->callToken) {
+ p->callToken) {
ooManualProgress(p->callToken);
p->progsent = 1;
}
if (gH323Debug)
ast_verbose("----- ooh323_indicate %d on call %s\n", condition, callToken);
-
- ast_mutex_lock(&p->lock);
+
+ ast_mutex_lock(&p->lock);
switch (condition) {
case AST_CONTROL_CONGESTION:
if (!ast_test_flag(p, H323_ALREADYGONE)) {
- ooHangCall(callToken, OO_REASON_LOCAL_CONGESTED,
+ ooHangCall(callToken, OO_REASON_LOCAL_CONGESTED,
AST_CAUSE_SWITCH_CONGESTION);
ast_set_flag(p, H323_ALREADYGONE);
}
break;
case AST_CONTROL_BUSY:
if (!ast_test_flag(p, H323_ALREADYGONE)) {
- ooHangCall(callToken, OO_REASON_LOCAL_BUSY, AST_CAUSE_USER_BUSY);
+ ooHangCall(callToken, OO_REASON_LOCAL_BUSY, AST_CAUSE_USER_BUSY);
ast_set_flag(p, H323_ALREADYGONE);
}
break;
case AST_CONTROL_HOLD:
- ast_moh_start(ast, data, NULL);
+ ast_moh_start(ast, data, NULL);
break;
case AST_CONTROL_UNHOLD:
ast_moh_stop(ast);
break;
case AST_CONTROL_PROGRESS:
if (ast->_state != AST_STATE_UP) {
- if (!p->progsent) {
- if (gH323Debug)
- ast_log(LOG_DEBUG,"Sending manual progress for %s, res = %d\n", callToken,
- ooManualProgress(callToken));
- else
- ooManualProgress(callToken);
- p->progsent = 1;
- }
+ if (!p->progsent) {
+ if (gH323Debug) {
+ ast_debug(1, "Sending manual progress for %s, res = %d\n", callToken,
+ ooManualProgress(callToken));
+ } else {
+ ooManualProgress(callToken);
+ }
+ p->progsent = 1;
+ }
}
break;
case AST_CONTROL_RINGING:
if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
- if (gH323Debug)
- ast_log(LOG_DEBUG,"Sending manual ringback for %s, res = %d\n",
+ if (gH323Debug) {
+ ast_debug(1, "Sending manual ringback for %s, res = %d\n",
callToken,
- ooManualRingback(callToken));
- else
- ooManualRingback(callToken);
+ ooManualRingback(callToken));
+ } else {
+ ooManualRingback(callToken);
+ }
}
break;
case AST_CONTROL_SRCUPDATE:
|| ast_strlen_zero(ast->connected.id.name.str)) {
break;
}
- if (gH323Debug)
- ast_log(LOG_DEBUG, "Sending connected line info for %s (%s)\n",
+ if (gH323Debug) {
+ ast_debug(1, "Sending connected line info for %s (%s)\n",
callToken, ast->connected.id.name.str);
+ }
ooSetANI(callToken, ast->connected.id.name.str);
break;
if (gH323Debug)
ast_verbose("+++++ ooh323_queryoption %d on channel %s\n", option, ast->name);
-
- ast_mutex_unlock(&p->lock);
+
+ ast_mutex_unlock(&p->lock);
return res;
}
char formats[FORMAT_STRING_SIZE];
if (gH323Debug)
- ast_verbose("--- ooh323_update_writeformat %s/%d\n",
+ ast_verbose("--- ooh323_update_writeformat %s/%d\n",
ast_getformatname(fmt), txframes);
-
+
p = find_call(call);
if (!p) {
ast_log(LOG_ERROR, "No matching call found for %s\n", call->callToken);
if (p->owner) {
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
return;
}
if (gH323Debug)
- ast_verbose("Writeformat before update %s/%s\n",
+ ast_verbose("Writeformat before update %s/%s\n",
ast_getformatname(&p->owner->writeformat),
ast_getformatname_multiple(formats, sizeof(formats), p->owner->nativeformats));
if (txframes)
if (gH323Debug)
ast_verbose("--- ooh323_update_readformat %s\n",
ast_getformatname(fmt));
-
+
p = find_call(call);
if (!p) {
ast_log(LOG_ERROR, "No matching call found for %s\n", call->callToken);
if (p->owner) {
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
}
if (gH323Debug)
- ast_verbose("Readformat before update %s\n",
+ ast_verbose("Readformat before update %s\n",
ast_getformatname(&p->owner->readformat));
ast_format_cap_set(p->owner->nativeformats, fmt);
- ast_set_read_format(p->owner, &p->owner->readformat);
+ ast_set_read_format(p->owner, &p->owner->readformat);
ast_channel_unlock(p->owner);
- } else
+ } else
ast_log(LOG_ERROR, "No owner found\n");
ast_mutex_unlock(&p->lock);
if (gH323Debug)
ast_verbose("--- onAlerting %s\n", call->callToken);
- p = find_call(call);
+ p = find_call(call);
- if(!p) {
+ if(!p) {
ast_log(LOG_ERROR, "No matching call found\n");
return -1;
- }
+ }
ast_mutex_lock(&p->lock);
if (!p->owner) {
ast_mutex_unlock(&p->lock);
return 0;
}
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
if (gH323Debug)
ast_verbose("--- onProgress %s\n", call->callToken);
- p = find_call(call);
+ p = find_call(call);
- if(!p) {
+ if(!p) {
ast_log(LOG_ERROR, "No matching call found\n");
return -1;
- }
+ }
ast_mutex_lock(&p->lock);
if (!p->owner) {
ast_mutex_unlock(&p->lock);
return 0;
}
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
ast_setstate(c, AST_STATE_RINGING);
ast_queue_control(c, AST_CONTROL_PROGRESS);
- ast_channel_unlock(c);
- ast_mutex_unlock(&p->lock);
+ ast_channel_unlock(c);
+ ast_mutex_unlock(&p->lock);
if (gH323Debug)
ast_verbose("+++ onProgress %s\n", call->callToken);
f.src = "SEND_DIGIT";
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
return -1;
}
- if(ast_test_flag(p, H323_OUTGOING)) {
+ if(ast_test_flag(p, H323_OUTGOING)) {
ast_mutex_lock(&p->lock);
if (!p->owner) {
ast_mutex_unlock(&p->lock);
ast_log(LOG_ERROR, "Channel has no owner\n");
return -1;
}
-
+
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (p->owner) {
}
ast_queue_control(c, AST_CONTROL_ANSWER);
- ast_channel_unlock(p->owner);
+ ast_channel_unlock(p->owner);
manager_event(EVENT_FLAG_SYSTEM,"ChannelUpdate","Channel: %s\r\nChanneltype: %s\r\n"
"CallRef: %d\r\n", c->name, "OOH323", p->call_reference);
}
if ((p = find_call(call))) {
ast_mutex_lock(&p->lock);
-
+
while (p->owner) {
if (ast_channel_trylock(p->owner)) {
ooTrace(OOTRCLVLINFO, "Failed to grab lock, trying again\n");
- ast_log(LOG_DEBUG,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
} else {
- ownerLock = 1; break;
+ ownerLock = 1; break;
}
}
if (ownerLock) {
- if (!ast_test_flag(p, H323_ALREADYGONE)) {
+ if (!ast_test_flag(p, H323_ALREADYGONE)) {
ast_set_flag(p, H323_ALREADYGONE);
p->owner->hangupcause = call->q931cause;
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
ast_queue_hangup_with_cause(p->owner,call->q931cause);
}
- }
+ }
- if(p->owner) {
- p->owner->tech_pvt = NULL;
+ if(p->owner) {
+ p->owner->tech_pvt = NULL;
ast_channel_unlock(p->owner);
- p->owner = NULL;
+ p->owner = NULL;
ast_module_unref(myself);
}
ast_set_flag(p, H323_NEEDDESTROY);
- ooh323c_stop_call_thread(call);
+ ooh323c_stop_call_thread(call);
ast_mutex_unlock(&p->lock);
- ast_mutex_lock(&usecnt_lock);
- usecnt--;
- ast_mutex_unlock(&usecnt_lock);
+ ast_mutex_lock(&usecnt_lock);
+ usecnt--;
+ ast_mutex_unlock(&usecnt_lock);
}
free(cur->callerid_name);
cur->callerid_name = 0;
}
-
+
if (cur->callerid_num) {
free(cur->callerid_num);
cur->callerid_num = 0;
ast_udptl_destroy(cur->udptl);
cur->udptl = NULL;
}
-
+
/* Unlink us from the owner if we have one */
if (cur->owner) {
- while(ast_channel_trylock(cur->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ while(ast_channel_trylock(cur->owner)) {
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&cur->lock);
- }
+ }
ast_debug(1, "Detaching from %s\n", cur->owner->name);
cur->owner->tech_pvt = NULL;
ast_channel_unlock(cur->owner);
cur->owner = NULL;
ast_module_unref(myself);
}
-
+
if (cur->vad) {
ast_dsp_free(cur->vad);
cur->vad = NULL;
ast_verbose("--- setup_udptl_connection\n");
/* Find the call or allocate a private structure if call not found */
- p = find_call(call);
+ p = find_call(call);
if (!p) {
ast_log(LOG_ERROR, "Something is wrong: rtp\n");
ast_mutex_lock(&p->lock);
if (p->owner) {
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, ¶meters, sizeof(parameters));
}
if (gH323Debug)
- ast_debug(1, "Receiving UDPTL %s:%d\n", ast_inet_ntoa(them.sin_addr),
+ ast_debug(1, "Receiving UDPTL %s:%d\n", ast_inet_ntoa(them.sin_addr),
ntohs(them.sin_port));
ast_channel_unlock(p->owner);
{
struct ooh323_pvt *p = NULL;
- if(gH323Debug)
+ if(gH323Debug)
ast_verbose("--- close_udptl_connection\n");
p = find_call(call);
if (!p) {
- ast_log(LOG_ERROR, "Couldn't find matching call to close udptl "
+ ast_log(LOG_ERROR, "Couldn't find matching call to close udptl "
"connection\n");
return;
}
ast_mutex_lock(&p->lock);
if (p->owner) {
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
break;
case 5:
f = ast_udptl_read(p->udptl); /* UDPTL t.38 data */
- if (gH323Debug) ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
+ if (gH323Debug) {
+ ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
f->frametype, f->subclass.integer, f->datalen, ast->name);
+ }
break;
default:
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE && !p->faxmode) {
if (!(ast_format_cap_iscompatible(p->owner->nativeformats, &f->subclass.format))) {
- ast_debug(1, "Oooh, voice format changed to %s\n", ast_getformatname(&f->subclass.format));
+ ast_debug(1, "Oooh, voice format changed to %s\n", ast_getformatname(&f->subclass.format));
ast_format_cap_set(p->owner->nativeformats, &f->subclass.format);
ast_set_read_format(p->owner, &p->owner->readformat);
ast_set_write_format(p->owner, &p->owner->writeformat);
(f->subclass.format.id == AST_FORMAT_SLINEAR || f->subclass.format.id == AST_FORMAT_ALAW ||
f->subclass.format.id == AST_FORMAT_ULAW)) {
f = ast_dsp_process(p->owner, p->vad, f);
- if (f && (f->frametype == AST_FRAME_DTMF))
- ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass.integer);
+ if (f && (f->frametype == AST_FRAME_DTMF)) {
+ ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass.integer);
+ }
}
}
}
ast_mutex_lock(&p->lock);
- if (gH323Debug)
- ast_debug(1, "change mode to %d for %s\n", t38mode, call->callToken);
+ if (gH323Debug) {
+ ast_debug(1, "change mode to %d for %s\n", t38mode, call->callToken);
+ }
if (t38mode == p->faxmode) {
- if (gH323Debug)
+ if (gH323Debug) {
ast_debug(1, "mode for %s is already %d\n", call->callToken,
t38mode);
+ }
ast_mutex_unlock(&p->lock);
return;
}
<depend>spandsp</depend>
<conflict>res_fax</conflict>
***/
-
+
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
} else if (level == SPAN_LOG_WARNING) {
ast_log(LOG_WARNING, "%s", msg);
} else {
- ast_log(LOG_DEBUG, "%s", msg);
+ ast_debug(1, "%s", msg);
}
}
return;
}
-
- s->finished = 1;
-
+
+ s->finished = 1;
+
local_ident = S_OR(t30_get_tx_ident(f), "");
far_ident = S_OR(t30_get_rx_ident(f), "");
- pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "SUCCESS");
- pbx_builtin_setvar_helper(s->chan, "FAXERROR", NULL);
+ pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "SUCCESS");
+ pbx_builtin_setvar_helper(s->chan, "FAXERROR", NULL);
pbx_builtin_setvar_helper(s->chan, "REMOTESTATIONID", far_ident);
#if SPANDSP_RELEASE_DATE >= 20090220
pages_transferred = (s->direction) ? stat.pages_tx : stat.pages_rx;
snprintf(buf, sizeof(buf), "%d", stat.y_resolution);
pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", buf);
snprintf(buf, sizeof(buf), "%d", stat.bit_rate);
- pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", buf);
-
+ pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", buf);
+
ast_debug(1, "Fax transmitted successfully.\n");
ast_debug(1, " Remote station ID: %s\n", far_ident);
ast_debug(1, " Pages transferred: %d\n", pages_transferred);
ast_debug(1, " Image resolution: %d x %d\n", stat.x_resolution, stat.y_resolution);
ast_debug(1, " Transfer Rate: %d\n", stat.bit_rate);
-
+
ast_manager_event(s->chan, EVENT_FLAG_CALL,
s->direction ? "FaxSent" : "FaxReceived",
"Channel: %s\r\n"
/* wait up to five seconds for negotiation to complete */
unsigned int timeout = 5000;
int ms;
-
+
ast_debug(1, "Negotiating T.38 for receive on %s\n", s->chan->name);
while (timeout > 0) {
ms = ast_waitfor(s->chan, 1000);
(inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) &&
(inf->datalen == sizeof(t38_parameters))) {
struct ast_control_t38_parameters *parameters = inf->data.ptr;
-
+
switch (parameters->request_response) {
case AST_T38_NEGOTIATED:
ast_debug(1, "Negotiated T.38 for receive on %s\n", s->chan->name);
res = -1;
break;
}
-
+
t38_terminal_send_timeout(&t38, ast_tvdiff_us(now, last_frame) / (1000000 / 8000));
if (!res) {
/* wait up to five seconds for negotiation to complete */
unsigned int timeout = 5000;
int ms;
-
+
ast_debug(1, "Shutting down T.38 on %s\n", s->chan->name);
while (timeout > 0) {
ms = ast_waitfor(s->chan, 1000);
(inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) &&
(inf->datalen == sizeof(t38_parameters))) {
struct ast_control_t38_parameters *parameters = inf->data.ptr;
-
+
switch (parameters->request_response) {
case AST_T38_TERMINATED:
ast_debug(1, "Shut down T.38 on %s\n", s->chan->name);
static void conf_start_moh(struct ast_channel *chan, const char *musicclass)
{
- char *original_moh;
+ char *original_moh;
ast_channel_lock(chan);
original_moh = ast_strdupa(chan->musicclass);
}
for (res = 1; !conf->announcethread_stop && (current = AST_LIST_REMOVE_HEAD(&local_list, entry)); ao2_ref(current, -1)) {
- ast_log(LOG_DEBUG, "About to play %s\n", current->namerecloc);
+ ast_debug(1, "About to play %s\n", current->namerecloc);
if (!ast_fileexists(current->namerecloc, NULL, NULL))
continue;
if ((current->confchan) && (current->confusers > 1) && !ast_check_hangup(current->confchan)) {
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET;
char *exitkeys = NULL;
- unsigned int calldurationlimit = 0;
- long timelimit = 0;
- long play_warning = 0;
- long warning_freq = 0;
- const char *warning_sound = NULL;
- const char *end_sound = NULL;
- char *parse;
- long time_left_ms = 0;
- struct timeval nexteventts = { 0, };
- int to;
+ unsigned int calldurationlimit = 0;
+ long timelimit = 0;
+ long play_warning = 0;
+ long warning_freq = 0;
+ const char *warning_sound = NULL;
+ const char *end_sound = NULL;
+ char *parse;
+ long time_left_ms = 0;
+ struct timeval nexteventts = { 0, };
+ int to;
int setusercount = 0;
int confsilence = 0, totalsilence = 0;
char *mailbox, *context;
(opt_waitmarked_timeout > 0)) {
timeout = time(NULL) + opt_waitmarked_timeout;
}
-
- if (ast_test_flag64(confflags, CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) {
- calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]);
- ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit);
- }
-
- if (ast_test_flag64(confflags, CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) {
- char *limit_str, *warning_str, *warnfreq_str;
+
+ if (ast_test_flag64(confflags, CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) {
+ calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]);
+ ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit);
+ }
+
+ if (ast_test_flag64(confflags, CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) {
+ char *limit_str, *warning_str, *warnfreq_str;
const char *var;
-
- parse = optargs[OPT_ARG_DURATION_LIMIT];
- limit_str = strsep(&parse, ":");
- warning_str = strsep(&parse, ":");
- warnfreq_str = parse;
-
- timelimit = atol(limit_str);
- if (warning_str)
- play_warning = atol(warning_str);
- if (warnfreq_str)
- warning_freq = atol(warnfreq_str);
-
- if (!timelimit) {
- timelimit = play_warning = warning_freq = 0;
- warning_sound = NULL;
- } else if (play_warning > timelimit) {
- if (!warning_freq) {
- play_warning = 0;
- } else {
- while (play_warning > timelimit)
- play_warning -= warning_freq;
- if (play_warning < 1)
- play_warning = warning_freq = 0;
- }
- }
-
+
+ parse = optargs[OPT_ARG_DURATION_LIMIT];
+ limit_str = strsep(&parse, ":");
+ warning_str = strsep(&parse, ":");
+ warnfreq_str = parse;
+
+ timelimit = atol(limit_str);
+ if (warning_str)
+ play_warning = atol(warning_str);
+ if (warnfreq_str)
+ warning_freq = atol(warnfreq_str);
+
+ if (!timelimit) {
+ timelimit = play_warning = warning_freq = 0;
+ warning_sound = NULL;
+ } else if (play_warning > timelimit) {
+ if (!warning_freq) {
+ play_warning = 0;
+ } else {
+ while (play_warning > timelimit)
+ play_warning -= warning_freq;
+ if (play_warning < 1)
+ play_warning = warning_freq = 0;
+ }
+ }
+
ast_channel_lock(chan);
if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_WARNING_FILE"))) {
var = ast_strdupa(var);
}
ast_channel_unlock(chan);
- warning_sound = var ? var : "timeleft";
-
+ warning_sound = var ? var : "timeleft";
+
ast_channel_lock(chan);
if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_TIMEOUT_FILE"))) {
var = ast_strdupa(var);
}
ast_channel_unlock(chan);
-
+
end_sound = var ? var : NULL;
-
- /* undo effect of S(x) in case they are both used */
- calldurationlimit = 0;
- /* more efficient do it like S(x) does since no advanced opts */
- if (!play_warning && !end_sound && timelimit) {
- calldurationlimit = timelimit / 1000;
- timelimit = play_warning = warning_freq = 0;
- } else {
- ast_debug(2, "Limit Data for this call:\n");
+
+ /* undo effect of S(x) in case they are both used */
+ calldurationlimit = 0;
+ /* more efficient do it like S(x) does since no advanced opts */
+ if (!play_warning && !end_sound && timelimit) {
+ calldurationlimit = timelimit / 1000;
+ timelimit = play_warning = warning_freq = 0;
+ } else {
+ ast_debug(2, "Limit Data for this call:\n");
ast_debug(2, "- timelimit = %ld\n", timelimit);
- ast_debug(2, "- play_warning = %ld\n", play_warning);
- ast_debug(2, "- warning_freq = %ld\n", warning_freq);
- ast_debug(2, "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF");
- ast_debug(2, "- end_sound = %s\n", end_sound ? end_sound : "UNDEF");
- }
- }
+ ast_debug(2, "- play_warning = %ld\n", play_warning);
+ ast_debug(2, "- warning_freq = %ld\n", warning_freq);
+ ast_debug(2, "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF");
+ ast_debug(2, "- end_sound = %s\n", end_sound ? end_sound : "UNDEF");
+ }
+ }
/* Get exit keys */
if (ast_test_flag64(confflags, CONFFLAG_KEYEXIT)) {
memset(&dahdic, 0, sizeof(dahdic));
memset(&dahdic_empty, 0, sizeof(dahdic_empty));
/* Check to see if we're in a conference... */
- dahdic.chan = 0;
+ dahdic.chan = 0;
if (ioctl(fd, DAHDI_GETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error getting conference\n");
close(fd);
}
memset(&dahdic, 0, sizeof(dahdic));
/* Add us to the conference */
- dahdic.chan = 0;
+ dahdic.chan = 0;
dahdic.confno = conf->dahdiconf;
if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && (ast_test_flag64(confflags, CONFFLAG_INTROUSER) ||
dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER;
else if (ast_test_flag64(confflags, CONFFLAG_TALKER))
dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
- else
+ else
dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
} else if ((f->frametype == AST_FRAME_DTMF) && ast_test_flag64(confflags, CONFFLAG_KEYEXIT) &&
(strchr(exitkeys, f->subclass.integer))) {
pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", dtmfstr);
-
+
if (ast_test_flag64(confflags, CONFFLAG_PASS_DTMF)) {
conf_queue_dtmf(conf, user, f);
}
goto outrun;
break;
default:
- ast_debug(1,
+ ast_debug(1,
"Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n",
chan->name, f->frametype, f->subclass.integer);
}
} else {
- ast_debug(1,
+ ast_debug(1,
"Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
chan->name, f->frametype, f->subclass.integer);
}
AST_LIST_LOCK(&confs);
AST_LIST_TRAVERSE(&confs, cnf, list) {
ast_debug(3, "Does conf %s match %s?\n", confno, cnf->confno);
- if (!strcmp(confno, cnf->confno))
+ if (!strcmp(confno, cnf->confno))
break;
}
if (cnf) {
}
snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name);
- ast_set_flag64(&conf_flags,
+ ast_set_flag64(&conf_flags,
CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION);
ast_answer(chan);
conf = build_conf(conf_name, "", "", 0, 0, 1, chan, NULL);
ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[15], 0);
else {
/* not handled */
- ast_log(LOG_DEBUG, "Unable to generate DTMF tone '%c' for '%s'\n", digit, myrpt->txchannel->name);
+ ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, myrpt->txchannel->name);
}
rpt_mutex_lock(&myrpt->lock);
}
f->data.ptr,f->datalen / 2);
if (n1 != l->wasvox)
{
- if (debug)ast_log(LOG_DEBUG,"Link Node %s, vox %d\n",l->name,n1);
+ ast_debug(1,"Link Node %s, vox %d\n",l->name,n1);
l->wasvox = n1;
l->voxtostate = 0;
if (n1) l->voxtotimer = myrpt->p.voxtimeout_ms;
n = dovox(&myrpt->vox,f->data.ptr,f->datalen / 2);
if (n != myrpt->wasvox)
{
- if (debug) ast_log(LOG_DEBUG,"Node %s, vox %d\n",myrpt->name,n);
+ ast_debug(1,"Node %s, vox %d\n",myrpt->name,n);
myrpt->wasvox = n;
myrpt->voxtostate = 0;
if (n) myrpt->voxtotimer = myrpt->p.voxtimeout_ms;
if (!ast_strlen_zero(ext_pass_check_cmd)) {
char cmd[255], buf[255];
- ast_log(AST_LOG_DEBUG, "Verify password policies for %s\n", password);
+ ast_debug(1, "Verify password policies for %s\n", password);
snprintf(cmd, sizeof(cmd), "%s %s %s %s %s", ext_pass_check_cmd, vmu->mailbox, vmu->context, vmu->password, password);
if (vm_check_password_shell(cmd, buf, sizeof(buf))) {
ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n", msgnum, messageNum);
return;
}
- if (option_debug > 2)
- ast_log(LOG_DEBUG, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum);
+ ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum);
/* delete message */
snprintf (arg, sizeof(arg), "%lu", messageNum);
ast_mutex_lock(&vms->lock);
if (file)
*file++ = '\0';
else {
- ast_debug (1, "Failed to procure file name from directory passed.\n");
+ ast_debug(1, "Failed to procure file name from directory passed.\n");
return -1;
}
}
res = -1;
goto exit;
}
-
+
make_file(vms->fn, sizeof(vms->fn), dir, msgnum);
snprintf(vms->introfn, sizeof(vms->introfn), "%sintro", vms->fn);
goto exit;
}
- if (option_debug > 2)
- ast_log(LOG_DEBUG, "Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", msgnum, vms->msgArray[msgnum]);
+ ast_debug(3, "Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", msgnum, vms->msgArray[msgnum]);
if (vms->msgArray[msgnum] == 0) {
ast_log(LOG_WARNING, "Trying to access unknown message\n");
res = -1;
return -1;
}
}
-
+
/* No IMAP account available */
if (vmu->imapuser[0] == '\0') {
ast_log(AST_LOG_WARNING, "IMAP user not set for mailbox %s\n", vmu->mailbox);
ast_play_and_wait(chan, "vm-mailboxfull");
return -1;
}
-
+
/* Check if we have exceeded maxmsg */
ast_debug(3, "Checking message number quota: mailbox has %d messages, maximum is set to %d, current messages %d\n", msgnum, vmu->maxmsg, inprocess_count(vmu->mailbox, vmu->context, 0));
if (msgnum >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context, +1)) {
if (msgnum < 0 && !imapgreetings) {
return 0;
}
-
+
if (imap_check_limits(chan, vms, vmu, msgcount)) {
return -1;
}
ast_debug(3, "Setting message flag \\\\FLAGGED.\n");
imap_flags = "\\FLAGGED";
}
-
+
/* Attach only the first format */
fmt = ast_strdupa(fmt);
stringp = fmt;
if (ast_fileexists(introfn, NULL, NULL) <= 0) {
*introfn = '\0';
}
-
+
if (ast_strlen_zero(vmu->email)) {
/* We need the vmu->email to be set when we call make_email_file, but
* if we keep it set, a duplicate e-mail will be created. So at the end
return -1;
}
ast_debug(3, "%s stored\n", fn);
-
+
if (tempcopy)
*(vmu->email) = '\0';
inprocess_count(vmu->mailbox, vmu->context, -1);
/* If no mailbox, return immediately */
if (ast_strlen_zero(mailbox_context))
return 0;
-
+
ast_copy_string(tmp, mailbox_context, sizeof(tmp));
context = strchr(tmp, '@');
if (strchr(mailbox_context, ',')) {
MAILSTREAM *stream = NIL;
long debug;
char tmp[256];
-
+
if (!vms) {
ast_log(LOG_ERROR, "vm_state is NULL!\n");
return -1;
}
- if (option_debug > 2)
- ast_log(LOG_DEBUG, "vm_state user is:%s\n", vms->imapuser);
+ ast_debug(3, "vm_state user is:%s\n", vms->imapuser);
if (vms->mailstream == NIL || !vms->mailstream) {
- if (option_debug)
- ast_log(LOG_DEBUG, "mailstream not set.\n");
+ ast_debug(1, "mailstream not set.\n");
} else {
stream = vms->mailstream;
}
}
/* Now connect to the target folder */
imap_mailbox_name(tmp, sizeof(tmp), vms, box, 1);
- if (option_debug > 2)
- ast_log(LOG_DEBUG, "Before mail_open, server: %s, box:%d\n", tmp, box);
+ ast_debug(3, "Before mail_open, server: %s, box:%d\n", tmp, box);
ast_mutex_lock(&vms->lock);
vms->mailstream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
ast_mutex_unlock(&vms->lock);
ast_log(AST_LOG_ERROR, "Could not initialize mailstream\n");
return -1;
}
-
+
create_dirpath(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox);
-
+
/* Check Quota */
if (box == 0) {
ast_debug(3, "Mailbox name set to: %s, about to check quotas\n", mbox(vmu, box));
char *mailbox = stream->mailbox, *user;
char buf[1024] = "";
unsigned long usage = 0, limit = 0;
-
+
while (pquota) {
usage = pquota->usage;
limit = pquota->limit;
pquota = pquota->next;
}
-
+
if (!(user = get_user_by_mailbox(mailbox, buf, sizeof(buf))) || (!(vms = get_vm_state_by_imapuser(user, 2)) && !(vms = get_vm_state_by_imapuser(user, 0)))) {
ast_log(AST_LOG_ERROR, "No state found.\n");
return;
if ((vms_p = pthread_getspecific(ts_vmstate.key)) && !strcmp(vms_p->imapuser, vmu->imapuser) && !strcmp(vms_p->username, vmu->mailbox)) {
return vms_p;
}
- if (option_debug > 4)
- ast_log(AST_LOG_DEBUG, "Adding new vmstate for %s\n", vmu->imapuser);
+ ast_debug(5, "Adding new vmstate for %s\n", vmu->imapuser);
if (!(vms_p = ast_calloc(1, sizeof(*vms_p))))
return NULL;
ast_copy_string(vms_p->imapuser, vmu->imapuser, sizeof(vms_p->imapuser));
ast_copy_string(vms_p->context, vmu->context, sizeof(vms_p->context));
vms_p->mailstream = NIL; /* save for access from interactive entry point */
vms_p->imapversion = vmu->imapversion;
- if (option_debug > 4)
- ast_log(AST_LOG_DEBUG, "Copied %s to %s\n", vmu->imapuser, vms_p->imapuser);
+ ast_debug(5, "Copied %s to %s\n", vmu->imapuser, vms_p->imapuser);
vms_p->updated = 1;
/* set mailbox to INBOX! */
ast_copy_string(vms_p->curbox, mbox(vmu, 0), sizeof(vms_p->curbox));
}
ast_debug(3, "comparing mailbox %s@%s (i=%d) to vmstate mailbox %s@%s (i=%d)\n", mailbox, local_context, interactive, vlist->vms->username, vlist->vms->context, vlist->vms->interactive);
-
+
if (!strcmp(vlist->vms->username, mailbox) && !strcmp(vlist->vms->context, local_context) && vlist->vms->interactive == interactive) {
ast_debug(3, "Found it!\n");
AST_LIST_UNLOCK(&vmstates);
return NULL;
}
-static void vmstate_insert(struct vm_state *vms)
+static void vmstate_insert(struct vm_state *vms)
{
struct vmstate *v;
struct vm_state *altvms;
We can compare the username to find the duplicate */
if (vms->interactive == 1) {
altvms = get_vm_state_by_mailbox(vms->username, vms->context, 0);
- if (altvms) {
+ if (altvms) {
ast_debug(3, "Duplicate mailbox %s, copying message info...\n", vms->username);
vms->newmessages = altvms->newmessages;
vms->oldmessages = altvms->oldmessages;
if (!(v = ast_calloc(1, sizeof(*v))))
return;
-
+
v->vms = vms;
ast_debug(3, "Inserting vm_state for user:%s, mailbox %s\n", vms->imapuser, vms->username);
AST_LIST_UNLOCK(&vmstates);
}
-static void vmstate_delete(struct vm_state *vms)
+static void vmstate_delete(struct vm_state *vms)
{
struct vmstate *vc = NULL;
struct vm_state *altvms = NULL;
/* Interactive states are not stored within the persistent list */
return;
}
-
+
ast_debug(3, "Removing vm_state for user:%s, mailbox %s\n", vms->imapuser, vms->username);
-
+
AST_LIST_LOCK(&vmstates);
AST_LIST_TRAVERSE_SAFE_BEGIN(&vmstates, vc, list) {
if (vc->vms == vms) {
ast_log(AST_LOG_ERROR, "No vmstate found for user:%s, mailbox %s\n", vms->imapuser, vms->username);
}
-static void set_update(MAILSTREAM * stream)
+static void set_update(MAILSTREAM * stream)
{
struct vm_state *vms;
char *mailbox = stream->mailbox, *user;
vms->updated = 1; /* Set updated flag since mailbox changed */
}
-static void init_vm_state(struct vm_state *vms)
+static void init_vm_state(struct vm_state *vms)
{
int x;
vms->vmArrayIndex = 0;
ast_mutex_init(&vms->lock);
}
-static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, int is_intro)
+static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, int is_intro)
{
char *body_content;
char *body_decoded;
unsigned long len;
unsigned long newlen;
char filename[256];
-
+
if (!body || body == NIL)
return -1;
ast_mutex_unlock(&vms->lock);
if (body_content != NIL) {
snprintf(filename, sizeof(filename), "%s.%s", fn, format);
- /* ast_debug(1,body_content); */
+ /* ast_debug(1, body_content); */
body_decoded = rfc822_base64((unsigned char *) body_content, len, &newlen);
- /* If the body of the file is empty, return an error */
+ /* If the body of the file is empty, return an error */
if (!newlen) {
return -1;
}
strcat(fromfile, ".txt");
}
if (!(msg_cfg = ast_config_load(fromfile, config_flags))) {
- if (option_debug > 0) {
- ast_log(LOG_DEBUG, "Config load for message text file '%s' failed\n", fromfile);
- }
+ ast_debug(1, "Config load for message text file '%s' failed\n", fromfile);
return;
}
{
struct ast_tm tm;
struct timeval t = ast_tvnow();
-
+
ast_localtime(&t, &tm, "UTC");
return ast_strftime(s, len, "%a %b %e %r UTC %Y", &tm);
}
/* If maxmsg is zero, act as a "greetings only" voicemail: Exit successfully without recording */
if (vmu->maxmsg == 0) {
- if (option_debug > 2)
- ast_log(LOG_DEBUG, "Greetings only VM (maxmsg=0), Skipping voicemail recording\n");
+ ast_debug(3, "Greetings only VM (maxmsg=0), Skipping voicemail recording\n");
pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
goto leave_vm_out;
}
}
}
vms->newmessages++;
-
+
/* here is a big difference! We add one to it later */
msgnum = newmsgs + oldmsgs;
ast_debug(3, "Messagecount set to %d\n", msgnum);
/* get the real IMAP message number for this message */
snprintf(sequence, sizeof(sequence), "%ld", vms->msgArray[msg]);
-
+
ast_debug(3, "Copying sequence %s to mailbox %s\n", sequence, mbox(vmu, box));
ast_mutex_lock(&vms->lock);
/* if save to Old folder, put in INBOX as read */
/* Create the folder if it don't exist */
imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1); /* Get the full mailbox name */
ast_debug(5, "Checking if folder exists: %s\n", mailbox);
- if (mail_create(vms->mailstream, mailbox) == NIL)
+ if (mail_create(vms->mailstream, mailbox) == NIL)
ast_debug(5, "Folder exists.\n");
else
ast_log(AST_LOG_NOTICE, "Folder %s created!\n", mbox(vmu, box));
int i;
char *callerid, *name;
char prefile[PATH_MAX] = "";
-
/* If voicemail cid is not enabled, or we didn't get cid or context from
* the attribute file, leave now.
ast_debug(1, "User %s set password to %s of length %d\n", vms->username, newpassword, (int) strlen(newpassword));
cmd = ast_play_and_wait(chan, vm_passchanged);
- /* If forcename is set, have the user record their name */
+ /* If forcename is set, have the user record their name */
if (ast_test_flag(vmu, VM_FORCENAME)) {
snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username);
if (ast_fileexists(prefile, NULL, NULL) < 1) {
vms->username, newpassword, (int) strlen(newpassword));
cmd = ast_play_and_wait(chan, vm_passchanged);
break;
- case '*':
+ case '*':
cmd = 't';
break;
- default:
+ default:
cmd = 0;
snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
cmd = ast_play_and_wait(chan, "an-error-has-occured");
return -1;
}
-
+
/* Set language from config to override channel language */
if (!ast_strlen_zero(vmu->language))
ast_string_field_set(chan, language, vmu->language);
deleted = 1;
#endif
break;
-
+
case '8': /* Forward the current messgae */
if (vms.lastmsg > -1) {
cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain, in_urgent);
#ifdef HAVE_IMAP_TK2006
if (LEVELUIDPLUS (vms.mailstream)) {
mail_expunge_full(vms.mailstream, NIL, EX_UID);
- } else
+ } else
#endif
mail_expunge(vms.mailstream);
ast_mutex_unlock(&vms.lock);
ast_copy_string(ext_pass_cmd, val, sizeof(ext_pass_cmd));
pwdchange = PWDCHANGE_EXTERNAL | PWDCHANGE_INTERNAL;
}
-
+
/* External password validation command */
if ((val = ast_variable_retrieve(cfg, "general", "externpasscheck"))) {
ast_copy_string(ext_pass_check_cmd, val, sizeof(ext_pass_check_cmd));
- ast_log(AST_LOG_DEBUG, "found externpasscheck: %s\n", ext_pass_check_cmd);
+ ast_debug(1, "found externpasscheck: %s\n", ext_pass_check_cmd);
}
#ifdef IMAP_STORAGE
}
if (!smdi_iface) {
ast_log(AST_LOG_ERROR, "No valid SMDI interface specfied, disabling SMDI voicemail notification\n");
- }
+ }
}
/* Silence treshold */
silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE);
if ((val = ast_variable_retrieve(cfg, "general", "silencethreshold")))
silencethreshold = atoi(val);
-
- if (!(val = ast_variable_retrieve(cfg, "general", "serveremail")))
+
+ if (!(val = ast_variable_retrieve(cfg, "general", "serveremail")))
val = ASTERISK_USERNAME;
ast_copy_string(serveremail, val, sizeof(serveremail));
-
+
vmmaxsecs = 0;
if ((val = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
if (sscanf(val, "%30d", &x) == 1) {
}
/* Force new user to record name ? */
- if (!(val = ast_variable_retrieve(cfg, "general", "forcename")))
+ if (!(val = ast_variable_retrieve(cfg, "general", "forcename")))
val = "no";
ast_set2_flag((&globalflags), ast_true(val), VM_FORCENAME);
/* Force new user to record greetings ? */
- if (!(val = ast_variable_retrieve(cfg, "general", "forcegreetings")))
+ if (!(val = ast_variable_retrieve(cfg, "general", "forcegreetings")))
val = "no";
ast_set2_flag((&globalflags), ast_true(val), VM_FORCEGREET);
ast_debug(1, "VM Review Option disabled globally\n");
val = "no";
}
- ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW);
+ ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW);
/* Temporary greeting reminder */
if (!(val = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) {
ast_debug(1, "VM next message wrap disabled globally\n");
val = "no";
}
- ast_set2_flag((&globalflags), ast_true(val), VM_MESSAGEWRAP);
+ ast_set2_flag((&globalflags), ast_true(val), VM_MESSAGEWRAP);
if (!(val = ast_variable_retrieve(cfg, "general", "operator"))){
ast_debug(1, "VM Operator break disabled globally\n");
val = "no";
}
- ast_set2_flag((&globalflags), ast_true(val), VM_OPERATOR);
+ ast_set2_flag((&globalflags), ast_true(val), VM_OPERATOR);
if (!(val = ast_variable_retrieve(cfg, "general", "saycid"))) {
ast_debug(1, "VM CID Info before msg disabled globally\n");
val = "no";
- }
- ast_set2_flag((&globalflags), ast_true(val), VM_SAYCID);
+ }
+ ast_set2_flag((&globalflags), ast_true(val), VM_SAYCID);
if (!(val = ast_variable_retrieve(cfg, "general", "sendvoicemail"))){
ast_debug(1, "Send Voicemail msg disabled globally\n");
val = "no";
}
ast_set2_flag((&globalflags), ast_true(val), VM_SVMAIL);
-
+
if (!(val = ast_variable_retrieve(cfg, "general", "envelope"))) {
ast_debug(1, "ENVELOPE before msg enabled globally\n");
val = "yes";
}
- ast_set2_flag((&globalflags), ast_true(val), VM_ENVELOPE);
+ ast_set2_flag((&globalflags), ast_true(val), VM_ENVELOPE);
if (!(val = ast_variable_retrieve(cfg, "general", "moveheard"))) {
ast_debug(1, "Move Heard enabled globally\n");
val = "yes";
}
- ast_set2_flag((&globalflags), ast_true(val), VM_MOVEHEARD);
+ ast_set2_flag((&globalflags), ast_true(val), VM_MOVEHEARD);
if (!(val = ast_variable_retrieve(cfg, "general", "forward_urgent_auto"))) {
ast_debug(1, "Autoset of Urgent flag on forwarded Urgent messages disabled globally\n");
val = "no";
}
- ast_set2_flag((&globalflags), ast_true(val), VM_FWDURGAUTO);
+ ast_set2_flag((&globalflags), ast_true(val), VM_FWDURGAUTO);
if (!(val = ast_variable_retrieve(cfg, "general", "sayduration"))) {
ast_debug(1, "Duration info before msg enabled globally\n");
val = "yes";
}
- ast_set2_flag((&globalflags), ast_true(val), VM_SAYDURATION);
+ ast_set2_flag((&globalflags), ast_true(val), VM_SAYDURATION);
saydurationminfo = 2;
if ((val = ast_variable_retrieve(cfg, "general", "saydurationm"))) {
ast_copy_string(dialcontext, val, sizeof(dialcontext));
ast_debug(1, "found dialout context: %s\n", dialcontext);
} else {
- dialcontext[0] = '\0';
+ dialcontext[0] = '\0';
}
-
+
if ((val = ast_variable_retrieve(cfg, "general", "callback"))) {
ast_copy_string(callcontext, val, sizeof(callcontext));
ast_debug(1, "found callback context: %s\n", callcontext);
} else {
exitcontext[0] = '\0';
}
-
+
/* load password sounds configuration */
if ((val = ast_variable_retrieve(cfg, "general", "vm-password")))
ast_copy_string(vm_password, val, sizeof(vm_password));
}
if (build_radius_record(&send, &record)) {
- if (option_debug) {
- ast_log(LOG_DEBUG, "Unable to create RADIUS record. CEL not recorded!\n");
- }
+ ast_debug(1, "Unable to create RADIUS record. CEL not recorded!\n");
goto return_cleanup;
}
if (num)
ast_copy_string(numbuf, num, ANALOG_MAX_CID);
- ast_log(LOG_DEBUG, "CallerID number: %s, name: %s, flags=%d\n", num, name, flags);
+ ast_debug(1, "CallerID number: %s, name: %s, flags=%d\n", num, name, flags);
return 0;
}
}
struct dahdi_pvt *p = pvt;
if (p->waitfordialtone && CANPROGRESSDETECT(p) && p->dsp) {
- ast_log(LOG_DEBUG, "Defer dialing for %dms or dialtone\n", p->waitfordialtone);
+ ast_debug(1, "Defer dialing for %dms or dialtone\n", p->waitfordialtone);
gettimeofday(&p->waitingfordt, NULL);
ast_setstate(ast, AST_STATE_OFFHOOK);
}
res = ioctl(p->subs[index].dfd, DAHDI_DIAL, &ddop);
if (res == -1)
- ast_log(LOG_DEBUG, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno));
+ ast_debug(1, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno));
return res;
}
index = analogsub_to_dahdisub(sub);
if (ioctl(p->subs[index].dfd, DAHDI_DIALING, &x)) {
- ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed!\n");
+ ast_debug(1, "DAHDI_DIALING ioctl failed!\n");
return -1;
}
p->mfcr2_recvd_category = category;
/* if we're not supposed to use CID, clear whatever we have */
if (!p->use_callerid) {
- ast_log(LOG_DEBUG, "No CID allowed in configuration, CID is being cleared!\n");
+ ast_debug(1, "No CID allowed in configuration, CID is being cleared!\n");
p->cid_num[0] = 0;
p->cid_name[0] = 0;
}
/* if we're supposed to answer immediately, clear DNIS and set 's' exten */
if (p->immediate || !openr2_context_get_max_dnis(openr2_chan_get_context(r2chan))) {
- ast_log(LOG_DEBUG, "Setting exten => s because of immediate or 0 DNIS configured\n");
+ ast_debug(1, "Setting exten => s because of immediate or 0 DNIS configured\n");
p->exten[0] = 's';
p->exten[1] = 0;
}
ast_log(LOG_WARNING, "Unable to create PBX channel in DAHDI channel %d\n", p->channel);
dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER);
} else if (p->mfcr2_charge_calls) {
- ast_log(LOG_DEBUG, "Accepting MFC/R2 call with charge on chan %d\n", p->channel);
+ ast_debug(1, "Accepting MFC/R2 call with charge on chan %d\n", p->channel);
openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE);
} else {
- ast_log(LOG_DEBUG, "Accepting MFC/R2 call with no charge on chan %d\n", p->channel);
+ ast_debug(1, "Accepting MFC/R2 call with no charge on chan %d\n", p->channel);
openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE);
}
}
if (!p->mfcr2_accept_on_offer) {
openr2_chan_disable_read(r2chan);
if (p->mfcr2_answer_pending) {
- ast_log(LOG_DEBUG, "Answering MFC/R2 call after accepting it on chan %d\n", openr2_chan_get_number(r2chan));
+ ast_debug(1, "Answering MFC/R2 call after accepting it on chan %d\n", openr2_chan_get_number(r2chan));
dahdi_r2_answer(p);
}
return;
static void dahdi_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf, int buflen)
{
- /*ast_log(LOG_DEBUG, "Read data from dahdi channel %d\n", openr2_chan_get_number(r2chan));*/
+ /*ast_debug(1, "Read data from dahdi channel %d\n", openr2_chan_get_number(r2chan));*/
}
static int dahdi_r2_cause_to_ast_cause(openr2_call_disconnect_cause_t cause)
case OR2_LOG_CAS_TRACE:
case OR2_LOG_DEBUG:
case OR2_LOG_EX_DEBUG:
- ast_log(LOG_DEBUG, "%s", logmessage);
+ ast_debug(1, "%s", logmessage);
break;
default:
ast_log(LOG_WARNING, "We should handle logging level %d here.\n", level);
- ast_log(LOG_DEBUG, "%s", logmessage);
+ ast_debug(1, "%s", logmessage);
break;
}
}
);
if (ast_strlen_zero(data)) {
- ast_log(LOG_DEBUG, "No data sent to application!\n");
+ ast_debug(1, "No data sent to application!\n");
return -1;
}
if (chan->tech != &dahdi_tech) {
- ast_log(LOG_DEBUG, "Only DAHDI technology accepted!\n");
+ ast_debug(1, "Only DAHDI technology accepted!\n");
return -1;
}
pvt = (struct dahdi_pvt *) chan->tech_pvt;
if (!pvt) {
- ast_log(LOG_DEBUG, "Unable to find technology private\n");
+ ast_debug(1, "Unable to find technology private\n");
return -1;
}
switch (pvt->sig) {
case SIG_PRI_LIB_HANDLE_CASES:
break;
default:
- ast_log(LOG_DEBUG, "callrerouting attempted on non-ISDN channel %s\n",
+ ast_debug(1, "callrerouting attempted on non-ISDN channel %s\n",
chan->name);
return -1;
}
);
if (ast_strlen_zero(data)) {
- ast_log(LOG_DEBUG, "No data sent to application!\n");
+ ast_debug(1, "No data sent to application!\n");
return -1;
}
if (chan->tech != &dahdi_tech) {
- ast_log(LOG_DEBUG, "Only DAHDI technology accepted!\n");
+ ast_debug(1, "Only DAHDI technology accepted!\n");
return -1;
}
p = (struct dahdi_pvt *)chan->tech_pvt;
if (!p) {
- ast_log(LOG_DEBUG, "Unable to find technology private!\n");
+ ast_debug(1, "Unable to find technology private!\n");
return -1;
}
ast_mutex_lock(&p->lock);
if (!p->mfcr2 || !p->mfcr2call) {
ast_mutex_unlock(&p->lock);
- ast_log(LOG_DEBUG, "Channel %s does not seems to be an R2 active channel!\n", chan->name);
+ ast_debug(1, "Channel %s does not seems to be an R2 active channel!\n", chan->name);
return -1;
}
if (p->mfcr2_call_accepted) {
ast_mutex_unlock(&p->lock);
- ast_log(LOG_DEBUG, "MFC/R2 call already accepted on channel %s!\n", chan->name);
+ ast_debug(1, "MFC/R2 call already accepted on channel %s!\n", chan->name);
return 0;
}
accept_mode = ast_true(args.charge) ? OR2_CALL_WITH_CHARGE : OR2_CALL_NO_CHARGE;
}
res = ast_waitfor(chan, timeout);
if (res < 0) {
- ast_log(LOG_DEBUG, "ast_waitfor failed on channel %s, going out ...\n", chan->name);
+ ast_debug(1, "ast_waitfor failed on channel %s, going out ...\n", chan->name);
res = -1;
break;
}
}
f = ast_read(chan);
if (!f) {
- ast_log(LOG_DEBUG, "No frame read on channel %s, going out ...\n", chan->name);
+ ast_debug(1, "No frame read on channel %s, going out ...\n", chan->name);
res = -1;
break;
}
if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
- ast_log(LOG_DEBUG, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
+ ast_debug(1, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
ast_frfree(f);
res = -1;
break;
ast_mutex_lock(&p->lock);
if (p->mfcr2_call_accepted) {
ast_mutex_unlock(&p->lock);
- ast_log(LOG_DEBUG, "Accepted MFC/R2 call!\n");
+ ast_debug(1, "Accepted MFC/R2 call!\n");
break;
}
ast_mutex_unlock(&p->lock);
r2cause = OR2_CAUSE_NORMAL_CLEARING;
break;
}
- ast_log(LOG_DEBUG, "ast cause %d resulted in openr2 cause %d/%s\n",
+ ast_debug(1, "ast cause %d resulted in openr2 cause %d/%s\n",
cause, r2cause, openr2_proto_get_disconnect_string(r2cause));
return r2cause;
}
/* Perform low level hangup if no owner left */
#ifdef HAVE_OPENR2
if (p->mfcr2 && p->mfcr2call && openr2_chan_get_direction(p->r2chan) != OR2_DIR_STOPPED) {
- ast_log(LOG_DEBUG, "disconnecting MFC/R2 call on chan %d\n", p->channel);
+ ast_debug(1, "disconnecting MFC/R2 call on chan %d\n", p->channel);
/* If it's an incoming call, check the mfcr2_forced_release setting */
if (openr2_chan_get_direction(p->r2chan) == OR2_DIR_BACKWARD && p->mfcr2_forced_release) {
dahdi_r2_disconnect_call(p, OR2_CAUSE_FORCED_RELEASE);
dahdi_r2_disconnect_call(p, r2cause);
}
} else if (p->mfcr2call) {
- ast_log(LOG_DEBUG, "Clearing call request on channel %d\n", p->channel);
+ ast_debug(1, "Clearing call request on channel %d\n", p->channel);
/* since ast_request() was called but not ast_call() we have not yet dialed
and the openr2 stack will not call on_call_end callback, we need to unset
the mfcr2call flag and bump the monitor count so the monitor thread can take
openr2_chan_answer_call will be called when the callback on_call_accepted is executed */
p->mfcr2_answer_pending = 1;
if (p->mfcr2_charge_calls) {
- ast_log(LOG_DEBUG, "Accepting MFC/R2 call with charge before answering on chan %d\n", p->channel);
+ ast_debug(1, "Accepting MFC/R2 call with charge before answering on chan %d\n", p->channel);
openr2_chan_accept_call(p->r2chan, OR2_CALL_WITH_CHARGE);
} else {
- ast_log(LOG_DEBUG, "Accepting MFC/R2 call with no charge before answering on chan %d\n", p->channel);
+ ast_debug(1, "Accepting MFC/R2 call with no charge before answering on chan %d\n", p->channel);
openr2_chan_accept_call(p->r2chan, OR2_CALL_NO_CHARGE);
}
} else {
- ast_log(LOG_DEBUG, "Answering MFC/R2 call on chan %d\n", p->channel);
+ ast_debug(1, "Answering MFC/R2 call on chan %d\n", p->channel);
dahdi_r2_answer(p);
}
break;
if (p->sig != SIG_MFCR2) {
ast_log(LOG_WARNING, "Received bits changed on %s signalling?\n", sig2str(p->sig));
} else {
- ast_log(LOG_DEBUG, "bits changed in chan %d\n", p->channel);
+ ast_debug(1, "bits changed in chan %d\n", p->channel);
openr2_chan_handle_cas(p->r2chan);
}
#else
if (p->inalarm) break;
if ((p->radio || (p->oprmode < 0))) break;
if (ioctl(p->subs[idx].dfd,DAHDI_DIALING,&x) == -1) {
- ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed on %s: %s\n",ast->name, strerror(errno));
+ ast_debug(1, "DAHDI_DIALING ioctl failed on %s: %s\n",ast->name, strerror(errno));
return NULL;
}
if (!x) { /* if not still dialing in driver */
if (p->mfcr2_call_accepted &&
!p->mfcr2_progress_sent &&
ast->_state == AST_STATE_RINGING) {
- ast_log(LOG_DEBUG, "Enqueuing progress frame after R2 accept in chan %d\n", p->channel);
+ ast_debug(1, "Enqueuing progress frame after R2 accept in chan %d\n", p->channel);
ast_queue_frame(p->owner, &fr);
p->mfcr2_progress_sent = 1;
}
p->waitingfordt.tv_sec = 0;
p->dsp_features &= ~DSP_FEATURE_WAITDIALTONE;
ast_dsp_set_features(p->dsp, p->dsp_features);
- ast_log(LOG_DEBUG, "Got 10 samples of dialtone!\n");
+ ast_debug(1, "Got 10 samples of dialtone!\n");
if (!ast_strlen_zero(p->dop.dialstr)) { /* Dial deferred digits */
res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop);
if (res < 0) {
ast_mutex_unlock(&p->lock);
return NULL;
} else {
- ast_log(LOG_DEBUG, "Sent deferred digit string: %s\n", p->dop.dialstr);
+ ast_debug(1, "Sent deferred digit string: %s\n", p->dop.dialstr);
p->dialing = 1;
p->dop.dialstr[0] = '\0';
p->dop.op = DAHDI_DIAL_OP_REPLACE;
f = ast_read(chan);
if (f->frametype == AST_FRAME_DTMF) {
dtmfbuf[k++] = f->subclass.integer;
- ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass.integer);
+ ast_debug(1, "CID got digit '%c'\n", f->subclass.integer);
res = 2000;
}
ast_frfree(f);
dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
/* Got cid and ring. */
callerid_get_dtmf(dtmfbuf, dtmfcid, &flags);
- ast_log(LOG_DEBUG, "CID is '%s', flags %d\n",
+ ast_debug(1, "CID is '%s', flags %d\n",
dtmfcid, flags);
/* If first byte is NULL, we have no cid */
if (!ast_strlen_zero(dtmfcid))
}
/* If we get a PR event, they hung up while processing calerid */
if ( res == DAHDI_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
- ast_log(LOG_DEBUG, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
+ ast_debug(1, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
p->polarity = POLARITY_IDLE;
callerid_free(cs);
ast_hangup(chan);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- ast_log(LOG_DEBUG, "Maybe some MWI on port %d!\n", i->channel);
+ ast_debug(1, "Maybe some MWI on port %d!\n", i->channel);
if ((mtd = ast_calloc(1, sizeof(*mtd)))) {
mtd->pvt = i;
memcpy(mtd->buf, buf, res);
new_r2link->r2master = AST_PTHREADT_NULL;
r2links[r2links_count] = new_r2link;
r2links_count++;
- ast_log(LOG_DEBUG, "Created new R2 link!\n");
+ ast_debug(1, "Created new R2 link!\n");
}
return r2links[r2links_count - 1];
}
return -EINVAL;
}
num = minor(stbuf.st_rdev);
- ast_log(LOG_DEBUG, "%s -> %d\n", path, num);
+ ast_debug(1, "%s -> %d\n", path, num);
return num;
}
ast_mutex_lock(&p->lock);
if (p->mfcr2call) {
ast_mutex_unlock(&p->lock);
- ast_log(LOG_DEBUG, "Yay!, someone just beat us in the race for channel %d.\n", p->channel);
+ ast_debug(1, "Yay!, someone just beat us in the race for channel %d.\n", p->channel);
goto next;
}
p->mfcr2call = 1;
continue;
}
if (!mfcr2->pvts[i]->r2chan) {
- ast_log(LOG_DEBUG, "Wow, no r2chan on channel %d\n", mfcr2->pvts[i]->channel);
+ ast_debug(1, "Wow, no r2chan on channel %d\n", mfcr2->pvts[i]->channel);
quit_loop = 1;
break;
}
}
if (pollsize == 0) {
if (!was_idle) {
- ast_log(LOG_DEBUG, "Monitor thread going idle since everybody has an owner\n");
+ ast_debug(1, "Monitor thread going idle since everybody has an owner\n");
was_idle = 1;
}
poll(NULL, 0, maxsleep);
/* Create the interface list */
if (!strcasecmp(v->name, "channel") || !strcasecmp(v->name, "channels")) {
- if (options & PROC_DAHDI_OPT_NOCHAN) {
+ if (options & PROC_DAHDI_OPT_NOCHAN) {
ast_log(LOG_WARNING, "Channel '%s' ignored.\n", v->value);
- continue;
+ continue;
}
if (build_channels(confp, v->value, reload, v->lineno, &found_pseudo)) {
if (confp->ignore_failed_channels) {
ast_log(LOG_WARNING, "Channel '%s' failure ignored: ignore_failed_channels.\n", v->value);
continue;
} else {
- return -1;
+ return -1;
}
}
- ast_log(LOG_DEBUG, "Channel '%s' configured.\n", v->value);
+ ast_debug(1, "Channel '%s' configured.\n", v->value);
} else if (!strcasecmp(v->name, "ignore_failed_channels")) {
confp->ignore_failed_channels = ast_true(v->value);
} else if (!strcasecmp(v->name, "buffers")) {
if (!parse_buffers_policy(v->value, &confp->chan.faxbuf_no, &confp->chan.faxbuf_policy)) {
confp->chan.usefaxbuffers = 1;
}
- } else if (!strcasecmp(v->name, "dahdichan")) {
- ast_copy_string(dahdichan, v->value, sizeof(dahdichan));
+ } else if (!strcasecmp(v->name, "dahdichan")) {
+ ast_copy_string(dahdichan, v->value, sizeof(dahdichan));
} else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
usedistinctiveringdetection = ast_true(v->value);
} else if (!strcasecmp(v->name, "distinctiveringaftercid")) {
(redirect = iks_find_cdata(traversenodes, "redirect")) &&
(redirect = strstr(redirect, "xmpp:"))) {
redirect += 5;
- ast_log(LOG_DEBUG, "redirect %s\n", redirect);
+ ast_debug(1, "redirect %s\n", redirect);
ast_copy_string(p->them, redirect, sizeof(p->them));
gtalk_invite(p, p->them, p->us, p->sid, 1);
char s1[BUFSIZ], s2[BUFSIZ], s3[BUFSIZ];
int peernoncodeccapability;
- ast_log(LOG_DEBUG, "The client is %s\n", client->name);
+ ast_debug(1, "The client is %s\n", client->name);
/* Make sure our new call does exist */
for (tmp = client->p; tmp; tmp = tmp->next) {
struct gtalk_pvt *tmp;
char *from;
- ast_log(LOG_DEBUG, "The client is %s\n", client->name);
+ ast_debug(1, "The client is %s\n", client->name);
/* find corresponding call */
for (tmp = client->p; tmp; tmp = tmp->next) {
if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid)) {
/*! \brief Send manager event at call setup to link between Asterisk channel name
and IAX2 call identifiers */
-static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt)
+static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt)
{
manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
"Channel: %s\r\nChanneltype: IAX2\r\nIAX2-callno-local: %d\r\nIAX2-callno-remote: %d\r\nIAX2-peer: %s\r\n",
return 0;
}
time(&t);
- if (t != lasterror)
+ if (t != lasterror)
ast_debug(1, "Out of idle IAX2 threads for scheduling!\n");
lasterror = t;
unsigned short callno = PTR_TO_CALLNO(vid);
ast_mutex_lock(&iaxsl[callno]);
if (iaxs[callno]) {
- if (option_debug) {
- ast_log(LOG_DEBUG, "Really destroying %d now...\n", callno);
- }
+ ast_debug(1, "Really destroying %d now...\n", callno);
iax2_destroy(callno);
}
ast_mutex_unlock(&iaxsl[callno]);
/* Don't send if there was an error, but return error instead */
if (!callno || !iaxs[callno] || iaxs[callno]->error)
return -1;
-
+
/* Called with iaxsl held */
if (iaxdebug)
ast_debug(3, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port));
-
+
if (f->transfer) {
if (iaxdebug)
iax_showframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr));
static void update_jbsched(struct chan_iax2_pvt *pvt)
{
int when;
-
+
when = ast_tvdiff_ms(ast_tvnow(), pvt->rxcore);
-
+
when = jb_next(pvt->jb) - when;
if (when <= 0) {
/* XXX should really just empty until when > 0.. */
when = 1;
}
-
- pvt->jbid = iax2_sched_replace(pvt->jbid, sched, when, get_from_jb,
+
+ pvt->jbid = iax2_sched_replace(pvt->jbid, sched, when, get_from_jb,
CALLNO_TO_PTR(pvt->callno));
}
-static void __get_from_jb(const void *p)
+static void __get_from_jb(const void *p)
{
int callno = PTR_TO_CALLNO(p);
struct chan_iax2_pvt *pvt = NULL;
int needfree = 0;
struct ast_channel *owner = NULL;
struct ast_channel *bridge = NULL;
-
+
/* Attempt to recover wrapped timestamps */
unwrap_timestamp(fr);
return 0;
}
-static int iax2_hangup(struct ast_channel *c)
+static int iax2_hangup(struct ast_channel *c)
{
unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
- struct iax_ie_data ied;
+ struct iax_ie_data ied;
int alreadygone;
- memset(&ied, 0, sizeof(ied));
+ memset(&ied, 0, sizeof(ied));
ast_mutex_lock(&iaxsl[callno]);
if (callno && iaxs[callno]) {
ast_debug(1, "We're hanging up %s now...\n", c->name);
alreadygone = ast_test_flag64(iaxs[callno], IAX_ALREADYGONE);
/* Send the hangup unless we have had a transmission error or are already gone */
- iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause);
+ iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause);
if (!iaxs[callno]->error && !alreadygone) {
- if (send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1)) {
+ if (send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1)) {
ast_log(LOG_WARNING, "No final packet could be sent for callno %d\n", callno);
}
if (!iaxs[callno]) {
iax_ie_append_addr(&ied1, IAX_IE_APPARENT_ADDR, &iaxs[callno0]->addr);
iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[callno0]->peercallno);
iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, transferid);
-
+
res = send_command(iaxs[callno0], AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos, -1);
if (res)
return -1;
return res;
}
-
+
static int iax2_transfer(struct ast_channel *c, const char *dest)
{
unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
ast_queue_control_data(c, AST_CONTROL_TRANSFER, &message, sizeof(message));
return send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1);
}
-
+
static int iax2_getpeertrunk(struct sockaddr_in sin)
{
struct iax2_peer *peer;
} else if (f->frametype == AST_FRAME_IAX) {
genuine = 1;
} else if (f->frametype == AST_FRAME_CNG) {
- p->notsilenttx = 0;
+ p->notsilenttx = 0;
}
}
if (ast_tvzero(p->offset)) {
struct iax2_trunk_peer *tpeer;
void *tmp, *ptr;
struct timeval now;
- int res;
+ int res;
struct ast_iax2_meta_trunk_entry *met;
struct ast_iax2_meta_trunk_mini *mtm;
ast_mutex_unlock(&tpeer->lock);
return -1;
}
-
+
tpeer->trunkdataalloc += DEFAULT_TRUNKDATA;
tpeer->trunkdata = tmp;
ast_debug(1, "Expanded trunk '%s:%d' to %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc);
return res;
}
-static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno,
+static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno,
int now, int transfer, int final)
{
struct ast_frame f = { 0, };
fh.type = AST_FRAME_IAX;
fh.csub = compress_subclass(IAX_COMMAND_INVAL);
iax_outputframe(NULL, &fh, 0, sin, 0);
-#if 0
- if (option_debug)
-#endif
- ast_debug(1, "Raw Hangup %s:%d, src=%d, dst=%d\n",
- ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), src, dst);
+ ast_debug(1, "Raw Hangup %s:%d, src=%d, dst=%d\n",
+ ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), src, dst);
return sendto(sockfd, &fh, sizeof(fh), 0, (struct sockaddr *)sin, sizeof(*sin));
}
calls = tpeer->calls;
#if 0
ast_debug(1, "Trunking %d call chunks in %d bytes to %s:%d, ts=%d\n", calls, fr->datalen, ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), ntohl(mth->ts));
-#endif
+#endif
/* Reset transmit trunk side data */
tpeer->trunkdatalen = 0;
tpeer->calls = 0;
drop = tpeer;
} else {
res = send_trunk(tpeer, &now);
- trunk_timed++;
+ trunk_timed++;
if (iaxtrunkdebug)
ast_verbose(" - Trunk peer (%s:%d) has %d call chunk%s in transit, %d bytes backloged and has hit a high water mark of %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), res, (res != 1) ? "s" : "", tpeer->trunkdatalen, tpeer->trunkdataalloc);
- }
- totalcalls += res;
+ }
+ totalcalls += res;
res = 0;
ast_mutex_unlock(&tpeer->lock);
}
ast_mutex_unlock(&drop->lock);
ast_mutex_destroy(&drop->lock);
ast_free(drop);
-
}
if (iaxtrunkdebug)
if (iax_provision_version(&ourver, rsi, 1))
return 0;
ast_debug(1, "Service identifier '%s', we think '%08x', they think '%08x'\n", si, ourver, ver);
- if (ourver != ver)
+ if (ourver != ver)
iax2_provision(sin, sockfd, NULL, rsi, 1);
return 0;
}
-static void construct_rr(struct chan_iax2_pvt *pvt, struct iax_ie_data *iep)
+static void construct_rr(struct chan_iax2_pvt *pvt, struct iax_ie_data *iep)
{
jb_info stats;
jb_getinfo(pvt->jb, &stats);
-
+
memset(iep, 0, sizeof(*iep));
iax_ie_append_int(iep,IAX_IE_RR_JITTER, stats.jitter);
if (!cur_pkt_buf)
AST_LIST_INSERT_TAIL(&to_here->full_frames, pkt_buf, entry);
-
+
ast_mutex_unlock(&to_here->lock);
}
f.subclass.integer != IAX_COMMAND_TXCNT && /* for attended transfer */
f.subclass.integer != IAX_COMMAND_TXACC) { /* for attended transfer */
unsigned short new_peercallno;
-
+
new_peercallno = (unsigned short) (ntohs(mh->callno) & ~IAX_FLAG_FULL);
if (new_peercallno && new_peercallno != iaxs[fr->callno]->peercallno) {
if (iaxs[fr->callno]->peercallno) {
(f.subclass.integer != IAX_COMMAND_TXACC) &&
(f.subclass.integer != IAX_COMMAND_VNAK)) ||
(f.frametype != AST_FRAME_IAX)) {
- /* If it's not an ACK packet, it's out of order. */
- ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n",
+ /* If it's not an ACK packet, it's out of order. */
+ ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n",
iaxs[fr->callno]->iseqno, fr->oseqno, f.frametype, f.subclass.integer);
/* Check to see if we need to request retransmission,
* and take sequence number wraparound into account */
if ((unsigned char) (iaxs[fr->callno]->iseqno - fr->oseqno) < 128) {
/* If we've already seen it, ack it XXX There's a border condition here XXX */
- if ((f.frametype != AST_FRAME_IAX) ||
+ if ((f.frametype != AST_FRAME_IAX) ||
((f.subclass.integer != IAX_COMMAND_ACK) && (f.subclass.integer != IAX_COMMAND_INVAL))) {
ast_debug(1, "Acking anyway\n");
/* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if
/* Handle implicit ACKing unless this is an INVAL, and only if this is
from the real peer, not the transfer peer */
- if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
+ if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
((f.subclass.integer != IAX_COMMAND_INVAL) ||
(f.frametype != AST_FRAME_IAX))) {
unsigned char x;
/* First we have to qualify that the ACKed value is within our window */
if (iaxs[fr->callno]->rseqno >= iaxs[fr->callno]->oseqno || (fr->iseqno >= iaxs[fr->callno]->rseqno && fr->iseqno < iaxs[fr->callno]->oseqno))
x = fr->iseqno;
- else
+ else
x = iaxs[fr->callno]->oseqno;
if ((x != iaxs[fr->callno]->oseqno) || (iaxs[fr->callno]->oseqno == fr->iseqno)) {
/* The acknowledgement is within our window. Time to acknowledge everything
ast_debug(1, "Received iseqno %d not within window %d->%d\n", fr->iseqno, iaxs[fr->callno]->rseqno, iaxs[fr->callno]->oseqno);
}
}
- if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
- ((f.frametype != AST_FRAME_IAX) ||
+ if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
+ ((f.frametype != AST_FRAME_IAX) ||
((f.subclass.integer != IAX_COMMAND_TXACC) &&
(f.subclass.integer != IAX_COMMAND_TXCNT)))) {
/* Only messages we accept from a transfer host are TXACC and TXCNT */
}
}
/* Schedule the next cycle */
- if ((peer->lastms < 0) || (peer->historicms > peer->maxms))
+ if ((peer->lastms < 0) || (peer->historicms > peer->maxms))
peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_peer_s, peer_ref(peer));
else
peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqok, iax2_poke_peer_s, peer_ref(peer));
}
/* Don't actually pass these frames along */
- if ((f.subclass.integer != IAX_COMMAND_ACK) &&
- (f.subclass.integer != IAX_COMMAND_TXCNT) &&
- (f.subclass.integer != IAX_COMMAND_TXACC) &&
+ if ((f.subclass.integer != IAX_COMMAND_ACK) &&
+ (f.subclass.integer != IAX_COMMAND_TXCNT) &&
+ (f.subclass.integer != IAX_COMMAND_TXACC) &&
(f.subclass.integer != IAX_COMMAND_INVAL) &&
- (f.subclass.integer != IAX_COMMAND_VNAK)) {
- if (iaxs[fr->callno] && iaxs[fr->callno]->aseqno != iaxs[fr->callno]->iseqno)
+ (f.subclass.integer != IAX_COMMAND_VNAK)) {
+ if (iaxs[fr->callno] && iaxs[fr->callno]->aseqno != iaxs[fr->callno]->iseqno)
send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
}
ast_mutex_unlock(&iaxsl[fr->callno]);
if (iaxdebug)
ast_debug(1, "Sending registration request for '%s'\n", reg->username);
- if (reg->dnsmgr &&
+ if (reg->dnsmgr &&
((reg->regstate == REG_STATE_TIMEOUT) || !ast_sockaddr_ipv4(®->addr))) {
/* Maybe the IP has changed, force DNS refresh */
ast_dnsmgr_refresh(reg->dnsmgr);
}
-
+
/*
* if IP has Changed, free allocated call to create a new one with new IP
* call has the pointer to IP and must be updated to the new one
if (iaxdebug)
ast_debug(1, "Unable to send registration request for '%s' without IP address\n", reg->username);
/* Setup the next registration attempt */
- reg->expire = iax2_sched_replace(reg->expire, sched,
+ reg->expire = iax2_sched_replace(reg->expire, sched,
(5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg);
return -1;
}
ast_mutex_unlock(&iaxsl[reg->callno]);
}
/* Setup the next registration a little early */
- reg->expire = iax2_sched_replace(reg->expire, sched,
+ reg->expire = iax2_sched_replace(reg->expire, sched,
(5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg);
/* Send the request */
memset(&ied, 0, sizeof(ied));
{
int sd;
int res;
-
+
sd = socket(AF_INET, SOCK_DGRAM, 0);
if (sd < 0) {
ast_log(LOG_ERROR, "Socket: %s\n", strerror(errno));
}
}
}
-
+
peer->sockfd = sockfd;
if (nonlocal == 1) {
}
/*! \brief Part of the device state notification system ---*/
-static int iax2_devicestate(void *data)
+static int iax2_devicestate(void *data)
{
struct parsed_dial_string pds;
char *tmp = ast_strdupa(data);
ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", (char *) data);
return res;
}
-
+
ast_debug(3, "Checking device state for device %s\n", pds.peer);
/* SLD: FIXME: second call to find_peer during registration */
res = AST_DEVICE_UNAVAILABLE;
ast_debug(3, "iax2_devicestate: Found peer. What's device state of %s? addr=%d, defaddr=%d maxms=%d, lastms=%d\n",
pds.peer, ast_sockaddr_ipv4(&p->addr), p->defaddr.sin_addr.s_addr, p->maxms, p->lastms);
-
+
if ((ast_sockaddr_ipv4(&p->addr) || p->defaddr.sin_addr.s_addr) &&
(!p->maxms || ((p->lastms > -1) && (p->historicms <= p->maxms)))) {
/* Peer is registered, or have default IP address
and a valid registration */
if (p->historicms == 0 || p->historicms <= p->maxms)
/* let the core figure out whether it is in use or not */
- res = AST_DEVICE_UNKNOWN;
+ res = AST_DEVICE_UNKNOWN;
}
peer_unref(p);
return res;
}
-static struct ast_switch iax2_switch =
+static struct ast_switch iax2_switch =
{
name: "IAX2",
description: "IAX Remote Dialplan Switch",
{
struct ast_frame *f;
- if (tmp->dsp) {
- f = ast_dsp_process(tmp->ast, tmp->dsp, frame);
- } else {
+ if (tmp->dsp) {
+ f = ast_dsp_process(tmp->ast, tmp->dsp, frame);
+ } else {
chan_misdn_log(0, tmp->bc->port, "No DSP-Path found\n");
return NULL;
}
ast_debug(1, "Detected inband DTMF digit: %c\n", f->subclass.integer);
- if (tmp->faxdetect && (f->subclass.integer == 'f')) {
- /* Fax tone -- Handle and return NULL */
- if (!tmp->faxhandled) {
- struct ast_channel *ast = tmp->ast;
- tmp->faxhandled++;
- chan_misdn_log(0, tmp->bc->port, "Fax detected, preparing %s for fax transfer.\n", ast->name);
- tmp->bc->rxgain = 0;
- isdn_lib_update_rxgain(tmp->bc);
- tmp->bc->txgain = 0;
- isdn_lib_update_txgain(tmp->bc);
+ if (tmp->faxdetect && (f->subclass.integer == 'f')) {
+ /* Fax tone -- Handle and return NULL */
+ if (!tmp->faxhandled) {
+ struct ast_channel *ast = tmp->ast;
+ tmp->faxhandled++;
+ chan_misdn_log(0, tmp->bc->port, "Fax detected, preparing %s for fax transfer.\n", ast->name);
+ tmp->bc->rxgain = 0;
+ isdn_lib_update_rxgain(tmp->bc);
+ tmp->bc->txgain = 0;
+ isdn_lib_update_txgain(tmp->bc);
#ifdef MISDN_1_2
*tmp->bc->pipeline = 0;
#else
- tmp->bc->ec_enable = 0;
+ tmp->bc->ec_enable = 0;
#endif
- isdn_lib_update_ec(tmp->bc);
- isdn_lib_stop_dtmf(tmp->bc);
- switch (tmp->faxdetect) {
- case 1:
- if (strcmp(ast->exten, "fax")) {
- char *context;
- char context_tmp[BUFFERSIZE];
- misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp));
- context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext) : context_tmp;
+ isdn_lib_update_ec(tmp->bc);
+ isdn_lib_stop_dtmf(tmp->bc);
+ switch (tmp->faxdetect) {
+ case 1:
+ if (strcmp(ast->exten, "fax")) {
+ char *context;
+ char context_tmp[BUFFERSIZE];
+ misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp));
+ context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext) : context_tmp;
if (ast_exists_extension(ast, context, "fax", 1,
S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) {
- ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast->name, context);
- /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
- pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten);
- if (ast_async_goto(ast, context, "fax", 1)) {
- ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, context);
+ ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast->name, context);
+ /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
+ pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten);
+ if (ast_async_goto(ast, context, "fax", 1)) {
+ ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, context);
}
- } else {
- ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast->exten);
+ } else {
+ ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast->exten);
}
- } else {
+ } else {
ast_debug(1, "Already in a fax extension, not redirecting\n");
}
- break;
- case 2:
- ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast->name);
- break;
+ break;
+ case 2:
+ ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast->name);
+ break;
default:
break;
- }
- } else {
+ }
+ } else {
ast_debug(1, "Fax already handled\n");
}
- }
+ }
- if (tmp->ast_dsp && (f->subclass.integer != 'f')) {
- chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass.integer);
- }
+ if (tmp->ast_dsp && (f->subclass.integer != 'f')) {
+ chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass.integer);
+ }
return f;
}
return -1;
}
- ast_log(LOG_DEBUG, "%s(%s)\n", misdn_command_name, (char *) data);
+ ast_debug(1, "%s(%s)\n", misdn_command_name, (char *) data);
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(subcommand, parse);
if (res == -1) {
switch (errno) {
- case EBADF: /* Bad file descriptor - seems like this is generated when the host exist, but doesn't accept the UDP packet */
- case EHOSTUNREACH: /* Host can't be reached */
- case ENETDOWN: /* Interface down */
+ case EBADF: /* Bad file descriptor - seems like this is generated when the host exist, but doesn't accept the UDP packet */
+ case EHOSTUNREACH: /* Host can't be reached */
+ case ENETDOWN: /* Interface down */
case ENETUNREACH: /* Network failure */
case ECONNREFUSED: /* ICMP port unreachable */
res = XMIT_ERROR; /* Don't bother with trying to transmit again */
if (!p->pendinginvite) { /* We are up, and have no outstanding invite */
transmit_reinvite_with_sdp(p, FALSE, FALSE);
} else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
- ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
- }
+ ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
+ }
break;
default:
ast_log(LOG_WARNING, "Don't know how to send URI when state is %d!\n", chan->_state);
if (debug)
ast_verbose("Sending text %s on %s\n", text, ast->name);
transmit_message_with_text(dialog, text);
- return 0;
+ return 0;
}
/*! \brief Update peer object in realtime storage
dialog_unlink_all(peer->call, TRUE, TRUE);
peer->call = dialog_unref(peer->call, "peer->call is being unset");
}
-
if (peer->mwipvt) { /* We have an active subscription, delete it */
dialog_unlink_all(peer->mwipvt, TRUE, TRUE);
peer->mwipvt = dialog_unref(peer->mwipvt, "unreffing peer->mwipvt");
}
-
+
if (peer->chanvars) {
ast_variables_destroy(peer->chanvars);
peer->chanvars = NULL;
}
-
+
register_peer_exten(peer, FALSE);
ast_free_ha(peer->ha);
ast_free_ha(peer->directmediaha);
reg->call = dialog_unref(reg->call, "unref reg->call");
/* reg->call = sip_destroy(reg->call); */
}
- AST_SCHED_DEL(sched, reg->expire);
+ AST_SCHED_DEL(sched, reg->expire);
AST_SCHED_DEL(sched, reg->timeout);
-
+
ast_string_field_free_memory(reg);
ast_atomic_fetchadd_int(®objs, -1);
ast_dnsmgr_release(reg->dnsmgr);
return "488 Not Acceptable Here";
case AST_CAUSE_INTERWORKING: /* Unspecified Interworking issues */
return "500 Network error";
-
+
case AST_CAUSE_NOTDEFINED:
default:
ast_debug(1, "AST hangup cause %d (no match found in SIP)\n", cause);
ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because it is not shared by both ends.\n");
} else
ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because of unrecognized/not configured codec (check allow/disallow in sip.conf): %s\n", codec);
- return;
+ return;
}
/*! \brief sip_answer: Answer SIP call , send 200 OK on Invite
sip_pvt_lock(p);
if (ast->_state != AST_STATE_UP) {
- try_suggested_sip_codec(p);
+ try_suggested_sip_codec(p);
ast_setstate(ast, AST_STATE_UP);
ast_debug(1, "SIP answering channel: %s\n", ast->name);
needvideo = 1;
else if (!ast_format_cap_is_empty(i->prefcaps))
needvideo = ast_format_cap_has_type(i->prefcaps, AST_FORMAT_TYPE_VIDEO); /* Outbound call */
- else
+ else
needvideo = ast_format_cap_has_type(i->jointcaps, AST_FORMAT_TYPE_VIDEO); /* Inbound call */
}
if (i->trtp) {
if (!ast_format_cap_is_empty(i->prefcaps))
needtext = ast_format_cap_has_type(i->prefcaps, AST_FORMAT_TYPE_TEXT); /* Outbound call */
- else
+ else
needtext = ast_format_cap_has_type(i->jointcaps, AST_FORMAT_TYPE_TEXT); /* Inbound call */
}
}
}
}
-
+
return f;
}
/* Add to active dialog list */
ao2_t_link(dialogs, p, "link pvt into dialogs table");
-
+
ast_debug(1, "Allocating new SIP dialog for %s - %s (%s)\n", callid ? callid : p->callid, sip_methods[intended_method].text, p->rtp ? "With RTP" : "No RTP");
return p;
}
}
ast_debug(3, "Processing session-level SDP %c=%s... %s\n", type, value, (processed == TRUE)? "OK." : "UNSUPPORTED.");
- }
+ }
ast_set_read_format(p->owner, &p->owner->readformat);
ast_set_write_format(p->owner, &p->owner->writeformat);
}
-
+
if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && (!ast_sockaddr_isnull(sa) || !ast_sockaddr_isnull(vsa) || !ast_sockaddr_isnull(tsa) || !ast_sockaddr_isnull(isa)) && (!sendonly || sendonly == -1)) {
ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
/* Activate a re-invite */
int is_outbound = ast_test_flag(&p->flags[0], SIP_OUTGOING); /* Session direction */
memset(req, 0, sizeof(struct sip_request));
-
+
snprintf(p->lastmsg, sizeof(p->lastmsg), "Tx: %s", sip_methods[sipmethod].text);
-
+
if (!seqno) {
p->ocseq++;
seqno = p->ocseq;
}
-
+
/* A CANCEL must have the same branch as the INVITE that it is canceling. */
if (sipmethod == SIP_CANCEL) {
p->branch = p->invite_branch;
if (sipdebug)
ast_debug(1, "Strict routing enforced for session %s\n", p->callid);
}
-
+
if (sipmethod == SIP_CANCEL)
c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2); /* Use original URI */
else if (sipmethod == SIP_ACK) {
(we only have the contacturi on INVITEs) */
if (!ast_strlen_zero(p->okcontacturi))
c = is_strict ? p->route->hop : p->okcontacturi;
- else
- c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);
+ else
+ c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);
} else if (!ast_strlen_zero(p->okcontacturi))
c = is_strict ? p->route->hop : p->okcontacturi; /* Use for BYE or REINVITE */
else if (!ast_strlen_zero(p->uri))
{
struct sip_request resp;
int seqno;
-
+
if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
return -1;
/* Strip of the starting " (if it's there) */
if (*headdup == '"') {
- headdup++;
+ headdup++;
}
if ((content = strchr(headdup, ':'))) {
*content++ = '\0';
content = ast_skip_blanks(content); /* Skip white space */
/* Strip the ending " (if it's there) */
- end = content + strlen(content) -1;
+ end = content + strlen(content) -1;
if (*end == '"') {
*end = '\0';
}
-
+
add_header(&req, headdup, content);
if (sipdebug) {
ast_debug(1, "Adding SIP Header \"%s\" with content :%s: \n", headdup, content);
if (!ast_strlen_zero(global_useragent))
add_header(&req, "User-Agent", global_useragent);
- if (auth) { /* Add auth header */
+ if (auth) { /* Add auth header */
add_header(&req, authheader, auth);
} else if (!ast_strlen_zero(r->nonce)) {
char digest[1024];
static int transmit_refer(struct sip_pvt *p, const char *dest)
{
struct sip_request req = {
- .headers = 0,
+ .headers = 0,
};
char from[256];
const char *of;
/* We only want to create the route set the first time this is called */
p->route_persistent = 1;
-
+
/* Build a tailq, then assign it to p->route when done.
* If backwards, we add entries from the head so they end up
* in reverse order. However, we do need to maintain a correct
}
/* Search dialogs and find the match */
-
+
sip_pvt_ptr = ao2_t_find(dialogs, &tmp_dialog, OBJ_POINTER, "ao2_find of dialog in dialogs table");
if (sip_pvt_ptr) {
/* Go ahead and lock it (and its owner) before returning */
return NULL;
}
}
-
+
if (totag)
ast_debug(4, "Matched %s call - their tag is %s Our tag is %s\n",
sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING",
}
ast_copy_string(referdata->replaces_callid_totag, ptr, sizeof(referdata->replaces_callid_totag));
}
-
+
if (from) {
ptr = from + 9;
if ((to = strchr(ptr, '&'))) {
}
ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag));
}
-
+
if (!sip_cfg.pedanticsipchecking) {
ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s (No check of from/to tags)\n", referdata->replaces_callid );
} else {
ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s F-tag: %s T-tag: %s\n", referdata->replaces_callid, referdata->replaces_callid_fromtag ? referdata->replaces_callid_fromtag : "<none>", referdata->replaces_callid_totag ? referdata->replaces_callid_totag : "<none>" );
}
}
-
+
if ((ptr = strchr(refer_to, '@'))) { /* Separate domain */
char *urioption = NULL, *domain;
int bracket = 0;
sip_pvt_unlock(dialog);
return 0;
}
-
+
if (dialog->vrtp && ast_rtp_instance_get_bridged(dialog->vrtp)) {
ast_debug(2, "Bridge still active. Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
sip_pvt_unlock(dialog);
memset(digest, 0, sizeof(digest));
if (reply_digest(p, req, header, SIP_REGISTER, digest, sizeof(digest))) {
/* There's nothing to use for authentication */
- /* No digest challenge in request */
- if (sip_debug_test_pvt(p) && p->registry)
- ast_verbose("No authentication challenge, sending blank registration to domain/host name %s\n", p->registry->hostname);
- /* No old challenge */
+ /* No digest challenge in request */
+ if (sip_debug_test_pvt(p) && p->registry)
+ ast_verbose("No authentication challenge, sending blank registration to domain/host name %s\n", p->registry->hostname);
+ /* No old challenge */
return -1;
}
if (p->do_history)
append_history(p, "RegistryAuth", "Try: %d", p->authtries);
- if (sip_debug_test_pvt(p) && p->registry)
- ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname);
+ if (sip_debug_test_pvt(p) && p->registry)
+ ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname);
return transmit_register(p->registry, SIP_REGISTER, digest, respheader);
}
snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random());
- /* Check if we have separate auth credentials */
- if(!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */
- auth = find_realm_authentication(authl, p->realm); /* If not, global list */
+ /* Check if we have separate auth credentials */
+ if(!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */
+ auth = find_realm_authentication(authl, p->realm); /* If not, global list */
- if (auth) {
+ if (auth) {
ast_debug(3, "use realm [%s] from peer [%s][%s]\n", auth->username, p->peername, p->username);
- username = auth->username;
- secret = auth->secret;
- md5secret = auth->md5secret;
+ username = auth->username;
+ secret = auth->secret;
+ md5secret = auth->md5secret;
if (sipdebug)
- ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid);
- } else {
- /* No authentication, use peer or register= config */
- username = p->authname;
- secret = p->peersecret;
- md5secret = p->peermd5secret;
- }
+ ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid);
+ } else {
+ /* No authentication, use peer or register= config */
+ username = p->authname;
+ secret = p->peersecret;
+ md5secret = p->peermd5secret;
+ }
if (ast_strlen_zero(username)) /* We have no authentication */
return -1;
- /* Calculate SIP digest response */
- snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
+ /* Calculate SIP digest response */
+ snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
snprintf(a2, sizeof(a2), "%s:%s", sip_methods[method].text, uri);
if (!ast_strlen_zero(md5secret))
ast_copy_string(a1_hash, md5secret, sizeof(a1_hash));
/* Perhaps there is an SD change INVITE outstanding */
transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, TRUE);
}
- ast_clear_flag(&p->flags[0], SIP_PENDINGBYE);
+ ast_clear_flag(&p->flags[0], SIP_PENDINGBYE);
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
} else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) {
/* if we can't REINVITE, hold it for later */
ast_debug(2, "Sending pending reinvite on '%s'\n", p->callid);
/* Didn't get to reinvite yet, so do it now */
transmit_reinvite_with_sdp(p, (p->t38.state == T38_LOCAL_REINVITE ? TRUE : FALSE), FALSE);
- ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
+ ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
}
}
}
pvt_set_needdestroy(p, "received erroneous 200 response");
return 0;
}
-
+
r->regstate = REG_STATE_REGISTERED;
r->regtime = ast_tvnow(); /* Reset time of last successful registration */
manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: SIP\r\nDomain: %s\r\nStatus: %s\r\n", r->hostname, regstate2str(r->regstate));
/* Let this one hang around until we have all the responses */
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
/* p->needdestroy = 1; */
-
+
/* set us up for re-registering
* figure out how long we got registered for
* according to section 6.13 of RFC, contact headers override
break;
default: /* Errors without handlers */
if ((resp >= 100) && (resp < 200)) {
- if (sipmethod == SIP_INVITE) { /* re-invite */
+ if (sipmethod == SIP_INVITE) { /* re-invite */
if (!req->ignore && sip_cancel_destroy(p))
ast_log(LOG_WARNING, "Unable to cancel SIP destruction. Expect bad things.\n");
}
}
res = ast_park_call(transferee, transferer, 0, d->parkexten, &ext);
-
#ifdef WHEN_WE_KNOW_THAT_THE_CLIENT_SUPPORTS_MESSAGE
if (!res) {
static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target)
{
int res = 0;
- struct ast_channel *peera = NULL,
+ struct ast_channel *peera = NULL,
*peerb = NULL,
*peerc = NULL,
*peerd = NULL;
/* We will try to connect the transferee with the target and hangup
- all channels to the transferer */
+ all channels to the transferer */
ast_debug(4, "Sip transfer:--------------------\n");
if (transferer->chan1)
ast_debug(4, "-- Transferer to PBX channel: %s State %s\n", transferer->chan1->name, ast_state2str(transferer->chan1->_state));
if (peera && peerb && peerc && (peerb != peerc)) {
ast_quiet_chan(peera); /* Stop generators */
- ast_quiet_chan(peerb);
+ ast_quiet_chan(peerb);
ast_quiet_chan(peerc);
if (peerd)
ast_quiet_chan(peerd);
*sep++ = '\0';
eventid = sep;
}
-
+
if (sipdebug)
ast_debug(2, "Got NOTIFY Event: %s\n", event);
We are getting notifications on a call that we transfered
We should hangup when we are getting a 200 OK in a sipfrag
Check if we have an owner of this event */
-
+
/* Check the content type */
if (strncasecmp(get_header(req, "Content-Type"), "message/sipfrag", strlen("message/sipfrag"))) {
/* We need a sipfrag */
transmit_response(p, "202 Accepted", req);
append_history(p, "Xfer", "Refer failed. Bad extension.");
transmit_notify_with_sipfrag(p, seqno, "404 Not found", TRUE);
- ast_clear_flag(&p->flags[0], SIP_GOTREFER);
+ ast_clear_flag(&p->flags[0], SIP_GOTREFER);
if (req->debug)
ast_debug(1, "SIP transfer to bad extension: %s\n", p->refer->refer_to);
break;
if (p->owner)
p->owner->hangupcause = AST_CAUSE_NORMAL_CLEARING;
append_history(p, "Xfer", "Refer succeeded.");
- ast_clear_flag(&p->flags[0], SIP_GOTREFER);
+ ast_clear_flag(&p->flags[0], SIP_GOTREFER);
/* Do not hangup call, the other side do that when we say 200 OK */
/* We could possibly implement a timer here, auto congestion */
res = 0;
/* Failure of some kind */
p->refer->status = REFER_FAILED;
transmit_notify_with_sipfrag(p, seqno, "503 Service Unavailable", TRUE);
- ast_clear_flag(&p->flags[0], SIP_GOTREFER);
+ ast_clear_flag(&p->flags[0], SIP_GOTREFER);
res = -1;
}
int resubscribe = (p->subscribed != NONE) && !req->ignore;
char *temp, *event;
- if (p->initreq.headers) {
+ if (p->initreq.headers) {
/* We already have a dialog */
if (p->initreq.method != SIP_SUBSCRIBE) {
/* This is a SUBSCRIBE within another SIP dialog, which we do not support */
/* For transfers, this could happen, but since we haven't seen it happening, let us just refuse this */
- transmit_response(p, "403 Forbidden (within dialog)", req);
+ transmit_response(p, "403 Forbidden (within dialog)", req);
/* Do not destroy session, since we will break the call if we do */
ast_debug(1, "Got a subscription within the context of another call, can't handle that - %s (Method %s)\n", p->callid, sip_methods[p->initreq.method].text);
return 0;
if so, we don't have to check peer settings after auth, which saves a lot of processing
*/
if (!sip_cfg.allowsubscribe) {
- transmit_response(p, "403 Forbidden (policy)", req);
+ transmit_response(p, "403 Forbidden (policy)", req);
pvt_set_needdestroy(p, "forbidden");
return 0;
}
if ( (strchr(eventheader, ';'))) {
event = ast_strdupa(eventheader); /* Since eventheader is a const, we can't change it */
- temp = strchr(event, ';');
+ temp = strchr(event, ';');
*temp = '\0'; /* Remove any options for now */
/* We might need to use them later :-) */
} else
while (!found_supported && !ast_strlen_zero(acceptheader)) {
found_supported = strcmp(acceptheader, "application/simple-message-summary") ? 0 : 1;
if (!found_supported && (option_debug > 2)) {
- ast_log(LOG_DEBUG, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
+ ast_debug(1, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
}
acceptheader = __get_header(req, "Accept", &start);
}
/* New SIP request coming in
(could be new request in existing SIP dialog as well...)
- */
-
+ */
p->method = req->method; /* Find out which SIP method they are using */
ast_debug(4, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, cmd);
/* Request failed */
ast_debug(1, "SIP message could not be handled, bad request: %-70.70s\n", p->callid[0] ? p->callid : "<no callid>");
}
-
+
if (recount)
ast_update_use_count();
if ((p = find_peer(host, NULL, FALSE, FINDALLDEVICES, TRUE, 0))) {
if (!(ast_sockaddr_isnull(&p->addr) && ast_sockaddr_isnull(&p->defaddr))) {
/* we have an address for the peer */
-
+
/* Check status in this order
- Hold
- Ringing
ao2_t_unlink(dialogs, p, "About to change the callid -- remove the old name");
build_callid_pvt(p);
ao2_t_link(dialogs, p, "Linking in under new name");
-
+
/* We have an extension to call, don't use the full contact here */
/* This to enable dialing registered peers with extension dialling,
like SIP/peername/extension
AST_LIST_INSERT_TAIL(&domain_list, d, list);
AST_LIST_UNLOCK(&domain_list);
- if (sipdebug)
+ if (sipdebug)
ast_debug(1, "Added local SIP domain '%s'\n", domain);
return 1;
if (len && !ast_strlen_zero(d->context))
ast_copy_string(context, d->context, len);
-
+
result = 1;
break;
}
sip_cfg.allowguest = ast_true(v->value) ? 1 : 0;
} else if (!strcasecmp(v->name, "realm")) {
ast_copy_string(sip_cfg.realm, v->value, sizeof(sip_cfg.realm));
- } else if (!strcasecmp(v->name, "domainsasrealm")) {
+ } else if (!strcasecmp(v->name, "domainsasrealm")) {
sip_cfg.domainsasrealm = ast_true(v->value);
} else if (!strcasecmp(v->name, "useragent")) {
ast_copy_string(global_useragent, v->value, sizeof(global_useragent));
STANDARD_TLS_PORT);
}
ast_tcptls_server_start(&sip_tls_desc);
- if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) {
+ if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) {
ast_log(LOG_ERROR, "TLS Server start failed. Not listening on TLS socket.\n");
sip_tls_desc.tls_cfg = NULL;
}
static int sip_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl)
{
struct sip_pvt *p;
-
+
p = chan->tech_pvt;
if (!p) {
return -1;
{
struct ast_var_t *newvariable;
struct varshead *headp;
- int removeall = 0;
+ int removeall = 0;
char *inbuf = (char *) data;
if (ast_strlen_zero(inbuf)) {
static int sip_do_reload(enum channelreloadreason reason)
{
time_t start_poke, end_poke;
-
+
reload_config(reason);
ast_sched_dump(sched);
sip_send_all_mwi_subscriptions();
end_poke = time(0);
-
+
ast_debug(4, "do_reload finished. peer poke/prune reg contact time = %d sec.\n", (int)(end_poke-start_poke));
ast_debug(4, "--------------- SIP reload done\n");
/*! \brief Force reload of module from cli */
static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
-
+
switch (cmd) {
case CLI_INIT:
e->command = "sip reload";
struct skinny_subchannel *xferor; /* the sub doing the transferring */
struct skinny_subchannel *xferee; /* the sub being transferred */
struct ast_tone_zone_sound *ts = NULL;
-
+
if (ast_bridged_channel(sub->owner) || ast_bridged_channel(sub->related->owner)) {
if (sub->xferor) {
xferor = sub;
xferor = sub;
xferee = sub->related;
}
-
+
if (skinnydebug) {
ast_debug(1, "Transferee channels (local/remote): %s and %s\n",
xferee->owner->name, ast_bridged_channel(xferee->owner)?ast_bridged_channel(xferee->owner)->name:"");
}
return 0;
} else {
- if (option_debug)
- ast_log(LOG_DEBUG, "Neither %s nor %s are in a bridge, nothing to transfer\n",
- xferor->owner->name, xferee->owner->name);
+ ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n",
+ xferor->owner->name, xferee->owner->name);
}
}
return 0;
} else {
/* Not ideal, but let's send updated time at onhook and offhook, as it clears the display */
transmit_definetimedate(d);
-
+
if (sub && sub->owner) {
ast_debug(1, "Current sub [%s] already has owner\n", sub->owner->name);
} else {
} else if (res != 4) {
ast_log(LOG_WARNING, "Skinny Client sent less data than expected. Expected 4 but got %d.\n", res);
ast_mutex_unlock(&s->lock);
-
+
if (res == 0) {
if (skinnydebug)
ast_verb(1, "Skinny Client was lost, unregistering\n");
}
ast_debug(3, "Skinny Session returned: %s\n", strerror(errno));
- if (s)
+ if (s)
destroy_session(s);
-
+
return 0;
}
{
struct ast_channel *ast;
- ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
+ ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
p->outgoing = 1;
ast = sig_pri_new_ast_channel(p, AST_STATE_RESERVED, law, transfercapability, p->exten, requestor);
timeout = pri_gendigittimeout;
res = ast_waitfordigit(chan, timeout);
if (res < 0) {
- ast_log(LOG_DEBUG, "waitfordigit returned < 0...\n");
+ ast_debug(1, "waitfordigit returned < 0...\n");
ast_hangup(chan);
return NULL;
} else if (res) {
ast_log(LOG_WARNING, "PBX exited non-zero!\n");
}
} else {
- ast_log(LOG_DEBUG, "No such possible extension '%s' in context '%s'\n", exten, chan->context);
+ ast_debug(1, "No such possible extension '%s' in context '%s'\n", exten, chan->context);
chan->hangupcause = AST_CAUSE_UNALLOCATED;
ast_hangup(chan);
p->exten[0] = '\0';
pvt->waiting_for_aoce = 1;
ast_channel_setwhentohangup_tv(pvt->owner, whentohangup);
- ast_log(LOG_DEBUG, "Delaying hangup on %s for aoc-e msg\n", pvt->owner->name);
+ ast_debug(1, "Delaying hangup on %s for aoc-e msg\n", pvt->owner->name);
cleanup_termination_request:
ast_channel_unlock(pvt->owner);
const char *useruser = pbx_builtin_getvar_helper(ast, "USERUSERINFO");
#endif
- ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
+ ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
if (!ast->tech_pvt) {
ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
return 0;
sig_pri_moh_fsm_event(ast, p, SIG_PRI_MOH_EVENT_RESET);
if (p->call) {
if (p->alreadyhungup) {
- ast_log(LOG_DEBUG, "Already hungup... Calling hangup once, and clearing call\n");
+ ast_debug(1, "Already hungup... Calling hangup once, and clearing call\n");
#ifdef SUPPORT_USERUSER
pri_call_set_useruser(p->call, useruser);
} else {
const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE");
int icause = ast->hangupcause ? ast->hangupcause : -1;
- ast_log(LOG_DEBUG, "Not yet hungup... Calling hangup once with icause, and clearing call\n");
+ ast_debug(1, "Not yet hungup... Calling hangup once with icause, and clearing call\n");
#ifdef SUPPORT_USERUSER
pri_call_set_useruser(p->call, useruser);
struct ast_flags opts;
char *opt_args[OPT_ARG_ARRAY_SIZE];
- ast_log(LOG_DEBUG, "CALLER NAME: %s NUM: %s\n",
+ ast_debug(1, "CALLER NAME: %s NUM: %s\n",
S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""),
S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""));
}
break;
case AST_CONTROL_PROCEEDING:
- ast_debug(1,"Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
+ ast_debug(1, "Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
if (p->call_level < SIG_PRI_CALL_LEVEL_PROCEEDING && !p->outgoing) {
p->call_level = SIG_PRI_CALL_LEVEL_PROCEEDING;
if (p->pri && p->pri->pri) {
res = 0;
break;
case AST_CONTROL_PROGRESS:
- ast_debug(1,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
+ ast_debug(1, "Received AST_CONTROL_PROGRESS on %s\n",chan->name);
sig_pri_set_digital(p, 0); /* Digital-only calls isn't allowing any inband progress messages */
if (!p->progress && p->call_level < SIG_PRI_CALL_LEVEL_ALERTING && !p->outgoing
&& !p->no_b_channel) {
* and initiate the softhangup since the delay is no longer necessary */
if (p->waiting_for_aoce) {
p->waiting_for_aoce = 0;
- ast_log(LOG_DEBUG,
+ ast_debug(1,
"Received final AOC-E msg, continue with hangup on %s\n",
chan->name);
ast_softhangup_nolock(chan, AST_SOFTHANGUP_DEV);
sig_pri_lock_private(p);
if (!p->pri || !p->call) {
- ast_log(LOG_DEBUG, "Unable to find pri or call on channel!\n");
+ ast_debug(1, "Unable to find pri or call on channel!\n");
sig_pri_unlock_private(p);
return -1;
}
res = pri_callrerouting_facility(p->pri->pri, p->call, destination, original, reason);
pri_rel(p->pri);
} else {
- ast_log(LOG_DEBUG, "Unable to grab pri to send callrerouting facility on span %d!\n", p->pri->span);
+ ast_debug(1, "Unable to grab pri to send callrerouting facility on span %d!\n", p->pri->span);
}
sig_pri_unlock_private(p);
float tmpf[ILBC_SAMPLES];
if (!f->data.ptr && f->datalen) {
- ast_log(LOG_DEBUG, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", f->datalen, f->src ? f->src : "no src set");
+ ast_debug(1, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", f->datalen, f->src ? f->src : "no src set");
f->datalen = 0;
}
ast_log(LOG_WARNING, "Huh? An ilbc frame that isn't a multiple of 50 bytes long from %s (%d)?\n", f->src, f->datalen);
return -1;
}
-
+
for (x=0; x < f->datalen ; x += ILBC_FRAME_LEN) {
- if (pvt->samples + ILBC_SAMPLES > BUFFER_SAMPLES) {
+ if (pvt->samples + ILBC_SAMPLES > BUFFER_SAMPLES) {
ast_log(LOG_WARNING, "Out of buffer space\n");
return -1;
- }
+ }
iLBC_decode(tmpf, plc_mode ? f->data.ptr + x : NULL, &tmp->dec, plc_mode);
for ( i=0; i < ILBC_SAMPLES; i++)
dst[pvt->samples + i] = tmpf[i];
#define CHECK_BLOCKING(c) do { \
if (ast_test_flag(c, AST_FLAG_BLOCKING)) {\
- if (option_debug) \
- ast_log(LOG_DEBUG, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), (c)->name, (long) (c)->blocker, (c)->blockproc); \
+ ast_debug(1, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), (c)->name, (long) (c)->blocker, (c)->blockproc); \
} else { \
(c)->blocker = pthread_self(); \
(c)->blockproc = __PRETTY_FUNCTION__; \
int _sched_res = -1; \
while (id > -1 && (_sched_res = ast_sched_del(sched, id)) && ++_count < 10) \
usleep(1); \
- if (_count == 10 && option_debug > 2) { \
- ast_log(LOG_DEBUG, "Unable to cancel schedule ID %d.\n", id); \
+ if (_count == 10) { \
+ ast_debug(3, "Unable to cancel schedule ID %d.\n", id); \
} \
id = -1; \
(_sched_res); \
usleep(1); \
ast_mutex_lock(lock); \
} \
- if (_count == 10 && option_debug > 2) { \
- ast_log(LOG_DEBUG, "Unable to cancel schedule ID %d.\n", id); \
+ if (_count == 10) { \
+ ast_debug(3, "Unable to cancel schedule ID %d.\n", id); \
} \
id = -1; \
(_sched_res); \
snprintf(s, strlen(path) + 19, "%s/lock", path);
unlink(s);
path_lock_destroy(p);
- ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
+ ast_debug(1, "Unlocked path '%s'\n", path);
} else {
- ast_log(LOG_DEBUG, "Failed to unlock path '%s': "
+ ast_debug(1, "Failed to unlock path '%s': "
"lock not found\n", path);
}
other_factory_ms = other_factory_samples / 8;
if (ast_test_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC) && other_factory_samples && (our_factory_ms - other_factory_ms > AST_AUDIOHOOK_SYNC_TOLERANCE)) {
- if (option_debug)
- ast_log(LOG_DEBUG, "Flushing audiohook %p so it remains in sync\n", audiohook);
+ ast_debug(1, "Flushing audiohook %p so it remains in sync\n", audiohook);
ast_slinfactory_flush(factory);
ast_slinfactory_flush(other_factory);
}
if (ast_test_flag(audiohook, AST_AUDIOHOOK_SMALL_QUEUE) && (our_factory_samples > 640 || other_factory_samples > 640)) {
- if (option_debug) {
- ast_log(LOG_DEBUG, "Audiohook %p has stale audio in its factories. Flushing them both\n", audiohook);
- }
+ ast_debug(1, "Audiohook %p has stale audio in its factories. Flushing them both\n", audiohook);
ast_slinfactory_flush(factory);
ast_slinfactory_flush(other_factory);
}
}
}
}
- } else if (option_debug)
- ast_log(LOG_DEBUG, "Failed to get %d samples from read factory %p\n", (int)samples, &audiohook->read_factory);
+ }
+ ast_debug(1, "Failed to get %d samples from read factory %p\n", (int)samples, &audiohook->read_factory);
/* Move on to the write factory... if there are enough samples, read them in */
if (usable_write) {
}
}
}
- } else if (option_debug)
- ast_log(LOG_DEBUG, "Failed to get %d samples from write factory %p\n", (int)samples, &audiohook->write_factory);
+ }
+ ast_debug(1, "Failed to get %d samples from write factory %p\n", (int)samples, &audiohook->write_factory);
/* Basically we figure out which buffer to use... and if mixing can be done here */
if (!read_buf && !write_buf)
AST_LIST_TRAVERSE_SAFE_END;
break;
default:
- ast_log(LOG_DEBUG, "Invalid audiohook type supplied, (%d)\n", type);
+ ast_debug(1, "Invalid audiohook type supplied, (%d)\n", type);
return -1;
}
AST_LIST_TRAVERSE_SAFE_END;
break;
default:
- ast_log(LOG_DEBUG, "Invalid audiohook type supplied, (%d)\n", type);
+ ast_debug(1, "Invalid audiohook type supplied, (%d)\n", type);
return -1;
}
return count;
return 0;
/* If the last saved context does not match the current one
OR we have not saved any context so far, then save the current context */
- if ((!AST_LIST_EMPTY(&traced->trace) && strcasecmp(AST_LIST_FIRST(&traced->trace)->context, chan->context)) ||
+ if ((!AST_LIST_EMPTY(&traced->trace) && strcasecmp(AST_LIST_FIRST(&traced->trace)->context, chan->context)) ||
(AST_LIST_EMPTY(&traced->trace))) {
/* Just do some debug logging */
if (AST_LIST_EMPTY(&traced->trace))
- ast_log(LOG_DEBUG, "Setting initial trace context to %s\n", chan->context);
+ ast_debug(1, "Setting initial trace context to %s\n", chan->context);
else
- ast_log(LOG_DEBUG, "Changing trace context from %s to %s\n", AST_LIST_FIRST(&traced->trace)->context, chan->context);
+ ast_debug(1, "Changing trace context from %s to %s\n", AST_LIST_FIRST(&traced->trace)->context, chan->context);
/* alloc or bail out */
trace = ast_malloc(sizeof(*trace));
- if (!trace)
+ if (!trace)
return -1;
/* save the current location and store it in the trace list */
ast_copy_string(trace->context, chan->context, sizeof(trace->context));
return 1;
if (ast_tvzero(chan->whentohangup)) /* no if no hangup scheduled */
return 0;
- if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0) /* no if hangup time has not come yet. */
+ if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0) /* no if hangup time has not come yet. */
return 0;
ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(chan->whentohangup, ast_tvnow()));
chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT; /* record event */
return -1;
}
}
-
+
if (!(chan = ast_calloc(1, sizeof(*chan)))) {
AST_RWLIST_UNLOCK(&backends);
return -1;
} else {
ast_debug(1, "Hanging up zombie '%s'\n", chan->name);
}
-
+
ast_channel_unlock(chan);
ast_cc_offer(chan);
ast_manager_event(chan, EVENT_FLAG_CALL, "Hangup",
} else {
samples = f->samples;
}
-
+
/* This unlock is here based on two assumptions that hold true at this point in the
* code. 1) this function is only called from within __ast_read() and 2) all generators
* call ast_write() in their generate callback.
if (res && chan->generator)
ast_playtones_stop(chan);
-
+
return 0;
}
ast_senddigit_begin(chan, digit);
ast_safe_sleep(chan, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));
}
-
+
return ast_senddigit_end(chan, digit, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));
}
struct ast_channel *chan2)
{
if (!ast_strlen_zero(chan1->accountcode) && ast_strlen_zero(chan2->peeraccount)) {
- ast_log(LOG_DEBUG, "setting peeraccount to %s for %s from data on channel %s\n",
+ ast_debug(1, "setting peeraccount to %s for %s from data on channel %s\n",
chan1->accountcode, chan2->name, chan1->name);
ast_string_field_set(chan2, peeraccount, chan1->accountcode);
}
if (!ast_strlen_zero(chan2->accountcode) && ast_strlen_zero(chan1->peeraccount)) {
- ast_log(LOG_DEBUG, "setting peeraccount to %s for %s from data on channel %s\n",
+ ast_debug(1, "setting peeraccount to %s for %s from data on channel %s\n",
chan2->accountcode, chan1->name, chan2->name);
ast_string_field_set(chan1, peeraccount, chan2->accountcode);
}
if (!ast_strlen_zero(chan1->peeraccount) && ast_strlen_zero(chan2->accountcode)) {
- ast_log(LOG_DEBUG, "setting accountcode to %s for %s from data on channel %s\n",
+ ast_debug(1, "setting accountcode to %s for %s from data on channel %s\n",
chan1->peeraccount, chan2->name, chan1->name);
ast_string_field_set(chan2, accountcode, chan1->peeraccount);
}
if (!ast_strlen_zero(chan2->peeraccount) && ast_strlen_zero(chan1->accountcode)) {
- ast_log(LOG_DEBUG, "setting accountcode to %s for %s from data on channel %s\n",
+ ast_debug(1, "setting accountcode to %s for %s from data on channel %s\n",
chan2->peeraccount, chan1->name, chan2->name);
ast_string_field_set(chan1, accountcode, chan2->peeraccount);
}
if (0 != strcmp(chan1->accountcode, chan2->peeraccount)) {
- ast_log(LOG_DEBUG, "changing peeraccount from %s to %s on %s to match channel %s\n",
+ ast_debug(1, "changing peeraccount from %s to %s on %s to match channel %s\n",
chan2->peeraccount, chan1->peeraccount, chan2->name, chan1->name);
ast_string_field_set(chan2, peeraccount, chan1->accountcode);
}
if (0 != strcmp(chan2->accountcode, chan1->peeraccount)) {
- ast_log(LOG_DEBUG, "changing peeraccount from %s to %s on %s to match channel %s\n",
+ ast_debug(1, "changing peeraccount from %s to %s on %s to match channel %s\n",
chan1->peeraccount, chan2->peeraccount, chan1->name, chan2->name);
ast_string_field_set(chan1, peeraccount, chan2->accountcode);
}
if (!f) {
*fo = NULL;
*rc = who;
- ast_debug(1, "Didn't get a frame from channel: %s\n",who->name);
+ ast_debug(1, "Didn't get a frame from channel: %s\n", who->name);
break;
}
f->frametype == AST_FRAME_DTMF_BEGIN)) {
*fo = f;
*rc = who;
- ast_debug(1, "Got DTMF %s on channel (%s)\n",
+ ast_debug(1, "Got DTMF %s on channel (%s)\n",
f->frametype == AST_FRAME_DTMF_END ? "end" : "begin",
who->name);
break;
/* Connected line party unknown element */
default:
- ast_log(LOG_DEBUG, "Unknown connected line element: %u (%u)\n",
+ ast_debug(1, "Unknown connected line element: %u (%u)\n",
(unsigned) ie_id, (unsigned) ie_len);
break;
}
* The other end is newer than we are.
* We need to assume that they are compatible with us.
*/
- ast_log(LOG_DEBUG, "Connected line frame has newer version: %u\n",
+ ast_debug(1, "Connected line frame has newer version: %u\n",
(unsigned) frame_version);
break;
}
break;
/* Redirecting unknown element */
default:
- ast_log(LOG_DEBUG, "Unknown redirecting element: %u (%u)\n",
+ ast_debug(1, "Unknown redirecting element: %u (%u)\n",
(unsigned) ie_id, (unsigned) ie_len);
break;
}
* The other end is newer than we are.
* We need to assume that they are compatible with us.
*/
- ast_log(LOG_DEBUG, "Redirecting frame has newer version: %u\n",
+ ast_debug(1, "Redirecting frame has newer version: %u\n",
(unsigned) frame_version);
break;
}
/*! \brief Notify metermaids that we've changed an extension */
static void notify_metermaids(const char *exten, char *context, enum ast_device_state state)
{
- ast_debug(4, "Notification of state change to metermaids %s@%s\n to state '%s'",
+ ast_debug(4, "Notification of state change to metermaids %s@%s\n to state '%s'",
exten, context, ast_devstate2str(state));
ast_devstate_changed(state, "park:%s@%s", exten, context);
exten = strsep(&context, "@");
if (!context)
return AST_DEVICE_INVALID;
-
+
ast_debug(4, "Checking state of exten %s in context %s\n", exten, context);
if (!ast_exists_extension(NULL, context, exten, 1, NULL))
}
if (transferer->cdr) {
struct ast_cdr *swap = transferer->cdr;
- ast_log(LOG_DEBUG,"transferer=%s; transferee=%s; lastapp=%s; lastdata=%s; chan=%s; dstchan=%s\n",
+ ast_debug(1, "transferer=%s; transferee=%s; lastapp=%s; lastdata=%s; chan=%s; dstchan=%s\n",
transferer->name, transferee->name, transferer->cdr->lastapp, transferer->cdr->lastdata,
transferer->cdr->channel, transferer->cdr->dstchannel);
- ast_log(LOG_DEBUG,"TRANSFEREE; lastapp=%s; lastdata=%s, chan=%s; dstchan=%s\n",
+ ast_debug(1, "TRANSFEREE; lastapp=%s; lastdata=%s, chan=%s; dstchan=%s\n",
transferee->cdr->lastapp, transferee->cdr->lastdata, transferee->cdr->channel, transferee->cdr->dstchannel);
- ast_log(LOG_DEBUG,"transferer_real_context=%s; xferto=%s\n", transferer_real_context, xferto);
+ ast_debug(1, "transferer_real_context=%s; xferto=%s\n", transferer_real_context, xferto);
/* swap cdrs-- it will save us some time & work */
transferer->cdr = transferee->cdr;
transferee->cdr = swap;
} else {
/* Set the channel's new extension, since it exists, using transferer context */
ast_set_flag(transferee, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
- ast_log(LOG_DEBUG,"ABOUT TO AST_ASYNC_GOTO, have a pbx... set HANGUP_DONT on chan=%s\n", transferee->name);
+ ast_debug(1, "ABOUT TO AST_ASYNC_GOTO, have a pbx... set HANGUP_DONT on chan=%s\n", transferee->name);
if (ast_channel_connected_line_macro(transferee, transferer, &transferer->connected, 1, 0)) {
ast_channel_update_connected_line(transferer, &transferer->connected, NULL);
}
ast_cdr_start(bridge_cdr);
}
}
- ast_debug(4,"bridge answer set, chan answer set\n");
+ ast_debug(4, "bridge answer set, chan answer set\n");
/* peer_cdr->answer will be set when a macro runs on the peer;
in that case, the bridge answer will be delayed while the
macro plays on the peer channel. The peer answered the call
} else if (!strcasecmp(confvar->name, "findslot")) {
parkinglot->parkfindnext = (!strcasecmp(confvar->value, "next"));
} else if (!strcasecmp(confvar->name, "parkedcalltransfers")) {
- ast_log(LOG_DEBUG, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
+ ast_debug(1, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
if (!strcasecmp(confvar->value, "both")) {
parkinglot->parkedcalltransfers = AST_FEATURE_FLAG_BYBOTH;
} else if (!strcasecmp(confvar->value, "caller")) {
parkinglot->parkedcalltransfers = AST_FEATURE_FLAG_BYCALLEE;
}
} else if (!strcasecmp(confvar->name, "parkedcallreparking")) {
- ast_log(LOG_DEBUG, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
+ ast_debug(1, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
if (!strcasecmp(confvar->value, "both")) {
parkinglot->parkedcallreparking = AST_FEATURE_FLAG_BYBOTH;
} else if (!strcasecmp(confvar->value, "caller")) {
parkinglot->parkedcallreparking = AST_FEATURE_FLAG_BYCALLEE;
}
} else if (!strcasecmp(confvar->name, "parkedcallhangup")) {
- ast_log(LOG_DEBUG, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
+ ast_debug(1, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
if (!strcasecmp(confvar->value, "both")) {
parkinglot->parkedcallhangup = AST_FEATURE_FLAG_BYBOTH;
} else if (!strcasecmp(confvar->value, "caller")) {
- parkinglot->parkedcallhangup = AST_FEATURE_FLAG_BYCALLER;
+ parkinglot->parkedcallhangup = AST_FEATURE_FLAG_BYCALLER;
} else if (!strcasecmp(confvar->value, "callee")) {
parkinglot->parkedcallhangup = AST_FEATURE_FLAG_BYCALLEE;
}
} else if (!strcasecmp(confvar->name, "parkedcallrecording")) {
- ast_log(LOG_DEBUG, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
+ ast_debug(1, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
if (!strcasecmp(confvar->value, "both")) {
parkinglot->parkedcallrecording = AST_FEATURE_FLAG_BYBOTH;
} else if (!strcasecmp(confvar->value, "caller")) {
return parkinglot;
}
-static int load_config(void)
+static int load_config(void)
{
int start = 0, end = 0;
int res;
default_parkinglot->parkingtime = DEFAULT_PARK_TIME;
ao2_unlock(default_parkinglot);
}
-
+
if (default_parkinglot) {
ast_debug(1, "Configuration of default parkinglot done.\n");
} else {
ast_log(LOG_ERROR, "Could not build parking lot %s. Configuration error.\n", ctg);
else
ast_debug(1, "Configured parking context %s\n", ctg);
- continue;
+ continue;
}
/* No, check if it's a group */
for (i = 0; i < ARRAY_LEN(categories); i++) {
break;
}
- if (i < ARRAY_LEN(categories))
+ if (i < ARRAY_LEN(categories))
continue;
if (!(fg = register_group(ctg)))
ast_set_flag(&(bconfig.features_caller), AST_FEATURE_DISCONNECT);
if (ast_test_flag(&opts, OPT_CALLEE_MONITOR))
ast_set_flag(&(bconfig.features_callee), AST_FEATURE_AUTOMON);
- if (ast_test_flag(&opts, OPT_CALLER_MONITOR))
+ if (ast_test_flag(&opts, OPT_CALLER_MONITOR))
ast_set_flag(&(bconfig.features_caller), AST_FEATURE_AUTOMON);
if (ast_test_flag(&opts, OPT_CALLEE_PARK))
ast_set_flag(&(bconfig.features_callee), AST_FEATURE_PARKCALL);
/* the bridge has ended, set BRIDGERESULT to SUCCESS. If the other channel has not been hung up, return it to the PBX */
pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "SUCCESS");
if (!ast_check_hangup(final_dest_chan) && !ast_test_flag(&opts, OPT_CALLEE_KILL)) {
- ast_debug(1, "starting new PBX in %s,%s,%d for chan %s\n",
- final_dest_chan->context, final_dest_chan->exten,
+ ast_debug(1, "starting new PBX in %s,%s,%d for chan %s\n",
+ final_dest_chan->context, final_dest_chan->exten,
final_dest_chan->priority, final_dest_chan->name);
if (ast_pbx_start(final_dest_chan) != AST_PBX_SUCCESS) {
}
if (option_debug) {
- ast_log(LOG_DEBUG, "mmm ... cookie! Name: '%s' Value: '%s'\n", name, val);
+ ast_debug(1, "mmm ... cookie! Name: '%s' Value: '%s'\n", name, val);
}
var = ast_variable_new(name, val, __FILE__);
char asteriskpath[256];
if (!(dli.dli_fname = ast_utils_which("asterisk", asteriskpath, sizeof(asteriskpath)))) {
/* This will fail to find symbols */
- ast_log(LOG_DEBUG, "Failed to find asterisk binary for debug symbols.\n");
+ ast_debug(1, "Failed to find asterisk binary for debug symbols.\n");
dli.dli_fname = "asterisk";
}
}
if ((strings = ast_bt_get_symbols(bt->addresses, bt->num_frames))) {
ast_debug(1, "Got %d backtrace record%c\n", bt->num_frames, bt->num_frames != 1 ? 's' : ' ');
for (i = 3; i < bt->num_frames - 2; i++) {
- ast_log(LOG_DEBUG, "#%d: [%p] %s\n", i - 3, bt->addresses[i], strings[i]);
+ ast_debug(1, "#%d: [%p] %s\n", i - 3, bt->addresses[i], strings[i]);
}
/* MALLOC_DEBUG will erroneously report an error here, unless we undef the macro. */
{
int refcount = ao2_ref(s, -1);
if (manager_debug) {
- ast_log(LOG_DEBUG, "Mansession: %p refcount now %d\n", s, refcount - 1);
+ ast_debug(1, "Mansession: %p refcount now %d\n", s, refcount - 1);
}
return s;
}
cut = filename + strlen(filename);
}
snprintf(cut, (sizeof(filename) - strlen(filename)) - 1, ".so");
- ast_log(LOG_DEBUG, "**** ModuleCheck .so file %s\n", filename);
+ ast_debug(1, "**** ModuleCheck .so file %s\n", filename);
res = ast_module_check(filename);
if (!res) {
astman_send_error(s, m, "Module not loaded");
return 0;
}
snprintf(cut, (sizeof(filename) - strlen(filename)) - 1, ".c");
- ast_log(LOG_DEBUG, "**** ModuleCheck .c file %s\n", filename);
+ ast_debug(1, "**** ModuleCheck .c file %s\n", filename);
#if !defined(LOW_MEMORY)
version = ast_file_version_find(filename);
#endif
} \
} \
}
-
+
#define NEW_MATCHER_RECURSE \
if (p->next_char && (*(str + 1) || (p->next_char->x[0] == '/' && p->next_char->x[1] == 0) \
- || p->next_char->x[0] == '!')) { \
+ || p->next_char->x[0] == '!')) { \
if (*(str + 1) || p->next_char->x[0] == '!') { \
new_find_extension(str + 1, score, p->next_char, length + 1, spec + p->specificity, callerid, label, action); \
if (score->exten) { \
new_find_extension("/", score, p->next_char, length + 1, spec + p->specificity, callerid, label, action); \
if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) { \
ast_debug(4,"returning a (can/more) match--- %s\n", score->exten ? score->exten->exten : \
- "NULL"); \
+ "NULL"); \
return; /* the first match is all we need */ \
} \
} \
return; \
} \
}
-
+
NEW_MATCHER_CHK_MATCH;
NEW_MATCHER_RECURSE;
}
NEW_MATCHER_CHK_MATCH;
NEW_MATCHER_RECURSE;
}
- } else if (p->x[0] == 'X') {
+ } else if (p->x[0] == 'X') {
if (p->x[1] == 0 && *str >= '0' && *str <= '9' ) {
NEW_MATCHER_CHK_MATCH;
NEW_MATCHER_RECURSE;
return 0;
}
#ifdef NEED_DEBUG
- ast_log(LOG_DEBUG, "Adding exten %s%c%s to tree\n", s1, e1->matchcid ? '/' : ' ', e1->matchcid ? e1->cidmatch : "");
+ ast_debug(1, "Adding exten %s%c%s to tree\n", s1, e1->matchcid ? '/' : ' ', e1->matchcid ? e1->cidmatch : "");
#endif
m1 = con->pattern_tree; /* each pattern starts over at the root of the pattern tree */
m0 = &con->pattern_tree;
#ifdef NEED_DEBUG
int biggest_bucket, resizes, numobjs, numbucks;
- ast_log(LOG_DEBUG,"Creating Extension Trie for context %s(%p)\n", con->name, con);
+ ast_debug(1, "Creating Extension Trie for context %s(%p)\n", con->name, con);
ast_hashtab_get_stats(con->root_table, &biggest_bucket, &resizes, &numobjs, &numbucks);
- ast_log(LOG_DEBUG,"This tree has %d objects in %d bucket lists, longest list=%d objects, and has resized %d times\n",
+ ast_debug(1, "This tree has %d objects in %d bucket lists, longest list=%d objects, and has resized %d times\n",
numobjs, numbucks, biggest_bucket, resizes);
#endif
t1 = ast_hashtab_start_traversal(con->root_table);
if (!tmp->pattern_tree && tmp->root_table) {
create_match_char_tree(tmp);
#ifdef NEED_DEBUG
- ast_log(LOG_DEBUG, "Tree Created in context %s:\n", context);
+ ast_debug(1, "Tree Created in context %s:\n", context);
log_match_char_tree(tmp->pattern_tree," ");
#endif
}
if (!dpc->total_items++)
manager_dpsendack(s, m);
astman_append(s, "Event: ListDialplan\r\n%s", actionidtext);
- astman_append(s, "Context: %s\r\nSwitch: %s/%s\r\nRegistrar: %s\r\n", ast_get_context_name(c), ast_get_switch_name(sw), ast_get_switch_data(sw), ast_get_switch_registrar(sw));
+ astman_append(s, "Context: %s\r\nSwitch: %s/%s\r\nRegistrar: %s\r\n", ast_get_context_name(c), ast_get_switch_name(sw), ast_get_switch_data(sw), ast_get_switch_registrar(sw));
astman_append(s, "\r\n");
ast_debug(3, "manager_show_dialplan: Found Switch : %s \n", ast_get_switch_name(sw));
}
}
if (!res) {
if (!ast_streamfile(chan, fn, language)) {
- if ((audiofd > -1) && (ctrlfd > -1))
+ if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
- else
+ else
res = ast_waitstream(chan, ints);
}
ast_stopstream(chan);
}
if (!res) {
if (!ast_streamfile(chan, fn, language)) {
- if ((audiofd > -1) && (ctrlfd > -1))
+ if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
- else
+ else
res = ast_waitstream(chan, ints);
}
ast_stopstream(chan);
num -= 100 * hundreds;
if (num)
playa++;
- } else if (num < 1000000) {
+ } else if (num < 1000000) {
res = ast_say_number_full_en_GB(chan, num / 1000, ints, language, audiofd, ctrlfd);
if (res)
return res;
num %= 1000;
if (num && num < 100)
playa++;
- } else if (num < 1000000000) {
+ } else if (num < 1000000000) {
int millions = num / 1000000;
res = ast_say_number_full_en_GB(chan, millions, ints, language, audiofd, ctrlfd);
if (res)
ast_debug(1, "Number '%d' is too big for me\n", num);
res = -1;
}
-
+
if (!res) {
if (!ast_streamfile(chan, fn, language)) {
- if ((audiofd > -1) && (ctrlfd > -1))
+ if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
- else
+ else
res = ast_waitstream(chan, ints);
}
ast_stopstream(chan);
ast_stopstream(chan);
}
-
+
}
return res;
}
num -= 100 * hundreds;
if (num)
playa++;
- } else if (num < 1000000) {
+ } else if (num < 1000000) {
res = ast_say_number_full_no(chan, num / 1000, ints, language, "n", audiofd, ctrlfd);
if (res)
return res;
num %= 1000;
if (num && num < 100)
playa++;
- } else if (num < 1000000000) {
+ } else if (num < 1000000000) {
int millions = num / 1000000;
res = ast_say_number_full_no(chan, millions, ints, language, "c", audiofd, ctrlfd);
if (res)
ast_debug(1, "Number '%d' is too big for me\n", num);
res = -1;
}
-
+
if (!res) {
if (!ast_streamfile(chan, fn, language)) {
- if ((audiofd > -1) && (ctrlfd > -1))
+ if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
- else
+ else
res = ast_waitstream(chan, ints);
}
ast_stopstream(chan);
static char* pl_append(char* buffer, char* str)
{
strcpy(buffer, str);
- buffer += strlen(str);
+ buffer += strlen(str);
return buffer;
}
static void pl_odtworz_plik(struct ast_channel *chan, const char *language, int audiofd, int ctrlfd, const char *ints, char *fn)
-{
+{
char file_name[255] = "digits/";
strcat(file_name, fn);
ast_debug(1, "Trying to play: %s\n", file_name);
num %= 1000000;
ast_copy_string(fn, "digits/million", sizeof(fn));
} else { /* Miljarder - Billions */
- ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+ ast_debug(1, "Number '%d' is too big for me\n", num);
return -1;
}
snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
playh++;
snprintf(buf, 10, "%d", num);
- ast_log(LOG_DEBUG, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
+ ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
last_length = strlen(buf);
num -= ((num / 100) * 100);
} else if (num < 10000){
snprintf(fn, sizeof(fn), "digits/%d", (num / 1000));
playt++;
snprintf(buf, 10, "%d", num);
- ast_log(LOG_DEBUG, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
+ ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
last_length = strlen(buf);
num -= ((num / 1000) * 1000);
} else if (num < 100000000) { /* 100,000,000 */
if (res)
return res;
snprintf(buf, 10, "%d", num);
- ast_log(LOG_DEBUG, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
+ ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
num -= ((num / 10000) * 10000);
last_length = strlen(buf);
snprintf(fn, sizeof(fn), "digits/wan");
if (res)
return res;
snprintf(buf, 10, "%d", num);
- ast_log(LOG_DEBUG, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
+ ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
last_length = strlen(buf);
num -= ((num / 100000000) * 100000000);
snprintf(fn, sizeof(fn), "digits/yi");
num = num % 10000000;
snprintf(fn, sizeof(fn), "digits/crore");
} else {
- ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+ ast_debug(1, "Number '%d' is too big for me\n", num);
res = -1;
}
ast_copy_string(fn, "digits/thousands", sizeof(fn));
}
num %= 1000;
- } else if (num < 1000000000) { /* 1,000,000,000 */
+ } else if (num < 1000000000) { /* 1,000,000,000 */
lastdigits = get_lastdigits_ru(num / 1000000);
/* say millions */
res = ast_say_number_full_ru(chan, num / 1000000, ints, language, NULL, audiofd, ctrlfd);
res = ast_say_number_full_en(chan, billions, ints, language, audiofd, ctrlfd);
if (res)
return res;
- if (num) {
+ if (num) {
ast_copy_string(fn, "digits/billion", sizeof(fn));
} else {
ast_copy_string(fn, "digits/h-billion", sizeof(fn));
res = ast_say_number_full_de(chan, billions, ints, language, options, audiofd, ctrlfd);
if (res)
return res;
- if (num) {
+ if (num) {
ast_copy_string(fn, "digits/milliards", sizeof(fna));
} else {
snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
if (!res) {
if (!ast_streamfile(chan, fn, language)) {
- if ((audiofd > -1) && (ctrlfd > -1))
+ if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
- else
+ else
res = ast_waitstream(chan, ints);
}
ast_stopstream(chan);
res = ast_say_number_full_de(chan, billions, ints, language, options, audiofd, ctrlfd);
if (res)
return res;
- if (num) {
+ if (num) {
ast_copy_string(fn, "digits/milliards", sizeof(fna));
} else {
snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
if (!res) {
if (!ast_streamfile(chan, fn, language)) {
- if ((audiofd > -1) && (ctrlfd > -1))
+ if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
- else
+ else
res = ast_waitstream(chan, ints);
}
ast_stopstream(chan);
snprintf(fn, sizeof(fn), "digits/1m");
num = num % 1000000;
} else {
- ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+ ast_debug(1, "Number '%d' is too big for me\n", num);
res = -1;
}
if (!res) {
ast_localtime(&when, &tm, tzone);
for (offset=0 ; format[offset] != '\0' ; offset++) {
- ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
+ ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
switch (format[offset]) {
/* NOTE: if you add more options here, please try to be consistent with strftime(3) */
case '\'':
res = wait_file(chan, ints, fn, lang);
} else if (num < 13) {
res = ast_say_number(chan, num, ints, lang, (char *) NULL);
- } else if (num <100 ) {
+ } else if (num <100 ) {
tmp = (num/10) * 10;
left = num - tmp;
snprintf(fn, sizeof(fn), "digits/%d", tmp);
res = ast_waitstream(chan, ints);
if (left)
gr_say_number_female(left, chan, ints, lang);
-
+
} else {
return -1;
}
snprintf(fn, sizeof(fn), "digits/xilia");
num %= 1000;
} else {
- /* num > 1000 */
+ /* num > 1000 */
if (num < 1000000) {
res = ast_say_number_full_gr(chan, (num / 1000), ints, chan->language, audiofd, ctrlfd);
if (res)
res = -1;
}
}
- }
+ }
if (!res) {
if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
format = "AdBY 'digits/at' IMp";
ast_localtime(&when, &tm, tzone);
-
+
for (offset=0 ; format[offset] != '\0' ; offset++) {
ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
switch (format[offset]) {
static void tps_taskprocessor_destroy(void *tps)
{
struct ast_taskprocessor *t = tps;
-
+
if (!tps) {
ast_log(LOG_ERROR, "missing taskprocessor\n");
return;
}
- ast_log(LOG_DEBUG, "destroying taskprocessor '%s'\n", t->name);
- /* kill it */
+ ast_debug(1, "destroying taskprocessor '%s'\n", t->name);
+ /* kill it */
ast_mutex_lock(&t->taskprocessor_lock);
t->poll_thread_run = 0;
ast_cond_signal(&t->poll_cond);
node = ast_xml_find_element(ast_xml_node_get_children(node), var, NULL, NULL);
if (!node || !ast_xml_node_get_children(node)) {
- ast_log(LOG_DEBUG, "Cannot find variable '%s' in tree '%s'\n", var, name);
+ ast_debug(1, "Cannot find variable '%s' in tree '%s'\n", var, name);
return ret;
}
char *newpattern=NULL; \
loopback_subst(buf, sizeof(buf), exten, context, priority, data); \
loopback_parse(&newexten, &newcontext, &newpriority, &newpattern, buf); \
- ast_log(LOG_DEBUG, "Parsed into %s @ %s priority %d\n", newexten, newcontext, newpriority); \
+ ast_debug(1, "Parsed into %s @ %s priority %d\n", newexten, newcontext, newpriority); \
if (!strcasecmp(newcontext, context)) return -1
static char *loopback_subst(char *buf, int buflen, const char *exten, const char *context, int priority, const char *data)
now += o->retrytime;
if (o->callingpid && (o->callingpid == ast_mainpid)) {
safe_append(o, time(NULL), "DelayedRetry");
- ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
+ ast_debug(1, "Delaying retry since we're currently running '%s'\n", o->fn);
free_outgoing(o);
} else {
/* Increment retries */
const char *filter_str;
SaEvtEventIdT event_id;
- ast_log(LOG_DEBUG, "Got an event to forward\n");
+ ast_debug(1, "Got an event to forward\n");
if (ast_eid_cmp(&ast_eid_default, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID))) {
/* If the event didn't originate from this server, don't send it back out. */
- ast_log(LOG_DEBUG, "Returning here\n");
+ ast_debug(1, "Returning here\n");
return;
}
ais_res = saEvtEventAllocate(event_channel->handle, &event_handle);
if (ais_res != SA_AIS_OK) {
ast_log(LOG_ERROR, "Error allocating event: %s\n", ais_err2str(ais_res));
- ast_log(LOG_DEBUG, "Returning here\n");
+ ast_debug(1, "Returning here\n");
return;
}
if (ais_res != SA_AIS_OK) {
ast_log(LOG_ERROR, "Error freeing allocated event: %s\n", ais_err2str(ais_res));
}
- ast_log(LOG_DEBUG, "Returning here (event_free)\n");
+ ast_debug(1, "Returning here (event_free)\n");
}
static char *ais_evt_show_event_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
}
publish_event->type = type;
- ast_log(LOG_DEBUG, "Subscribing to event type %d\n", type);
+ ast_debug(1, "Subscribing to event type %d\n", type);
publish_event->sub = ast_event_subscribe(type, ast_event_cb, "AIS", event_channel,
AST_EVENT_IE_END);
ast_event_dump_cache(publish_event->sub);
return CLI_FAILURE;
}
- ast_log(LOG_DEBUG, "Added AGI command to channel %s queue\n", chan->name);
+ ast_debug(1, "Added AGI command to channel %s queue\n", chan->name);
ast_channel_unlock(chan);
chan = ast_channel_unref(chan);
while (1) {
/* bail out if we need to hangup */
if (ast_check_hangup(chan)) {
- ast_log(LOG_DEBUG, "ast_check_hangup returned true on chan %s\n", chan->name);
+ ast_debug(1, "ast_check_hangup returned true on chan %s\n", chan->name);
break;
}
/* retrieve a command
/* no command so far, wait a bit for a frame to read */
res = ast_waitfor(chan, timeout);
if (res < 0) {
- ast_log(LOG_DEBUG, "ast_waitfor returned <= 0 on chan %s\n", chan->name);
+ ast_debug(1, "ast_waitfor returned <= 0 on chan %s\n", chan->name);
break;
}
if (res == 0)
continue;
f = ast_read(chan);
if (!f) {
- ast_log(LOG_DEBUG, "No frame read on channel %s, going out ...\n", chan->name);
+ ast_debug(1, "No frame read on channel %s, going out ...\n", chan->name);
returnstatus = AGI_RESULT_HANGUP;
break;
}
/* is there any other frame we should care about
besides AST_CONTROL_HANGUP? */
if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
- ast_log(LOG_DEBUG, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
+ ast_debug(1, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
ast_frfree(f);
break;
}
}
return count;
-}
+}
/* takes a linked list of \a ast_variable variables, finds the one with the name variable_value
* and returns the number of semicolons in the value for that \a ast_variable
i = 0;
/* For each static realtime variable we may create several entries in the \a vars array if it's delimited */
- for (entry_index = 0; ldap_entry; ) {
+ for (entry_index = 0; ldap_entry; ) {
int pos = 0;
delim_value = NULL;
delim_tot_count = 0;
delim_count = 0;
-
+
do { /* while delim_count */
/* Starting new static var */
char *ldap_attribute_name = ldap_first_attribute(ldapConn, ldap_entry, &ber);
struct berval *value;
while (ldap_attribute_name) {
-
const char *attribute_name = convert_attribute_name_from_ldap(table_config, ldap_attribute_name);
int is_realmed_password_attribute = strcasecmp(attribute_name, "md5secret") == 0;
struct berval **values = NULL;
ast_debug(2, "md5: %s\n", valptr);
}
if (valptr) {
- if (delim_value == NULL && !is_realmed_password_attribute
+ if (delim_value == NULL && !is_realmed_password_attribute
&& (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0)) {
delim_value = ast_strdup(valptr);
}
}
- if (is_delimited != 0 && !is_realmed_password_attribute
+ if (is_delimited != 0 && !is_realmed_password_attribute
&& (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0) ) {
/* for non-Static RealTime, first */
delim_value[i] = '\0';
ast_debug(2, "LINE(%d) DELIM - attribute_name: %s value: %s pos: %d\n", __LINE__, attribute_name, &delim_value[pos], pos);
-
+
if (prev) {
prev->next = ast_variable_new(attribute_name, &delim_value[pos], table_config->table_name);
if (prev->next) {
}
free(delim_value);
delim_value = NULL;
-
+
ast_debug(4, "LINE(%d) DELIM pos: %d i: %d\n", __LINE__, pos, i);
} else {
/* not delimited */
if (static_table_config != table_config) {
ast_debug(3, "LINE(%d) Added to vars - non static\n", __LINE__);
-
+
vars[entry_index++] = var;
prev = NULL;
}
LDAP_SCOPE_SUBTREE, ast_str_buffer(filter), NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT,
&ldap_result_msg);
if (result != LDAP_SUCCESS && is_ldap_connect_error(result)) {
- ast_log(LOG_DEBUG, "Failed to query directory. Try %d/10\n", tries + 1);
+ ast_debug(1, "Failed to query directory. Try %d/10\n", tries + 1);
if (++tries < 10) {
usleep(1);
if (ldapConn) {
struct ast_variable *var_val = variable_named(*p, "variable_value");
struct ast_variable *var_metric = variable_named(*p, "var_metric");
struct ast_variable *dn = variable_named(*p, "dn");
-
+
ast_debug(3, "category: %s\n", category->value);
ast_debug(3, "var_name: %s\n", var_name->value);
ast_debug(3, "var_val: %s\n", var_val->value);
ldap_entry = ldap_first_entry(ldapConn, ldap_result_msg);
- for (i = 0; ldap_entry; i++) {
+ for (i = 0; ldap_entry; i++) {
dn = ldap_get_dn(ldapConn, ldap_entry);
if ((error = ldap_modify_ext_s(ldapConn, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) {
ast_log(LOG_ERROR, "Couldn't modify dn:%s because %s", dn, ldap_err2string(error));
return;
} else if (GMIME_IS_MULTIPART(part)) {
GList *l;
-
+
ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MULTIPART, trying to process subparts\n");
l = GMIME_MULTIPART(part)->subparts;
while (l) {
fprintf(f, "\r\n");
if (0 > readmimefile(ser->f, f, boundary_marker, content_len)) {
- if (option_debug) {
- ast_log(LOG_DEBUG, "Cannot find boundary marker in POST request.\n");
- }
+ ast_debug(1, "Cannot find boundary marker in POST request.\n");
fclose(f);
return -1;
if (ast_eid_cmp(&ast_eid_default, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID)))
{
/* If the event didn't originate from this server, don't send it back out. */
- ast_log(LOG_DEBUG, "Returning here\n");
+ ast_debug(1, "Returning here\n");
return;
}
if (ast_eid_cmp(&ast_eid_default, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID)))
{
/* If the event didn't originate from this server, don't send it back out. */
- ast_log(LOG_DEBUG, "Returning here\n");
+ ast_debug(1, "Returning here\n");
return;
}
item_content = iks_child(item);
ast_str_to_eid(&pubsub_eid, iks_find_attrib(item_content, "eid"));
if (!ast_eid_cmp(&ast_eid_default, &pubsub_eid)) {
- ast_log(LOG_DEBUG, "Returning here, eid of incoming event matches ours!\n");
+ ast_debug(1, "Returning here, eid of incoming event matches ours!\n");
return IKS_FILTER_EAT;
}
if (!strcasecmp(iks_name(item_content), "state")) {
return IKS_FILTER_EAT;
}
} else {
- ast_log(LOG_DEBUG, "Don't know how to handle PubSub event of type %s\n",
+ ast_debug(1, "Don't know how to handle PubSub event of type %s\n",
iks_name(item_content));
return IKS_FILTER_EAT;
}
return 0;
}
-static struct ast_frame *moh_files_readframe(struct ast_channel *chan)
+static struct ast_frame *moh_files_readframe(struct ast_channel *chan)
{
struct ast_frame *f = NULL;
-
+
if (!(chan->stream && (f = ast_readframe(chan->stream)))) {
if (!ast_moh_files_next(chan))
f = ast_readframe(chan->stream);
#endif
if (!moh && warn) {
- ast_log(LOG_DEBUG, "Music on Hold class '%s' not found in memory\n", name);
+ ast_debug(1, "Music on Hold class '%s' not found in memory\n", name);
}
return moh;
static struct mohdata *mohalloc(struct mohclass *cl)
{
struct mohdata *moh;
- long flags;
-
+ long flags;
+
if (!(moh = ast_calloc(1, sizeof(*moh))))
return NULL;
-
+
if (pipe(moh->pipe)) {
ast_log(LOG_WARNING, "Failed to create pipe: %s\n", strerror(errno));
ast_free(moh);
char buff[8192];
int bytes, tbytes = 0, stime = 0, pid = 0;
- ast_log(LOG_DEBUG, "killing %d!\n", class->pid);
+ ast_debug(1, "killing %d!\n", class->pid);
stime = time(NULL) + 2;
pid = class->pid;
tbytes = tbytes + bytes;
}
- ast_log(LOG_DEBUG, "mpg123 pid %d and child died after %d bytes read\n", pid, tbytes);
+ ast_debug(1, "mpg123 pid %d and child died after %d bytes read\n", pid, tbytes);
close(class->srcfd);
}
if (obj->parent) {
if (res == SQL_SUCCESS || res == SQL_SUCCESS_WITH_INFO) {
- ast_log(LOG_DEBUG, "Disconnected %d from %s [%s]\n", res, obj->parent->name, obj->parent->dsn);
+ ast_debug(1, "Disconnected %d from %s [%s]\n", res, obj->parent->name, obj->parent->dsn);
} else {
- ast_log(LOG_DEBUG, "res_odbc: %s [%s] already disconnected\n", obj->parent->name, obj->parent->dsn);
+ ast_debug(1, "res_odbc: %s [%s] already disconnected\n", obj->parent->name, obj->parent->dsn);
}
}
if ((res = SQLFreeHandle(SQL_HANDLE_DBC, obj->con) == SQL_SUCCESS)) {
obj->con = NULL;
- ast_log(LOG_DEBUG, "Database handle deallocated\n");
+ ast_debug(1, "Database handle deallocated\n");
} else {
SQLGetDiagRec(SQL_HANDLE_DBC, obj->con, 1, state, &err, msg, 100, &mlen);
ast_log(LOG_WARNING, "Unable to deallocate database handle? %d errno=%d %s\n", res, (int)err, msg);
strerror(errno));
} else if (((ast_test_flag(rtp, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(rtp, FLAG_NAT_INACTIVE_NOWARN)) {
/* Only give this error message once if we are not RTP debugging */
- if (option_debug || rtpdebug)
+ if (rtpdebug)
ast_debug(0, "RTP NAT: Can't write RTP to private address %s, waiting for other end to send audio...\n",
ast_sockaddr_stringify(&remote_address));
ast_set_flag(rtp, FLAG_NAT_INACTIVE_NOWARN);
}
/* Print out debug if turned on */
- if (rtpdebug || option_debug > 2)
+ if (rtpdebug)
ast_debug(0, "- RTP 2833 Event: %08x (len = %d)\n", event, len);
/* Figure out what digit was pressed */
resp = 'X';
} else {
/* Not a supported event */
- ast_log(LOG_DEBUG, "Ignoring RTP 2833 Event: %08x. Not a DTMF Digit.\n", event);
+ ast_debug(1, "Ignoring RTP 2833 Event: %08x. Not a DTMF Digit.\n", event);
return;
}
power = data[2];
event = data[3] & 0x1f;
- if (option_debug > 2 || rtpdebug)
+ if (rtpdebug)
ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02x, power=%d, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2);
if (event < 10) {
resp = '0' + event;
/* Send to whoever sent to us */
if (ast_sockaddr_cmp(&rtp->rtcp->them, &addr)) {
ast_sockaddr_copy(&rtp->rtcp->them, &addr);
- if (option_debug || rtpdebug)
+ if (rtpdebug)
ast_debug(0, "RTCP NAT: Got RTCP from other end. Now sending to address %s\n",
ast_sockaddr_stringify(&rtp->rtcp->them));
}
length &= 0xffff;
if ((i + length) > packetwords) {
- if (option_debug || rtpdebug)
- ast_log(LOG_DEBUG, "RTCP Read too short\n");
+ if (rtpdebug)
+ ast_debug(1, "RTCP Read too short\n");
return &ast_null_frame;
}
}
rtp->rxseqno = 0;
ast_set_flag(rtp, FLAG_NAT_ACTIVE);
- if (option_debug || rtpdebug)
+ if (rtpdebug)
ast_debug(0, "RTP NAT: Got audio from other end. Now sending to address %s\n",
ast_sockaddr_stringify(&remote_address));
}
};
if (!mark) {
- if (option_debug || rtpdebug) {
+ if (rtpdebug) {
ast_debug(1, "Forcing Marker bit, because SSRC has changed\n");
}
mark = 1;
{
FILE *file;
int i;
-
+
if (!(file = fopen(iface->name, "w"))) {
ast_log(LOG_ERROR, "Error opening SMDI interface %s (%s) for writing\n", iface->name, strerror(errno));
return 1;
- }
-
+ }
+
ASTOBJ_WRLOCK(iface);
-
+
fprintf(file, "%s:MWI ", on ? "OP" : "RMV");
-
+
for (i = 0; i < iface->msdstrip; i++)
fprintf(file, "0");
char *cp = NULL;
int i;
int start = 0;
-
+
/* read an smdi message */
while ((c = fgetc(iface->file))) {
/* check if this is the start of a message */
if (!start) {
if (c == 'M') {
- ast_log(LOG_DEBUG, "Read an 'M' to start an SMDI message\n");
+ ast_debug(1, "Read an 'M' to start an SMDI message\n");
start = 1;
}
continue;
}
-
+
if (c == 'D') { /* MD message */
start = 0;
- ast_log(LOG_DEBUG, "Read a 'D' ... it's an MD message.\n");
+ ast_debug(1, "Read a 'D' ... it's an MD message.\n");
if (!(md_msg = ast_calloc(1, sizeof(*md_msg)))) {
ASTOBJ_UNREF(iface, ast_smdi_interface_destroy);
return NULL;
}
-
+
ASTOBJ_INIT(md_msg);
/* read the message desk number */
for (i = 0; i < sizeof(md_msg->mesg_desk_num) - 1; i++) {
md_msg->mesg_desk_num[i] = fgetc(iface->file);
- ast_log(LOG_DEBUG, "Read a '%c'\n", md_msg->mesg_desk_num[i]);
+ ast_debug(1, "Read a '%c'\n", md_msg->mesg_desk_num[i]);
}
md_msg->mesg_desk_num[sizeof(md_msg->mesg_desk_num) - 1] = '\0';
-
- ast_log(LOG_DEBUG, "The message desk number is '%s'\n", md_msg->mesg_desk_num);
+
+ ast_debug(1, "The message desk number is '%s'\n", md_msg->mesg_desk_num);
/* read the message desk terminal number */
for (i = 0; i < sizeof(md_msg->mesg_desk_term) - 1; i++) {
md_msg->mesg_desk_term[i] = fgetc(iface->file);
- ast_log(LOG_DEBUG, "Read a '%c'\n", md_msg->mesg_desk_term[i]);
+ ast_debug(1, "Read a '%c'\n", md_msg->mesg_desk_term[i]);
}
md_msg->mesg_desk_term[sizeof(md_msg->mesg_desk_term) - 1] = '\0';
- ast_log(LOG_DEBUG, "The message desk terminal is '%s'\n", md_msg->mesg_desk_term);
+ ast_debug(1, "The message desk terminal is '%s'\n", md_msg->mesg_desk_term);
/* read the message type */
md_msg->type = fgetc(iface->file);
-
- ast_log(LOG_DEBUG, "Message type is '%c'\n", md_msg->type);
+
+ ast_debug(1, "Message type is '%c'\n", md_msg->type);
/* read the forwarding station number (may be blank) */
cp = &md_msg->fwd_st[0];
for (i = 0; i < sizeof(md_msg->fwd_st) - 1; i++) {
if ((c = fgetc(iface->file)) == ' ') {
*cp = '\0';
- ast_log(LOG_DEBUG, "Read a space, done looking for the forwarding station\n");
+ ast_debug(1, "Read a space, done looking for the forwarding station\n");
break;
}
/* store c in md_msg->fwd_st */
if (i >= iface->msdstrip) {