[-]
[+]
|
Changed |
asterisk16-addons.spec
|
|
[-]
[+]
|
Deleted |
asterisk-addons-1.6.0-beta3.tar.gz/apps/app_fax.c
^
|
@@ -1,746 +0,0 @@
-/*
- * Asterisk -- A telephony toolkit for Linux.
- *
- * Simple fax applications
- *
- * 2007-2008, Dmitry Andrianov <asterisk@dima.spb.ru>
- *
- * Code based on original implementation by Steve Underwood <steveu@coppice.org>
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License
- *
- */
-
-/*** MODULEINFO
- <depend>spandsp</depend>
-***/
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision: 534 $")
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <errno.h>
-#include <tiffio.h>
-
-#include <spandsp.h>
-
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/app.h"
-#include "asterisk/dsp.h"
-#include "asterisk/module.h"
-#include "asterisk/manager.h"
-
-static char *app_sndfax_name = "SendFAX";
-static char *app_sndfax_synopsis = "Send a FAX";
-static char *app_sndfax_desc =
-" SendFAX(filename[|options]):\n"
-"Send a given TIFF file to the channel as a FAX.\n"
-"The option string may contain zero or more of the following characters:\n"
-" 'a' -- makes the application behave as an answering machine\n"
-" The default behaviour is to behave as a calling machine.\n"
-"\n"
-"This application uses following variables:\n"
-" LOCALSTATIONID to identify itself to the remote end.\n"
-" LOCALHEADERINFO to generate a header line on each page.\n"
-"\n"
-"This application sets the following channel variables upon completion:\n"
-" FAXSTATUS - status of operation:\n"
-" SUCCESS | FAILED\n"
-" FAXERROR - Error when FAILED\n"
-" REMOTESTATIONID - CSID of the remote side.\n"
-" FAXPAGES - number of pages sent.\n"
-" FAXBITRATE - transmition rate.\n"
-" FAXRESOLUTION - resolution.\n"
-"\n"
-"Returns -1 in case of user hang up or any channel error.\n"
-"Returns 0 on success.\n";
-
-static char *app_rcvfax_name = "ReceiveFAX";
-static char *app_rcvfax_synopsis = "Receive a FAX";
-static char *app_rcvfax_desc =
-" ReceiveFAX(filename[|options]):\n"
-"Receives a fax from the channel into the given filename overwriting\n"
-"the file if it already exists. File created will have TIFF format.\n"
-"The option string may contain zero or more of the following characters:\n"
-" 'c' -- makes the application behave as a calling machine\n"
-" The default behaviour is to behave as an answering machine.\n"
-"\n"
-"This application uses following variables:\n"
-" LOCALSTATIONID to identify itself to the remote end.\n"
-" LOCALHEADERINFO to generate a header line on each page.\n"
-"\n"
-"This application sets the following channel variables upon completion:\n"
-" FAXSTATUS - status of operation:\n"
-" SUCCESS | FAILED\n"
-" FAXERROR - Error when FAILED\n"
-" REMOTESTATIONID - CSID of the remote side.\n"
-" FAXPAGES - number of pages sent.\n"
-" FAXBITRATE - transmition rate.\n"
-" FAXRESOLUTION - resolution.\n"
-"\n"
-"Returns -1 in case of user hang up or any channel error.\n"
-"Returns 0 on success.\n";
-
-#define MAX_SAMPLES 240
-
-/* Watchdog. I have seen situations when remote fax disconnects (because of poor line
- quality) while SpanDSP continues staying in T30_STATE_IV_CTC state forever.
- To avoid this, we terminate when we see that T30 state does not change for 5 minutes.
- We also terminate application when more than 30 minutes passed regardless of
- state changes. This is just a precaution measure - no fax should take that long */
-
-#define WATCHDOG_TOTAL_TIMEOUT 30 * 60
-#define WATCHDOG_STATE_TIMEOUT 5 * 60
-
-typedef struct {
- struct ast_channel *chan;
- enum ast_t38_state t38state; /* T38 state of the channel */
- int direction; /* Fax direction: 0 - receiving, 1 - sending */
- int caller_mode;
- char *file_name;
-
- volatile int finished;
-} fax_session;
-
-static void span_message(int level, const char *msg)
-{
- if (level == SPAN_LOG_ERROR)
- ast_log(LOG_ERROR, msg);
- else if (level == SPAN_LOG_WARNING)
- ast_log(LOG_WARNING, msg);
- else
- ast_log(LOG_DEBUG, msg);
-}
-
-static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
-{
- struct ast_channel *chan = (struct ast_channel *) user_data;
-
- struct ast_frame outf = {
- .frametype = AST_FRAME_MODEM,
- .subclass = AST_MODEM_T38,
- .src = __FUNCTION__,
- };
-
- /* TODO: Asterisk does not provide means of resending the same packet multiple
- times so count is ignored at the moment */
-
- AST_FRAME_SET_BUFFER(&outf, buf, 0, len);
-
- if (ast_write(chan, &outf) < 0) {
- ast_log(LOG_WARNING, "Unable to write frame to channel; %s\n", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static void phase_e_handler(t30_state_t *f, void *user_data, int result)
-{
- char local_ident[T30_MAX_IDENT_LEN];
- char far_ident[T30_MAX_IDENT_LEN];
- char buf[20];
- fax_session *s = (fax_session *) user_data;
- t30_stats_t stat;
-
- ast_debug(1, "Fax phase E handler. result=%d\n", result);
-
- t30_get_transfer_statistics(f, &stat);
-
- s = (fax_session *) user_data;
-
- if (result != T30_ERR_OK) {
- s->finished = -1;
-
- /* FAXSTATUS is already set to FAILED */
- pbx_builtin_setvar_helper(s->chan, "FAXERROR", t30_completion_code_to_str(result));
-
- ast_log(LOG_WARNING, "Error transmitting fax. result=%d: %s.\n", result, t30_completion_code_to_str(result));
-
- return;
- }
-
- s->finished = 1;
-
- t30_get_local_ident(f, local_ident);
- t30_get_far_ident(f, far_ident);
- 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);
- snprintf(buf, sizeof(buf), "%d", stat.pages_transferred);
- pbx_builtin_setvar_helper(s->chan, "FAXPAGES", buf);
- 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);
-
- ast_debug(1, "Fax transmitted successfully.\n");
- ast_debug(1, " Remote station ID: %s\n", far_ident);
- ast_debug(1, " Pages transferred: %d\n", stat.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);
-
- manager_event(EVENT_FLAG_CALL,
- s->direction ? "FaxSent" : "FaxReceived",
- "Channel: %s\r\n"
- "Exten: %s\r\n"
- "CallerID: %s\r\n"
- "RemoteStationID: %s\r\n"
- "LocalStationID: %s\r\n"
- "PagesTransferred: %d\r\n"
- "Resolution: %d\r\n"
- "TransferRate: %d\r\n"
- "FileName: %s\r\n",
- s->chan->name,
- s->chan->exten,
- S_OR(s->chan->cid.cid_num, ""),
- far_ident,
- local_ident,
- stat.pages_transferred,
- stat.y_resolution,
- stat.bit_rate,
- s->file_name);
-}
-
-/* === Helper functions to configure fax === */
-
-/* Setup SPAN logging according to Asterisk debug level */
-static int set_logging(logging_state_t *state)
-{
- int level = SPAN_LOG_WARNING + option_debug;
-
- span_log_set_message_handler(state, span_message);
- span_log_set_level(state, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | level);
-}
-
-static void set_local_info(t30_state_t *state, fax_session *s)
-{
- const char *x;
-
- x = pbx_builtin_getvar_helper(s->chan, "LOCALSTATIONID");
- if (!ast_strlen_zero(x))
- t30_set_local_ident(state, x);
-
- x = pbx_builtin_getvar_helper(s->chan, "LOCALHEADERINFO");
- if (!ast_strlen_zero(x))
- t30_set_header_info(state, x);
-}
-
-static void set_file(t30_state_t *state, fax_session *s)
-{
- if (s->direction)
- t30_set_tx_file(state, s->file_name, -1, -1);
- else
- t30_set_rx_file(state, s->file_name, -1);
-}
-
-static void set_ecm(t30_state_t *state, int ecm)
-{
- t30_set_ecm_capability(state, ecm);
- t30_set_supported_compressions(state, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
-}
-
-/* === Generator === */
-
-/* This function is only needed to return passed params so
- generator_activate will save it to channel's generatordata */
-static void *fax_generator_alloc(struct ast_channel *chan, void *params)
-{
- return params;
-}
-
-static int fax_generator_generate(struct ast_channel *chan, void *data, int len, int samples)
-{
- fax_state_t *fax = (fax_state_t*) data;
- uint8_t buffer[AST_FRIENDLY_OFFSET + MAX_SAMPLES * sizeof(uint16_t)];
- int16_t *buf = (int16_t *) (buffer + AST_FRIENDLY_OFFSET);
-
- struct ast_frame outf = {
- .frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_SLINEAR,
- .src = __FUNCTION__,
- };
-
- if (samples > MAX_SAMPLES) {
- ast_log(LOG_WARNING, "Only generating %d samples, where %d requested\n", MAX_SAMPLES, samples);
- samples = MAX_SAMPLES;
- }
-
- if ((len = fax_tx(fax, buf, samples)) > 0) {
- outf.samples = len;
- AST_FRAME_SET_BUFFER(&outf, buffer, AST_FRIENDLY_OFFSET, len * sizeof(int16_t));
-
- if (ast_write(chan, &outf) < 0) {
- ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno));
- return -1;
- }
- }
-
- return 0;
-}
-
-struct ast_generator generator = {
- alloc: fax_generator_alloc,
- generate: fax_generator_generate,
-};
-
-
-/* === Transmission === */
-
-static int transmit_audio(fax_session *s)
-{
- int res = -1;
- int original_read_fmt = AST_FORMAT_SLINEAR;
- int original_write_fmt = AST_FORMAT_SLINEAR;
- int len;
- int samples;
- fax_state_t fax;
- struct ast_dsp *dsp = NULL;
- int detect_tone = 0;
- struct ast_frame *inf = NULL;
- struct ast_frame outf;
- struct ast_frame *fr;
- uint8_t buffer[AST_FRIENDLY_OFFSET + MAX_SAMPLES * sizeof(uint16_t)];
- int16_t *buf = (int16_t *) (buffer + AST_FRIENDLY_OFFSET);
- int last_state = 0;
- struct timeval now, start, state_change;
- enum ast_control_t38 t38control;
-
- original_read_fmt = s->chan->readformat;
- if (original_read_fmt != AST_FORMAT_SLINEAR) {
- res = ast_set_read_format(s->chan, AST_FORMAT_SLINEAR);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to set to linear read mode, giving up\n");
- goto done;
- }
- }
-
- original_write_fmt = s->chan->writeformat;
- if (original_write_fmt != AST_FORMAT_SLINEAR) {
- res = ast_set_write_format(s->chan, AST_FORMAT_SLINEAR);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to set to linear write mode, giving up\n");
- goto done;
- }
- }
-
- /* Initialize T30 terminal */
- fax_init(&fax, s->caller_mode);
-
- /* Setup logging */
- set_logging(&fax.logging);
- set_logging(&fax.t30_state.logging);
-
- /* Configure terminal */
- set_local_info(&fax.t30_state, s);
- set_file(&fax.t30_state, s);
- set_ecm(&fax.t30_state, TRUE);
-
- fax_set_transmit_on_idle(&fax, TRUE);
-
- t30_set_phase_e_handler(&fax.t30_state, phase_e_handler, s);
-
- if (s->t38state == T38_STATE_UNAVAILABLE) {
- ast_debug(1, "T38 is unavailable on %s\n", s->chan->name);
- } else if (!s->direction) {
- /* We are receiving side and this means we are the side which should
- request T38 when the fax is detected. Use DSP to detect fax tone */
- ast_debug(1, "Setting up CNG detection on %s\n", s->chan->name);
- dsp = ast_dsp_new();
- ast_dsp_set_features(dsp, DSP_FEATURE_FAX_DETECT);
- ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG);
- detect_tone = 1;
- }
-
- start = state_change = ast_tvnow();
-
- ast_activate_generator(s->chan, &generator, &fax);
-
- while (!s->finished) {
- res = ast_waitfor(s->chan, 20);
- if (res < 0)
- break;
- else if (res > 0)
- res = 0;
-
- inf = ast_read(s->chan);
- if (inf == NULL) {
- ast_debug(1, "Channel hangup\n");
- res = -1;
- break;
- }
-
- ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
-
- /* Detect fax tone */
- if (detect_tone && inf->frametype == AST_FRAME_VOICE) {
- /* Duplicate frame because ast_dsp_process may free the frame passed */
- fr = ast_frdup(inf);
-
- /* Do not pass channel to ast_dsp_process otherwise it may queue modified audio frame back */
- fr = ast_dsp_process(NULL, dsp, fr);
- if (fr && fr->frametype == AST_FRAME_DTMF && fr->subclass == 'f') {
- ast_debug(1, "Fax tone detected. Requesting T38\n");
- t38control = AST_T38_REQUEST_NEGOTIATE;
- ast_indicate_data(s->chan, AST_CONTROL_T38, &t38control, sizeof(t38control));
- detect_tone = 0;
- }
-
- ast_frfree(fr);
- }
-
-
- /* Check the frame type. Format also must be checked because there is a chance
- that a frame in old format was already queued before we set chanel format
- to slinear so it will still be received by ast_read */
- if (inf->frametype == AST_FRAME_VOICE && inf->subclass == AST_FORMAT_SLINEAR) {
-
- if (fax_rx(&fax, inf->data, inf->samples) < 0) {
- /* I know fax_rx never returns errors. The check here is for good style only */
- ast_log(LOG_WARNING, "fax_rx returned error\n");
- res = -1;
- break;
- }
-
- /* Watchdog */
- if (last_state != fax.t30_state.state) {
- state_change = ast_tvnow();
- last_state = fax.t30_state.state;
- }
- } else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38 &&
- inf->datalen == sizeof(enum ast_control_t38)) {
- t38control =*((enum ast_control_t38 *) inf->data);
- if (t38control == AST_T38_NEGOTIATED) {
- /* T38 switchover completed */
- ast_debug(1, "T38 negotiated, finishing audio loop\n");
- res = 1;
- break;
- }
- }
-
- ast_frfree(inf);
- inf = NULL;
-
- /* Watchdog */
- now = ast_tvnow();
- if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
- ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
- res = -1;
- break;
- }
- }
-
- ast_debug(1, "Loop finished, res=%d\n", res);
-
- if (inf)
- ast_frfree(inf);
-
- if (dsp)
- ast_dsp_free(dsp);
-
- ast_deactivate_generator(s->chan);
-
- /* Remove phase E handler because we do not want it to be executed
- only because we called t30_terminate */
- t30_set_phase_e_handler(&fax.t30_state, NULL, NULL);
-
- t30_terminate(&fax.t30_state);
- fax_release(&fax);
-
-done:
- if (original_write_fmt != AST_FORMAT_SLINEAR) {
- if (ast_set_write_format(s->chan, original_write_fmt) < 0)
- ast_log(LOG_WARNING, "Unable to restore write format on '%s'\n", s->chan->name);
- }
-
- if (original_read_fmt != AST_FORMAT_SLINEAR) {
- if (ast_set_read_format(s->chan, original_read_fmt) < 0)
- ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", s->chan->name);
- }
-
- return res;
-
-}
-
-static int transmit_t38(fax_session *s)
-{
- int res = 0;
- int len;
- int samples;
- t38_terminal_state_t t38;
- struct ast_frame *inf = NULL;
- int last_state = 0;
- struct timeval now, start, state_change, last_frame;
- enum ast_control_t38 t38control;
-
- /* Initialize terminal */
- memset(&t38, 0, sizeof(t38));
- if (t38_terminal_init(&t38, s->caller_mode, t38_tx_packet_handler, s->chan) == NULL) {
- ast_log(LOG_WARNING, "Unable to start T.38 termination.\n");
- return -1;
- }
-
- /* Setup logging */
- set_logging(&t38.logging);
- set_logging(&t38.t30_state.logging);
- set_logging(&t38.t38.logging);
-
- /* Configure terminal */
- set_local_info(&t38.t30_state, s);
- set_file(&t38.t30_state, s);
- set_ecm(&t38.t30_state, TRUE);
-
- t30_set_phase_e_handler(&t38.t30_state, phase_e_handler, s);
-
- now = start = state_change = ast_tvnow();
-
- while (!s->finished) {
-
- res = ast_waitfor(s->chan, 20);
- if (res < 0)
- break;
- else if (res > 0)
- res = 0;
-
- last_frame = now;
- now = ast_tvnow();
- t38_terminal_send_timeout(&t38, ast_tvdiff_us(now, last_frame) / (1000000 / 8000));
-
- inf = ast_read(s->chan);
- if (inf == NULL) {
- ast_debug(1, "Channel hangup\n");
- res = -1;
- break;
- }
-
- ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
-
- if (inf->frametype == AST_FRAME_MODEM && inf->subclass == AST_MODEM_T38) {
- t38_core_rx_ifp_packet(&t38.t38, inf->data, inf->datalen, inf->seqno);
-
- /* Watchdog */
- if (last_state != t38.t30_state.state) {
- state_change = ast_tvnow();
- last_state = t38.t30_state.state;
- }
- } else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38 &&
- inf->datalen == sizeof(enum ast_control_t38)) {
-
- t38control = *((enum ast_control_t38 *) inf->data);
-
- if (t38control == AST_T38_TERMINATED || t38control == AST_T38_REFUSED) {
- ast_debug(1, "T38 down, terminating\n");
- res = -1;
- break;
- }
- }
-
- ast_frfree(inf);
- inf = NULL;
-
- /* Watchdog */
- if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
- ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
- res = -1;
- break;
- }
- }
-
- ast_debug(1, "Loop finished, res=%d\n", res);
-
- if (inf)
- ast_frfree(inf);
-
- /* Remove phase E handler because we do not want it to be executed
- only because we called t30_terminate */
- t30_set_phase_e_handler(&t38.t30_state, NULL, NULL);
-
- t30_terminate(&t38.t30_state);
-
- return res;
-}
-
-static int transmit(fax_session *s)
-{
- int res = 0;
- enum ast_t38_state t38state;
-
- /* Clear all channel variables which to be set by the application.
- Pre-set status to error so in case of any problems we can just leave */
- pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "FAILED");
- pbx_builtin_setvar_helper(s->chan, "FAXERROR", "Channel problems");
-
- pbx_builtin_setvar_helper(s->chan, "REMOTESTATIONID", NULL);
- pbx_builtin_setvar_helper(s->chan, "FAXPAGES", NULL);
- pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", NULL);
- pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", NULL);
-
- if (s->chan->_state != AST_STATE_UP) {
- /* Shouldn't need this, but checking to see if channel is already answered
- * Theoretically asterisk should already have answered before running the app */
- res = ast_answer(s->chan);
- if (res) {
- ast_log(LOG_WARNING, "Could not answer channel '%s'\n", s->chan->name);
- return res;
- }
- }
-
- s->t38state = ast_channel_get_t38_state(s->chan);
- if (t38state != T38_STATE_NEGOTIATED) {
- /* T38 is not negotiated on the channel yet. First start regular transmission. If it switches to T38, follow */
- res = transmit_audio(s);
- if (res > 0) {
- /* transmit_audio reports switchover to T38. Update t38state */
- s->t38state = ast_channel_get_t38_state(s->chan);
- if (s->t38state != T38_STATE_NEGOTIATED) {
- ast_log(LOG_ERROR, "Audio loop reports T38 switchover but t38state != T38_STATE_NEGOTIATED\n");
- }
- }
- }
-
- if (s->t38state == T38_STATE_NEGOTIATED) {
- res = transmit_t38(s);
- }
-
- if (res) {
- ast_log(LOG_WARNING, "Transmission error\n");
- res = -1;
- } else if (s->finished < 0) {
- ast_log(LOG_WARNING, "Transmission failed\n");
- } else if (s->finished > 0) {
- ast_debug(1, "Transmission finished Ok\n");
- }
-
- return res;
-}
-
-/* === Application functions === */
-
-static int sndfax_exec(struct ast_channel *chan, void *data)
-{
- int res = 0;
- char *parse;
- fax_session session;
-
- AST_DECLARE_APP_ARGS(args,
- AST_APP_ARG(file_name);
- AST_APP_ARG(options);
- );
-
- if (chan == NULL) {
- ast_log(LOG_ERROR, "Fax channel is NULL. Giving up.\n");
- return -1;
- }
-
- /* The next few lines of code parse out the filename and header from the input string */
- if (ast_strlen_zero(data)) {
- /* No data implies no filename or anything is present */
- ast_log(LOG_ERROR, "SendFAX requires an argument (filename)\n");
- return -1;
- }
-
- parse = ast_strdupa(data);
- AST_STANDARD_APP_ARGS(args, parse);
-
- session.caller_mode = TRUE;
-
- if (args.options) {
- if (strchr(args.options, 'a'))
- session.caller_mode = FALSE;
- }
-
- /* Done parsing */
- session.direction = 1;
- session.file_name = args.file_name;
- session.chan = chan;
- session.finished = 0;
-
- res = transmit(&session);
-
- return res;
-}
-
-static int rcvfax_exec(struct ast_channel *chan, void *data)
-{
- int res = 0;
- char *parse;
- fax_session session;
-
- AST_DECLARE_APP_ARGS(args,
- AST_APP_ARG(file_name);
- AST_APP_ARG(options);
- );
-
- if (chan == NULL) {
- ast_log(LOG_ERROR, "Fax channel is NULL. Giving up.\n");
- return -1;
- }
-
- /* The next few lines of code parse out the filename and header from the input string */
- if (ast_strlen_zero(data)) {
- /* No data implies no filename or anything is present */
- ast_log(LOG_ERROR, "ReceiveFAX requires an argument (filename)\n");
- return -1;
- }
-
- parse = ast_strdupa(data);
- AST_STANDARD_APP_ARGS(args, parse);
-
- session.caller_mode = FALSE;
-
- if (args.options) {
- if (strchr(args.options, 'c'))
- session.caller_mode = TRUE;
- }
-
- /* Done parsing */
- session.direction = 0;
- session.file_name = args.file_name;
- session.chan = chan;
- session.finished = 0;
-
- res = transmit(&session);
-
- return res;
-}
-
-static int unload_module(void)
-{
- int res;
-
- res = ast_unregister_application(app_sndfax_name);
- res |= ast_unregister_application(app_rcvfax_name);
-
- return res;
-}
-
-static int load_module(void)
-{
- int res ;
-
- res = ast_register_application(app_sndfax_name, sndfax_exec, app_sndfax_synopsis, app_sndfax_desc);
- res |= ast_register_application(app_rcvfax_name, rcvfax_exec, app_rcvfax_synopsis, app_rcvfax_desc);
-
- /* The default SPAN message handler prints to stderr. It is something we do not want */
- span_set_message_handler(NULL);
-
- return res;
-}
-
-
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Simple FAX Application",
- .load = load_module,
- .unload = unload_module,
- );
-
-
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/.version
^
|
@@ -1 +1 @@
-1.6.0-beta3
+1.6.0.1
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/ChangeLog
^
|
@@ -1,3 +1,224 @@
+2008-12-01 Tilghman Lesher <tlesher@digium.com>
+
+ * Asterisk-Addons 1.6.0.1 released
+
+2008-11-10 20:25 +0000 [r690] Tilghman Lesher <tlesher@digium.com>
+
+ * configs/res_mysql.conf.sample, res/res_config_mysql.c: Fix
+ specification of different databases in extconfig.conf when using
+ MySQL backend. This fixes a regression. (closes issue #13603)
+ Reported by: atis Patches: multi_db.patch uploaded by atis
+ (license 242)
+
+2008-10-01 Russell Bryant <russell@digium.com>
+
+ * Asterisk-Addons 1.6.0 released
+
+2008-09-12 18:21 +0000 [r661-663] Sean Bright <sean.bright@gmail.com>
+
+ * Makefile, /: Merged revisions 662 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r662 | seanbright | 2008-09-12 14:19:17 -0400 (Fri, 12 Sep 2008)
+ | 1 line Forgot about menuselect.makeopts ........
+
+ * Makefile, /: Merged revisions 659 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r659 | seanbright | 2008-09-11 22:23:28 -0400 (Thu, 11 Sep 2008)
+ | 10 lines Update asterisk-addons to use the same logic as
+ asterisk when determining what version of menuselect to spin up
+ when not explicitly specified (i.e. 'make menuselect'). (closes
+ issue #13466) Reported by: jonnt Patches: 13466.diff uploaded by
+ seanbright (license 71) Tested by: jonnt ........
+
+2008-09-03 Russell Bryant <russell@digium.com>
+
+ * Asterisk-Addons 1.6.0-rc1 released
+
+2008-08-28 16:40 +0000 [r654] Tilghman Lesher <tlesher@digium.com>
+
+ * cdr/cdr_addon_mysql.c, /: Merged revisions 653 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r653 | tilghman | 2008-08-28 11:38:24 -0500 (Thu, 28 Aug 2008) |
+ 8 lines Don't DESC the MySQL table every time through, but
+ instead cache the state at module load and reload, just like the
+ other CDR drivers. (closes issue #13379) Reported by: Corydon76
+ Patches: 20080826__cdr_mysql__2.diff.txt uploaded by Corydon76
+ (license 14) Tested by: chris-mac ........
+
+2008-07-30 03:08 +0000 [r648] Joshua Colp <jcolp@digium.com>
+
+ * channels/ooh323c/src/ooSocket.c, /: Merged revisions 647 via
+ svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r647 | file | 2008-07-30 00:07:14 -0300 (Wed, 30 Jul 2008) | 2
+ lines Fix building of ooh323 on FreeBSD. ........
+
+2008-06-04 Mark Michelson <mmichelson@digium.com>
+
+ * Asterisk-Addons 1.6.0-beta4 released
+
+2008-06-04 17:54 +0000 [r628] Mark Michelson <mmichelson@digium.com>
+
+ * channels/ooh323c/src/ooSocket.c, channels/ooh323c/src/ooh323ep.h,
+ channels/ooh323c/src/oochannels.c,
+ channels/ooh323c/src/ooCmdChannel.c,
+ channels/ooh323c/src/ootrace.c, /, channels/chan_ooh323.c,
+ channels/ooh323c/src/ooCapability.c,
+ channels/ooh323c/src/ooCmdChannel.h,
+ channels/ooh323c/src/ootrace.h, channels/ooh323c/src/ooh323ep.c:
+ Merged revisions 627 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r627 | mmichelson | 2008-06-04 12:35:29 -0500 (Wed, 04 Jun 2008)
+ | 20 lines
+ ------------------------------------------------------------------------
+ r620 | mmichelson | 2008-06-04 11:55:58 -0500 (Wed, 04 Jun 2008)
+ | 15 lines A few changes: 1. Add error-checking to the call to
+ ooReadAndProcessStackCommands in oochannels.c 2. (1.2 only) There
+ was a char * being used before being set. This was causing an
+ almost immediate crash when ooh323 would load. This commit fixes
+ that issue. 3. Most importantly, fix a security issue wherein
+ arbitrary data could be sent to ooh323's command stack listening
+ socket causing a remote crash. See AST-2008-009 for more details.
+ (closes issue #12756) Reported by: tzafrir Patches:
+ ooh323_pipev3.diff uploaded by putnopvut (license 60) Tested by:
+ putnopvut
+ ------------------------------------------------------------------------
+ ........
+
+2008-06-02 16:17 +0000 [r616-618] Russell Bryant <russell@digium.com>
+
+ * aclocal.m4, /, configure: Merged revisions 617 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r617 | russell | 2008-06-02 11:16:32 -0500 (Mon, 02 Jun 2008) | 1
+ line regenerate configure script ........
+
+ * /, build_tools/menuselect-deps.in, apps/app_fax.c (removed),
+ configure.ac, makeopts.in: Merged revisions 615 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r615 | russell | 2008-06-02 11:15:45 -0500 (Mon, 02 Jun 2008) | 2
+ lines Remove app_fax, as it has been moved into the main Asterisk
+ repository ........
+
+2008-05-30 16:50 +0000 [r613] Tilghman Lesher <tlesher@digium.com>
+
+ * apps/app_addon_sql_mysql.c, /: Merged revisions 612 via svnmerge
+ from https://origsvn.digium.com/svn/asterisk-addons/trunk
+ ........ r612 | tilghman | 2008-05-30 11:49:06 -0500 (Fri, 30 May
+ 2008) | 6 lines When the result id is invalid, indicate that the
+ fetch returned no rows (closes issue #12758) Reported by: atis
+ Patches: mysql_fetch_bad_conn.patch uploaded by atis (license
+ 242) ........
+
+2008-05-28 22:32 +0000 [r604-608] Tilghman Lesher <tlesher@digium.com>
+
+ * /, channels/chan_ooh323.c: Merged revisions 607 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk
+ ................ r607 | tilghman | 2008-05-28 17:31:22 -0500
+ (Wed, 28 May 2008) | 15 lines Merged revisions 606 via svnmerge
+ from https://origsvn.digium.com/svn/asterisk-addons/branches/1.4
+ ........ r606 | tilghman | 2008-05-28 17:29:27 -0500 (Wed, 28 May
+ 2008) | 7 lines Change channel name to use the section name,
+ rather than CallerID name (which can contain strange characters).
+ (closes issue #12743) Reported by: softins Patches:
+ ooh323-1.4-diff.txt uploaded by softins (license 197) ........
+ ................
+
+ * channels/ooh323c/src/ooSocket.c, channels/ooh323c/src/ootypes.h,
+ channels/ooh323c/src/ooLogChan.c, channels/ooh323c/src/ooq931.c,
+ channels/ooh323c/src/ootrace.c, /, channels/ooh323c/src/ooh323.c,
+ channels/ooh323c/src/ooGkClient.c, channels/chan_ooh323.c,
+ channels/ooh323c/src/ooCapability.c, channels/chan_ooh323.h,
+ channels/ooh323cDriver.c: Merged revisions 603 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r603 | tilghman | 2008-05-28 09:45:23 -0500 (Wed, 28 May 2008) |
+ 6 lines Bring trunk up to date. (related to issue #12715)
+ Reported by: softins Patches: ooh323-1.6.0-trunk-diff.txt
+ uploaded by softins (license 197) ........
+
+2008-05-05 19:18 +0000 [r589-595] Jason Parker <jparker@digium.com>
+
+ * channels/ooh323c/src/ootrace.c, /: Merged revisions 594 via
+ svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r594 | twilson | 2008-05-05 12:37:49 -0500 (Mon, 05 May 2008) | 2
+ lines Add format attribute ........
+
+ * channels/ooh323c/src/ootrace.c, /: Merged revisions 592 via
+ svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r592 | qwell | 2008-05-05 12:06:41 -0500 (Mon, 05 May 2008) | 1
+ line Uses unambiguous non-US-centric date format. Also (and
+ mainly), %D uses %y, which is only 2 digits. gcc warns about
+ using this. ........
+
+ * /, channels/chan_ooh323.c, channels/ooh323cDriver.c: Merged
+ revisions 590 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r590 | qwell | 2008-05-05 11:50:05 -0500 (Mon, 05 May 2008) | 1
+ line Allow chan_ooh323 to build under dev-mode ........
+
+ * Makefile, /, apps/app_fax.c: Merged revisions 588 via svnmerge
+ from https://origsvn.digium.com/svn/asterisk-addons/trunk
+ ........ r588 | qwell | 2008-05-05 11:11:10 -0500 (Mon, 05 May
+ 2008) | 9 lines Make --enable-dev-mode actually work. Fix app_fax
+ build to not give warnings (which are errors when dev-mode
+ actually works). (closes issue #12579) Reported by: IgorG
+ Patches: addons_dev_mode.v2.diff uploaded by IgorG (license 20)
+ ........
+
+2008-05-05 03:49 +0000 [r587] Tilghman Lesher <tlesher@digium.com>
+
+ * cdr/cdr_addon_mysql.c, /: Merged revisions 586 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r586 | tilghman | 2008-05-04 22:37:10 -0500 (Sun, 04 May 2008) |
+ 9 lines If you pass NULL as the default to
+ my_load_config_string(), you get a string of "(null)", which is
+ NOT zero-length, and so things succeed where they should fail.
+ (Closes issue #12580) Reported by: pnlarsson Patches:
+ cdr_addon_mysql.c.patch uploaded by pnlarsson (license 79) Tested
+ by: mvanbaak ........
+
+2008-05-02 17:53 +0000 [r584] Jason Parker <jparker@digium.com>
+
+ * channels/chan_mobile.c, /: Merged revisions 583 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk ........
+ r583 | qwell | 2008-05-02 12:49:14 -0500 (Fri, 02 May 2008) | 6
+ lines Expand ciev_call (and ciev_callsetup) buffers to allow for
+ longer responses in +CIEV. Also switch a bunch of (all of)
+ sprintf calls to snprintf. (closes issue #12568) Reported by:
+ Shkoder ........
+
+2008-04-30 12:33 +0000 [r580] Kevin P. Fleming <kpfleming@digium.com>
+
+ * /, Makefile.rules: Merged revisions 579 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk
+ ................ r579 | kpfleming | 2008-04-30 07:32:23 -0500
+ (Wed, 30 Apr 2008) | 21 lines Merged revisions 578 via svnmerge
+ from https://origsvn.digium.com/svn/asterisk-addons/branches/1.4
+ ........ r578 | tilghman | 2008-04-29 23:46:37 -0500 (Tue, 29 Apr
+ 2008) | 13 lines Don't exclude system header files when doing
+ dependency checks. The reason for this is fairly obvious -- the
+ Asterisk header files (but only in -addons) are part of the
+ system header files at that point, so a changed buildopts.h is
+ considered a change in the system headers. We WANT that change to
+ be considered a reason to rebuild everything in -addons, since
+ the buildsum will no longer match at runtime. Note that if you're
+ building -addons, you'll still need to do a 'make clean' to get
+ the old dependency files to go away this first time, but after
+ that, the dependency checks will take care of it for you. (Closes
+ issue #11291) ........ ................
+
+2008-03-31 21:11 +0000 [r571-576] Jason Parker <jparker@digium.com>
+
+ * /: Merged revisions 575 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/trunk
+ ................ r575 | qwell | 2008-03-31 16:10:46 -0500 (Mon,
+ 31 Mar 2008) | 9 lines Merged revisions 574 via svnmerge from
+ https://origsvn.digium.com/svn/asterisk-addons/branches/1.4
+ ........ r574 | qwell | 2008-03-31 16:09:59 -0500 (Mon, 31 Mar
+ 2008) | 1 line Switch to proper externals locations.. ........
+ ................
+
2008-03-31 Jason Parker <jparker@digium.com>
* Asterisk-Addons 1.6.0-beta3 released.
@@ -37,12 +258,6 @@
that the version of spandsp is new enough (closes issue #12181)
(reported by adriavidal, patched by me)
-2008-03-07 15:05 +0000 [r545] Tilghman Lesher <tlesher@digium.com>
-
- * /: Blocked revisions 544 via svnmerge ........ r544 | tilghman |
- 2008-03-07 09:04:06 -0600 (Fri, 07 Mar 2008) | 3 lines Fix
- documentation (Closes issue #12166) ........
-
2008-03-03 17:03 +0000 [r540] Jason Parker <jparker@digium.com>
* /, Makefile.moddir_rules: Merged revisions 539 via svnmerge from
@@ -346,11 +561,6 @@
2007-10-04 13:29 +0000 [r461-463] Joshua Colp <jcolp@digium.com>
- * /: Blocked revisions 462 via svnmerge ........ r462 | file |
- 2007-10-04 10:27:32 -0300 (Thu, 04 Oct 2007) | 4 lines Delete old
- .cvsignore file. (closes issue #10883) Reported by: casper
- ........
-
* .cvsignore (removed): Remove old .cvsignore file. (closes issue
#10883) Reported by: casper
@@ -419,14 +629,6 @@
* chan_mobile.c, configs/mobile.conf.sample: Modified audio
handling methodology to align with SCO timing requirements.
-2007-09-06 15:32 +0000 [r440] Joshua Colp <jcolp@digium.com>
-
- * /: Blocked revisions 439 via svnmerge ........ r439 | file |
- 2007-09-06 12:31:01 -0300 (Thu, 06 Sep 2007) | 6 lines (closes
- issue #10657) Reported by: casper Patches:
- cdr_addon_mysql.c.438.diff uploaded by casper (license 55) Don't
- log debug messages if debug is not enabled. ........
-
2007-09-06 10:41 +0000 [r438] David Bowerman <david.bowerman@gmail.com>
* chan_mobile.c: code cleanup and formatting changes
@@ -647,13 +849,6 @@
2007) | 3 lines Fix cross compiling for format_mp3 (issue #9875,
patch from zandbelt) ........
-2007-06-04 18:52 +0000 [r386] Joshua Colp <jcolp@digium.com>
-
- * /: Blocked revisions 385 via svnmerge ........ r385 | file |
- 2007-06-04 14:50:38 -0400 (Mon, 04 Jun 2007) | 2 lines Don't try
- to access a variable that may be NULL, mmmk? (issue #9829
- reported by xrg) ........
-
2007-05-17 15:49 +0000 [r384] Jason Parker <jparker@digium.com>
* Makefile, build_tools/menuselect-deps.in, chan_mobile.c (added),
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/Makefile
^
|
@@ -28,10 +28,6 @@
# Overwite config files on "make samples"
OVERWRITE:=y
-ifeq ($(AST_DEVMODE),yes)
- ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT) -Wmissing-format-attribute -Wformat-security -Wformat=2
-endif
-
# If the file .asteriskaddons.makeopts is present in your home directory, you can
# include all of your favorite menuselect options so that every time you download
# a new version of Asterisk-addons, you don't have to run menuselect to set them.
@@ -55,6 +51,10 @@
include makeopts
endif
+ifeq ($(AST_DEVMODE),yes)
+ ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT) -Wmissing-format-attribute -Wformat-security -Wformat=2
+endif
+
ifeq ($(OSARCH),SunOS)
ASTETCDIR=/var/etc/asterisk
ASTLIBDIR=/opt/asterisk/lib
@@ -123,8 +123,8 @@
@echo "****"
@exit 1
-menuselect.makeopts: menuselect/menuselect menuselect-tree
- menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
+menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts
+ menuselect/menuselect --check-deps $@ $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
$(MOD_SUBDIRS_EMBED_LDSCRIPT):
@echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
@@ -243,23 +243,33 @@
nmenuconfig: nmenuselect
-menuselect: menuselect/menuselect menuselect-tree
- -@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
+menuselect: menuselect/cmenuselect menuselect/nmenuselect menuselect/gmenuselect
+ @if [ -x menuselect/nmenuselect ]; then \
+ $(MAKE) nmenuselect; \
+ elif [ -x menuselect/cmenuselect ]; then \
+ $(MAKE) cmenuselect; \
+ elif [ -x menuselect/gmenuselect ]; then \
+ $(MAKE) gmenuselect; \
+ else \
+ echo "No menuselect user interface found. Install ncurses,"; \
+ echo "newt or GTK libraries to build one and re-rerun"; \
+ echo "'make menuselect'."; \
+ fi
cmenuselect: menuselect/cmenuselect menuselect-tree
- -@menuselect/cmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
+ -@menuselect/cmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
gmenuselect: menuselect/gmenuselect menuselect-tree
- -@menuselect/gmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
+ -@menuselect/gmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
nmenuselect: menuselect/nmenuselect menuselect-tree
- -@menuselect/nmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
+ -@menuselect/nmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
# options for make in menuselect/
MAKE_MENUSELECT=CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
menuselect/menuselect: menuselect/makeopts
- $(MAKE_MENUSELECT)
+ $(MAKE_MENUSELECT) menuselect
menuselect/cmenuselect: menuselect/makeopts
$(MAKE_MENUSELECT) cmenuselect
@@ -270,7 +280,7 @@
menuselect/nmenuselect: menuselect/makeopts
$(MAKE_MENUSELECT) nmenuselect
-menuselect/makeopts:
+menuselect/makeopts: makeopts
$(MAKE_MENUSELECT) makeopts
menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) configure
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/Makefile.rules
^
|
@@ -21,7 +21,7 @@
.PHONY: dist-clean
# extra cflags to build dependencies. Recursively expanded.
-MAKE_DEPS= -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
ifeq ($(NOISY_BUILD),)
ECHO_PREFIX=@
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/aclocal.m4
^
|
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/apps/app_addon_sql_mysql.c
^
|
@@ -402,6 +402,7 @@
}
return 0;
} else {
+ set_asterisk_int(chan, args.resultvar, 0);
ast_log(LOG_WARNING, "aMYSQL_fetch: Invalid result identifier %d passed\n", resultid);
}
} else {
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/cdr/cdr_addon_mysql.c
^
|
@@ -83,11 +83,12 @@
struct column {
char *name;
char *cdrname;
+ char *type;
AST_LIST_ENTRY(column) list;
};
/* Protected with mysql_lock */
-static AST_LIST_HEAD_NOLOCK_STATIC(columns, column);
+static AST_RWLIST_HEAD_STATIC(columns, column);
static MYSQL mysql = { { NULL }, };
@@ -149,7 +150,6 @@
static int mysql_log(struct ast_cdr *cdr)
{
- char sqldesc[128];
char *sql1 = ast_calloc(1, 4096), *sql2 = ast_calloc(1, 2048);
int sql1size = 4096, sql2size = 2048;
int retries = 5;
@@ -204,54 +204,27 @@
ast_log(LOG_ERROR, "Unknown connection error: (%d) %s\n", mysql_errno(&mysql), mysql_error(&mysql));
}
retries--;
- if (retries)
+ if (retries) {
goto db_reconnect;
- else
- ast_log(LOG_ERROR, "Retried to connect fives times, giving up.\n");
+ } else {
+ ast_log(LOG_ERROR, "Retried to connect five times, giving up.\n");
+ }
}
}
if (connected) {
- MYSQL_ROW row;
- MYSQL_RES *result;
int column_count = 0;
+ char *cdrname;
+ char workspace[2048], *value = NULL, *ptr;
+ int sql2len;
+ struct column *entry;
snprintf(sql1, sql1size, "INSERT INTO %s (", dbtable ? dbtable->str : "cdr");
strcpy(sql2, ") VALUES ('");
- /* Get table description */
- snprintf(sqldesc, sizeof(sqldesc), "DESC %s", dbtable ? dbtable->str : "cdr");
- if (mysql_query(&mysql, sqldesc)) {
- ast_log(LOG_ERROR, "Unable to query table description!!\n");
- mysql_close(&mysql);
- connected = 0;
- goto log_exit;
- }
-
- if (!(result = mysql_store_result(&mysql))) {
- ast_log(LOG_ERROR, "Unable to query table description!!\n");
- mysql_close(&mysql);
- connected = 0;
- goto log_exit;
- }
-
- while ((row = mysql_fetch_row(result))) {
- struct column *entry;
- char *cdrname;
- char workspace[2048], *value = NULL, *ptr;
- int sql2len;
-
- ast_debug(1, "Got a field '%s' of type '%s'\n", row[0], row[1]);
- /* Check for an alias */
- AST_LIST_TRAVERSE(&columns, entry, list) {
- /* This would probably be better off as a hash */
- if (!strcasecmp(entry->name, row[0]))
- break;
- }
-
- if (entry) {
- cdrname = entry->cdrname;
- } else if (!strcmp(row[0], "calldate")) {
+ AST_RWLIST_RDLOCK(&columns);
+ AST_RWLIST_TRAVERSE(&columns, entry, list) {
+ if (!strcmp(entry->name, "calldate")) {
/*!\note
* For some dumb reason, "calldate" used to be formulated using
* the datetime the record was posted, rather than the start
@@ -270,7 +243,7 @@
cdrname = "start";
}
} else {
- cdrname = row[0];
+ cdrname = entry->cdrname;
}
/* Construct SQL */
@@ -279,14 +252,14 @@
strcat(sql2, "','");
}
- if (strlen(sql1) + 2 + strlen(row[0]) > sql1size) {
+ if (strlen(sql1) + 2 + strlen(entry->name) > sql1size) {
char *tmp = ast_realloc(sql1, sql1size * 2);
if (!tmp)
goto log_exit;
sql1size *= 2;
sql1 = tmp;
}
- strcat(sql1, row[0]);
+ strcat(sql1, entry->name);
/* Need the type and value to determine if we want the raw value or not */
if ((!strcmp(cdrname, "start") ||
@@ -294,13 +267,13 @@
!strcmp(cdrname, "end") ||
!strcmp(cdrname, "disposition") ||
!strcmp(cdrname, "amaflags")) &&
- (strstr(row[1], "int") ||
- strstr(row[1], "dec") ||
- strstr(row[1], "float") ||
- strstr(row[1], "double") ||
- strstr(row[1], "real") ||
- strstr(row[1], "numeric") ||
- strstr(row[1], "fixed")))
+ (strstr(entry->type, "int") ||
+ strstr(entry->type, "dec") ||
+ strstr(entry->type, "float") ||
+ strstr(entry->type, "double") ||
+ strstr(entry->type, "real") ||
+ strstr(entry->type, "numeric") ||
+ strstr(entry->type, "fixed")))
ast_cdr_getvar(cdr, cdrname, &value, workspace, sizeof(workspace), 0, 1);
else
ast_cdr_getvar(cdr, cdrname, &value, workspace, sizeof(workspace), 0, 0);
@@ -329,7 +302,7 @@
sql2[sql2len] = '\0';
}
}
- mysql_free_result(result);
+ AST_RWLIST_UNLOCK(&columns);
ast_debug(1, "Inserting a CDR record.\n");
if (strlen(sql1) + 3 + strlen(sql2) > sql1size) {
@@ -379,8 +352,11 @@
}
AST_LIST_UNLOCK(&unload_strings);
- while ((entry = AST_LIST_REMOVE_HEAD(&columns, list)))
+ AST_RWLIST_WRLOCK(&columns);
+ while ((entry = AST_RWLIST_REMOVE_HEAD(&columns, list))) {
ast_free(entry);
+ }
+ AST_RWLIST_UNLOCK(&columns);
dbport = 0;
ast_cdr_unregister(name);
@@ -435,6 +411,9 @@
struct column *entry;
char *temp;
struct ast_str *compat;
+ MYSQL_ROW row;
+ MYSQL_RES *result;
+ char sqldesc[128];
#if MYSQL_VERSION_ID >= 50013
my_bool my_bool_true = 1;
#endif
@@ -460,13 +439,13 @@
res |= my_load_config_string(cfg, "global", "hostname", &hostname, "localhost");
res |= my_load_config_string(cfg, "global", "dbname", &dbname, "astriskcdrdb");
res |= my_load_config_string(cfg, "global", "user", &dbuser, "root");
- res |= my_load_config_string(cfg, "global", "sock", &dbsock, NULL);
+ res |= my_load_config_string(cfg, "global", "sock", &dbsock, "");
res |= my_load_config_string(cfg, "global", "table", &dbtable, "cdr");
res |= my_load_config_string(cfg, "global", "password", &password, "");
- res |= my_load_config_string(cfg, "global", "ssl_ca", &ssl_ca, NULL);
- res |= my_load_config_string(cfg, "global", "ssl_cert", &ssl_cert, NULL);
- res |= my_load_config_string(cfg, "global", "ssl_key", &ssl_key, NULL);
+ res |= my_load_config_string(cfg, "global", "ssl_ca", &ssl_ca, "");
+ res |= my_load_config_string(cfg, "global", "ssl_cert", &ssl_cert, "");
+ res |= my_load_config_string(cfg, "global", "ssl_key", &ssl_key, "");
res |= my_load_config_number(cfg, "global", "port", &dbport, 0);
res |= my_load_config_number(cfg, "global", "timeout", &timeout, 0);
@@ -481,24 +460,11 @@
return AST_MODULE_LOAD_FAILURE;
/* Check for any aliases */
- while ((entry = AST_LIST_REMOVE_HEAD(&columns, list)))
+ AST_RWLIST_WRLOCK(&columns);
+ while ((entry = AST_LIST_REMOVE_HEAD(&columns, list))) {
ast_free(entry);
-
- for (var = ast_variable_browse(cfg, "aliases"); var; var = var->next) {
- struct column *entry = ast_calloc(1, sizeof(*entry) + strlen(var->name) + 1 + strlen(var->value) + 1);
- if (!entry)
- continue;
- entry->cdrname = (char *)entry + sizeof(*entry);
- entry->name = (char *)entry + sizeof(*entry) + strlen(var->name) + 1;
- strcpy(entry->cdrname, var->name);
- strcpy(entry->name, var->value);
-
- AST_LIST_INSERT_TAIL(&columns, entry, list);
- ast_log(LOG_NOTICE, "Found an alias from CDR variable %s to DB column %s\n", entry->cdrname, entry->name);
}
- ast_config_destroy(cfg);
-
ast_debug(1, "Got hostname of %s\n", hostname->str);
ast_debug(1, "Got port of %d\n", dbport);
ast_debug(1, "Got a timeout of %d\n", timeout);
@@ -522,11 +488,11 @@
}
#endif
- if (ssl_ca || ssl_cert || ssl_key) {
+ if ((ssl_ca && !ast_strlen_zero(ssl_ca->str)) || (ssl_cert && !ast_strlen_zero(ssl_cert->str)) || (ssl_key && !ast_strlen_zero(ssl_key->str))) {
mysql_ssl_set (&mysql, ssl_key->str, ssl_cert->str, ssl_ca->str, NULL, NULL);
}
temp = dbsock && !ast_strlen_zero(dbsock->str) ? dbsock->str : NULL;
- if (!mysql_real_connect(&mysql, hostname->str, dbuser->str, password->str, dbname->str, dbport, temp, ssl_ca ? CLIENT_SSL : 0)) {
+ if (!mysql_real_connect(&mysql, hostname->str, dbuser->str, password->str, dbname->str, dbport, temp, ssl_ca && !ast_strlen_zero(ssl_ca->str) ? CLIENT_SSL : 0)) {
ast_log(LOG_ERROR, "Failed to connect to mysql database %s on %s.\n", dbname->str, hostname->str);
connected = 0;
records = 0;
@@ -535,7 +501,70 @@
connected = 1;
records = 0;
connect_time = time(NULL);
+
+ /* Get table description */
+ snprintf(sqldesc, sizeof(sqldesc), "DESC %s", dbtable ? dbtable->str : "cdr");
+ if (mysql_query(&mysql, sqldesc)) {
+ ast_log(LOG_ERROR, "Unable to query table description!! Logging disabled.\n");
+ mysql_close(&mysql);
+ connected = 0;
+ AST_RWLIST_UNLOCK(&columns);
+ ast_config_destroy(cfg);
+ return AST_MODULE_LOAD_SUCCESS;
+ }
+
+ if (!(result = mysql_store_result(&mysql))) {
+ ast_log(LOG_ERROR, "Unable to query table description!! Logging disabled.\n");
+ mysql_close(&mysql);
+ connected = 0;
+ AST_RWLIST_UNLOCK(&columns);
+ ast_config_destroy(cfg);
+ return AST_MODULE_LOAD_SUCCESS;
+ }
+
+ while ((row = mysql_fetch_row(result))) {
+ struct column *entry;
+ int foundalias = 0;
+
+ ast_debug(1, "Got a field '%s' of type '%s'\n", row[0], row[1]);
+ /* Check for an alias */
+ for (var = ast_variable_browse(cfg, "aliases"); var; var = var->next) {
+ if (strcasecmp(var->value, row[0])) {
+ continue;
+ }
+
+ if (!(entry = ast_calloc(1, sizeof(*entry) + strlen(var->name) + 1 + strlen(var->value) + 1 + strlen(row[1]) + 1))) {
+ continue;
+ }
+
+ entry->cdrname = (char *)entry + sizeof(*entry);
+ entry->name = (char *)entry + sizeof(*entry) + strlen(var->name) + 1;
+ entry->type = (char *)entry + sizeof(*entry) + strlen(var->name) + 1 + strlen(var->value) + 1;
+ strcpy(entry->cdrname, var->name);
+ strcpy(entry->name, var->value);
+ strcpy(entry->type, row[1]);
+
+ AST_LIST_INSERT_TAIL(&columns, entry, list);
+ ast_log(LOG_NOTICE, "Found an alias from CDR variable %s to DB column %s, type %s\n", entry->cdrname, entry->name, entry->type);
+ foundalias = 1;
+ break;
+ }
+
+ if (!foundalias && (entry = ast_calloc(1, sizeof(*entry) + strlen(row[0]) + 1 + strlen(row[1]) + 1))) {
+ entry->cdrname = (char *)entry + sizeof(*entry);
+ entry->name = (char *)entry + sizeof(*entry);
+ entry->type = (char *)entry + sizeof(*entry) + strlen(row[0]) + 1;
+ strcpy(entry->name, row[0]);
+ strcpy(entry->type, row[1]);
+
+ AST_LIST_INSERT_TAIL(&columns, entry, list);
+ ast_log(LOG_NOTICE, "Found a DB column %s, type %s\n", entry->name, entry->type);
+ }
+ }
+ mysql_free_result(result);
}
+ AST_RWLIST_UNLOCK(&columns);
+ ast_config_destroy(cfg);
res = ast_cdr_register(name, desc, mysql_log);
if (res) {
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/chan_mobile.c
^
|
@@ -31,7 +31,7 @@
#include <asterisk.h>
-ASTERISK_FILE_VERSION(__FILE__, "$Revision: 523 $")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 584 $")
#include <stdio.h>
#include <string.h>
@@ -148,12 +148,12 @@
pthread_t monitor_thread; /* monitor thread handle */
char dial_number[AST_MAX_EXTENSION]; /* number for the monitor thread to dial */
int dial_timeout;
- char ciev_call_0[4]; /* dynamically built reponse strings */
- char ciev_call_1[4];
- char ciev_callsetup_0[4];
- char ciev_callsetup_1[4];
- char ciev_callsetup_2[4];
- char ciev_callsetup_3[4];
+ char ciev_call_0[5]; /* dynamically built reponse strings */
+ char ciev_call_1[5];
+ char ciev_callsetup_0[5];
+ char ciev_callsetup_1[5];
+ char ciev_callsetup_2[5];
+ char ciev_callsetup_3[5];
unsigned int no_callsetup:1;
unsigned int has_sms:1;
unsigned int sent_answer:1;
@@ -427,7 +427,7 @@
stat = 3;
}
- sprintf(status, "%d", stat);
+ snprintf(status, sizeof(status), "%d", stat);
pbx_builtin_setvar_helper(ast, args.variable, status);
return 0;
@@ -741,7 +741,7 @@
case '9':
case '*':
case '#':
- sprintf(buf, "AT+VTS=%c\r", digit);
+ snprintf(buf, sizeof(buf), "AT+VTS=%c\r", digit);
rfcomm_write(pvt, buf);
break;
default:
@@ -1357,12 +1357,12 @@
if (strstr(buf+i, "\"callsetup\""))
callsetupp = group2;
}
- sprintf(pvt->ciev_call_0, "%d,0", callp);
- sprintf(pvt->ciev_call_1, "%d,1", callp);
- sprintf(pvt->ciev_callsetup_0, "%d,0", callsetupp);
- sprintf(pvt->ciev_callsetup_1, "%d,1", callsetupp);
- sprintf(pvt->ciev_callsetup_2, "%d,2", callsetupp);
- sprintf(pvt->ciev_callsetup_3, "%d,3", callsetupp);
+ snprintf(pvt->ciev_call_0, sizeof(pvt->ciev_call_0), "%d,0", callp);
+ snprintf(pvt->ciev_call_1, sizeof(pvt->ciev_call_1), "%d,1", callp);
+ snprintf(pvt->ciev_callsetup_0, sizeof(pvt->ciev_callsetup_0), "%d,0", callsetupp);
+ snprintf(pvt->ciev_callsetup_1, sizeof(pvt->ciev_callsetup_1), "%d,1", callsetupp);
+ snprintf(pvt->ciev_callsetup_2, sizeof(pvt->ciev_callsetup_2), "%d,2", callsetupp);
+ snprintf(pvt->ciev_callsetup_3, sizeof(pvt->ciev_callsetup_3), "%d,3", callsetupp);
if (callsetupp == 0) /* This phone has no call setup indication!! ... */
pvt->no_callsetup = 1;
ast_debug(1, "CIEV_CALL=%d CIEV_CALLSETUP=%d\n", callp, callsetupp);
@@ -1566,7 +1566,7 @@
p++;
smsi = atoi(p);
if (smsi > 0) {
- sprintf(buf, "AT+CMGR=%d\r", smsi);
+ snprintf(buf, sizeof(buf), "AT+CMGR=%d\r", smsi);
rfcomm_write(pvt, buf);
pvt->state = MBL_STATE_INSMS;
}
@@ -1585,7 +1585,7 @@
ast_verbose(VERBOSE_PREFIX_3 "Bluetooth Device %s initialised and ready.\n", pvt->id);
pvt->state = MBL_STATE_IDLE;
} else if (pvt->state == MBL_STATE_DIAL) {
- sprintf(buf, "ATD%s;\r", pvt->dial_number);
+ snprintf(buf, sizeof(buf), "ATD%s;\r", pvt->dial_number);
if (!rfcomm_write(pvt, buf)) {
ast_log(LOG_ERROR, "Dial failed on %s state %d\n", pvt->owner->name, pvt->state);
ast_queue_control(pvt->owner, AST_CONTROL_CONGESTION);
@@ -1611,7 +1611,7 @@
} else
pvt->state = MBL_STATE_IDLE;
} else if (pvt->state == MBL_STATE_OUTSMS) {
- sprintf(buf, "AT+CMGS=\"%s\"\r", pvt->dial_number);
+ snprintf(buf, sizeof(buf), "AT+CMGS=\"%s\"\r", pvt->dial_number);
rfcomm_write(pvt, buf);
pvt->state = MBL_STATE_OUTSMS1;
} else if (pvt->state == MBL_STATE_OUTSMS1) {
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/chan_ooh323.c
^
|
@@ -59,8 +59,10 @@
struct ast_rtp *vrtp, struct ast_rtp *trtp, int codecs, int nat_active);
static void print_codec_to_cli(int fd, struct ast_codec_pref *pref);
-static void ast_ooh323c_exit();
+#if 0
+static void ast_ooh323c_exit();
+#endif
static const struct ast_channel_tech ooh323_tech = {
.type = type,
@@ -82,10 +84,10 @@
};
static struct ast_rtp_protocol ooh323_rtp = {
- type: type,
- get_rtp_info: ooh323_get_rtp_peer,
- get_vrtp_info: ooh323_get_vrtp_peer,
- set_rtp_peer: ooh323_set_rtp_peer
+ .type = type,
+ .get_rtp_info = ooh323_get_rtp_peer,
+ .get_vrtp_info = ooh323_get_vrtp_peer,
+ .set_rtp_peer = ooh323_set_rtp_peer
};
/* H.323 channel private structure */
@@ -143,6 +145,8 @@
struct ast_codec_pref prefs;
int dtmfmode;
int rtptimeout;
+ int mUseIP; /* Use IP address or H323-ID to search user */
+ char mIP[20];
struct ooh323_user *next;
};
@@ -157,6 +161,7 @@
char accountcode[20];
int amaflags;
int dtmfmode;
+ int mFriend; /* indicates defined as friend */
char ip[20];
int port;
char *h323id; /* H323-ID alias, which asterisk will register with gk to reach this peer*/
@@ -219,6 +224,11 @@
static int gOutgoingLimit = 4;
OOBOOL gH323Debug = FALSE;
+static struct ooh323_config
+{
+ int mTCPPortStart;
+ int mTCPPortEnd;
+}ooconfig;
/** Asterisk RTP stuff*/
static struct sched_context *sched;
@@ -240,7 +250,7 @@
struct ast_channel *ch = NULL;
int fmt;
if(gH323Debug)
- ast_debug(1, "--- ooh323_new - %s\n", host);
+ ast_verbose("--- ooh323_new - %s\n", host);
/* Don't hold a h323 pvt lock while we allocate a channel */
@@ -342,7 +352,7 @@
if(ch) ast_channel_unlock(ch);
if(gH323Debug)
- ast_debug(1, "+++ h323_new\n");
+ ast_verbose("+++ h323_new\n");
return ch;
}
@@ -354,7 +364,7 @@
struct ooh323_pvt *pvt = NULL;
struct in_addr ipAddr;
if(gH323Debug)
- ast_debug(1, "--- ooh323_alloc\n");
+ ast_verbose("--- ooh323_alloc\n");
pvt = (struct ooh323_pvt*) malloc(sizeof(struct ooh323_pvt));
if(!pvt)
@@ -437,7 +447,7 @@
ast_mutex_unlock(&iflock);
if(gH323Debug)
- ast_debug(1, "+++ ooh323_alloc\n");
+ ast_verbose("+++ ooh323_alloc\n");
return pvt;
}
@@ -450,14 +460,16 @@
void *data, int *cause)
{
- struct ast_channel *chan=NULL;
- struct ooh323_pvt *p = NULL;
- struct ooh323_peer *peer = NULL;
- char *dest = NULL;
- char *ext = NULL;
- char tmp[256];
- char formats[512];
- int oldformat;
+ struct ast_channel *chan = NULL;
+ struct ooh323_pvt *p = NULL;
+ struct ooh323_peer *peer = NULL;
+ char *dest = NULL;
+ char *ext = NULL;
+ char tmp[256];
+ char formats[512];
+ int oldformat;
+ int port = 0;
+
if(gH323Debug)
ast_verbose("--- ooh323_request - data %s format %s\n", (char*)data,
ast_getformatname_multiple(formats,512,format) );
@@ -502,9 +514,16 @@
dest = tmp;
ext = NULL;
}
+
+ /*if((sport = strchr(dest, ':'))) {
+ *sport = '\0';
+ sport++;
+ port = atoi(sport);
+ }*/
- if(dest)
- peer = find_peer(dest);
+ if(dest) {
+ peer = find_peer(dest, port);
+ }
else{
ast_log(LOG_ERROR, "Destination format is not supported\n");
return NULL;
@@ -540,8 +559,12 @@
p->host = strdup(dest);
- if(ext)
+ if(port > 0) {
+ p->port = port;
+ }
+ if(ext) {
strncpy(p->exten, ext, sizeof(p->exten)-1);
+ }
}
@@ -592,53 +615,104 @@
return p;
}
-struct ooh323_user *find_user(const char * name)
+struct ooh323_user *find_user(const char * name, const char* ip)
{
struct ooh323_user *user=NULL;
if(gH323Debug)
ast_verbose("--- find_user\n");
-
user = userl.users;
ast_mutex_lock(&userl.lock);
while(user)
{
- if(name && !strcmp(user->name, name))
+ if(ip && user->mUseIP && !strcmp(user->mIP, ip)) {
break;
+ }
+ if(name && !strcmp(user->name, name)) {
+ break;
+ }
user = user->next;
}
ast_mutex_unlock(&userl.lock);
+
if(gH323Debug)
ast_verbose("+++ find_user\n");
return user;
}
-struct ooh323_peer *find_peer(const char * name)
+struct ooh323_peer *find_friend(const char *name, int port)
+{
+ struct ooh323_peer *peer=NULL;
+
+ if(gH323Debug)
+ ast_verbose("--- find_friend \"%s\"\n", name);
+
+
+ peer = peerl.peers;
+ ast_mutex_lock(&peerl.lock);
+ while(peer)
+ {
+ if(gH323Debug) {
+ ast_verbose(" comparing with \"%s\"\n", peer->ip);
+ }
+ if(!strcmp(peer->ip, name)) {
+ if(port > 0 && peer->port == port) { break; }
+ else if (port <= 0) { break; }
+ }
+ peer = peer->next;
+ }
+ ast_mutex_unlock(&peerl.lock);
+
+ if(gH323Debug) {
+ if(peer) {
+ ast_verbose(" found matching friend\n");
+ }
+ ast_verbose("+++ find_friend \"%s\"\n", name);
+ }
+
+ return peer;
+}
+
+
+struct ooh323_peer *find_peer(const char * name, int port)
{
struct ooh323_peer *peer=NULL;
if(gH323Debug)
- ast_verbose("--- find_peer\n");
+ ast_verbose("--- find_peer \"%s\"\n", name);
peer = peerl.peers;
ast_mutex_lock(&peerl.lock);
while(peer)
{
+ if(gH323Debug) {
+ ast_verbose(" comparing with \"%s\"\n", peer->ip);
+ }
if(!strcasecmp(peer->name, name))
break;
if(peer->h323id && !strcasecmp(peer->h323id, name))
break;
if(peer->e164 && !strcasecmp(peer->e164, name))
break;
+ /*
+ if(!strcmp(peer->ip, name)) {
+ if(port > 0 && peer->port == port) { break; }
+ else if (port <= 0) { break; }
+ }
+ */
peer = peer->next;
}
ast_mutex_unlock(&peerl.lock);
- if(gH323Debug)
- ast_verbose("+++ find_peer\n");
+ if(gH323Debug) {
+ if(peer) {
+ ast_verbose(" found matching peer\n");
+ }
+ ast_verbose("+++ find_peer \"%s\"\n", name);
+ }
return peer;
}
@@ -677,7 +751,6 @@
static int ooh323_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
{
- char dtmf[2];
struct ooh323_pvt *p = (struct ooh323_pvt *) chan->tech_pvt;
if(gH323Debug)
@@ -889,7 +962,7 @@
fr = ooh323_rtp_read(ast, p);
else
fr = &null_frame;
- // time(&p->lastrtprx);
+ /* time(&p->lastrtprx); */
ast_mutex_unlock(&p->lock);
return fr;
}
@@ -995,7 +1068,7 @@
struct ooh323_pvt *p = newchan->tech_pvt;
if(gH323Debug)
- ast_verbose("start: ooh323c ooh323_fixup\n");
+ ast_verbose("--- ooh323c ooh323_fixup\n");
ast_mutex_lock(&p->lock);
if (p->owner != oldchan) {
@@ -1014,7 +1087,7 @@
ast_mutex_unlock(&p->lock);
if(gH323Debug)
- ast_verbose("end: ooh323c ooh323_fixup \n");
+ ast_verbose("+++ ooh323c ooh323_fixup \n");
return 0;
}
@@ -1138,13 +1211,13 @@
* Callback for sending digits from H.323 up to asterisk
*
*/
-int ooh323_onReceivedDigit(OOH323CallData *call, const char* digit)
+int ooh323_onReceivedDigit(OOH323CallData *call, const char *digit)
{
struct ooh323_pvt *p=NULL;
struct ast_frame f;
int res;
- ast_debug(1, "Received Digit: %c\n", digit);
+ ast_debug(1, "Received Digit: %c\n", digit[0]);
p = find_call(call);
if(!p) {
ast_log(LOG_ERROR, "Failed to find a matching call.\n");
@@ -1266,11 +1339,11 @@
if(p->callerid_name)
{
- p->username = strdup(p->callerid_name);
- user = find_user(p->username);
+ user = find_user(p->callerid_name, call->remoteIP);
if(user)
{
ast_mutex_lock(&user->lock);
+ p->username = strdup(user->name);
strncpy(p->context, user->context, sizeof(p->context)-1);
strncpy(p->accountcode, user->accountcode, sizeof(p->accountcode)-1);
p->amaflags = user->amaflags;
@@ -1340,8 +1413,7 @@
if(!ast_strlen_zero(p->caller_dialedDigits)){
if(gH323Debug) {
- ast_debug(1, "Setting dialed digits %s\n",
- p->caller_dialedDigits);
+ ast_verbose("Setting dialed digits %s\n", p->caller_dialedDigits);
}
ooCallAddAliasDialedDigits(call, p->caller_dialedDigits);
}
@@ -1482,6 +1554,7 @@
return OO_OK;
}
+#if 0
static void ooh323_delete_user(struct ooh323_user *user)
{
struct ooh323_user *prev=NULL, *cur=NULL;
@@ -1516,6 +1589,7 @@
ast_verbose("+++ ooh323_delete_user\n");
}
+#endif
void ooh323_delete_peer(struct ooh323_peer *peer)
{
@@ -1602,12 +1676,20 @@
v->value, 0);
}
else if (!strcasecmp(v->name, "allow")) {
+ const char* tcodecs = v->value;
+ if(!strcasecmp(v->value, "all")) {
+ tcodecs = "ulaw,alaw,g729,g723,gsm";
+ }
ast_parse_allow_disallow(&user->prefs, &user->capability,
- v->value, 1);
+ tcodecs, 1);
}
else if (!strcasecmp(v->name, "amaflags")) {
user->amaflags = ast_cdr_amaflags2int(v->value);
}
+ else if (!strcasecmp(v->name, "ip")) {
+ strncpy(user->mIP, v->value, sizeof(user->mIP)-1);
+ user->mUseIP = 1;
+ }
else if (!strcasecmp(v->name, "dtmfmode")) {
if(!strcasecmp(v->value, "rfc2833"))
user->dtmfmode = H323_DTMF_RFC2833;
@@ -1628,7 +1710,7 @@
return user;
}
-static struct ooh323_peer *build_peer(const char *name, struct ast_variable *v)
+static struct ooh323_peer *build_peer(const char *name, struct ast_variable *v, int friend_type)
{
struct ooh323_peer *peer=NULL;
@@ -1646,6 +1728,9 @@
strncpy(peer->accountcode, gAccountcode, sizeof(peer->accountcode)-1);
peer->amaflags = gAMAFLAGS;
peer->dtmfmode = gDTMFMode;
+ if(0 == friend_type) {
+ peer->mFriend = 1;
+ }
while(v) {
if (!strcasecmp(v->name, "h323id")) {
@@ -1716,8 +1801,12 @@
v->value, 0);
}
else if (!strcasecmp(v->name, "allow")) {
+ const char* tcodecs = v->value;
+ if(!strcasecmp(v->value, "all")) {
+ tcodecs = "ulaw,alaw,g729,g723,gsm";
+ }
ast_parse_allow_disallow(&peer->prefs, &peer->capability,
- v->value, 1);
+ tcodecs, 1);
}
else if (!strcasecmp(v->name, "amaflags")) {
peer->amaflags = ast_cdr_amaflags2int(v->value);
@@ -1757,6 +1846,7 @@
return 0;
}
+#if 0
/*--- h323_reload: Force reload of module from cli ---*/
static int ooh323_reload(int fd, int argc, char *argv[])
{
@@ -1779,11 +1869,14 @@
return 0;
}
+#endif
+#if 0
static int reload(void *mod)
{
return ooh323_reload(0, 0, NULL);
}
+#endif
int reload_config(int reload)
{
@@ -1832,6 +1925,8 @@
strcpy(gContext, DEFAULT_CONTEXT);
gAliasList = NULL;
gMediaWaitForConnect = 0;
+ ooconfig.mTCPPortStart = 12030;
+ ooconfig.mTCPPortEnd = 12230;
v = ast_variable_browse(cfg, "general");
while(v) {
@@ -1842,6 +1937,27 @@
else if (!strcasecmp(v->name, "bindaddr")) {
strncpy(gIP, v->value, sizeof(gIP)-1);
}
+ else if (!strcasecmp(v->name, "h225portrange")) {
+ char* endlimit = 0;
+ char temp[512];
+ strncpy(temp, v->value, sizeof(temp) - 1);
+ /* char *temp = ast_strdupa(v->value); */
+ endlimit = strchr(temp, ',');
+ if (endlimit) {
+ *endlimit = '\0';
+ endlimit++;
+ ooconfig.mTCPPortStart = atoi(temp);
+ ooconfig.mTCPPortEnd = atoi(endlimit);
+
+ if(ooH323EpSetTCPPortRange(ooconfig.mTCPPortStart,
+ ooconfig.mTCPPortEnd) == OO_FAILED) {
+ ast_log(LOG_ERROR, "h225portrange: Failed to set range\n");
+ }
+ }
+ else {
+ ast_log(LOG_ERROR, "h225portrange: Invalid format, separate port range with \",\"\n");
+ }
+ }
else if (!strcasecmp(v->name, "gateway")) {
gIsGateway = ast_true(v->value);
}
@@ -1964,7 +2080,11 @@
ast_parse_allow_disallow(&gPrefs, &gCapability, v->value, 0);
}
else if (!strcasecmp(v->name, "allow")) {
- ast_parse_allow_disallow(&gPrefs, &gCapability, v->value, 1);
+ const char* tcodecs = v->value;
+ if(!strcasecmp(v->value, "all")) {
+ tcodecs = "ulaw,alaw,g729,g723,gsm";
+ }
+ ast_parse_allow_disallow(&gPrefs, &gCapability, tcodecs, 1);
}
else if (!strcasecmp(v->name, "dtmfmode")) {
if (!strcasecmp(v->value, "inband"))
@@ -1991,10 +2111,12 @@
{
if(strcasecmp(cat, "general"))
{
+ int friend_type = 0;
utype = ast_variable_retrieve(cfg, cat, "type");
if(utype)
{
- if(!strcmp(utype, "user") || !strcasecmp(utype, "friend"))
+ friend_type = strcasecmp(utype, "friend");
+ if(!strcmp(utype, "user") || 0 == friend_type)
{
user = build_user(cat, ast_variable_browse(cfg, cat));
if (user)
@@ -2008,15 +2130,15 @@
ast_log(LOG_WARNING, "Failed to build user %s\n", cat);
}
}
- if(!strcasecmp(utype, "peer") || !strcasecmp(utype, "friend"))
+ if(!strcasecmp(utype, "peer") || 0 == friend_type)
{
- peer = build_peer(cat, ast_variable_browse(cfg, cat));
+ peer = build_peer(cat, ast_variable_browse(cfg, cat), friend_type);
if(peer)
{
- ast_mutex_lock(&userl.lock);
+ ast_mutex_lock(&peerl.lock);
peer->next = peerl.peers;
peerl.peers = peer;
- ast_mutex_unlock(&userl.lock);
+ ast_mutex_unlock(&peerl.lock);
}
else {
ast_log(LOG_WARNING, "Failed to build peer %s\n", cat);
@@ -2301,10 +2423,12 @@
return CLI_SUCCESS;
}
+#if 0
static int ooh323_show_channels(int fd, int argc, char *argv[])
{
return RESULT_SUCCESS;
}
+#endif
static char *handle_cli_ooh323_show_config(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
@@ -2332,7 +2456,6 @@
ast_cli(a->fd, "%-20s%s\n", "Tunneling", gTunneling?"yes":"no");
ast_cli(a->fd, "%-20s%s\n", "CallerId", gCallerID);
ast_cli(a->fd, "%-20s%s\n", "MediaWaitForConnect", gMediaWaitForConnect ? "yes" : "no");
- ast_cli(a->fd, "%-15s%s\n", "MediaWaitForConnect", gMediaWaitForConnect ? "yes" : "no");
#if (0)
{
@@ -2430,8 +2553,10 @@
ast_mutex_init(&userl.lock);
peerl.peers = NULL;
ast_mutex_init(&peerl.lock);
-
- //ast_register_atexit(&ast_ooh323c_exit);
+
+#if 0
+ ast_register_atexit(&ast_ooh323c_exit);
+#endif
sched = sched_context_create();
if (!sched) {
@@ -2544,14 +2669,6 @@
return 1;
}
- /* Create command Listener */
- if(ooH323EpCreateCmdListener(0) != OO_OK)
- {
- ast_log(LOG_ERROR, "OOH323 Command Listener creation failure. "
- "OOH323 DISABLED\n");
- ooH323EpDestroy();
- return 1;
- }
if(ooh323c_start_stack_thread() <0)
{
ast_log(LOG_ERROR, "Failed to start OOH323 stack thread. "
@@ -2575,6 +2692,7 @@
time_t t;
for(;;) {
+ struct ooh323_pvt *h323_next;
/* Check for a reload request */
ast_mutex_lock(&h323_reload_lock);
reloading = h323_reloading;
@@ -2588,7 +2706,6 @@
}
/* Check for interfaces needing to be killed */
ast_mutex_lock(&iflock);
- struct ooh323_pvt *h323_next;
time(&t);
h323 = iflist;
while(h323) {
@@ -2685,24 +2802,36 @@
else
iflist = cur->next;
- if(cur->callToken)
+ if(cur->callToken) {
free(cur->callToken);
+ cur->callToken = 0;
+ }
- if(cur->username)
+ if(cur->username) {
free(cur->username);
+ cur->username = 0;
+ }
- if(cur->host)
+ if(cur->host) {
free(cur->host);
+ cur->host = 0;
+ }
- if(cur->callerid_name)
+ if(cur->callerid_name) {
free(cur->callerid_name);
+ cur->callerid_name = 0;
+ }
- if(cur->callerid_num)
+ if(cur->callerid_num) {
free(cur->callerid_num);
+ cur->callerid_num = 0;
+ }
- if (cur->rtp)
+ if (cur->rtp) {
ast_rtp_destroy(cur->rtp);
+ cur->rtp = 0;
+ }
/* Unlink us from the owner if we have one */
if (cur->owner) {
@@ -2783,7 +2912,10 @@
ast_cli_unregister_multiple(cli_ooh323, sizeof(cli_ooh323) / sizeof(struct ast_cli_entry));
ast_rtp_proto_unregister(&ooh323_rtp);
ast_channel_unregister(&ooh323_tech);
- //ast_unregister_atexit(&ast_ooh323c_exit);
+
+#if 0
+ ast_unregister_atexit(&ast_ooh323c_exit);
+#endif
if(gH323Debug) {
ast_verbose(" unload_module - hanging up all interfaces\n");
@@ -2964,6 +3096,8 @@
return OO_G729A;
case AST_FORMAT_G723_1:
return OO_G7231;
+ case AST_FORMAT_H263:
+ return OO_H263VIDEO;
default:
ast_log(LOG_NOTICE, "Don't know how to deal with mode %s\n",
ast_getformatname_multiple(formats,512,cap));
@@ -3061,7 +3195,7 @@
}
them.sin_family = AF_INET;
- them.sin_addr.s_addr = inet_addr(remoteIp); // only works for IPv4
+ them.sin_addr.s_addr = inet_addr(remoteIp); /* only works for IPv4 */
them.sin_port = htons(remotePort);
ast_rtp_set_peer(p->rtp, &them);
@@ -3242,9 +3376,11 @@
return 0;
}
+#if 0
void ast_ooh323c_exit()
{
ooGkClientDestroy();
}
+#endif
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Objective Systems H323 Channel");
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/chan_ooh323.h
^
|
@@ -77,8 +77,8 @@
struct ooh323_user;
struct ooh323_peer;
/* Helper functions */
-struct ooh323_user *find_user(const char * name);
-struct ooh323_peer *find_peer(const char * name);
+struct ooh323_user *find_user(const char * name, const char *ip);
+struct ooh323_peer *find_peer(const char * name, int port);
void ooh323_delete_peer(struct ooh323_peer *peer);
int delete_users(void);
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooCapability.c
^
|
@@ -898,6 +898,9 @@
H245AudioCapability* audioCap, int dir)
{
int noofframes=0, cap;
+
+ OOTRACEDBGC2("Comparing channel with codec type: %d\n", audioCap->t);
+
switch(audioCap->t)
{
case T_H245AudioCapability_g711Ulaw56k:
@@ -929,7 +932,7 @@
noofframes = audioCap->u.g729;
break;
case T_H245AudioCapability_g729AnnexA:
- cap = OO_G729;
+ cap = OO_G729A;
noofframes = audioCap->u.g729AnnexA;
break;
case T_H245AudioCapability_g7231:
@@ -940,11 +943,15 @@
return FALSE;
}
+ OOTRACEDBGC3("Comparing codecs: current=%d, requested=%d\n",
+ epCap->cap, cap);
if(cap != epCap->cap) { return FALSE; }
/* Can we receive this capability */
if(dir & OORX)
{
+ OOTRACEDBGC3("Comparing RX frame rate: channel's=%d, requested=%d\n",
+ ((OOCapParams*)epCap->params)->rxframes, noofframes);
if(((OOCapParams*)epCap->params)->rxframes >= noofframes) {
return TRUE;
}
@@ -958,6 +965,8 @@
/* Can we transmit compatible stream */
if(dir & OOTX)
{
+ OOTRACEDBGC3("Comparing TX frame rate: channel's=%d, requested=%d\n",
+ ((OOCapParams*)epCap->params)->txframes, noofframes);
if(((OOCapParams*)epCap->params)->txframes <= noofframes) {
return TRUE;
}
@@ -1215,7 +1224,7 @@
videoCap, dir);
default:
OOTRACEDBGC3("ooCapabilityCheckCompatibility_Video - Unsupported video "
- "capability. (%s, $s)\n", call->callType, call->callToken);
+ "capability. (%s, %s)\n", call->callType, call->callToken);
}
return FALSE;
}
@@ -1242,7 +1251,7 @@
case T_H245DataType_data:
default:
OOTRACEDBGC3("ooCapabilityCheckCompatibility - Unsupported "
- "capability. (%s, $s)\n", call->callType, call->callToken);
+ "capability. (%s, %s)\n", call->callType, call->callToken);
}
return FALSE;
@@ -1684,7 +1693,7 @@
if(!cur) return NULL;
- OOTRACEDBGC4("Found matching simple audio capability type %s. Comparing"
+ OOTRACEDBGC4("Found matching H.263 video capability type %s. Comparing"
" other parameters. (%s, %s)\n", ooGetCapTypeText(cap),
call->callType, call->callToken);
if(dir & OORX)
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooCmdChannel.c
^
|
@@ -27,104 +27,48 @@
extern OOH323EndPoint gH323ep;
OOSOCKET gCmdChan = 0;
-char gCmdIP[20];
-int gCmdPort = OO_DEFAULT_CMDLISTENER_PORT;
-
-int ooCreateCmdListener()
-{
- int ret=0;
- OOIPADDR ipaddrs;
-
- OOTRACEINFO3("Creating CMD listener at %s:%d\n",
- gH323ep.signallingIP, gH323ep.cmdPort);
- if((ret=ooSocketCreate (&gH323ep.cmdListener))!=ASN_OK)
- {
- OOTRACEERR1("ERROR: Failed to create socket for CMD listener\n");
- return OO_FAILED;
- }
- ret= ooSocketStrToAddr (gH323ep.signallingIP, &ipaddrs);
- if((ret=ooSocketBind (gH323ep.cmdListener, ipaddrs,
- gH323ep.cmdPort))==ASN_OK)
- {
- ooSocketListen(gH323ep.cmdListener,5); /*listen on socket*/
- OOTRACEINFO1("CMD listener creation - successful\n");
- return OO_OK;
- }
- else
- {
- OOTRACEERR1("ERROR:Failed to create CMD listener\n");
- return OO_FAILED;
- }
-
- return OO_OK;
-}
+pthread_mutex_t gCmdChanLock;
int ooCreateCmdConnection()
{
- int ret=0;
- if((ret=ooSocketCreate (&gCmdChan))!=ASN_OK)
- {
+ int ret = 0;
+ int thePipe[2];
+
+ if ((ret = pipe(thePipe)) == -1) {
return OO_FAILED;
}
- else
- {
- /*
- bind socket to a port before connecting. Thus avoiding
- implicit bind done by a connect call. Avoided on windows as
- windows sockets have problem in reusing the addresses even after
- setting SO_REUSEADDR, hence in windows we just allow os to bind
- to any random port.
- */
-#ifndef _WIN32
- ret = ooBindPort(OOTCP,gCmdChan, gCmdIP);
-#else
- ret = ooBindOSAllocatedPort(gCmdChan, gCmdIP);
-#endif
-
- if(ret == OO_FAILED)
- {
- return OO_FAILED;
- }
-
-
- if((ret=ooSocketConnect(gCmdChan, gCmdIP,
- gCmdPort)) != ASN_OK)
- return OO_FAILED;
+ pthread_mutex_init(&gCmdChanLock);
- }
+ gH323ep.cmdSock = dup(thePipe[0]);
+ close(thePipe[0]);
+ gCmdChan = dup(thePipe[1]);
+ close(thePipe[1]);
return OO_OK;
}
int ooCloseCmdConnection()
{
- ooSocketClose(gH323ep.cmdSock);
+ close(gH323ep.cmdSock);
gH323ep.cmdSock = 0;
+ close(gCmdChan);
+ gCmdChan = 0;
+ pthread_mutex_destroy(&gCmdChanLock);
return OO_OK;
}
-int ooAcceptCmdConnection()
-{
- int ret;
-
- ret = ooSocketAccept (gH323ep.cmdListener, &gH323ep.cmdSock,
- NULL, NULL);
- if(ret != ASN_OK)
- {
- OOTRACEERR1("Error:Accepting CMD connection\n");
- return OO_FAILED;
- }
- OOTRACEINFO1("Cmd connection accepted\n");
- return OO_OK;
-}
-
int ooWriteStackCommand(OOStackCommand *cmd)
{
- if(ASN_OK != ooSocketSend(gCmdChan, (char*)cmd, sizeof(OOStackCommand)))
- return OO_FAILED;
+
+ pthread_mutex_lock(&gCmdChanLock);
+ if (write(gCmdChan, (char*)cmd, sizeof(OOStackCommand)) == -1) {
+ pthread_mutex_unlock(&gCmdChanLock);
+ return OO_FAILED;
+ }
+ pthread_mutex_unlock(&gCmdChanLock);
- return OO_OK;
+ return OO_OK;
}
@@ -135,7 +79,7 @@
int i, recvLen = 0;
OOStackCommand cmd;
memset(&cmd, 0, sizeof(OOStackCommand));
- recvLen = ooSocketRecv (gH323ep.cmdSock, buffer, MAXMSGLEN);
+ recvLen = read(gH323ep.cmdSock, buffer, MAXMSGLEN);
if(recvLen <= 0)
{
OOTRACEERR1("Error:Failed to read CMD message\n");
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooCmdChannel.h
^
|
@@ -45,23 +45,6 @@
*/
/**
- * This function creates a command listener. This is nothing but a tcp socket
- * in listen mode waiting for incoming connection on which the stack thread
- * will receive commands.
- *
- * @return OO_OK, on success; OO_FAILED, on failure
- */
-EXTERN int ooCreateCmdListener();
-
-/**
- * This function is used to accept an incoming connection request for command
- * channel.
- *
- * @return OO_OK, on success; OO_FAILED, on failure
- */
-EXTERN int ooAcceptCmdConnection();
-
-/**
* This function is used to setup a command connection with the main stack
* thread. The application commands are sent over this connection to stack
* thread.
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooGkClient.c
^
|
@@ -981,6 +981,37 @@
pRegReq->discoveryComplete= pGkClient->discoveryComplete;
pRegReq->m.keepAlivePresent=TRUE;
pRegReq->keepAlive= keepAlive;
+
+ /*
+ * Cisco Gatekeeper re-registration fix. Thanks to Mike Tubby (mike@tubby.org) 28feb2007
+ * Without this patch initial registration works, but re-registration fails!
+ *
+ * For light-weight re-registration, keepalive is set true
+ * GK needs rasAddress, keepAlive, endpointIdentifier, gatekeeperIdentifier,
+ * tokens, and timeToLive
+ * GK will ignore all other params if KeepAlive is set.
+ *
+ */
+ if(keepAlive) {
+ /* KeepAlive, re-registration message...
+ allocate storage for endpoint-identifier, and populate it from what the
+ GK told us from the previous RCF. Only allocate on the first pass thru here */
+ pRegReq->endpointIdentifier.data =
+ (ASN116BITCHAR*)memAlloc(pctxt, pGkClient->gkId.nchars*sizeof(ASN116BITCHAR));
+ if (pRegReq->endpointIdentifier.data) {
+ pRegReq->endpointIdentifier.nchars = pGkClient->endpointId.nchars;
+ pRegReq->m.endpointIdentifierPresent = TRUE;
+ memcpy(pRegReq->endpointIdentifier.data, pGkClient->endpointId.data, pGkClient->endpointId.nchars*sizeof(ASN116BITCHAR));
+ OOTRACEINFO1("Sending RRQ for re-registration (with EndpointID)\n");
+ }
+ else {
+ OOTRACEERR1("Error: Failed to allocate memory for EndpointIdentifier in RRQ \n");
+ memReset(pctxt);
+ pGkClient->state = GkClientFailed;
+ return OO_FAILED;
+ }
+ }
+
pRegReq->m.timeToLivePresent = TRUE;
pRegReq->timeToLive = pGkClient->regTimeout;
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooLogChan.c
^
|
@@ -191,6 +191,8 @@
{
if(!strcmp(pChannel->dir, dir))
{
+ OOTRACEDBGC3("ooFindLogicalChannel, comparing channel: %d:%s\n",
+ pChannel->channelNo, pChannel->dir);
if(!strcmp(dir, "receive"))
{
if(ooCapabilityCheckCompatibility(call, pChannel->chanCap,
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooSocket.c
^
|
@@ -338,7 +338,7 @@
if (pNewSocket == 0) return ASN_E_INVPARAM;
*pNewSocket = accept (socket, (struct sockaddr *) (void*) &m_addr,
- (socklen_t*)&addr_length);
+ (socklen_t *) &addr_length);
if (*pNewSocket <= 0) return ASN_E_INVSOCKET;
if (destAddr != 0)
@@ -608,7 +608,10 @@
int flags;
for (ifName = ifc.ifc_req; (void*)ifName < ifEndList; ifName++) {
char *pName=NULL;
- char addr[50], mask[50];
+ char addr[50];
+#ifdef ifr_netmask
+ char mask[50];
+#endif
pIf = (struct OOInterface*)memAlloc(pctxt, sizeof(struct OOInterface));
pName = (char*)memAlloc(pctxt, strlen(ifName->ifr_name)+1);
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/oochannels.c
^
|
@@ -492,12 +492,6 @@
*nfds = *((int*)gH323ep.listener);
}
- if(gH323ep.cmdListener)
- {
- FD_SET(gH323ep.cmdListener, pReadfds);
- if(*nfds < (int)gH323ep.cmdListener)
- *nfds = (int)gH323ep.cmdListener;
- }
if(gH323ep.cmdSock)
{
FD_SET(gH323ep.cmdSock, pReadfds);
@@ -582,21 +576,12 @@
}
}
-
- if(gH323ep.cmdListener)
- {
- if(FD_ISSET(gH323ep.cmdListener, pReadfds))
- {
- if(ooAcceptCmdConnection() != OO_OK){
- OOTRACEERR1("Error:Failed to accept command connection\n");
- return OO_FAILED;
- }
- }
- }
-
if(gH323ep.cmdSock) {
if(FD_ISSET(gH323ep.cmdSock, pReadfds)) {
- ooReadAndProcessStackCommand();
+ if(ooReadAndProcessStackCommand() != OO_OK) {
+ /* ooReadAndProcessStackCommand prints an error message */
+ return OO_FAILED;
+ }
}
}
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooh323.c
^
|
@@ -528,7 +528,14 @@
}
/* Retrieve the H.245 control channel address from the connect msg */
- if(callProceeding->m.h245AddressPresent)
+ if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
+ q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
+ callProceeding->m.h245AddressPresent) {
+ OOTRACEINFO3("Tunneling and h245address provided."
+ "Using Tunneling for H.245 messages (%s, %s)\n",
+ call->callType, call->callToken);
+ }
+ else if(callProceeding->m.h245AddressPresent)
{
if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
{
@@ -718,7 +725,14 @@
}
/* Retrieve the H.245 control channel address from the connect msg */
- if(alerting->m.h245AddressPresent)
+ if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
+ q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
+ alerting->m.h245AddressPresent) {
+ OOTRACEINFO3("Tunneling and h245address provided."
+ "Giving preference to Tunneling (%s, %s)\n",
+ call->callType, call->callToken);
+ }
+ else if(alerting->m.h245AddressPresent)
{
if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
{
@@ -933,7 +947,14 @@
}
/* Retrieve the H.245 control channel address from the CONNECT msg */
- if(connect->m.h245AddressPresent)
+ if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
+ q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
+ connect->m.h245AddressPresent) {
+ OOTRACEINFO3("Tunneling and h245address provided."
+ "Giving preference to Tunneling (%s, %s)\n",
+ call->callType, call->callToken);
+ }
+ else if(connect->m.h245AddressPresent)
{
if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
{
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooh323ep.c
^
|
@@ -24,8 +24,6 @@
ooEndPoint gH323ep;
-extern int gCmdPort;
-extern char gCmdIP[20];
extern DList g_TimerList;
int ooH323EpInitialize
@@ -127,9 +125,7 @@
ooSetTraceThreshold(OOTRCLVLINFO);
OO_SETFLAG(gH323ep.flags, OO_M_ENDPOINTCREATED);
- gH323ep.cmdListener = 0;
gH323ep.cmdSock = 0;
- gH323ep.cmdPort = OO_DEFAULT_CMDLISTENER_PORT;
return OO_OK;
}
@@ -145,7 +141,6 @@
if(localip)
{
strcpy(gH323ep.signallingIP, localip);
- strcpy(gCmdIP, localip);
OOTRACEINFO2("Signalling IP address is set to %s\n", localip);
}
@@ -157,19 +152,6 @@
return OO_OK;
}
-int ooH323EpCreateCmdListener(int cmdPort)
-{
- if(cmdPort != 0)
- {
- gH323ep.cmdPort = cmdPort;
- gCmdPort = cmdPort;
- }
- if(ooCreateCmdListener() != OO_OK)
- return OO_FAILED;
-
- return OO_OK;
-}
-
int ooH323EpAddAliasH323ID(const char *h323id)
{
ooAliases * psNewAlias=NULL;
@@ -373,13 +355,7 @@
gH323ep.listener = NULL;
}
- if(gH323ep.cmdListener != 0)
- {
- ooSocketClose(gH323ep.cmdListener);
- gH323ep.cmdListener = 0;
- }
-
- ooGkClientDestroy();
+ ooGkClientDestroy();
if(gH323ep.fptraceFile)
{
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooh323ep.h
^
|
@@ -147,9 +147,7 @@
OOInterface *ifList; /* interface list for the host we are running on*/
OOBOOL isGateway;
- OOSOCKET cmdListener;
OOSOCKET cmdSock;
- int cmdPort; /* default 7575 */
} OOH323EndPoint;
#define ooEndPoint OOH323EndPoint
@@ -166,19 +164,6 @@
EXTERN int ooH323EpInitialize
(enum OOCallMode callMode, const char* tracefile);
-
-
-/**
- * This function is used to create a command listener for the endpoint.
- * Before any command is issued to the endpoint, command listener must be
- * created.
- * @param cmdPort Port number on which command listener waits for
- * incoming requests.
- *
- * @return OO_OK, on success; OO_FAILED, on failure
- */
-EXTERN int ooH323EpCreateCmdListener(int cmdPort);
-
/**
* This function is used to represent the H.323 application endpoint as
* gateway, instead of an H.323 phone endpoint.
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ooq931.c
^
|
@@ -2037,10 +2037,10 @@
/* Set calling party number Q931 IE */
if(call->callingPartyNumber)
ooQ931SetCallingPartyNumberIE(q931msg,
- (const char*)call->callingPartyNumber, 1, 0, 1, 1);
+ (const char*)call->callingPartyNumber, 1, 0, 0, 0);
- /* Set called party number Q931 ie */
+ /* Set called party number Q931 IE */
if(call->calledPartyNumber)
ooQ931SetCalledPartyNumberIE(q931msg,
(const char*)call->calledPartyNumber, 1, 0);
@@ -3358,6 +3358,7 @@
"OOConnect",
"OOReleaseComplete",
"OOFacility",
+ "OOInformation",
"OOMasterSlaveDetermination",
"OOMasterSlaveAck",
"OOMasterSlaveReject",
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ootrace.c
^
|
@@ -70,7 +70,7 @@
#else
struct tm *ptime;
- char dateString[10];
+ char dateString[15];
time_t t = time(NULL);
ptime = localtime(&t);
strftime(timeString, 100, "%H:%M:%S", ptime);
@@ -100,7 +100,7 @@
if(printDate)
{
printDate = 0;
- strftime(dateString, 10, "%D", ptime);
+ strftime(dateString, 15, "%m/%d/%Y", ptime);
fprintf(gH323ep.fptraceFile, "---------Date %s---------\n",
dateString);
}
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ootrace.h
^
|
@@ -52,7 +52,7 @@
#define TRACELVL 1
#endif
-#define OOTRACEERR1(a) ooTrace(OOTRCLVLERR,a)
+#define OOTRACEERR1(a) ooTrace(OOTRCLVLERR,"%s", a)
#define OOTRACEERR2(a,b) ooTrace(OOTRCLVLERR,a,b)
#define OOTRACEERR3(a,b,c) ooTrace(OOTRCLVLERR,a,b,c)
#define OOTRACEERR4(a,b,c,d) ooTrace(OOTRCLVLERR,a,b,c,d)
@@ -72,7 +72,7 @@
#define OOTRACEDBGA3(a,b,c) ooTrace(OOTRCLVLDBGA,a,b,c)
#define OOTRACEDBGA4(a,b,c,d) ooTrace(OOTRCLVLDBGA,a,b,c,d)
#define OOTRACEDBGA5(a,b,c,d,e) ooTrace(OOTRCLVLDBGA,a,b,c,d,e)
-#define OOTRACEDBGB1(a) ooTrace(OOTRCLVLDBGB,a)
+#define OOTRACEDBGB1(a) ooTrace(OOTRCLVLDBGB,"%s",a)
#define OOTRACEDBGB2(a,b) ooTrace(OOTRCLVLDBGB,a,b)
#define OOTRACEDBGB3(a,b,c) ooTrace(OOTRCLVLDBGB,a,b,c)
#define OOTRACEDBGB4(a,b,c,d) ooTrace(OOTRCLVLDBGB,a,b,c,d)
@@ -129,7 +129,7 @@
*
* @return - none
*/
-EXTERN void ooTrace(OOUINT32 traceLevel, const char * fmtspec, ...);
+EXTERN void ooTrace(OOUINT32 traceLevel, const char * fmtspec, ...)__attribute__((format(printf, 2, 3)));
/**
* Helper function for the trace function. This function performs actual
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323c/src/ootypes.h
^
|
@@ -61,7 +61,7 @@
-#define OOH323C_VERSION "v0.8.2"
+#define OOH323C_VERSION "v0.8.3"
#ifndef EXTERN
#ifdef MAKE_DLL
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/channels/ooh323cDriver.c
^
|
@@ -121,6 +121,18 @@
}
+ if(format & AST_FORMAT_H263)
+ {
+ if(gH323Debug)
+ ast_verbose("\tAdding h263 capability to H323 endpoint\n");
+ ret = ooH323EpAddH263VideoCapability(OO_H263VIDEO, 1, 0, 0, 0, 0, 320*1024,
+ OORXANDTX, &ooh323c_start_receive_channel,
+ &ooh323c_start_transmit_channel,
+ &ooh323c_stop_receive_channel,
+ &ooh323c_stop_transmit_channel);
+
+ }
+
if(format & AST_FORMAT_GSM)
{
if(gH323Debug)
@@ -148,7 +160,7 @@
int ooh323c_set_capability_for_call
(ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf)
{
- int ret, x, txframes, rxframes;
+ int ret, x, txframes;
int format=0;
if(gH323Debug)
ast_verbose("\tAdding capabilities to call(%s, %s)\n", call->callType,
@@ -225,6 +237,19 @@
}
+ if(format & AST_FORMAT_H263)
+ {
+ if(gH323Debug)
+ ast_verbose("\tAdding h263 capability to call (%s, %s)\n",
+ call->callType, call->callToken);
+ ret = ooCallAddH263VideoCapability(call, OO_H263VIDEO, 1, 0, 0, 0, 0, 320*1024,
+ OORXANDTX, &ooh323c_start_receive_channel,
+ &ooh323c_start_transmit_channel,
+ &ooh323c_stop_receive_channel,
+ &ooh323c_stop_transmit_channel);
+
+ }
+
if(format & AST_FORMAT_GSM)
{
if(gH323Debug)
@@ -323,8 +348,10 @@
return AST_FORMAT_G729A;
case OO_G7231:
return AST_FORMAT_G723_1;
+ case OO_H263VIDEO:
+ return AST_FORMAT_H263;
default:
- ast_debug(1, "Cap %d is not supported by driver yet\n");
+ ast_debug(1, "Cap %d is not supported by driver yet\n", cap);
return -1;
}
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/configs/res_mysql.conf.sample
^
|
@@ -6,6 +6,21 @@
; to the local host is assumed and dbsock is used instead of TCP/IP
; to connect to the server.
;
+; In addition to a [general] section, this file may also be configured
+; with separate [read] and [write] sections, which permits separation
+; of read-only queries from queries which alter the database. This
+; enables the use of master and slave replication servers for
+; scalability.
+;
+; The way this meshes with extconfig.conf is kind of tricky. If the
+; externally specified database is the same as the [read] database,
+; then reads and writes will go to the separate places as specified
+; in this file. However, if the externally specified database is
+; different than in the [read] database, then both reads and writes
+; will go to the same place, as specified. That there is only read/
+; write separation for a single set of databases will be corrected
+; in a future version of Asterisk-Addons.
+;
[general]
;dbhost = 127.0.0.1
;dbname = asterisk
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/configure
^
|
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 523 .
+# From configure.ac Revision: 615 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61.
#
@@ -715,9 +715,6 @@
ASTERISK_LIB
ASTERISK_INCLUDE
PBX_ASTERISK
-SPANDSP_LIB
-SPANDSP_INCLUDE
-PBX_SPANDSP
CPP
EGREP
AST_DECLARATION_AFTER_STATEMENT
@@ -1320,7 +1317,6 @@
--with-ncurses=PATH use ncurses files in PATH
--with-mysqlclient=PATH use mysqlclient files in PATH
--with-asterisk=PATH use asterisk files in PATH
- --with-spandsp=PATH use spandsp Library files in PATH
Some influential environment variables:
CC C compiler command
@@ -4702,33 +4698,6 @@
-SPANDSP_DESCRIP="spandsp Library"
-SPANDSP_OPTION="spandsp"
-
-# Check whether --with-spandsp was given.
-if test "${with_spandsp+set}" = set; then
- withval=$with_spandsp;
-case ${withval} in
- n|no)
- USE_SPANDSP=no
- ;;
- y|ye|yes)
- SPANDSP_MANDATORY="yes"
- ;;
- *)
- SPANDSP_DIR="${withval}"
- SPANDSP_MANDATORY="yes"
- ;;
-esac
-
-fi
-
-PBX_SPANDSP=0
-
-
-
-
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -6552,401 +6521,6 @@
fi
-if test "${USE_SPANDSP}" != "no"; then
- pbxlibdir=""
- if test "x${SPANDSP_DIR}" != "x"; then
- if test -d ${SPANDSP_DIR}/lib; then
- pbxlibdir="-L${SPANDSP_DIR}/lib"
- else
- pbxlibdir="-L${SPANDSP_DIR}"
- fi
- fi
- { echo "$as_me:$LINENO: checking for span_set_message_handler in -lspandsp" >&5
-echo $ECHO_N "checking for span_set_message_handler in -lspandsp... $ECHO_C" >&6; }
-if test "${ac_cv_lib_spandsp_span_set_message_handler+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lspandsp ${pbxlibdir} -ltiff $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char span_set_message_handler ();
-int
-main ()
-{
-return span_set_message_handler ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_lib_spandsp_span_set_message_handler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_spandsp_span_set_message_handler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_spandsp_span_set_message_handler" >&5
-echo "${ECHO_T}$ac_cv_lib_spandsp_span_set_message_handler" >&6; }
-if test $ac_cv_lib_spandsp_span_set_message_handler = yes; then
- AST_SPANDSP_FOUND=yes
-else
- AST_SPANDSP_FOUND=no
-fi
-
-
- if test "${AST_SPANDSP_FOUND}" = "yes"; then
- SPANDSP_LIB="-lspandsp -ltiff"
- SPANDSP_HEADER_FOUND="1"
- if test "x${SPANDSP_DIR}" != "x"; then
- SPANDSP_LIB="${pbxlibdir} ${SPANDSP_LIB}"
- SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
- if test "xspandsp.h" != "x" ; then
- as_ac_Header=`echo "ac_cv_header_${SPANDSP_DIR}/include/spandsp.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { echo "$as_me:$LINENO: checking for ${SPANDSP_DIR}/include/spandsp.h" >&5
-echo $ECHO_N "checking for ${SPANDSP_DIR}/include/spandsp.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
- # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SPANDSP_DIR}/include/spandsp.h usability" >&5
-echo $ECHO_N "checking ${SPANDSP_DIR}/include/spandsp.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <${SPANDSP_DIR}/include/spandsp.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${SPANDSP_DIR}/include/spandsp.h presence" >&5
-echo $ECHO_N "checking ${SPANDSP_DIR}/include/spandsp.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <${SPANDSP_DIR}/include/spandsp.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: ${SPANDSP_DIR}/include/spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SPANDSP_DIR}/include/spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${SPANDSP_DIR}/include/spandsp.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SPANDSP_DIR}/include/spandsp.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: ${SPANDSP_DIR}/include/spandsp.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SPANDSP_DIR}/include/spandsp.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${SPANDSP_DIR}/include/spandsp.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SPANDSP_DIR}/include/spandsp.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${SPANDSP_DIR}/include/spandsp.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SPANDSP_DIR}/include/spandsp.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${SPANDSP_DIR}/include/spandsp.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SPANDSP_DIR}/include/spandsp.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${SPANDSP_DIR}/include/spandsp.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SPANDSP_DIR}/include/spandsp.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${SPANDSP_DIR}/include/spandsp.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SPANDSP_DIR}/include/spandsp.h: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SPANDSP_DIR}/include/spandsp.h" >&5
-echo $ECHO_N "checking for ${SPANDSP_DIR}/include/spandsp.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- SPANDSP_HEADER_FOUND=1
-else
- SPANDSP_HEADER_FOUND=0
-fi
-
-
- fi
- else
- if test "xspandsp.h" != "x" ; then
- if test "${ac_cv_header_spandsp_h+set}" = set; then
- { echo "$as_me:$LINENO: checking for spandsp.h" >&5
-echo $ECHO_N "checking for spandsp.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_spandsp_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_spandsp_h" >&5
-echo "${ECHO_T}$ac_cv_header_spandsp_h" >&6; }
-else
- # Is the header compilable?
-{ echo "$as_me:$LINENO: checking spandsp.h usability" >&5
-echo $ECHO_N "checking spandsp.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <spandsp.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking spandsp.h presence" >&5
-echo $ECHO_N "checking spandsp.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <spandsp.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: spandsp.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: spandsp.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: spandsp.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: spandsp.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: spandsp.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: spandsp.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: spandsp.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: spandsp.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: spandsp.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: spandsp.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: spandsp.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: spandsp.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: spandsp.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: spandsp.h: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ echo "$as_me:$LINENO: checking for spandsp.h" >&5
-echo $ECHO_N "checking for spandsp.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_spandsp_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_spandsp_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_spandsp_h" >&5
-echo "${ECHO_T}$ac_cv_header_spandsp_h" >&6; }
-
-fi
-if test $ac_cv_header_spandsp_h = yes; then
- SPANDSP_HEADER_FOUND=1
-else
- SPANDSP_HEADER_FOUND=0
-fi
-
-
- fi
- fi
- if test "x${SPANDSP_HEADER_FOUND}" = "x0" ; then
- if test ! -z "${SPANDSP_MANDATORY}" ;
- then
- { echo "$as_me:$LINENO: ***" >&5
-echo "$as_me: ***" >&6;}
- { echo "$as_me:$LINENO: *** It appears that you do not have the spandsp development package installed." >&5
-echo "$as_me: *** It appears that you do not have the spandsp development package installed." >&6;}
- { echo "$as_me:$LINENO: *** Please install it to include ${SPANDSP_DESCRIP} support" >&5
-echo "$as_me: *** Please install it to include ${SPANDSP_DESCRIP} support" >&or re-run configure;}
- { echo "$as_me:$LINENO: *** without explicitly specifying --with-${SPANDSP_OPTION}" >&5
-echo "$as_me: *** without explicitly specifying --with-${SPANDSP_OPTION}" >&6;}
- exit 1
- fi
- SPANDSP_LIB=""
- SPANDSP_INCLUDE=""
- PBX_SPANDSP=0
- else
- PBX_SPANDSP=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SPANDSP 1
-_ACEOF
-
- fi
- elif test ! -z "${SPANDSP_MANDATORY}";
- then
- { echo "$as_me:$LINENO: ***" >&5
-echo "$as_me: ***" >&6;}
- { echo "$as_me:$LINENO: *** The ${SPANDSP_DESCRIP} installation on this system appears to be broken." >&5
-echo "$as_me: *** The ${SPANDSP_DESCRIP} installation on this system appears to be broken." >&6;}
- { echo "$as_me:$LINENO: *** Either correct the installation" >&5
-echo "$as_me: *** Either correct the installation" >&or run configure;}
- { echo "$as_me:$LINENO: *** without explicitly specifying --with-${SPANDSP_OPTION}" >&5
-echo "$as_me: *** without explicitly specifying --with-${SPANDSP_OPTION}" >&6;}
- exit 1
- fi
-fi
-
-
{ echo "$as_me:$LINENO: checking for -Wdeclaration-after-statement support" >&5
echo $ECHO_N "checking for -Wdeclaration-after-statement support... $ECHO_C" >&6; }
if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
@@ -8141,9 +7715,6 @@
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
PBX_ASTERISK!$PBX_ASTERISK$ac_delim
-SPANDSP_LIB!$SPANDSP_LIB$ac_delim
-SPANDSP_INCLUDE!$SPANDSP_INCLUDE$ac_delim
-PBX_SPANDSP!$PBX_SPANDSP$ac_delim
CPP!$CPP$ac_delim
EGREP!$EGREP$ac_delim
AST_DECLARATION_AFTER_STATEMENT!$AST_DECLARATION_AFTER_STATEMENT$ac_delim
@@ -8152,7 +7723,7 @@
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 10; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 7; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/configure.ac
^
|
@@ -17,7 +17,7 @@
AC_CONFIG_SRCDIR([res/res_config_mysql.c])
AC_COPYRIGHT("Asterisk-addons")
-AC_REVISION($Revision: 570 $)
+AC_REVISION($Revision: 616 $)
case "${host}" in
*freebsd*)
@@ -175,12 +175,10 @@
AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
AST_EXT_LIB_SETUP([MYSQLCLIENT], [mysqlclient], [mysqlclient])
AST_EXT_LIB_SETUP([ASTERISK], [asterisk], [asterisk])
-AST_EXT_LIB_SETUP([SPANDSP], [spandsp Library], [spandsp])
AST_EXT_LIB_CHECK([BLUETOOTH], [bluetooth], [ba2str], [bluetooth/bluetooth.h])
AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
-AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/makeopts.in
^
|
@@ -50,6 +50,3 @@
NCURSES_LIB=@NCURSES_LIB@
NCURSES_INCLUDE=@NCURSES_INCLUDE@
-
-SPANDSP_INCLUDE=@SPANDSP_INCLUDE@
-SPANDSP_LIB=@SPANDSP_LIB@
|
[-]
[+]
|
Changed |
asterisk-addons-1.6.0.1.tar.bz2/res/res_config_mysql.c
^
|
@@ -100,6 +100,7 @@
char *stringp;
char *chunk;
char *op;
+ char dbname[50] = "";
const char *newparam, *newval;
struct ast_variable *var=NULL, *prev=NULL;
@@ -134,7 +135,10 @@
if ((valsz = strlen (newval)) * 2 + 1 > sizeof(buf))
valsz = (sizeof(buf) - 1) / 2;
mysql_real_escape_string(&dbread.handle, buf, newval, valsz);
- snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s '%s'", table, newparam, op, buf);
+ if (strcmp(database, dbread.name)) {
+ snprintf(dbname, sizeof(dbname), "%s.", database);
+ }
+ snprintf(sql, sizeof(sql), "SELECT * FROM %s%s WHERE %s%s '%s'", dbname, table, newparam, op, buf);
while ((newparam = va_arg(ap, const char *))) {
newval = va_arg(ap, const char *);
if (!strchr(newparam, ' '))
@@ -203,6 +207,7 @@
char *stringp;
char *chunk;
char *op;
+ char dbname[50] = "";
const char *newparam, *newval;
struct ast_variable *var = NULL;
struct ast_config *cfg = NULL;
@@ -253,7 +258,10 @@
if ((valsz = strlen (newval)) * 2 + 1 > sizeof(buf))
valsz = (sizeof(buf) - 1) / 2;
mysql_real_escape_string(&dbread.handle, buf, newval, valsz);
- snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s '%s'", table, newparam, op, buf);
+ if (strcmp(database, dbread.name)) {
+ snprintf(dbname, sizeof(dbname), "%s.", database);
+ }
+ snprintf(sql, sizeof(sql), "SELECT * FROM %s%s WHERE %s%s '%s'", dbname, table, newparam, op, buf);
while ((newparam = va_arg(ap, const char *))) {
newval = va_arg(ap, const char *);
if (!strchr(newparam, ' ')) op = " ="; else op = "";
@@ -322,6 +330,7 @@
my_ulonglong numrows;
char sql[512];
char buf[511]; /* Keep this size uneven as it is 2n+1. */
+ char dbname[50] = "";
int valsz;
const char *newparam, *newval;
@@ -351,7 +360,10 @@
if ((valsz = strlen (newval)) * 2 + 1 > sizeof(buf))
valsz = (sizeof(buf) - 1) / 2;
mysql_real_escape_string(&dbwrite.handle, buf, newval, valsz);
- snprintf(sql, sizeof(sql), "UPDATE %s SET %s = '%s'", table, newparam, buf);
+ if (strcmp(database, dbwrite.name)) {
+ snprintf(dbname, sizeof(dbname), "%s.", database);
+ }
+ snprintf(sql, sizeof(sql), "UPDATE %s%s SET %s = '%s'", dbname, table, newparam, buf);
while((newparam = va_arg(ap, const char *))) {
newval = va_arg(ap, const char *);
if ((valsz = strlen (newval)) * 2 + 1 > sizeof(buf))
@@ -365,7 +377,7 @@
mysql_real_escape_string(&dbwrite.handle, buf, lookup, valsz);
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " WHERE %s = '%s'", keyfield, buf);
- ast_debug(1,"MySQL RealTime: Update SQL: %s\n", sql);
+ ast_debug(1, "MySQL RealTime: Update SQL: %s\n", sql);
/* Execution. */
if (mysql_real_query(&dbwrite.handle, sql, strlen(sql))) {
@@ -379,7 +391,7 @@
numrows = mysql_affected_rows(&dbwrite.handle);
ast_mutex_unlock(&dbwrite.lock);
- ast_debug(1,"MySQL RealTime: Updated %llu rows on table: %s\n", numrows, table);
+ ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n", numrows, table);
/* From http://dev.mysql.com/doc/mysql/en/mysql-affected-rows.html
* An integer greater than zero indicates the number of rows affected
@@ -397,6 +409,7 @@
char buf[511]; /* Keep this size uneven as it is 2n+1. */
char fields[512];
char values[512];
+ char dbname[50] = "";
int valsz;
const char *newparam, *newval;
@@ -441,8 +454,11 @@
snprintf(values + strlen(values), sizeof(values), ", '%s'", buf);
}
va_end(ap);
- snprintf(sql, sizeof(sql), "INSERT into %s (%s) values (%s)", table, fields, values);
- ast_debug(1,"MySQL RealTime: Insert SQL: %s\n", sql);
+ if (strcmp(database, dbwrite.name)) {
+ snprintf(dbname, sizeof(dbname), "%s.", database);
+ }
+ snprintf(sql, sizeof(sql), "INSERT into %s%s (%s) values (%s)", dbname, table, fields, values);
+ ast_debug(1, "MySQL RealTime: Insert SQL: %s\n", sql);
/* Execution. */
if (mysql_real_query(&dbwrite.handle, sql, strlen(sql))) {
@@ -472,6 +488,7 @@
char sql[512];
char buf[511]; /* Keep this size uneven as it is 2n+1. */
int valsz;
+ char dbname[50] = "";
const char *newparam, *newval;
if (!table) {
@@ -500,7 +517,10 @@
if ((valsz = strlen (lookup)) * 2 + 1 > sizeof(buf))
valsz = (sizeof(buf) - 1) / 2;
mysql_real_escape_string(&dbwrite.handle, buf, lookup, valsz);
- snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE %s = '%s'", table, keyfield, buf);
+ if (strcmp(database, dbwrite.name)) {
+ snprintf(dbname, sizeof(dbname), "%s.", database);
+ }
+ snprintf(sql, sizeof(sql), "DELETE FROM %s%s WHERE %s = '%s'", dbname, table, keyfield, buf);
while ((newparam = va_arg(ap, const char *))) {
newval = va_arg(ap, const char *);
if ((valsz = strlen (newval)) * 2 + 1 > sizeof(buf))
@@ -544,6 +564,7 @@
struct ast_category *cur_cat;
char sql[250] = "";
char last[80] = "";
+ char dbname[50] = "";
int last_cat_metric = 0;
ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
@@ -554,17 +575,19 @@
return NULL;
}
- snprintf(sql, sizeof(sql), "SELECT category, var_name, var_val, cat_metric FROM %s WHERE filename='%s' and commented=0 ORDER BY filename, cat_metric desc, var_metric asc, category, var_name, var_val, id", table, file);
-
- ast_debug(1, "MySQL RealTime: Static SQL: %s\n", sql);
-
- /* We now have our complete statement; Lets connect to the server and execute it. */
ast_mutex_lock(&dbread.lock);
if (!mysql_reconnect(&dbread)) {
ast_mutex_unlock(&dbread.lock);
return NULL;
}
+ if (strcmp(database, dbread.name)) {
+ snprintf(dbname, sizeof(dbname), "%s.", database);
+ }
+ snprintf(sql, sizeof(sql), "SELECT category, var_name, var_val, cat_metric FROM %s%s WHERE filename='%s' and commented=0 ORDER BY filename, cat_metric desc, var_metric asc, category, var_name, var_val, id", dbname, table, file);
+
+ ast_debug(1, "MySQL RealTime: Static SQL: %s\n", sql);
+
if (mysql_real_query(&dbread.handle, sql, strlen(sql))) {
ast_log(LOG_WARNING, "MySQL RealTime: Failed to query database. Check debug for more info.\n");
ast_debug(1, "MySQL RealTime: Query: %s\n", sql);
|