Merge Olle's comment patch (bug #3097)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Mark Spencer 21 years ago
parent d6a415c262
commit d6471bec31

@ -1013,15 +1013,15 @@ static int dial_exec(struct ast_channel *chan, void *data)
ast_channel_sendurl( peer, url ); ast_channel_sendurl( peer, url );
} /* /JDG */ } /* /JDG */
if (announce && announcemsg) { if (announce && announcemsg) {
// Start autoservice on the other chan /* Start autoservice on the other chan */
res = ast_autoservice_start(chan); res = ast_autoservice_start(chan);
// Now Stream the File /* Now Stream the File */
if (!res) if (!res)
res = ast_streamfile(peer,announcemsg,peer->language); res = ast_streamfile(peer,announcemsg,peer->language);
if (!res) { if (!res) {
digit = ast_waitstream(peer, AST_DIGIT_ANY); digit = ast_waitstream(peer, AST_DIGIT_ANY);
} }
// Ok, done. stop autoservice /* Ok, done. stop autoservice */
res = ast_autoservice_stop(chan); res = ast_autoservice_stop(chan);
if (digit > 0 && !res) if (digit > 0 && !res)
res = ast_senddigit(chan, digit); res = ast_senddigit(chan, digit);

@ -120,7 +120,7 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
if (x != fd) if (x != fd)
close(x); close(x);
} }
//IAS /*IAS */
#ifdef __PPC__ #ifdef __PPC__
for( x=0; x<length; x+=2) for( x=0; x<length; x+=2)
{ {
@ -216,7 +216,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
res = -1; res = -1;
break; break;
} }
if (res < needed) { // last frame if (res < needed) { /* last frame */
ast_log(LOG_DEBUG, "Last frame\n"); ast_log(LOG_DEBUG, "Last frame\n");
res=0; res=0;
break; break;
@ -231,8 +231,9 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
} }
close(fds[0]); close(fds[0]);
close(fds[1]); close(fds[1]);
// if (pid > -1)
// kill(pid, SIGKILL); /* if (pid > -1) */
/* kill(pid, SIGKILL); */
if (!res && owriteformat) if (!res && owriteformat)
ast_set_write_format(chan, owriteformat); ast_set_write_format(chan, owriteformat);
return res; return res;

@ -799,7 +799,7 @@ zapretry:
} }
} }
if (user->adminflags & ADMINFLAG_KICKME) { if (user->adminflags & ADMINFLAG_KICKME) {
//You have been kicked. /* You have been kicked. */
if (!ast_streamfile(chan, "conf-kicked", chan->language)) if (!ast_streamfile(chan, "conf-kicked", chan->language))
ast_waitstream(chan, ""); ast_waitstream(chan, "");
ret = 0; ret = 0;

@ -38,8 +38,8 @@ static char *synopsis = "Play an MP3 file or stream";
static char *descrip = static char *descrip =
" MP3Player(location) Executes mpg123 to play the given location\n" " MP3Player(location) Executes mpg123 to play the given location\n"
"which typically would be a filename or a URL. Returns -1 on\n" "which typically would be a filename o a URL. User can exit by pressing any key\n."
"hangup or 0 otherwise. User can exit by pressing any key\n."; "Returns -1 on hangup or 0 otherwise.";
STANDARD_LOCAL_USER; STANDARD_LOCAL_USER;

@ -124,7 +124,7 @@ static char *descrip =
" The timeout will cause the queue to fail out after a specified number of\n" " The timeout will cause the queue to fail out after a specified number of\n"
"seconds, checked between each queues.conf 'timeout' and 'retry' cycle.\n"; "seconds, checked between each queues.conf 'timeout' and 'retry' cycle.\n";
// [PHM 06/26/03] /* PHM 06/26/03 */
static char *app_aqm = "AddQueueMember" ; static char *app_aqm = "AddQueueMember" ;
static char *app_aqm_synopsis = "Dynamically adds queue members" ; static char *app_aqm_synopsis = "Dynamically adds queue members" ;
static char *app_aqm_descrip = static char *app_aqm_descrip =
@ -1506,7 +1506,7 @@ static int wait_a_bit(struct queue_ent *qe)
return ast_waitfordigit(qe->chan, retrywait); return ast_waitfordigit(qe->chan, retrywait);
} }
// [PHM 06/26/03] /* [PHM 06/26/03] */
static struct member * interface_exists( struct ast_call_queue * q, char * interface ) static struct member * interface_exists( struct ast_call_queue * q, char * interface )
{ {
@ -1994,7 +1994,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
} }
} }
// if (option_debug) /* if (option_debug) */
ast_log(LOG_DEBUG, "queue: %s, options: %s, url: %s, announce: %s, timeout: %d, priority: %d\n", ast_log(LOG_DEBUG, "queue: %s, options: %s, url: %s, announce: %s, timeout: %d, priority: %d\n",
queuename, options, url, announceoverride, qe.queuetimeout, (int)prio); queuename, options, url, announceoverride, qe.queuetimeout, (int)prio);

@ -226,7 +226,7 @@ static int aPGSQL_connect(struct ast_channel *chan, void *data) {
s1=malloc(l); s1=malloc(l);
strncpy(s1, data, l -1); strncpy(s1, data, l -1);
stringp=s1; stringp=s1;
strsep(&stringp," "); // eat the first token, we already know it :P strsep(&stringp," "); /* eat the first token, we already know it :P */
var=strsep(&stringp," "); var=strsep(&stringp," ");
optionstring=strsep(&stringp,"\n"); optionstring=strsep(&stringp,"\n");
@ -267,9 +267,9 @@ static int aPGSQL_query(struct ast_channel *chan, void *data) {
s2=malloc(l); s2=malloc(l);
strncpy(s1, data, l - 1); strncpy(s1, data, l - 1);
stringp=s1; stringp=s1;
strsep(&stringp," "); // eat the first token, we already know it :P strsep(&stringp," "); /* eat the first token, we already know it :P */
s3=strsep(&stringp," "); s3=strsep(&stringp," ");
while (1) { // ugly trick to make branches with break; while (1) { /* ugly trick to make branches with break; */
var=s3; var=s3;
s4=strsep(&stringp," "); s4=strsep(&stringp," ");
id=atoi(s4); id=atoi(s4);
@ -330,10 +330,10 @@ static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
s2=malloc(l); s2=malloc(l);
strncpy(s1, data, l - 1); strncpy(s1, data, l - 1);
stringp=s1; stringp=s1;
strsep(&stringp," "); // eat the first token, we already know it :P strsep(&stringp," "); /* eat the first token, we already know it :P */
fetchid_var=strsep(&stringp," "); fetchid_var=strsep(&stringp," ");
while (1) { // ugly trick to make branches with break; while (1) { /* ugly trick to make branches with break; */
var=fetchid_var; // fetchid var=fetchid_var; /* fetchid */
fnd=0; fnd=0;
AST_LIST_TRAVERSE(headp,variables,entries) { AST_LIST_TRAVERSE(headp,variables,entries) {
@ -350,19 +350,19 @@ static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
} }
s4=strsep(&stringp," "); s4=strsep(&stringp," ");
id=atoi(s4); // resultid id=atoi(s4); /* resultid */
if ((PGSQLres=find_identifier(id,AST_PGSQL_ID_RESID))==NULL) { if ((PGSQLres=find_identifier(id,AST_PGSQL_ID_RESID))==NULL) {
ast_log(LOG_WARNING,"Invalid result identifier %d passed in aPGSQL_fetch\n",id); ast_log(LOG_WARNING,"Invalid result identifier %d passed in aPGSQL_fetch\n",id);
res=-1; res=-1;
break; break;
} }
id=atoi(s7); //fetchid id=atoi(s7); /*fetchid */
if ((lalares=find_identifier(id,AST_PGSQL_ID_FETCHID))==NULL) { if ((lalares=find_identifier(id,AST_PGSQL_ID_FETCHID))==NULL) {
i=0; // fetching the very first row i=0; /* fetching the very first row */
} else { } else {
i=*lalares; i=*lalares;
free(lalares); free(lalares);
del_identifier(id,AST_PGSQL_ID_FETCHID); // will re-add it a bit later del_identifier(id,AST_PGSQL_ID_FETCHID); /* will re-add it a bit later */
} }
if (i<PQntuples(PGSQLres)) { if (i<PQntuples(PGSQLres)) {
@ -383,11 +383,11 @@ static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
pbx_builtin_setvar_helper(chan,s5,s6); pbx_builtin_setvar_helper(chan,s5,s6);
} }
lalares=malloc(sizeof(int)); lalares=malloc(sizeof(int));
*lalares = ++i; // advance to the next row *lalares = ++i; /* advance to the next row */
id1 = add_identifier(AST_PGSQL_ID_FETCHID,lalares); id1 = add_identifier(AST_PGSQL_ID_FETCHID,lalares);
} else { } else {
ast_log(LOG_WARNING,"ast_PGSQL_fetch : EOF\n"); ast_log(LOG_WARNING,"ast_PGSQL_fetch : EOF\n");
id1 = 0; // no more rows id1 = 0; /* no more rows */
} }
snprintf(s, sizeof(s), "%d", id1); snprintf(s, sizeof(s), "%d", id1);
ast_log(LOG_WARNING,"Setting var '%s' to value '%s'\n",fetchid_var,s); ast_log(LOG_WARNING,"Setting var '%s' to value '%s'\n",fetchid_var,s);
@ -413,7 +413,7 @@ static int aPGSQL_reset(struct ast_channel *chan, void *data) {
s1=malloc(l); s1=malloc(l);
strncpy(s1, data, l - 1); strncpy(s1, data, l - 1);
stringp=s1; stringp=s1;
strsep(&stringp," "); // eat the first token, we already know it :P strsep(&stringp," "); /* eat the first token, we already know it :P */
s3=strsep(&stringp," "); s3=strsep(&stringp," ");
id=atoi(s3); id=atoi(s3);
if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) { if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) {
@ -439,7 +439,7 @@ static int aPGSQL_clear(struct ast_channel *chan, void *data) {
s1=malloc(l); s1=malloc(l);
strncpy(s1, data, l - 1); strncpy(s1, data, l - 1);
stringp=s1; stringp=s1;
strsep(&stringp," "); // eat the first token, we already know it :P strsep(&stringp," "); /* eat the first token, we already know it :P */
s3=strsep(&stringp," "); s3=strsep(&stringp," ");
id=atoi(s3); id=atoi(s3);
if ((karoto=find_identifier(id,AST_PGSQL_ID_RESID))==NULL) { if ((karoto=find_identifier(id,AST_PGSQL_ID_RESID))==NULL) {
@ -469,7 +469,7 @@ static int aPGSQL_disconnect(struct ast_channel *chan, void *data) {
s1=malloc(l); s1=malloc(l);
strncpy(s1, data, l - 1); strncpy(s1, data, l - 1);
stringp=s1; stringp=s1;
strsep(&stringp," "); // eat the first token, we already know it :P strsep(&stringp," "); /* eat the first token, we already know it :P */
s3=strsep(&stringp," "); s3=strsep(&stringp," ");
id=atoi(s3); id=atoi(s3);
if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) { if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) {

@ -1299,7 +1299,7 @@ yuck:
#else #else
static int count_messages(char *dir) static int count_messages(char *dir)
{ {
// Find all .txt files - even if they are not in sequence from 0000 /* Find all .txt files - even if they are not in sequence from 0000 */
int vmcount = 0; int vmcount = 0;
DIR *vmdir = NULL; DIR *vmdir = NULL;
@ -2214,12 +2214,10 @@ leave_vm_out:
return res; return res;
} }
#ifdef USE_ODBC_STORAGE
#endif
static void resequence_mailbox(char * dir) static void resequence_mailbox(char * dir)
{ {
// we know max messages, so stop process when number is hit /* we know max messages, so stop process when number is hit */
int x,dest; int x,dest;
char sfn[256]; char sfn[256];

@ -3,9 +3,9 @@
* *
* Comma Separated Value CDR records. * Comma Separated Value CDR records.
* *
* Copyright (C) 1999, Mark Spencer * Copyright (C) 1999-2004, Digium, inc
* *
* Mark Spencer <markster@linux-support.net> * Mark Spencer <markster@digium.com>
* *
* This program is free software, distributed under the terms of * This program is free software, distributed under the terms of
* the GNU General Public License. * the GNU General Public License.
@ -39,32 +39,33 @@
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
/* The values are as follows: /*----------------------------------------------------
The values are as follows:
"accountcode", // accountcode is the account name of detail records, Master.csv contains all records "accountcode", accountcode is the account name of detail records, Master.csv contains all records *
// Detail records are configured on a channel basis, IAX and SIP are determined by user Detail records are configured on a channel basis, IAX and SIP are determined by user *
// Zap is determined by channel in zaptel.conf Zap is determined by channel in zaptel.conf
"source", "source",
"destination", "destination",
"destination context", "destination context",
"callerid", "callerid",
"channel", "channel",
"destination channel", (if applicable) "destination channel", (if applicable)
"last application", // Last application run on the channel "last application", Last application run on the channel
"last app argument", // argument to the last channel "last app argument", argument to the last channel
"start time", "start time",
"answer time", "answer time",
"end time", "end time",
duration, // Duration is the whole length that the entire call lasted. ie. call rx'd to hangup duration, Duration is the whole length that the entire call lasted. ie. call rx'd to hangup
// "end time" minus "start time" "end time" minus "start time"
billable seconds, // the duration that a call was up after other end answered which will be <= to duration billable seconds, the duration that a call was up after other end answered which will be <= to duration
// "end time" minus "answer time" "end time" minus "answer time"
"disposition", // ANSWERED, NO ANSWER, BUSY "disposition", ANSWERED, NO ANSWER, BUSY
"amaflags", // DOCUMENTATION, BILL, IGNORE etc, specified on a per channel basis like accountcode. "amaflags", DOCUMENTATION, BILL, IGNORE etc, specified on a per channel basis like accountcode.
"uniqueid", // unique call identifier "uniqueid", unique call identifier
"userfield" // user field set via SetCDRUserField "userfield" user field set via SetCDRUserField
*/ ----------------------------------------------------------*/
static char *desc = "Comma Separated Values CDR Backend"; static char *desc = "Comma Separated Values CDR Backend";

@ -508,7 +508,7 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
if (res) if (res)
ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats))); ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats)));
} else { } else {
// Agent hung-up /* Agent hung-up */
p->chan = NULL; p->chan = NULL;
} }

@ -1,9 +1,9 @@
/* /*
* Asterisk -- A telephony toolkit for Linux. * Asterisk -- A telephony toolkit for Linux.
* *
* Copyright (C) 2002, Linux Support Services * Copyright (C) 2002-2004, Digium, inc
* *
* By Matthew Fredrickson <creslin@linux-support.net> * By Matthew Fredrickson <creslin@digium.com>
* *
* This program is free software, distributed under the terms of * This program is free software, distributed under the terms of
* the GNU General Public License * the GNU General Public License
@ -61,7 +61,7 @@
#define MIN_SWITCH_TIME 600 #define MIN_SWITCH_TIME 600
static snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE; static snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
//static int block = O_NONBLOCK; /* static int block = O_NONBLOCK; */
static char indevname[50] = ALSA_INDEV; static char indevname[50] = ALSA_INDEV;
static char outdevname[50] = ALSA_OUTDEV; static char outdevname[50] = ALSA_OUTDEV;
@ -284,14 +284,14 @@ static snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream)
snd_pcm_sw_params_t *swparams = NULL; snd_pcm_sw_params_t *swparams = NULL;
struct pollfd pfd; struct pollfd pfd;
snd_pcm_uframes_t period_size = PERIOD_FRAMES * 4; snd_pcm_uframes_t period_size = PERIOD_FRAMES * 4;
//int period_bytes = 0; /* int period_bytes = 0; */
snd_pcm_uframes_t buffer_size = 0; snd_pcm_uframes_t buffer_size = 0;
unsigned int rate = DESIRED_RATE; unsigned int rate = DESIRED_RATE;
#if 0 #if 0
unsigned int per_min = 1; unsigned int per_min = 1;
#endif #endif
//unsigned int per_max = 8; /* unsigned int per_max = 8; */
snd_pcm_uframes_t start_threshold, stop_threshold; snd_pcm_uframes_t start_threshold, stop_threshold;
err = snd_pcm_open(&handle, dev, stream, O_NONBLOCK); err = snd_pcm_open(&handle, dev, stream, O_NONBLOCK);
@ -334,7 +334,7 @@ static snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream)
ast_log(LOG_DEBUG, "Period size is %d\n", err); ast_log(LOG_DEBUG, "Period size is %d\n", err);
} }
buffer_size = 4096 * 2; //period_size * 16; buffer_size = 4096 * 2; /* period_size * 16; */
err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &buffer_size); err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &buffer_size);
if (err < 0) { if (err < 0) {
ast_log(LOG_WARNING, "Problem setting buffer size of %ld: %s\n", buffer_size, snd_strerror(err)); ast_log(LOG_WARNING, "Problem setting buffer size of %ld: %s\n", buffer_size, snd_strerror(err));
@ -542,7 +542,7 @@ static int alsa_write(struct ast_channel *chan, struct ast_frame *f)
int len = sizpos; int len = sizpos;
int pos; int pos;
int res = 0; int res = 0;
//size_t frames = 0; /* size_t frames = 0; */
snd_pcm_state_t state; snd_pcm_state_t state;
/* Immediately return if no sound is enabled */ /* Immediately return if no sound is enabled */
if (nosound) if (nosound)

@ -6617,8 +6617,8 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, in
} }
} else if (!strcasecmp(v->name, "timezone")) { } else if (!strcasecmp(v->name, "timezone")) {
strncpy(peer->zonetag, v->value, sizeof(peer->zonetag)-1); strncpy(peer->zonetag, v->value, sizeof(peer->zonetag)-1);
}// else if (strcasecmp(v->name,"type")) }/* else if (strcasecmp(v->name,"type")) */
// ast_log(LOG_WARNING, "Ignoring %s\n", v->name); /* ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
v=v->next; v=v->next;
} }
if (!peer->authmethods) if (!peer->authmethods)
@ -6755,8 +6755,8 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, in
} }
} else if (!strcasecmp(v->name, "inkeys")) { } else if (!strcasecmp(v->name, "inkeys")) {
strncpy(user->inkeys, v->value, sizeof(user->inkeys) - 1); strncpy(user->inkeys, v->value, sizeof(user->inkeys) - 1);
}// else if (strcasecmp(v->name,"type")) }/* else if (strcasecmp(v->name,"type")) */
// ast_log(LOG_WARNING, "Ignoring %s\n", v->name); /* ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
v = v->next; v = v->next;
} }
if (!user->authmethods) { if (!user->authmethods) {
@ -7038,8 +7038,8 @@ static int set_config(char *config_file, struct sockaddr_in* sin){
} }
} else if (!strcasecmp(v->name, "language")) { } else if (!strcasecmp(v->name, "language")) {
strncpy(language, v->value, sizeof(language) - 1); strncpy(language, v->value, sizeof(language) - 1);
} //else if (strcasecmp(v->name,"type")) } /*else if (strcasecmp(v->name,"type")) */
// ast_log(LOG_WARNING, "Ignoring %s\n", v->name); /* ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
v = v->next; v = v->next;
} }
iax2_capability = capability; iax2_capability = capability;

@ -1019,7 +1019,7 @@ static int mgcp_show_endpoints(int fd, int argc, char *argv[])
e = g->endpoints; e = g->endpoints;
ast_cli(fd, "Gateway '%s' at %s (%s)\n", g->name, g->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), g->addr.sin_addr) : ast_inet_ntoa(iabuf, sizeof(iabuf), g->defaddr.sin_addr), g->dynamic ? "Dynamic" : "Static"); ast_cli(fd, "Gateway '%s' at %s (%s)\n", g->name, g->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), g->addr.sin_addr) : ast_inet_ntoa(iabuf, sizeof(iabuf), g->defaddr.sin_addr), g->dynamic ? "Dynamic" : "Static");
while(e) { while(e) {
// JS: Don't show wilcard endpoint /* JS: Don't show wilcard endpoint */
if (strcmp(e->name, g->wcardep) !=0) if (strcmp(e->name, g->wcardep) !=0)
ast_cli(fd, " -- '%s@%s in '%s' is %s\n", e->name, g->name, e->context, e->sub->owner ? "active" : "idle"); ast_cli(fd, " -- '%s@%s in '%s' is %s\n", e->name, g->name, e->context, e->sub->owner ? "active" : "idle");
hasendpoints = 1; hasendpoints = 1;
@ -1721,7 +1721,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
#if 0 #if 0
printf("Peer RTP is at port %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port)); printf("Peer RTP is at port %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port));
#endif #endif
// Scan through the RTP payload types specified in a "m=" line: /* Scan through the RTP payload types specified in a "m=" line: */
ast_rtp_pt_clear(sub->rtp); ast_rtp_pt_clear(sub->rtp);
codecs = m + len; codecs = m + len;
while(strlen(codecs)) { while(strlen(codecs)) {
@ -1733,18 +1733,18 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
codecs += len; codecs += len;
} }
// Next, scan through each "a=rtpmap:" line, noting each /* Next, scan through each "a=rtpmap:" line, noting each */
// specified RTP payload type (with corresponding MIME subtype): /* specified RTP payload type (with corresponding MIME subtype): */
sdpLineNum_iterator_init(&iterator); sdpLineNum_iterator_init(&iterator);
while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') { while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
char* mimeSubtype = strdup(a); // ensures we have enough space char* mimeSubtype = strdup(a); /* ensures we have enough space */
if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) continue; if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) continue;
// Note: should really look at the 'freq' and '#chans' params too /* Note: should really look at the 'freq' and '#chans' params too */
ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype); ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype);
free(mimeSubtype); free(mimeSubtype);
} }
// Now gather all of the codecs that were asked for: /* Now gather all of the codecs that were asked for: */
ast_rtp_get_current_formats(sub->rtp, ast_rtp_get_current_formats(sub->rtp,
&peercapability, &peerNonCodecCapability); &peercapability, &peerNonCodecCapability);
p->capability = capability & peercapability; p->capability = capability & peercapability;
@ -2167,7 +2167,7 @@ static int transmit_audit_endpoint(struct mgcp_endpoint *p)
struct mgcp_request resp; struct mgcp_request resp;
reqprep(&resp, p, "AUEP"); reqprep(&resp, p, "AUEP");
/* SC: removed unknown param VS */ /* SC: removed unknown param VS */
//add_header(&resp, "F", "A,R,D,S,X,N,I,T,O,ES,E,MD,M"); /*add_header(&resp, "F", "A,R,D,S,X,N,I,T,O,ES,E,MD,M"); */
add_header(&resp, "F", "A"); add_header(&resp, "F", "A");
/* SC: fill in new fields */ /* SC: fill in new fields */
resp.cmd = MGCP_CMD_AUEP; resp.cmd = MGCP_CMD_AUEP;
@ -2923,7 +2923,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
if (option_verbose > 2 && (strcmp(p->name, p->parent->wcardep) != 0)) { if (option_verbose > 2 && (strcmp(p->name, p->parent->wcardep) != 0)) {
ast_verbose(VERBOSE_PREFIX_3 "Resetting interface %s@%s\n", p->name, p->parent->name); ast_verbose(VERBOSE_PREFIX_3 "Resetting interface %s@%s\n", p->name, p->parent->name);
} }
// JS: For RSIP on wildcard we reset all endpoints /* JS: For RSIP on wildcard we reset all endpoints */
if (!strcmp(p->name, p->parent->wcardep)) { if (!strcmp(p->name, p->parent->wcardep)) {
/* Reset all endpoints */ /* Reset all endpoints */
struct mgcp_endpoint *tmp_ep; struct mgcp_endpoint *tmp_ep;
@ -2931,7 +2931,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
g = p->parent; g = p->parent;
tmp_ep = g->endpoints; tmp_ep = g->endpoints;
while (tmp_ep) { while (tmp_ep) {
//if ((strcmp(tmp_ep->name, "*") != 0) && (strcmp(tmp_ep->name, "aaln/*") != 0)) { /*if ((strcmp(tmp_ep->name, "*") != 0) && (strcmp(tmp_ep->name, "aaln/*") != 0)) { */
if (strcmp(tmp_ep->name, g->wcardep) != 0) { if (strcmp(tmp_ep->name, g->wcardep) != 0) {
struct mgcp_subchannel *tmp_sub, *first_sub; struct mgcp_subchannel *tmp_sub, *first_sub;
if (option_verbose > 2) { if (option_verbose > 2) {
@ -3635,7 +3635,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v)
e->needaudit = 1; e->needaudit = 1;
} }
strncpy(gw->wcardep, v->value, sizeof(gw->wcardep)-1); strncpy(gw->wcardep, v->value, sizeof(gw->wcardep)-1);
//strncpy(e->name, "aaln/*", sizeof(e->name) - 1); /*strncpy(e->name, "aaln/*", sizeof(e->name) - 1); */
/* XXX Should we really check for uniqueness?? XXX */ /* XXX Should we really check for uniqueness?? XXX */
strncpy(e->context, context, sizeof(e->context) - 1); strncpy(e->context, context, sizeof(e->context) - 1);
strncpy(e->cid_num, cid_num, sizeof(e->cid_num) - 1); strncpy(e->cid_num, cid_num, sizeof(e->cid_num) - 1);

@ -172,8 +172,8 @@ static int i4l_init(struct ast_modem_pvt *p)
if (strlen(p->incomingmsn)) { if (strlen(p->incomingmsn)) {
char *q; char *q;
snprintf(cmd, sizeof(cmd), "AT&L%s", p->incomingmsn); snprintf(cmd, sizeof(cmd), "AT&L%s", p->incomingmsn);
// translate , into ; since that is the seperator I4L uses, but can't be directly /* translate , into ; since that is the seperator I4L uses, but can't be directly */
// put in the config file because it will interpret the rest of the line as comment. /* put in the config file because it will interpret the rest of the line as comment. */
q = cmd+4; q = cmd+4;
while (*q) { while (*q) {
if (*q == ',') *q = ';'; if (*q == ',') *q = ';';
@ -319,9 +319,9 @@ static struct ast_frame *i4l_read(struct ast_modem_pvt *p)
/* Read the first two bytes, first, in case it's a control message */ /* Read the first two bytes, first, in case it's a control message */
res = read(p->fd, result, 2); res = read(p->fd, result, 2);
if (res < 2) { if (res < 2) {
// short read, means there was a hangup? /* short read, means there was a hangup? */
// (or is this also possible without hangup?) /* (or is this also possible without hangup?) */
// Anyway, reading from unitialized buffers is a bad idea anytime. /* Anyway, reading from unitialized buffers is a bad idea anytime. */
if (errno == EAGAIN) if (errno == EAGAIN)
return i4l_handle_escape(p, 0); return i4l_handle_escape(p, 0);
return NULL; return NULL;
@ -337,7 +337,7 @@ static struct ast_frame *i4l_read(struct ast_modem_pvt *p)
ast_modem_trim(result); ast_modem_trim(result);
if (!strcasecmp(result, "VCON")) { if (!strcasecmp(result, "VCON")) {
/* If we're in immediate mode, reply now */ /* If we're in immediate mode, reply now */
// if (p->mode == MODEM_MODE_IMMEDIATE) /* if (p->mode == MODEM_MODE_IMMEDIATE) */
return i4l_handle_escape(p, 'X'); return i4l_handle_escape(p, 'X');
} else } else
if (!strcasecmp(result, "BUSY")) { if (!strcasecmp(result, "BUSY")) {
@ -587,11 +587,11 @@ static int i4l_dial(struct ast_modem_pvt *p, char *stuff)
char tmpmsn[255]; char tmpmsn[255];
struct ast_channel *c = p->owner; struct ast_channel *c = p->owner;
// Find callerid number first, to set the correct A number /* Find callerid number first, to set the correct A number */
if (c && c->cid.cid_num && !(c->cid.cid_pres & 0x20)) { if (c && c->cid.cid_num && !(c->cid.cid_pres & 0x20)) {
snprintf(tmpmsn, sizeof(tmpmsn), ",%s,", c->cid.cid_num); snprintf(tmpmsn, sizeof(tmpmsn), ",%s,", c->cid.cid_num);
if(strlen(p->outgoingmsn) && strstr(p->outgoingmsn,tmpmsn) != NULL) { if(strlen(p->outgoingmsn) && strstr(p->outgoingmsn,tmpmsn) != NULL) {
// Tell ISDN4Linux to use this as A number /* Tell ISDN4Linux to use this as A number */
snprintf(cmd, sizeof(cmd), "AT&E%s\n", c->cid.cid_num); snprintf(cmd, sizeof(cmd), "AT&E%s\n", c->cid.cid_num);
if (ast_modem_send(p, cmd, strlen(cmd))) { if (ast_modem_send(p, cmd, strlen(cmd))) {
ast_log(LOG_WARNING, "Unable to set A number to %s\n", c->cid.cid_num); ast_log(LOG_WARNING, "Unable to set A number to %s\n", c->cid.cid_num);

@ -3,7 +3,7 @@
* *
* Implementation of the Skinny protocol * Implementation of the Skinny protocol
* *
* Asterisk is Copyright (C) 1999-2003 Mark Spencer * Copyright (C) 1999-2004 Digium, inc
* *
* chan_skinny was developed by Jeremy McNamara & Florian Overkamp * chan_skinny was developed by Jeremy McNamara & Florian Overkamp
* *
@ -1449,7 +1449,7 @@ static void *skinny_ss(void *data)
((exten[0] != '*') || (!ast_strlen_zero(exten) > 2))) { ((exten[0] != '*') || (!ast_strlen_zero(exten) > 2))) {
ast_log(LOG_WARNING, "Can't match [%s] from '%s' in context %s\n", exten, chan->cid.cid_num ? chan->cid.cid_num : "<Unknown Caller>", chan->context); ast_log(LOG_WARNING, "Can't match [%s] from '%s' in context %s\n", exten, chan->cid.cid_num ? chan->cid.cid_num : "<Unknown Caller>", chan->context);
transmit_tone(s, SKINNY_REORDER); transmit_tone(s, SKINNY_REORDER);
sleep(3); // hang out for 3 seconds to let congestion play sleep(3); /* hang out for 3 seconds to let congestion play */
break; break;
} }
if (!timeout) if (!timeout)
@ -2716,7 +2716,7 @@ void delete_devices(void)
int reload(void) int reload(void)
{ {
#if 0 #if 0
// XXX Causes Seg /* XXX Causes Seg - needs to be fixed, or? */
delete_devices(); delete_devices();
reload_config(); reload_config();

@ -5,9 +5,10 @@
* Based on frompcm.c and topcm.c from the Emiliano MIPL browser/ * Based on frompcm.c and topcm.c from the Emiliano MIPL browser/
* interpreter. See http://www.bsdtelephony.com.mx * interpreter. See http://www.bsdtelephony.com.mx
* *
* Copyright (c) 2001 Linux Support Services, Inc. All rights reserved. * Copyright (c) 2001-2004 Digium, inc
* All rights reserved.
* *
* Karl Sackett <krs@linux-support.net>, 2001-3-21 * Karl Sackett <krs@linux-support.net>, 2001-03-21
* *
* This program is free software, distributed under the terms of * This program is free software, distributed under the terms of
* the GNU General Public License * the GNU General Public License

@ -5,7 +5,7 @@
* Based on frompcm.c and topcm.c from the Emiliano MIPL browser/ * Based on frompcm.c and topcm.c from the Emiliano MIPL browser/
* interpreter. See http://www.bsdtelephony.com.mx * interpreter. See http://www.bsdtelephony.com.mx
* *
* Copyright (c) 2004, Digium * Copyright (c) 2004, Digium, inc
* *
* Mark Spencer <markster@digium.com> * Mark Spencer <markster@digium.com>
* *

@ -8,9 +8,9 @@
* *
* See http://www.arl.wustl.edu/~jaf/ * See http://www.arl.wustl.edu/~jaf/
* *
* Copyright (C) 1999, Mark Spencer * Copyright (C) 1999-2004 Digium,inc
* *
* Mark Spencer <markster@linux-support.net> * Mark Spencer <markster@digium.com>
* *
* This program is free software, distributed under the terms of * This program is free software, distributed under the terms of
* the GNU General Public License * the GNU General Public License

@ -187,7 +187,7 @@ static int g729_seek(struct ast_filestream *fs, long sample_offset, int whence)
if (whence != SEEK_FORCECUR) { if (whence != SEEK_FORCECUR) {
offset = (offset > max)?max:offset; offset = (offset > max)?max:offset;
} }
// protect against seeking beyond begining. /* protect against seeking beyond begining. */
offset = (offset < min)?min:offset; offset = (offset < min)?min:offset;
if (lseek(fs->fd, offset, SEEK_SET) < 0) if (lseek(fs->fd, offset, SEEK_SET) < 0)
return -1; return -1;

@ -3,9 +3,9 @@
* *
* Save to raw, headerless GSM data. * Save to raw, headerless GSM data.
* *
* Copyright (C) 1999, Mark Spencer * Copyright (C) 1999-2004, Digium, inc
* *
* Mark Spencer <markster@linux-support.net> * Mark Spencer <markster@digium.com>
* *
* This program is free software, distributed under the terms of * This program is free software, distributed under the terms of
* the GNU General Public License * the GNU General Public License
@ -200,7 +200,7 @@ static int gsm_seek(struct ast_filestream *fs, long sample_offset, int whence)
offset = distance + cur; offset = distance + cur;
else if(whence == SEEK_END) else if(whence == SEEK_END)
offset = max - distance; offset = max - distance;
// Always protect against seeking past the begining. /* Always protect against seeking past the begining. */
offset = (offset < min)?min:offset; offset = (offset < min)?min:offset;
if (whence != SEEK_FORCECUR) { if (whence != SEEK_FORCECUR) {
offset = (offset > max)?max:offset; offset = (offset > max)?max:offset;

@ -5,9 +5,9 @@
* *
* Brian K. West <brian@bkw.org> * Brian K. West <brian@bkw.org>
* *
* Copyright (C) 1999, Mark Spencer * Copyright (C) 1999-2004, Digium, inc
* *
* Mark Spencer <markster@linux-support.net> * Mark Spencer <markster@digium.com>
* *
* This program is free software, distributed under the terms of * This program is free software, distributed under the terms of
* the GNU General Public License * the GNU General Public License
@ -189,7 +189,7 @@ static int ilbc_seek(struct ast_filestream *fs, long sample_offset, int whence)
if (whence != SEEK_FORCECUR) { if (whence != SEEK_FORCECUR) {
offset = (offset > max)?max:offset; offset = (offset > max)?max:offset;
} }
// protect against seeking beyond begining. /* protect against seeking beyond begining. */
offset = (offset < min)?min:offset; offset = (offset < min)?min:offset;
if (lseek(fs->fd, offset, SEEK_SET) < 0) if (lseek(fs->fd, offset, SEEK_SET) < 0)
return -1; return -1;

@ -175,7 +175,7 @@ static int slinear_seek(struct ast_filestream *fs, long sample_offset, int whenc
if (whence != SEEK_FORCECUR) { if (whence != SEEK_FORCECUR) {
offset = (offset > max)?max:offset; offset = (offset > max)?max:offset;
} }
// always protect against seeking past begining. /* always protect against seeking past begining. */
offset = (offset < min)?min:offset; offset = (offset < min)?min:offset;
return lseek(fs->fd, offset, SEEK_SET); return lseek(fs->fd, offset, SEEK_SET);
} }

@ -501,7 +501,7 @@ static int wav_seek(struct ast_filestream *fs, long sample_offset, int whence)
offset = distance + cur; offset = distance + cur;
else if(whence == SEEK_END) else if(whence == SEEK_END)
offset = max - distance; offset = max - distance;
// always protect against seeking past end of header /* always protect against seeking past end of header */
offset = (offset < min)?min:offset; offset = (offset < min)?min:offset;
if (whence != SEEK_FORCECUR) { if (whence != SEEK_FORCECUR) {
offset = (offset > max)?max:offset; offset = (offset > max)?max:offset;

@ -10,8 +10,8 @@
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
// SMS queuing application for use with asterisk app_sms /* SMS queuing application for use with asterisk app_sms */
// by Adrian Kennard, 2004 /* by Adrian Kennard, 2004 */
/* reads next USC character from null terminated UTF-8 string and advanced pointer */ /* reads next USC character from null terminated UTF-8 string and advanced pointer */
/* for non valid UTF-8 sequences, returns character as is */ /* for non valid UTF-8 sequences, returns character as is */
@ -65,8 +65,8 @@ static int utf8decode (unsigned char **pp)
return *p; /* not sensible */ return *p; /* not sensible */
} }
// check for any queued messages in specific queue (queue="" means any queue) /* check for any queued messages in specific queue (queue="" means any queue) */
// returns 0 if nothing queued, 1 if queued and outgoing set up OK, 2 of outgoing exists /* returns 0 if nothing queued, 1 if queued and outgoing set up OK, 2 of outgoing exists */
static char txqcheck (char *dir, char *queue, char subaddress, char *channel, char *callerid, int wait, int delay, int retries, int concurrent) static char txqcheck (char *dir, char *queue, char subaddress, char *channel, char *callerid, int wait, int delay, int retries, int concurrent)
{ {
char ogname[100], char ogname[100],
@ -90,7 +90,7 @@ static char txqcheck (char *dir, char *queue, char subaddress, char *channel, ch
return 0; return 0;
} }
if (!ql) if (!ql)
{ // not searching any specific queue, so use whatr we found as the queue { /* not searching any specific queue, so use whatr we found as the queue */
queue = fn->d_name; queue = fn->d_name;
ql = p - queue; ql = p - queue;
} }
@ -150,18 +150,18 @@ static char txqcheck (char *dir, char *queue, char subaddress, char *channel, ch
try++; try++;
snprintf(ogname, sizeof(ogname), "outgoing/smsq.%s.%s.%d", dir, queue, try); snprintf(ogname, sizeof(ogname), "outgoing/smsq.%s.%s.%d", dir, queue, try);
if (!link (temp, ogname)) if (!link (temp, ogname))
{ // queued OK { /* queued OK */
unlink (temp); unlink (temp);
return 1; return 1;
} }
} }
} }
// failed to create call queue /* failed to create call queue */
unlink (temp); unlink (temp);
return 2; return 2;
} }
// Process received queue entries and run through a process, setting environment variables /* Process received queue entries and run through a process, setting environment variables */
static void rxqcheck (char *dir, char *queue, char *process) static void rxqcheck (char *dir, char *queue, char *process)
{ {
unsigned char *p; unsigned char *p;
@ -186,7 +186,7 @@ static void rxqcheck (char *dir, char *queue, char *process)
FILE *f; FILE *f;
snprintf (filename, sizeof(filename), "sms/%s/%s", dir, fn->d_name); snprintf (filename, sizeof(filename), "sms/%s/%s", dir, fn->d_name);
if (rename (filename, temp)) if (rename (filename, temp))
continue; // cannot access file continue; /* cannot access file */
f = fopen (temp, "r"); f = fopen (temp, "r");
unlink (temp); unlink (temp);
if (!f) if (!f)
@ -229,7 +229,7 @@ static void rxqcheck (char *dir, char *queue, char *process)
while (isspace (*p)) while (isspace (*p))
*p++ = 0; *p++ = 0;
if (*p == '=') if (*p == '=')
{ // = { /* = */
*p++ = 0; *p++ = 0;
if (!strcmp (line, "oa") || !strcmp (line, "da") || !strcmp (line, "scts") || !strcmp (line, "pid") if (!strcmp (line, "oa") || !strcmp (line, "da") || !strcmp (line, "scts") || !strcmp (line, "pid")
|| !strcmp (line, "dcs") || !strcmp (line, "mr") || !strcmp (line, "vp")) || !strcmp (line, "dcs") || !strcmp (line, "mr") || !strcmp (line, "vp"))
@ -237,7 +237,7 @@ static void rxqcheck (char *dir, char *queue, char *process)
else if ((!strcmp (line, "srr") || !strcmp (line, "rp")) && atoi (p)) else if ((!strcmp (line, "srr") || !strcmp (line, "rp")) && atoi (p))
setenv (line, "", 1); setenv (line, "", 1);
else if (!strcmp (line, "ud")) else if (!strcmp (line, "ud"))
{ // read the user data as UTF-8 { /* read the user data as UTF-8 */
long v; long v;
udl = 0; udl = 0;
while ((v = utf8decode (&p)) && udl < 160) while ((v = utf8decode (&p)) && udl < 160)
@ -248,12 +248,12 @@ static void rxqcheck (char *dir, char *queue, char *process)
{ {
*p++ = 0; *p++ = 0;
if (*p == '#') if (*p == '#')
{ // ## { /* ## */
p++; p++;
if (!strcmp (line, "udh")) if (!strcmp (line, "udh"))
setenv (line, p, 1); setenv (line, p, 1);
else if (!strcmp (line, "ud")) else if (!strcmp (line, "ud"))
{ // read user data UCS-2 { /* read user data UCS-2 */
udl = 0; udl = 0;
while (*p && udl < 160) while (*p && udl < 160)
{ {
@ -269,9 +269,9 @@ static void rxqcheck (char *dir, char *queue, char *process)
} }
} }
} else } else
{ // # { /* # */
if (!strcmp (line, "ud")) if (!strcmp (line, "ud"))
{ // read user data UCS-1 { /* read user data UCS-1 */
udl = 0; udl = 0;
while (*p && udl < 160) while (*p && udl < 160)
{ {
@ -287,7 +287,7 @@ static void rxqcheck (char *dir, char *queue, char *process)
} }
} }
fclose (f); fclose (f);
// set up user data variables /* set up user data variables */
{ {
char temp[481]; char temp[481];
int n, int n,
@ -367,13 +367,13 @@ static void rxqcheck (char *dir, char *queue, char *process)
} }
setenv ("ud16", temp, 1); setenv ("ud16", temp, 1);
} }
// run the command /* run the command */
system (process); system (process);
} }
closedir (d); closedir (d);
} }
// Main app /* Main app */
int int
main (int argc, const char *argv[]) main (int argc, const char *argv[])
{ {
@ -417,7 +417,7 @@ main (int argc, const char *argv[])
*defaultsubaddress = "9", *defaultsubaddress = "9",
subaddress = 0, subaddress = 0,
*scts = 0; *scts = 0;
poptContext optCon; // context for parsing command-line options poptContext optCon; /* context for parsing command-line options */
const struct poptOption optionsTable[] = { const struct poptOption optionsTable[] = {
{"queue", 'q', POPT_ARG_STRING | POPT_ARGFLAG_SHOW_DEFAULT, &queue, 0, "Queue [inc sub address]", "number[-X]"}, {"queue", 'q', POPT_ARG_STRING | POPT_ARGFLAG_SHOW_DEFAULT, &queue, 0, "Queue [inc sub address]", "number[-X]"},
{"da", 'd', POPT_ARG_STRING, &da, 0, "Destination address", "number"}, {"da", 'd', POPT_ARG_STRING, &da, 0, "Destination address", "number"},
@ -485,7 +485,7 @@ main (int argc, const char *argv[])
fprintf (stderr, "Command line arguments always treated as UTF-8\n"); fprintf (stderr, "Command line arguments always treated as UTF-8\n");
return 1; return 1;
} }
// if (!where && poptPeekArg (optCon)) where = (char *) poptGetArg (optCon); /* if (!where && poptPeekArg (optCon)) where = (char *) poptGetArg (optCon); */
if (!mt && !mo && process) if (!mt && !mo && process)
mt = 1; mt = 1;
if (!mt && !mo && oa) if (!mt && !mo && oa)
@ -585,7 +585,7 @@ main (int argc, const char *argv[])
return 1; return 1;
} }
if (udfile) if (udfile)
{ // get message from file { /* get message from file */
unsigned char dat[1204], unsigned char dat[1204],
*p = dat, *p = dat,
*e; *e;
@ -642,14 +642,14 @@ main (int argc, const char *argv[])
} }
if (oa || da) if (oa || da)
{ // send message { /* send message */
char temp[100], char temp[100],
queuename[100], queuename[100],
*dir = (mo ? rx ? "sms/morx" : "sms/motx" : rx ? "sms/mtrx" : "sms/mttx"); *dir = (mo ? rx ? "sms/morx" : "sms/motx" : rx ? "sms/mtrx" : "sms/mttx");
FILE *f; FILE *f;
snprintf (temp, sizeof(temp), "sms/.smsq-%d", getpid ()); snprintf (temp, sizeof(temp), "sms/.smsq-%d", getpid ());
mkdir ("sms", 0777); // ensure directory exists mkdir ("sms", 0777); /* ensure directory exists */
mkdir (dir, 0777); // ensure directory exists mkdir (dir, 0777); /* ensure directory exists */
snprintf (queuename, sizeof(queuename), "%s/%s.%ld-%d", dir, *queue ? queue : "0", (long)time (0), getpid ()); snprintf (queuename, sizeof(queuename), "%s/%s.%ld-%d", dir, *queue ? queue : "0", (long)time (0), getpid ());
f = fopen (temp, "w"); f = fopen (temp, "w");
if (!f) if (!f)
@ -713,7 +713,7 @@ main (int argc, const char *argv[])
} }
if (!nodial && tx && !process) if (!nodial && tx && !process)
{ // dial to send messages { /* dial to send messages */
char ret=0, char ret=0,
try = 3; try = 3;
if (nowait) if (nowait)
@ -725,7 +725,7 @@ main (int argc, const char *argv[])
else else
ret = txqcheck ("mttx", queue, subaddress, mttxchannel, mttxcallerid, mttxwait, mttxdelay, mttxretries, concurrent); ret = txqcheck ("mttx", queue, subaddress, mttxchannel, mttxcallerid, mttxwait, mttxdelay, mttxretries, concurrent);
if (ret < 2) if (ret < 2)
break; // sent, or queued OK break; /* sent, or queued OK */
if (try) if (try)
sleep (1); sleep (1);
} }

Loading…
Cancel
Save