[asterisk-commits] branch rizzo/base r9688 - in /team/rizzo/base:
./ apps/ channels/ codecs/ doc...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Feb 12 08:02:29 MST 2006
Author: rizzo
Date: Sun Feb 12 09:02:06 2006
New Revision: 9688
URL: http://svn.digium.com/view/asterisk?rev=9688&view=rev
Log:
merge with current version and fix bugs.
Added:
team/rizzo/base/channels/misdn_config.c
- copied unchanged from r9674, trunk/channels/misdn_config.c
team/rizzo/base/funcs/func_channel.c
- copied unchanged from r9674, trunk/funcs/func_channel.c
Removed:
team/rizzo/base/channels/chan_misdn_config.c
Modified:
team/rizzo/base/ (props changed)
team/rizzo/base/apps/app_curl.c
team/rizzo/base/apps/app_hasnewvoicemail.c
team/rizzo/base/apps/app_morsecode.c
team/rizzo/base/apps/app_page.c
team/rizzo/base/apps/app_queue.c
team/rizzo/base/channel.c
team/rizzo/base/channels/Makefile
team/rizzo/base/channels/chan_agent.c
team/rizzo/base/channels/chan_iax2.c
team/rizzo/base/channels/chan_mgcp.c
team/rizzo/base/channels/chan_sip.c
team/rizzo/base/codecs/Makefile
team/rizzo/base/doc/CODING-GUIDELINES
team/rizzo/base/formats/format_g723.c
team/rizzo/base/formats/format_ogg_vorbis.c
team/rizzo/base/funcs/func_base64.c
team/rizzo/base/funcs/func_callerid.c
team/rizzo/base/funcs/func_cdr.c
team/rizzo/base/funcs/func_cut.c
team/rizzo/base/funcs/func_db.c
team/rizzo/base/funcs/func_enum.c
team/rizzo/base/funcs/func_env.c
team/rizzo/base/funcs/func_groupcount.c
team/rizzo/base/funcs/func_language.c
team/rizzo/base/funcs/func_logic.c
team/rizzo/base/funcs/func_math.c
team/rizzo/base/funcs/func_md5.c
team/rizzo/base/funcs/func_moh.c
team/rizzo/base/funcs/func_odbc.c
team/rizzo/base/funcs/func_rand.c
team/rizzo/base/funcs/func_sha1.c
team/rizzo/base/funcs/func_strings.c
team/rizzo/base/funcs/func_timeout.c
team/rizzo/base/funcs/func_uri.c
team/rizzo/base/include/asterisk/channel.h
team/rizzo/base/include/asterisk/manager.h
team/rizzo/base/include/asterisk/module.h
team/rizzo/base/include/asterisk/pbx.h
team/rizzo/base/include/asterisk/stringfields.h
team/rizzo/base/manager.c
team/rizzo/base/pbx.c
team/rizzo/base/pbx/pbx_dundi.c
team/rizzo/base/pbx/pbx_spool.c
team/rizzo/base/res/res_agi.c
team/rizzo/base/res/res_clioriginate.c
team/rizzo/base/utils.c
Propchange: team/rizzo/base/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/rizzo/base/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/rizzo/base/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Feb 12 09:02:06 2006
@@ -1,1 +1,1 @@
-/trunk:1-9580
+/trunk:1-9687
Modified: team/rizzo/base/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_curl.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/apps/app_curl.c (original)
+++ team/rizzo/base/apps/app_curl.c Sun Feb 12 09:02:06 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 2004 - 2005, Tilghman Lesher
+ * Copyright (C) 2004 - 2006, Tilghman Lesher
*
* Tilghman Lesher <curl-20050919 at the-tilghman.com>
* and Brian Wilkins <bwilkins at cfl.rr.com> (Added POST option)
@@ -109,10 +109,9 @@
return 0;
}
-static char *acf_curl_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int acf_curl_exec(struct ast_channel *chan, char *cmd, char *info, char *buf, size_t len)
{
struct localuser *u;
- char *info;
struct MemoryStruct chunk = { NULL, 0 };
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(url);
@@ -121,21 +120,16 @@
*buf = '\0';
- if (ast_strlen_zero(data)) {
+ if (ast_strlen_zero(info)) {
ast_log(LOG_WARNING, "CURL requires an argument (URL)\n");
- return buf;
+ return -1;
}
LOCAL_USER_ACF_ADD(u);
- if (!(info = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return buf;
- }
-
AST_STANDARD_APP_ARGS(args, info);
- if (! curl_internal(&chunk, args.url, args.postdata)) {
+ if (!curl_internal(&chunk, args.url, args.postdata)) {
if (chunk.memory) {
chunk.memory[chunk.size] = '\0';
if (chunk.memory[chunk.size - 1] == 10)
@@ -149,7 +143,8 @@
}
LOCAL_USER_REMOVE(u);
- return buf;
+
+ return 0;
}
struct ast_custom_function acf_curl = {
Modified: team/rizzo/base/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_hasnewvoicemail.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/apps/app_hasnewvoicemail.c (original)
+++ team/rizzo/base/apps/app_hasnewvoicemail.c Sun Feb 12 09:02:06 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Changes Copyright (c) 2004 - 2005 Todd Freeman <freeman at andrews.edu>
+ * Changes Copyright (c) 2004 - 2006 Todd Freeman <freeman at andrews.edu>
*
* 95% based on HasNewVoicemail by:
*
@@ -178,10 +178,10 @@
return 0;
}
-static char *acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *argsstr, char *buf, size_t len)
{
struct localuser *u;
- char *argsstr, *context;
+ char *context;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(vmbox);
AST_APP_ARG(folder);
@@ -190,11 +190,6 @@
LOCAL_USER_ACF_ADD(u);
buf[0] = '\0';
-
- if (!(argsstr = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return buf;
- }
AST_STANDARD_APP_ARGS(args, argsstr);
@@ -213,7 +208,7 @@
LOCAL_USER_REMOVE(u);
- return buf;
+ return 0;
}
struct ast_custom_function acf_vmcount = {
Modified: team/rizzo/base/apps/app_morsecode.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_morsecode.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/apps/app_morsecode.c (original)
+++ team/rizzo/base/apps/app_morsecode.c Sun Feb 12 09:02:06 2006
@@ -49,14 +49,14 @@
static char *morsecode_descrip =
"Usage: Morsecode(<string>)\n"
-"Plays the Morse code equivalent of the passed string\n";
+"Plays the Morse code equivalent of the passed string. If the variable\n"
+"MORSEDITLEN is set, it will use that value for the length (in ms) of the dit\n"
+"(defaults to 80). Additionally, if MORSETONE is set, it will use that tone\n"
+"(in Hz). The tone default is 800.\n";
STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
-
-#define TONE 800
-#define DITLEN 80
static char *morsecode[] = {
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 0-15 */
@@ -105,16 +105,17 @@
static void playtone(struct ast_channel *chan, int tone, int len)
{
char dtmf[20];
- snprintf(dtmf, sizeof(dtmf), "%d/%d", tone, DITLEN * len);
+ snprintf(dtmf, sizeof(dtmf), "%d/%d", tone, len);
ast_playtones_start(chan, 0, dtmf, 0);
- ast_safe_sleep(chan, DITLEN * len);
+ ast_safe_sleep(chan, len);
ast_playtones_stop(chan);
}
static int morsecode_exec(struct ast_channel *chan, void *data)
{
- int res=0;
+ int res=0, ditlen, tone;
char *digit;
+ const char *ditlenc, *tonec;
struct localuser *u;
LOCAL_USER_ADD(u);
@@ -125,6 +126,18 @@
return 0;
}
+ /* Use variable MORESEDITLEN, if set (else 80) */
+ ditlenc = pbx_builtin_getvar_helper(chan, "MORSEDITLEN");
+ if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%d", &ditlen) != 1)) {
+ ditlen = 80;
+ }
+
+ /* Use variable MORSETONE, if set (else 800) */
+ tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
+ if (ast_strlen_zero(tonec) || (sscanf(tonec, "%d", &tone) != 1)) {
+ tone = 800;
+ }
+
for (digit = data; *digit; digit++) {
char *dahdit;
if (*digit < 0) {
@@ -132,19 +145,19 @@
}
for (dahdit = morsecode[(int)*digit]; *dahdit; dahdit++) {
if (*dahdit == '-') {
- playtone(chan, TONE, 3);
+ playtone(chan, tone, 3 * ditlen);
} else if (*dahdit == '.') {
- playtone(chan, TONE, 1);
+ playtone(chan, tone, 1 * ditlen);
} else {
/* Account for ditlen of silence immediately following */
- playtone(chan, 0, 2);
+ playtone(chan, 0, 2 * ditlen);
}
/* Pause slightly between each dit and dah */
- playtone(chan, 0, 1);
+ playtone(chan, 0, 1 * ditlen);
}
/* Pause between characters */
- playtone(chan, 0, 2);
+ playtone(chan, 0, 2 * ditlen);
}
LOCAL_USER_REMOVE(u);
Modified: team/rizzo/base/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_page.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/apps/app_page.c (original)
+++ team/rizzo/base/apps/app_page.c Sun Feb 12 09:02:06 2006
@@ -87,7 +87,7 @@
{
struct calloutdata *cd = data;
ast_pbx_outgoing_app(cd->tech, AST_FORMAT_SLINEAR, cd->resource, 30000,
- "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL);
+ "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL, NULL);
free(cd);
return NULL;
}
Modified: team/rizzo/base/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/apps/app_queue.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/apps/app_queue.c (original)
+++ team/rizzo/base/apps/app_queue.c Sun Feb 12 09:02:06 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -3093,19 +3093,18 @@
return res;
}
-static char *queue_function_qac(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
int count = 0;
struct ast_call_queue *q;
struct localuser *lu;
struct member *m;
-
- ast_copy_string(buf, "0", len);
+ buf[0] = '\0';
if (ast_strlen_zero(data)) {
ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
- return buf;
+ return -1;
}
LOCAL_USER_ACF_ADD(lu);
@@ -3134,10 +3133,10 @@
snprintf(buf, len, "%d", count);
LOCAL_USER_REMOVE(lu);
- return buf;
-}
-
-static char *queue_function_queuememberlist(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+ return 0;
+}
+
+static int queue_function_queuememberlist(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
struct localuser *u;
struct ast_call_queue *q;
@@ -3148,7 +3147,7 @@
if (ast_strlen_zero(data)) {
ast_log(LOG_ERROR, "QUEUE_MEMBER_LIST requires an argument: queuename\n");
- return buf;
+ return -1;
}
LOCAL_USER_ACF_ADD(u);
@@ -3187,7 +3186,7 @@
/* We should already be terminated, but let's make sure. */
buf[len - 1] = '\0';
LOCAL_USER_REMOVE(u);
- return buf;
+ return 0;
}
static struct ast_custom_function queueagentcount_function = {
Modified: team/rizzo/base/channel.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channel.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/channel.c (original)
+++ team/rizzo/base/channel.c Sun Feb 12 09:02:06 2006
@@ -2421,6 +2421,8 @@
ast_set_callerid(chan, oh->cid_num, oh->cid_name, oh->cid_num);
if (oh->parent_channel)
ast_channel_inherit_variables(oh->parent_channel, chan);
+ if (oh->account)
+ ast_cdr_setaccount(chan, oh->account);
}
ast_set_callerid(chan, cid_num, cid_name, cid_num);
Modified: team/rizzo/base/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/Makefile?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/channels/Makefile (original)
+++ team/rizzo/base/channels/Makefile Sun Feb 12 09:02:06 2006
@@ -235,15 +235,14 @@
misdn/chan_misdn_lib.a:
make -C misdn
-chan_misdn.so: chan_misdn.o chan_misdn_config.o misdn/chan_misdn_lib.a
+chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a
$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN
chan_misdn.o: chan_misdn.c
$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
-chan_misdn_config.o: chan_misdn_config.c misdn/chan_misdn_config.h
+misdn_config.o: misdn_config.c misdn/chan_misdn_config.h
$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
-
install: all
for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
Modified: team/rizzo/base/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_agent.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_agent.c (original)
+++ team/rizzo/base/channels/chan_agent.c Sun Feb 12 09:02:06 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -2406,7 +2406,7 @@
return cur;
}
-static char *function_agent(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int function_agent(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
char *parse;
AST_DECLARE_APP_ARGS(args,
@@ -2420,11 +2420,11 @@
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "The AGENT function requires an argument - agentid!\n");
- return buf;
+ return -1;
}
if (!(parse = ast_strdupa(data)))
- return buf;
+ return -1;
AST_NONSTANDARD_APP_ARGS(args, parse, ':');
if (!args.item)
@@ -2432,7 +2432,7 @@
if (!(agent = find_agent(args.agentid))) {
ast_log(LOG_WARNING, "Agent '%s' not found!\n", args.agentid);
- return buf;
+ return -1;
}
if (!strcasecmp(args.item, "status")) {
@@ -2458,7 +2458,7 @@
ast_copy_string(buf, agent->loginchan, len);
}
- return buf;
+ return 0;
}
struct ast_custom_function agent_function = {
Modified: team/rizzo/base/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_iax2.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_iax2.c (original)
+++ team/rizzo/base/channels/chan_iax2.c Sun Feb 12 09:02:06 2006
@@ -9145,31 +9145,29 @@
return -1;
}
-static char *function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
-{
- char *ret = NULL;
+static int function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
struct iax2_peer *peer;
char *peername, *colname;
char iabuf[INET_ADDRSTRLEN];
if (!(peername = ast_strdupa(data)))
- return ret;
+ return -1;
/* if our channel, return the IP address of the endpoint of current channel */
if (!strcmp(peername,"CURRENTCHANNEL")) {
unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
ast_copy_string(buf, iaxs[callno]->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr) : "", len);
- return buf;
- }
-
- if ((colname = strchr(peername, ':'))) {
- *colname = '\0';
- colname++;
- } else {
+ return 0;
+ }
+
+ if ((colname = strchr(peername, ':')))
+ *colname++ = '\0';
+ else
colname = "ip";
- }
+
if (!(peer = find_peer(peername, 1)))
- return ret;
+ return -1;
if (!strcasecmp(colname, "ip")) {
ast_copy_string(buf, peer->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), peer->addr.sin_addr) : "", len);
@@ -9204,16 +9202,15 @@
ast_copy_string(buf, ast_getformatname(codec), len);
}
}
- ret = buf;
-
- return ret;
+
+ return 0;
}
struct ast_custom_function iaxpeer_function = {
- .name = "IAXPEER",
- .synopsis = "Gets IAX peer information",
- .syntax = "IAXPEER(<peername|CURRENTCHANNEL>[:item])",
- .read = function_iaxpeer,
+ .name = "IAXPEER",
+ .synopsis = "Gets IAX peer information",
+ .syntax = "IAXPEER(<peername|CURRENTCHANNEL>[:item])",
+ .read = function_iaxpeer,
.desc = "If peername specified, valid items are:\n"
"- ip (default) The IP address.\n"
"- status The peer's status (if qualify=yes)\n"
@@ -9459,6 +9456,7 @@
ast_channel_unregister(&iax2_tech);
delete_users();
iax_provision_unload();
+ sched_context_destroy(sched);
return 0;
}
Modified: team/rizzo/base/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_mgcp.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_mgcp.c (original)
+++ team/rizzo/base/channels/chan_mgcp.c Sun Feb 12 09:02:06 2006
@@ -4450,6 +4450,7 @@
ast_cli_unregister(&cli_debug);
ast_cli_unregister(&cli_no_debug);
ast_cli_unregister(&cli_mgcp_reload);
+ sched_context_destroy(sched);
return 0;
}
Modified: team/rizzo/base/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/channels/chan_sip.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/channels/chan_sip.c (original)
+++ team/rizzo/base/channels/chan_sip.c Sun Feb 12 09:02:06 2006
@@ -9021,21 +9021,21 @@
/*! \brief func_header_read: Read SIP header (dialplan function) */
-static char *func_header_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+int func_header_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len)
{
struct sip_pvt *p;
const char *content;
if (!data) {
ast_log(LOG_WARNING, "This function requires a header name.\n");
- return NULL;
+ return -1;
}
ast_mutex_lock(&chan->lock);
if (chan->tech != &sip_tech) {
ast_log(LOG_WARNING, "This function can only be used on SIP channels.\n");
ast_mutex_unlock(&chan->lock);
- return NULL;
+ return -1;
}
p = chan->tech_pvt;
@@ -9043,22 +9043,21 @@
/* If there is no private structure, this channel is no longer alive */
if (!p) {
ast_mutex_unlock(&chan->lock);
- return NULL;
+ return -1;
}
content = get_header(&p->initreq, data);
if (ast_strlen_zero(content)) {
ast_mutex_unlock(&chan->lock);
- return NULL;
+ return -1;
}
ast_copy_string(buf, content, len);
ast_mutex_unlock(&chan->lock);
- return buf;
-}
-
+ return 0;
+}
static struct ast_custom_function sip_header_function = {
.name = "SIP_HEADER",
@@ -9068,17 +9067,17 @@
};
/*! \brief function_check_sipdomain: Dial plan function to check if domain is local */
-static char *func_check_sipdomain(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+int func_check_sipdomain(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "CHECKSIPDOMAIN requires an argument - A domain name\n");
- return buf;
+ return -1;
}
if (check_sip_domain(data, NULL, 0))
ast_copy_string(buf, data, len);
else
buf[0] = '\0';
- return buf;
+ return 0;
}
static struct ast_custom_function checksipdomain_function = {
@@ -9092,26 +9091,20 @@
"Check the domain= configuration in sip.conf\n",
};
-
/*! \brief function_sippeer: ${SIPPEER()} Dialplan function - reads peer data */
-static char *function_sippeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
-{
- char *ret = NULL;
+static int function_sippeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
struct sip_peer *peer;
- char *peername, *colname;
+ char *colname;
char iabuf[INET_ADDRSTRLEN];
- if (!(peername = ast_strdupa(data)))
- return ret;
-
- if ((colname = strchr(peername, ':'))) {
- *colname = '\0';
- colname++;
- } else {
+ if ((colname = strchr(data, ':')))
+ *colname++ = '\0';
+ else
colname = "ip";
- }
- if (!(peer = find_peer(peername, NULL, 1)))
- return ret;
+
+ if (!(peer = find_peer(data, NULL, 1)))
+ return -1;
if (!strcasecmp(colname, "ip")) {
ast_copy_string(buf, peer->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), peer->addr.sin_addr) : "", len);
@@ -9148,19 +9141,18 @@
codecnum = strchr(colname, '[');
*codecnum = '\0';
codecnum++;
- if ((ptr = strchr(codecnum, ']'))) {
+ if ((ptr = strchr(codecnum, ']')))
*ptr = '\0';
- }
+
index = atoi(codecnum);
if((codec = ast_codec_pref_index(&peer->prefs, index))) {
ast_copy_string(buf, ast_getformatname(codec), len);
}
}
- ret = buf;
ASTOBJ_UNREF(peer, sip_destroy_peer);
- return ret;
+ return 0;
}
/*! \brief Structure to declare a dialplan function: SIPPEER */
@@ -9190,7 +9182,7 @@
};
/*! \brief function_sipchaninfo_read: ${SIPCHANINFO()} Dialplan function - reads sip channel data */
-static char *function_sipchaninfo_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+int function_sipchaninfo_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
struct sip_pvt *p;
char iabuf[INET_ADDRSTRLEN];
@@ -9199,14 +9191,14 @@
if (!data) {
ast_log(LOG_WARNING, "This function requires a parameter name.\n");
- return NULL;
+ return -1;
}
ast_mutex_lock(&chan->lock);
if (chan->tech != &sip_tech) {
ast_log(LOG_WARNING, "This function can only be used on SIP channels.\n");
ast_mutex_unlock(&chan->lock);
- return NULL;
+ return -1;
}
/* ast_verbose("function_sipchaninfo_read: %s\n", data); */
@@ -9215,7 +9207,7 @@
/* If there is no private structure, this channel is no longer alive */
if (!p) {
ast_mutex_unlock(&chan->lock);
- return NULL;
+ return -1;
}
if (!strcasecmp(data, "peerip")) {
@@ -9232,11 +9224,11 @@
ast_copy_string(buf, p->peername, len);
} else {
ast_mutex_unlock(&chan->lock);
- return NULL;
+ return -1;
}
ast_mutex_unlock(&chan->lock);
- return buf;
+ return 0;
}
/*! \brief Structure to declare a dialplan function: SIPCHANINFO */
@@ -9253,8 +9245,6 @@
"- useragent The useragent.\n"
"- peername The name of the peer.\n"
};
-
-
/*! \brief parse_moved_contact: Parse 302 Moved temporalily response */
static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
@@ -13003,6 +12993,7 @@
clear_realm_authentication(authl);
clear_sip_domains();
close(sipsock);
+ sched_context_destroy(sched);
return 0;
}
Modified: team/rizzo/base/codecs/Makefile
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/codecs/Makefile?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/codecs/Makefile (original)
+++ team/rizzo/base/codecs/Makefile Sun Feb 12 09:02:06 2006
@@ -33,7 +33,7 @@
endif
SPEEX_PATH:=/usr/local/include /usr/include /usr/include/speex /usr/local/include/speex
-SPEEX_SYSTEM_HEADERS:=$(wildcard $(SPEEX_PATH:%=$(CROSS_COMPILE_TARGET)%/speex.h))
+SPEEX_SYSTEM_HEADERS:=$(firstword $(wildcard $(SPEEX_PATH:%=$(CROSS_COMPILE_TARGET)%/speex.h)))
ifeq (${SPEEX_SYSTEM_HEADERS},)
MODS:=$(filter-out codec_speex.so,$(MODS))
else
@@ -48,7 +48,7 @@
endif
LIBGSM_PATH:=/usr/local/include /usr/include
-LIBGSM_SYSTEM_HEADERS:=$(wildcard $(LIBGSM_PATH:%=$(CROSS_COMPILE_TARGET)%/gsm/gsm.h))
+LIBGSM_SYSTEM_HEADERS:=$(firstword $(wildcard $(LIBGSM_PATH:%=$(CROSS_COMPILE_TARGET)%/gsm/gsm.h)))
ifneq ($(LIBGSM_SYSTEM_HEADERS),)
LIBGSM=-lgsm
LIBGSMT=
Modified: team/rizzo/base/doc/CODING-GUIDELINES
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/doc/CODING-GUIDELINES?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/doc/CODING-GUIDELINES (original)
+++ team/rizzo/base/doc/CODING-GUIDELINES Sun Feb 12 09:02:06 2006
@@ -77,7 +77,7 @@
Roughly, Asterisk code formatting guidelines are generally equivalent to the
following:
-# indent -i4 -ts4 -br -brs -cdw -cli0 -ce -nbfda -npcs -nprs -npsl -saf -sai -saw foo.c
+# indent -i4 -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -ln90 foo.c
this means in verbose:
-i4: indent level 4
@@ -85,7 +85,7 @@
-br: braces on if line
-brs: braces on struct decl line
-cdw: cuddle do while
- -cli0: case indentation 0
+ -lp: line up continuation below parenthesis
-ce: cuddle else
-nbfda: dont break function decl args
-npcs: no space after function call names
@@ -94,6 +94,8 @@
-saf: space after for
-sai: space after if
-saw: space after while
+ -cs: space after cast
+ -ln90: line length 90 columns
Function calls and arguments should be spaced in a consistent way across
the codebase.
Modified: team/rizzo/base/formats/format_g723.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/formats/format_g723.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/formats/format_g723.c (original)
+++ team/rizzo/base/formats/format_g723.c Sun Feb 12 09:02:06 2006
@@ -44,9 +44,6 @@
#include "asterisk/logger.h"
#include "asterisk/sched.h"
#include "asterisk/module.h"
-
-#include "../channels/adtranvofr.h"
-
#define G723_MAX_SIZE 1024
Modified: team/rizzo/base/formats/format_ogg_vorbis.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/formats/format_ogg_vorbis.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/formats/format_ogg_vorbis.c (original)
+++ team/rizzo/base/formats/format_ogg_vorbis.c Sun Feb 12 09:02:06 2006
@@ -20,7 +20,7 @@
* \arg File name extension: ogg
* \ingroup formats
*/
-
+
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -48,32 +48,31 @@
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
-
#define SAMPLES_MAX 160
#define BLOCK_SIZE 4096
-
struct vorbis_desc {
/* structures for handling the Ogg container */
- ogg_sync_state oy;
+ ogg_sync_state oy;
ogg_stream_state os;
- ogg_page og;
- ogg_packet op;
+ ogg_page og;
+ ogg_packet op;
/* structures for handling Vorbis audio data */
- vorbis_info vi;
- vorbis_comment vc;
+ vorbis_info vi;
+ vorbis_comment vc;
vorbis_dsp_state vd;
- vorbis_block vb;
+ vorbis_block vb;
/*! \brief Indicates whether this filestream is set up for reading or writing. */
int writing;
-
+
/*! \brief Indicates whether an End of Stream condition has been detected. */
int eos;
};
AST_MUTEX_DEFINE_STATIC(ogg_vorbis_lock);
+
static int glistcnt = 0;
static char *name = "ogg_vorbis";
@@ -210,7 +209,8 @@
* \param comment Comment that should be embedded in the OGG/Vorbis file.
* \return A new filestream.
*/
-static struct ast_filestream *ogg_vorbis_rewrite(FILE *f, const char *comment)
+static struct ast_filestream *ogg_vorbis_rewrite(FILE * f,
+ const char *comment)
{
ogg_packet header;
ogg_packet header_comm;
@@ -218,7 +218,7 @@
struct ast_filestream *tmp;
- if((tmp = malloc(sizeof(struct ast_filestream)))) {
+ if ((tmp = malloc(sizeof(struct ast_filestream)))) {
memset(tmp, 0, sizeof(struct ast_filestream));
tmp->writing = 1;
@@ -226,7 +226,7 @@
vorbis_info_init(&tmp->vi);
- if(vorbis_encode_init_vbr(&tmp->vi, 1, 8000, 0.4)) {
+ if (vorbis_encode_init_vbr(&tmp->vi, 1, 8000, 0.4)) {
ast_log(LOG_ERROR, "Unable to initialize Vorbis encoder!\n");
free(tmp);
return NULL;
@@ -234,7 +234,7 @@
vorbis_comment_init(&tmp->vc);
vorbis_comment_add_tag(&tmp->vc, "ENCODER", "Asterisk PBX");
- if(comment)
+ if (comment)
vorbis_comment_add_tag(&tmp->vc, "COMMENT", (char *) comment);
vorbis_analysis_init(&tmp->vd, &tmp->vi);
@@ -242,21 +242,22 @@
ogg_stream_init(&tmp->os, rand());
- vorbis_analysis_headerout(&tmp->vd, &tmp->vc, &header, &header_comm, &header_code);
- ogg_stream_packetin(&tmp->os, &header);
+ vorbis_analysis_headerout(&tmp->vd, &tmp->vc, &header, &header_comm,
+ &header_code);
+ ogg_stream_packetin(&tmp->os, &header);
ogg_stream_packetin(&tmp->os, &header_comm);
ogg_stream_packetin(&tmp->os, &header_code);
- while(!tmp->eos) {
- if(ogg_stream_flush(&tmp->os, &tmp->og) == 0)
+ while (!tmp->eos) {
+ if (ogg_stream_flush(&tmp->os, &tmp->og) == 0)
break;
fwrite(tmp->og.header, 1, tmp->og.header_len, tmp->f);
fwrite(tmp->og.body, 1, tmp->og.body_len, tmp->f);
- if(ogg_page_eos(&tmp->og))
+ if (ogg_page_eos(&tmp->og))
tmp->eos = 1;
}
- if(ast_mutex_lock(&ogg_vorbis_lock)) {
+ if (ast_mutex_lock(&ogg_vorbis_lock)) {
ast_log(LOG_WARNING, "Unable to lock ogg_vorbis list\n");
fclose(f);
ogg_stream_clear(&tmp->os);
@@ -283,16 +284,16 @@
while (vorbis_analysis_blockout(&s->vd, &s->vb) == 1) {
vorbis_analysis(&s->vb, NULL);
vorbis_bitrate_addblock(&s->vb);
-
+
while (vorbis_bitrate_flushpacket(&s->vd, &s->op)) {
ogg_stream_packetin(&s->os, &s->op);
while (!s->eos) {
- if(ogg_stream_pageout(&s->os, &s->og) == 0) {
+ if (ogg_stream_pageout(&s->os, &s->og) == 0) {
break;
}
fwrite(s->og.header, 1, s->og.header_len, s->f);
fwrite(s->og.body, 1, s->og.body_len, s->f);
- if(ogg_page_eos(&s->og)) {
+ if (ogg_page_eos(&s->og)) {
s->eos = 1;
}
}
@@ -312,20 +313,21 @@
float **buffer;
short *data;
- if(!s->writing) {
+ if (!s->writing) {
ast_log(LOG_ERROR, "This stream is not set up for writing!\n");
return -1;
}
- if(f->frametype != AST_FRAME_VOICE) {
+ if (f->frametype != AST_FRAME_VOICE) {
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
return -1;
}
- if(f->subclass != AST_FORMAT_SLINEAR) {
- ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%d)!\n", f->subclass);
+ if (f->subclass != AST_FORMAT_SLINEAR) {
+ ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%d)!\n",
+ f->subclass);
return -1;
}
- if(!f->datalen)
+ if (!f->datalen)
return -1;
data = (short *) f->data;
@@ -333,7 +335,7 @@
buffer = vorbis_analysis_buffer(&s->vd, f->samples);
for (i = 0; i < f->samples; i++) {
- buffer[0][i] = data[i]/32768.f;
+ buffer[0][i] = data[i] / 32768.f;
}
vorbis_analysis_wrote(&s->vd, f->samples);
@@ -349,7 +351,7 @@
*/
static void ogg_vorbis_close(struct ast_filestream *s)
{
- if(ast_mutex_lock(&ogg_vorbis_lock)) {
+ if (ast_mutex_lock(&ogg_vorbis_lock)) {
ast_log(LOG_WARNING, "Unable to lock ogg_vorbis list\n");
return;
}
@@ -357,7 +359,7 @@
ast_mutex_unlock(&ogg_vorbis_lock);
ast_update_use_count();
- if(s->writing) {
+ if (s->writing) {
/* Tell the Vorbis encoder that the stream is finished
* and write out the rest of the data */
vorbis_analysis_wrote(&s->vd, 0);
@@ -370,7 +372,7 @@
vorbis_comment_clear(&s->vc);
vorbis_info_clear(&s->vi);
- if(s->writing) {
+ if (s->writing) {
ogg_sync_clear(&s->oy);
}
}
@@ -390,28 +392,29 @@
while (1) {
samples_in = vorbis_synthesis_pcmout(&s->vd, pcm);
- if(samples_in > 0) {
+ if (samples_in > 0) {
return samples_in;
}
-
+
/* The Vorbis decoder needs more data... */
/* See ifOGG has any packets in the current page for the Vorbis decoder. */
result = ogg_stream_packetout(&s->os, &s->op);
- if(result > 0) {
+ if (result > 0) {
/* Yes OGG had some more packets for the Vorbis decoder. */
- if(vorbis_synthesis(&s->vb, &s->op) == 0) {
+ if (vorbis_synthesis(&s->vb, &s->op) == 0) {
vorbis_synthesis_blockin(&s->vd, &s->vb);
}
-
+
continue;
}
- if(result < 0)
- ast_log(LOG_WARNING, "Corrupt or missing data at this page position; continuing...\n");
-
+ if (result < 0)
+ ast_log(LOG_WARNING,
+ "Corrupt or missing data at this page position; continuing...\n");
+
/* No more packets left in the current page... */
- if(s->eos) {
+ if (s->eos) {
/* No more pages left in the stream */
return -1;
}
@@ -419,22 +422,24 @@
while (!s->eos) {
/* See ifOGG has any pages in it's internal buffers */
result = ogg_sync_pageout(&s->oy, &s->og);
- if(result > 0) {
+ if (result > 0) {
/* Yes, OGG has more pages in it's internal buffers,
add the page to the stream state */
result = ogg_stream_pagein(&s->os, &s->og);
- if(result == 0) {
+ if (result == 0) {
/* Yes, got a new,valid page */
- if(ogg_page_eos(&s->og)) {
+ if (ogg_page_eos(&s->og)) {
s->eos = 1;
}
break;
}
- ast_log(LOG_WARNING, "Invalid page in the bitstream; continuing...\n");
- }
-
- if(result < 0)
- ast_log(LOG_WARNING, "Corrupt or missing data in bitstream; continuing...\n");
+ ast_log(LOG_WARNING,
+ "Invalid page in the bitstream; continuing...\n");
+ }
+
+ if (result < 0)
+ ast_log(LOG_WARNING,
+ "Corrupt or missing data in bitstream; continuing...\n");
/* No, we need to read more data from the file descrptor */
/* get a buffer from OGG to read the data into */
@@ -443,7 +448,7 @@
bytes = fread(buffer, 1, BLOCK_SIZE, s->f);
/* Tell OGG how many bytes we actually read into the buffer */
ogg_sync_wrote(&s->oy, bytes);
- if(bytes == 0) {
+ if (bytes == 0) {
s->eos = 1;
}
}
@@ -456,7 +461,8 @@
* \param whennext Number of sample times to schedule the next call.
* \return A pointer to a frame containing audio data or NULL ifthere is no more audio data.
*/
-static struct ast_frame *ogg_vorbis_read(struct ast_filestream *s, int *whennext)
+static struct ast_frame *ogg_vorbis_read(struct ast_filestream *s,
+ int *whennext)
{
int clipflag = 0;
int i;
@@ -470,25 +476,25 @@
while (1) {
/* See ifwe have filled up an audio frame yet */
- if(samples_out == SAMPLES_MAX)
+ if (samples_out == SAMPLES_MAX)
break;
/* See ifVorbis decoder has some audio data for us ... */
samples_in = read_samples(s, &pcm);
- if(samples_in <= 0)
+ if (samples_in <= 0)
break;
/* Got some audio data from Vorbis... */
/* Convert the float audio data to 16-bit signed linear */
-
+
clipflag = 0;
samples_in = samples_in < (SAMPLES_MAX - samples_out) ? samples_in : (SAMPLES_MAX - samples_out);
-
- for(j = 0; j < samples_in; j++)
+
+ for (j = 0; j < samples_in; j++)
accumulator[j] = 0.0;
- for(i = 0; i < s->vi.channels; i++) {
+ for (i = 0; i < s->vi.channels; i++) {
mono = pcm[i];
for (j = 0; j < samples_in; j++) {
accumulator[j] += mono[j];
@@ -496,27 +502,26 @@
}
for (j = 0; j < samples_in; j++) {
- val = accumulator[j] * 32767.0 / s->vi.channels;
- if(val > 32767) {
+ val = accumulator[j] * 32767.0 / s->vi.channels;
+ if (val > 32767) {
val = 32767;
clipflag = 1;
}
- if(val < -32768) {
+ if (val < -32768) {
val = -32768;
clipflag = 1;
}
s->buffer[samples_out + j] = val;
}
-
- if(clipflag)
- ast_log(LOG_WARNING, "Clipping in frame %ld\n", (long)(s->vd.sequence));
-
+
+ if (clipflag)
+ ast_log(LOG_WARNING, "Clipping in frame %ld\n", (long) (s->vd.sequence));
/* Tell the Vorbis decoder how many samples we actually used. */
vorbis_synthesis_read(&s->vd, samples_in);
samples_out += samples_in;
}
- if(samples_out > 0) {
+ if (samples_out > 0) {
s->fr.frametype = AST_FRAME_VOICE;
s->fr.subclass = AST_FORMAT_SLINEAR;
s->fr.offset = AST_FRIENDLY_OFFSET;
@@ -526,7 +531,7 @@
s->fr.mallocd = 0;
s->fr.samples = samples_out;
*whennext = samples_out;
-
+
return &s->fr;
} else {
return NULL;
@@ -553,17 +558,21 @@
* \return 0 on success, -1 on failure.
*/
-static int ogg_vorbis_seek(struct ast_filestream *s, long sample_offset, int whence) {
+static int ogg_vorbis_seek(struct ast_filestream *s, long sample_offset,
+ int whence)
+{
ast_log(LOG_WARNING, "Seeking is not supported on OGG/Vorbis streams!\n");
return -1;
}
-static long ogg_vorbis_tell(struct ast_filestream *s) {
+static long ogg_vorbis_tell(struct ast_filestream *s)
+{
ast_log(LOG_WARNING, "Telling is not supported on OGG/Vorbis streams!\n");
return -1;
}
-static char *ogg_vorbis_getcomment(struct ast_filestream *s) {
+static char *ogg_vorbis_getcomment(struct ast_filestream *s)
+{
ast_log(LOG_WARNING, "Getting comments is not supported on OGG/Vorbis streams!\n");
return NULL;
}
@@ -595,7 +604,7 @@
int unload_module()
{
return ast_format_unregister(name);
-}
+}
int usecount()
{
@@ -612,11 +621,3 @@
{
return ASTERISK_GPL_KEY;
}
-
-/*
-Local Variables:
-mode: C
-c-file-style: "linux"
-indent-tabs-mode: t
-End:
-*/
Modified: team/rizzo/base/funcs/func_base64.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/funcs/func_base64.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/funcs/func_base64.c (original)
+++ team/rizzo/base/funcs/func_base64.c Sun Feb 12 09:02:06 2006
@@ -36,31 +36,30 @@
#include "asterisk/utils.h"
#include "asterisk/app.h"
-static char *base64_encode(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int base64_encode(struct ast_channel *chan, char *cmd, char *data,
+ char *buf, size_t len)
{
- int res = 0;
-
- if (ast_strlen_zero(data) ) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Syntax: BASE64_ENCODE(<data>) - missing argument!\n");
- return NULL;
+ return -1;
}
- ast_log(LOG_DEBUG, "data=%s\n",data);
- res = ast_base64encode(buf, (unsigned char *)data, strlen(data), len);
- ast_log(LOG_DEBUG, "res=%d\n", res);
- return buf;
+ ast_base64encode(buf, (unsigned char *) data, strlen(data), len);
+
+ return 0;
}
-static char *base64_decode(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int base64_decode(struct ast_channel *chan, char *cmd, char *data,
+ char *buf, size_t len)
{
- if (ast_strlen_zero(data) ) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Syntax: BASE64_DECODE(<base_64 string>) - missing argument!\n");
- return NULL;
+ return -1;
}
- ast_log(LOG_DEBUG, "data=%s\n", data);
- ast_base64decode((unsigned char *)buf, data, len);
- return buf;
+ ast_base64decode((unsigned char *) buf, data, len);
+
+ return 0;
}
static struct ast_custom_function base64_encode_function = {
@@ -83,13 +82,13 @@
int unload_module(void)
{
- return ast_custom_function_unregister(&base64_encode_function) ||
+ return ast_custom_function_unregister(&base64_encode_function) |
ast_custom_function_unregister(&base64_decode_function);
}
int load_module(void)
{
- return ast_custom_function_register(&base64_encode_function) ||
+ return ast_custom_function_register(&base64_encode_function) |
ast_custom_function_register(&base64_decode_function);
}
@@ -107,11 +106,3 @@
{
return ASTERISK_GPL_KEY;
}
-
-/*
-Local Variables:
-mode: C
-c-file-style: "linux"
-indent-tabs-mode: nil
-End:
-*/
Modified: team/rizzo/base/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/base/funcs/func_callerid.c?rev=9688&r1=9687&r2=9688&view=diff
==============================================================================
--- team/rizzo/base/funcs/func_callerid.c (original)
+++ team/rizzo/base/funcs/func_callerid.c Sun Feb 12 09:02:06 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999-2006, Digium, Inc.
*
[... 3840 lines stripped ...]
More information about the asterisk-commits
mailing list