[asterisk-commits] branch oej/sdpcleanup r29015 - in
/team/oej/sdpcleanup: ./ apps/ channels/ fu...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat May 20 04:58:29 MST 2006
Author: oej
Date: Sat May 20 06:58:28 2006
New Revision: 29015
URL: http://svn.digium.com/view/asterisk?rev=29015&view=rev
Log:
Reset non-existing conflict
Modified:
team/oej/sdpcleanup/ (props changed)
team/oej/sdpcleanup/apps/app_channelredirect.c
team/oej/sdpcleanup/apps/app_dial.c
team/oej/sdpcleanup/apps/app_voicemail.c
team/oej/sdpcleanup/channel.c
team/oej/sdpcleanup/channels/chan_sip.c
team/oej/sdpcleanup/channels/chan_zap.c
team/oej/sdpcleanup/funcs/func_odbc.c
team/oej/sdpcleanup/include/asterisk/frame.h
team/oej/sdpcleanup/include/asterisk/rtp.h
team/oej/sdpcleanup/rtp.c
Propchange: team/oej/sdpcleanup/
------------------------------------------------------------------------------
automerge = http://edvina.net/training/
Propchange: team/oej/sdpcleanup/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/oej/sdpcleanup/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/sdpcleanup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat May 20 06:58:28 2006
@@ -1,1 +1,1 @@
-/trunk:1-27461
+/trunk:1-27721
Modified: team/oej/sdpcleanup/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/apps/app_channelredirect.c?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/apps/app_channelredirect.c (original)
+++ team/oej/sdpcleanup/apps/app_channelredirect.c Sat May 20 06:58:28 2006
@@ -40,6 +40,7 @@
#include "asterisk/lock.h"
#include "asterisk/app.h"
#include "asterisk/features.h"
+#include "asterisk/options.h"
static char *app = "ChannelRedirect";
static char *synopsis = "Redirects given channel to a dialplan target.";
Modified: team/oej/sdpcleanup/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/apps/app_dial.c?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/apps/app_dial.c (original)
+++ team/oej/sdpcleanup/apps/app_dial.c Sat May 20 06:58:28 2006
@@ -472,6 +472,8 @@
c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
if (!c)
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
+ else
+ ast_channel_inherit_variables(in, o->chan);
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", c->name);
@@ -1051,6 +1053,8 @@
tmp->chan = ast_request(tech, chan->nativeformats, stuff, &cause);
if (!tmp->chan)
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
+ else
+ ast_channel_inherit_variables(chan, tmp->chan);
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", tmp->chan->name);
Modified: team/oej/sdpcleanup/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/apps/app_voicemail.c?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/apps/app_voicemail.c (original)
+++ team/oej/sdpcleanup/apps/app_voicemail.c Sat May 20 06:58:28 2006
@@ -2413,17 +2413,17 @@
static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
{
- char tmptxtfile[256], txtfile[256];
+ char txtfile[256], tmptxtfile[256];
char callerid[256];
FILE *txt;
- int res = 0;
+ int res = 0, txtdes;
int msgnum;
int duration = 0;
int ausemacro = 0;
int ousemacro = 0;
int ouseexten = 0;
char date[256];
- char dir[256];
+ char dir[256], tmpdir[260];
char fn[256];
char prefile[256]="";
char tempfile[256]="";
@@ -2475,6 +2475,7 @@
DISPOSE(tempfile, -1);
/* It's easier just to try to make it than to check for its existence */
create_dirpath(dir, sizeof(dir), vmu->context, ext, "INBOX");
+ create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, ext, "tmp");
/* Check current or macro-calling context for special extensions */
if (ast_test_flag(vmu, VM_OPERATOR)) {
@@ -2579,121 +2580,129 @@
if (!ast_strlen_zero(fmt)) {
msgnum = 0;
- if (vm_lock_path(dir)) {
- free_user(vmu);
- return ERROR_LOCK_PATH;
- }
-
- /*
- * This operation can be very expensive if done say over NFS or if the mailbox has 100+ messages
- * in the folder. So we should get this first so we don't cut off the first few seconds of the
- * message.
- */
- do {
- make_file(fn, sizeof(fn), dir, msgnum);
- if (!EXISTS(dir,msgnum,fn,chan->language))
- break;
- msgnum++;
- } while (msgnum < vmu->maxmsg);
+ if (count_messages(vmu, dir) >= vmu->maxmsg) {
+ res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
+ if (!res)
+ res = ast_waitstream(chan, "");
+ ast_log(LOG_WARNING, "No more messages possible\n");
+ pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+ goto leave_vm_out;
+ }
+
+ snprintf(tmptxtfile, sizeof(tmptxtfile), "%s/XXXXXX", tmpdir);
+ txtdes = mkstemp(tmptxtfile);
+ if (txtdes < 0) {
+ res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
+ if (!res)
+ res = ast_waitstream(chan, "");
+ ast_log(LOG_ERROR, "Unable to create message file: %s\n", strerror(errno));
+ pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+ goto leave_vm_out;
+ }
/* Now play the beep once we have the message number for our next message. */
if (res >= 0) {
/* Unless we're *really* silent, try to send the beep */
res = ast_stream_and_wait(chan, "beep", chan->language, "");
}
- if (msgnum < vmu->maxmsg) {
- /* assign a variable with the name of the voicemail file */
- pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", fn);
-
- /* Store information */
- snprintf(txtfile, sizeof(txtfile), "%s.txt", fn);
- snprintf(tmptxtfile, sizeof(tmptxtfile), "%s.txt.tmp", fn);
- txt = fopen(tmptxtfile, "w+");
- if (txt) {
- get_date(date, sizeof(date));
- fprintf(txt,
- ";\n"
- "; Message Information file\n"
- ";\n"
- "[message]\n"
- "origmailbox=%s\n"
- "context=%s\n"
- "macrocontext=%s\n"
- "exten=%s\n"
- "priority=%d\n"
- "callerchan=%s\n"
- "callerid=%s\n"
- "origdate=%s\n"
- "origtime=%ld\n"
- "category=%s\n",
- ext,
- chan->context,
- chan->macrocontext,
- chan->exten,
- chan->priority,
- chan->name,
- ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
- date, (long)time(NULL),
- category ? category : "");
- } else
- ast_log(LOG_WARNING, "Error opening text file for output\n");
- res = play_record_review(chan, NULL, fn, vmmaxmessage, fmt, 1, vmu, &duration, dir, options->record_gain);
- if (res == '0') {
- if (txt && EXISTS(dir,msgnum,fn,chan->language)) {
- fclose(txt);
- rename(tmptxtfile, txtfile);
- } else if (txt && !EXISTS(dir,msgnum,fn,chan->language)) {
- if (option_debug)
- ast_log(LOG_DEBUG, "The recorded media file is gone, so we should remove the .txt file too!\n");
- fclose(txt);
- unlink(tmptxtfile);
- }
- goto transfer;
- }
- if (res > 0)
- res = 0;
- if (txt) {
- fprintf(txt, "duration=%d\n", duration);
- fclose(txt);
- rename(tmptxtfile, txtfile);
- }
-
+
+ /* Store information */
+ txt = fdopen(txtdes, "w+");
+ if (txt) {
+ get_date(date, sizeof(date));
+ fprintf(txt,
+ ";\n"
+ "; Message Information file\n"
+ ";\n"
+ "[message]\n"
+ "origmailbox=%s\n"
+ "context=%s\n"
+ "macrocontext=%s\n"
+ "exten=%s\n"
+ "priority=%d\n"
+ "callerchan=%s\n"
+ "callerid=%s\n"
+ "origdate=%s\n"
+ "origtime=%ld\n"
+ "category=%s\n",
+ ext,
+ chan->context,
+ chan->macrocontext,
+ chan->exten,
+ chan->priority,
+ chan->name,
+ ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
+ date, (long)time(NULL),
+ category ? category : "");
+ } else
+ ast_log(LOG_WARNING, "Error opening text file for output\n");
+ res = play_record_review(chan, NULL, tmptxtfile, vmmaxmessage, fmt, 1, vmu, &duration, NULL, options->record_gain);
+
+ if (txt) {
if (duration < vmminmessage) {
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminmessage);
DELETE(dir,msgnum,fn);
- /* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
- pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
- goto leave_vm_out;
- }
- /* Are there to be more recipients of this message? */
- while (tmpptr) {
- struct ast_vm_user recipu, *recip;
- char *exten, *context;
-
- exten = strsep(&tmpptr, "&");
- context = strchr(exten, '@');
- if (context) {
- *context = '\0';
- context++;
+ } else {
+ fprintf(txt, "duration=%d\n", duration);
+ fclose(txt);
+ if (vm_lock_path(dir)) {
+ ast_log(LOG_ERROR, "Couldn't lock directory %s. Voicemail will be lost.\n", dir);
+ /* Delete files */
+ ast_filedelete(tmptxtfile, NULL);
+ unlink(tmptxtfile);
+ } else {
+ for (;;) {
+ make_file(fn, sizeof(fn), dir, msgnum);
+ if (!EXISTS(dir, msgnum, fn, NULL))
+ break;
+ msgnum++;
+ }
+
+ /* assign a variable with the name of the voicemail file */
+ pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", fn);
+
+ snprintf(txtfile, sizeof(txtfile), "%s.txt", fn);
+ ast_filerename(tmptxtfile, fn, NULL);
+ rename(tmptxtfile, txtfile);
+
+ ast_unlock_path(dir);
+
+ /* Are there to be more recipients of this message? */
+ while (tmpptr) {
+ struct ast_vm_user recipu, *recip;
+ char *exten, *context;
+
+ exten = strsep(&tmpptr, "&");
+ context = strchr(exten, '@');
+ if (context) {
+ *context = '\0';
+ context++;
+ }
+ if ((recip = find_user(&recipu, context, exten))) {
+ copy_message(chan, vmu, 0, msgnum, duration, recip, fmt);
+ free_user(recip);
+ }
+ }
+ if (ast_fileexists(fn, NULL, NULL)) {
+ STORE(dir, vmu->mailbox, vmu->context, msgnum);
+ notify_new_message(chan, vmu, msgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
+ DISPOSE(dir, msgnum);
+ }
}
- if ((recip = find_user(&recipu, context, exten))) {
- copy_message(chan, vmu, 0, msgnum, duration, recip, fmt);
- free_user(recip);
- }
- }
- if (ast_fileexists(fn, NULL, NULL)) {
- STORE(dir, vmu->mailbox, vmu->context, msgnum);
- notify_new_message(chan, vmu, msgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
- DISPOSE(dir, msgnum);
- }
+ }
+ }
+
+ if (res == '0') {
+ goto transfer;
+ } else if (res > 0)
+ res = 0;
+
+ if (duration < vmminmessage)
+ /* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
+ pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+ else
pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
- } else {
- ast_unlock_path(dir);
- res = ast_stream_and_wait(chan, "vm-mailboxfull", chan->language, "");
- ast_log(LOG_WARNING, "No more messages possible\n");
- pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
- }
} else
ast_log(LOG_WARNING, "No format for saving voicemail?\n");
leave_vm_out:
Modified: team/oej/sdpcleanup/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/channel.c?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/channel.c (original)
+++ team/oej/sdpcleanup/channel.c Sat May 20 06:58:28 2006
@@ -1955,9 +1955,11 @@
if (f->subclass == AST_CONTROL_ANSWER) {
if (!ast_test_flag(chan, AST_FLAG_OUTGOING)) {
ast_log(LOG_DEBUG, "Ignoring answer on an inbound call!\n");
+ ast_frfree(f);
f = &ast_null_frame;
} else if (prestate == AST_STATE_UP) {
ast_log(LOG_DEBUG, "Dropping duplicate answer!\n");
+ ast_frfree(f);
f = &ast_null_frame;
} else {
/* Answer the CDR */
@@ -1973,6 +1975,7 @@
chan->dtmfq[strlen(chan->dtmfq)] = f->subclass;
else
ast_log(LOG_WARNING, "Dropping deferred DTMF digits on %s\n", chan->name);
+ ast_frfree(f);
f = &ast_null_frame;
}
break;
Modified: team/oej/sdpcleanup/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/channels/chan_sip.c?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/channels/chan_sip.c (original)
+++ team/oej/sdpcleanup/channels/chan_sip.c Sat May 20 06:58:28 2006
@@ -2199,6 +2199,7 @@
ast_rtp_destroy(r->vrtp);
r->vrtp = NULL;
}
+ ast_rtp_setdtmf(r->rtp, ast_test_flag(&r->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
r->prefs = peer->prefs;
natflags = ast_test_flag(&r->flags[0], SIP_NAT) & SIP_NAT_ROUTE;
if (r->rtp) {
@@ -3545,9 +3546,12 @@
free(p);
return NULL;
}
+ ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
ast_rtp_settos(p->rtp, global_tos_audio);
- if (p->vrtp)
+ if (p->vrtp) {
ast_rtp_settos(p->vrtp, global_tos_video);
+ ast_rtp_setdtmf(p->vrtp, 0);
+ }
p->rtptimeout = global_rtptimeout;
p->rtpholdtimeout = global_rtpholdtimeout;
p->rtpkeepalive = global_rtpkeepalive;
@@ -4855,7 +4859,7 @@
char c[256];
char t[256];
char b[256] = "";
- char hold[256] = "";
+ char *hold;
char m_audio[256];
char m_video[256];
char a_audio[1024];
@@ -4945,6 +4949,11 @@
ast_build_string(&m_audio_next, &m_audio_left, "m=audio %d RTP/AVP", ntohs(dest.sin_port));
ast_build_string(&m_video_next, &m_video_left, "m=video %d RTP/AVP", ntohs(vdest.sin_port));
+ if (ast_test_flag(&p->flags[0], SIP_CALL_ONHOLD))
+ hold = "a=recvonly";
+ else
+ hold = "a=sendrecv";
+
/* Prefer the codec we were requested to use, first, no matter what */
if (capability & p->prefcodec) {
if (p->prefcodec <= AST_FORMAT_MAX_AUDIO)
@@ -5025,10 +5034,11 @@
ast_build_string(&m_audio_next, &m_audio_left, "\r\n");
ast_build_string(&m_video_next, &m_video_left, "\r\n");
- if (ast_test_flag(&p->flags[0], SIP_CALL_ONHOLD))
- sprintf(hold, "a=recvonly");
- else
- sprintf(hold, "a=sendrecv");
+ len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio) + strlen(hold);
+ if ((p->vrtp) &&
+ (!ast_test_flag(&p->flags[0], SIP_NOVIDEO)) &&
+ (capability & VIDEO_CODEC_MASK)) /* only if video response is appropriate */
+ len += strlen(m_video) + strlen(a_video) + strlen(b) + strlen(hold);
len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio) + strlen(hold);
if (needvideo) /* only if video response is appropriate */
@@ -11301,6 +11311,7 @@
get_rdnis(p, NULL); /* Get redirect information */
extract_uri(p, req); /* Get the Contact URI */
build_contact(p); /* Build our contact header */
+ ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
if (gotdest) {
if (gotdest == 1 && ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWOVERLAP)) {
Modified: team/oej/sdpcleanup/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/channels/chan_zap.c?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/channels/chan_zap.c (original)
+++ team/oej/sdpcleanup/channels/chan_zap.c Sat May 20 06:58:28 2006
@@ -2899,6 +2899,16 @@
}
ast_log(LOG_DEBUG, "Set Operator Services mode, value: %d on %s/%s\n",
oprmode->mode, chan->name,oprmode->peer->name);;
+ break;
+ case AST_OPTION_ECHOCAN:
+ cp = (char *) data;
+ if (*cp) {
+ ast_log(LOG_DEBUG, "Enabling echo cancelation on %s\n", chan->name);
+ zt_enable_ec(p);
+ } else {
+ ast_log(LOG_DEBUG, "Disabling echo cancelation on %s\n", chan->name);
+ zt_disable_ec(p);
+ }
break;
}
errno = 0;
Modified: team/oej/sdpcleanup/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/funcs/func_odbc.c?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/funcs/func_odbc.c (original)
+++ team/oej/sdpcleanup/funcs/func_odbc.c Sat May 20 06:58:28 2006
@@ -81,9 +81,14 @@
{
struct odbc_obj *obj;
struct acf_odbc_query *query;
- char *t, *arg, buf[2048]="", varname[15];
- int res, argcount=0, valcount=0, i, retry=0;
- struct ast_channel *ast;
+ char *t, buf[2048]="", varname[15];
+ int res, i, retry=0;
+ AST_DECLARE_APP_ARGS(values,
+ AST_APP_ARG(field)[100];
+ );
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(field)[100];
+ );
SQLHSTMT stmt;
SQLINTEGER nativeerror=0, numfields=0, rows=0;
SQLSMALLINT diagbytes=0;
@@ -123,52 +128,37 @@
return -1;
}
- /* XXX You might be tempted to change this section into using
- * pbx_builtin_pushvar_helper(). However, note that if you try
- * to set a NULL (like for VALUE), then nothing gets set, and the
- * value doesn't get masked out. Even worse, when you subsequently
- * try to remove the value you just set, you'll wind up unsetting
- * the previous value (which is wholly undesireable). Hence, this
- * has to remain the way it is done here. XXX
- */
-
- /* Save old arguments as variables in a fake channel */
- ast = ast_channel_alloc(0);
- while ((arg = strsep(&s, "|"))) {
- argcount++;
- snprintf(varname, sizeof(varname), "ARG%d", argcount);
- pbx_builtin_setvar_helper(ast, varname, pbx_builtin_getvar_helper(chan, varname));
- pbx_builtin_setvar_helper(chan, varname, arg);
+ AST_STANDARD_APP_ARGS(args, s);
+ for (i = 0; i < args.argc; i++) {
+ snprintf(varname, sizeof(varname), "ARG%d", i + 1);
+ pbx_builtin_pushvar_helper(chan, varname, args.field[i]);
}
/* Parse values, just like arguments */
- while ((arg = strsep(&t, "|"))) {
- valcount++;
- snprintf(varname, sizeof(varname), "VAL%d", valcount);
- pbx_builtin_setvar_helper(ast, varname, pbx_builtin_getvar_helper(chan, varname));
- pbx_builtin_setvar_helper(chan, varname, arg);
- }
-
- /* Additionally set the value as a whole */
- /* Note that pbx_builtin_setvar_helper will quite happily take a NULL for the 3rd argument */
- pbx_builtin_setvar_helper(ast, "VALUE", pbx_builtin_getvar_helper(chan, "VALUE"));
- pbx_builtin_setvar_helper(chan, "VALUE", value);
+ /* Can't use the pipe, because app Set removes them */
+ AST_NONSTANDARD_APP_ARGS(values, t, ',');
+ for (i = 0; i < values.argc; i++) {
+ snprintf(varname, sizeof(varname), "VAL%d", i + 1);
+ pbx_builtin_pushvar_helper(chan, varname, values.field[i]);
+ }
+
+ /* Additionally set the value as a whole (but push an empty string if value is NULL) */
+ pbx_builtin_pushvar_helper(chan, "VALUE", value ? value : "");
pbx_substitute_variables_helper(chan, query->sql_write, buf, sizeof(buf) - 1);
/* Restore prior values */
- for (i=1; i<=argcount; i++) {
- snprintf(varname, sizeof(varname), "ARG%d", argcount);
- pbx_builtin_setvar_helper(chan, varname, pbx_builtin_getvar_helper(ast, varname));
- }
-
- for (i=1; i<=valcount; i++) {
- snprintf(varname, sizeof(varname), "VAL%d", argcount);
- pbx_builtin_setvar_helper(chan, varname, pbx_builtin_getvar_helper(ast, varname));
- }
- pbx_builtin_setvar_helper(chan, "VALUE", pbx_builtin_getvar_helper(ast, "VALUE"));
-
- ast_channel_free(ast);
+ for (i = 0; i < args.argc; i++) {
+ snprintf(varname, sizeof(varname), "ARG%d", i + 1);
+ pbx_builtin_setvar_helper(chan, varname, NULL);
+ }
+
+ for (i = 0; i < values.argc; i++) {
+ snprintf(varname, sizeof(varname), "VAL%d", i + 1);
+ pbx_builtin_setvar_helper(chan, varname, NULL);
+ }
+ pbx_builtin_setvar_helper(chan, "VALUE", NULL);
+
AST_LIST_UNLOCK(&queries);
retry_write:
@@ -239,8 +229,11 @@
{
struct odbc_obj *obj;
struct acf_odbc_query *query;
- char *arg, sql[2048] = "", varname[15];
- int count=0, res, x, buflen = 0;
+ char sql[2048] = "", varname[15];
+ int res, x, buflen = 0;
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(field)[100];
+ );
SQLHSTMT stmt;
SQLSMALLINT colcount=0;
SQLINTEGER indicator;
@@ -275,18 +268,17 @@
SQLSetConnectAttr(obj->con, SQL_ATTR_TRACEFILE, tracefile, strlen(tracefile));
#endif
- while ((arg = strsep(&s, "|"))) {
- count++;
- snprintf(varname, sizeof(varname), "ARG%d", count);
- /* arg is by definition non-NULL, so this works, here */
- pbx_builtin_pushvar_helper(chan, varname, arg);
+ AST_STANDARD_APP_ARGS(args, s);
+ for (x = 0; x < args.argc; x++) {
+ snprintf(varname, sizeof(varname), "ARG%d", x + 1);
+ pbx_builtin_pushvar_helper(chan, varname, args.field[x]);
}
pbx_substitute_variables_helper(chan, query->sql_read, sql, sizeof(sql) - 1);
/* Restore prior values */
- for (x = 1; x <= count; x++) {
- snprintf(varname, sizeof(varname), "ARG%d", x);
+ for (x = 0; x < args.argc; x++) {
+ snprintf(varname, sizeof(varname), "ARG%d", x + 1);
pbx_builtin_setvar_helper(chan, varname, NULL);
}
@@ -330,7 +322,8 @@
} else if (option_verbose > 3) {
ast_log(LOG_WARNING, "Error %d in FETCH [%s]\n", res, sql);
}
- goto acf_out;
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ return 0;
}
for (x = 0; x < colcount; x++) {
@@ -369,7 +362,6 @@
/* Trim trailing comma */
buf[buflen - 1] = '\0';
-acf_out:
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
return 0;
}
Modified: team/oej/sdpcleanup/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/include/asterisk/frame.h?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/include/asterisk/frame.h (original)
+++ team/oej/sdpcleanup/include/asterisk/frame.h Sat May 20 06:58:28 2006
@@ -303,6 +303,9 @@
/* set channel into "Operator Services" mode */
#define AST_OPTION_OPRMODE 7
+/*! Explicitly enable or disable echo cancelation for the given channel */
+#define AST_OPTION_ECHOCAN 8
+
struct oprmode {
struct ast_channel *peer;
int mode;
Modified: team/oej/sdpcleanup/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/include/asterisk/rtp.h?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/include/asterisk/rtp.h (original)
+++ team/oej/sdpcleanup/include/asterisk/rtp.h Sat May 20 06:58:28 2006
@@ -200,6 +200,9 @@
void ast_rtp_setnat(struct ast_rtp *rtp, int nat);
+/*! \brief Indicate whether this RTP session is carrying DTMF or not */
+void ast_rtp_setdtmf(struct ast_rtp *rtp, int dtmf);
+
int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
int ast_rtp_proto_register(struct ast_rtp_protocol *proto);
Modified: team/oej/sdpcleanup/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/rtp.c?rev=29015&r1=29014&r2=29015&view=diff
==============================================================================
--- team/oej/sdpcleanup/rtp.c (original)
+++ team/oej/sdpcleanup/rtp.c Sat May 20 06:58:28 2006
@@ -78,6 +78,7 @@
#define FLAG_NAT_ACTIVE (3 << 1)
#define FLAG_NAT_INACTIVE (0 << 1)
#define FLAG_NAT_INACTIVE_NOWARN (1 << 1)
+#define FLAG_HAS_DTMF (1 << 3)
/*!
* \brief Structure defining an RTCP session.
@@ -279,7 +280,7 @@
stun_send(rtp->s, suggestion, req);
}
-static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, int len)
+static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, size_t len)
{
struct stun_header *resp, *hdr = (struct stun_header *)data;
struct stun_attr *attr;
@@ -290,14 +291,14 @@
if (len < sizeof(struct stun_header)) {
if (option_debug)
- ast_log(LOG_DEBUG, "Runt STUN packet (only %d, wanting at least %d)\n", len, sizeof(struct stun_header));
+ ast_log(LOG_DEBUG, "Runt STUN packet (only %zd, wanting at least %zd)\n", len, sizeof(struct stun_header));
return -1;
}
if (stundebug)
ast_verbose("STUN Packet, msg %s (%04x), length: %d\n", stun_msg2str(ntohs(hdr->msgtype)), ntohs(hdr->msgtype), ntohs(hdr->msglen));
if (ntohs(hdr->msglen) > len - sizeof(struct stun_header)) {
if (option_debug)
- ast_log(LOG_DEBUG, "Scrambled STUN packet length (got %d, expecting %d)\n", ntohs(hdr->msglen), len - sizeof(struct stun_header));
+ ast_log(LOG_DEBUG, "Scrambled STUN packet length (got %d, expecting %zd)\n", ntohs(hdr->msglen), len - sizeof(struct stun_header));
} else
len = ntohs(hdr->msglen);
data += sizeof(struct stun_header);
@@ -305,13 +306,13 @@
while(len) {
if (len < sizeof(struct stun_attr)) {
if (option_debug)
- ast_log(LOG_DEBUG, "Runt Attribute (got %d, expecting %d)\n", len, sizeof(struct stun_attr));
+ ast_log(LOG_DEBUG, "Runt Attribute (got %zd, expecting %zd)\n", len, sizeof(struct stun_attr));
break;
}
attr = (struct stun_attr *)data;
if (ntohs(attr->len) > len) {
if (option_debug)
- ast_log(LOG_DEBUG, "Inconsistant Attribute (length %d exceeds remaining msg len %d)\n", ntohs(attr->len), len);
+ ast_log(LOG_DEBUG, "Inconsistant Attribute (length %d exceeds remaining msg len %zd)\n", ntohs(attr->len), len);
break;
}
if (stun_process_attr(&st, attr)) {
@@ -383,6 +384,11 @@
void ast_rtp_setnat(struct ast_rtp *rtp, int nat)
{
rtp->nat = nat;
+}
+
+void ast_rtp_setdtmf(struct ast_rtp *rtp, int dtmf)
+{
+ ast_set2_flag(rtp, dtmf ? 1 : 0, FLAG_HAS_DTMF);
}
static struct ast_frame *send_dtmf(struct ast_rtp *rtp)
@@ -1294,6 +1300,7 @@
rtp->s = rtp_socket();
rtp->ssrc = ast_random();
rtp->seqno = ast_random() & 0xffff;
+ ast_set_flag(rtp, FLAG_HAS_DTMF);
if (rtp->s < 0) {
free(rtp);
ast_log(LOG_ERROR, "Unable to allocate socket: %s\n", strerror(errno));
@@ -1871,10 +1878,6 @@
memset(&vac0, 0, sizeof(vac0));
memset(&vac1, 0, sizeof(vac1));
- /* if need DTMF, cant native bridge */
- if (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1))
- return AST_BRIDGE_FAILED_NOWARN;
-
/* Lock channels */
ast_channel_lock(c0);
while(ast_channel_trylock(c1)) {
@@ -1916,6 +1919,25 @@
ast_channel_unlock(c1);
return AST_BRIDGE_FAILED_NOWARN;
}
+
+ if (ast_test_flag(p0, FLAG_HAS_DTMF) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) {
+ /* can't bridge, we are carrying DTMF for this channel and the bridge
+ needs it
+ */
+ ast_channel_unlock(c0);
+ ast_channel_unlock(c1);
+ return AST_BRIDGE_FAILED_NOWARN;
+ }
+
+ if (ast_test_flag(p1, FLAG_HAS_DTMF) && (flags & AST_BRIDGE_DTMF_CHANNEL_1)) {
+ /* can't bridge, we are carrying DTMF for this channel and the bridge
+ needs it
+ */
+ ast_channel_unlock(c0);
+ ast_channel_unlock(c1);
+ return AST_BRIDGE_FAILED_NOWARN;
+ }
+
/* Get codecs from both sides */
codec0 = pr0->get_codec ? pr0->get_codec(c0) : 0;
codec1 = pr1->get_codec ? pr1->get_codec(c1) : 0;
More information about the asterisk-commits
mailing list