mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Strip the preamble from the output also when -rx is not being used
(Related to issue #12702) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@117519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2347,6 +2347,14 @@ static void ast_remotecontrol(char * data)
|
|||||||
if (ebuf[strlen(ebuf)-1] == '\n')
|
if (ebuf[strlen(ebuf)-1] == '\n')
|
||||||
ebuf[strlen(ebuf)-1] = '\0';
|
ebuf[strlen(ebuf)-1] = '\0';
|
||||||
if (!remoteconsolehandler(ebuf)) {
|
if (!remoteconsolehandler(ebuf)) {
|
||||||
|
/* Strip preamble from output */
|
||||||
|
char *tmp;
|
||||||
|
for (tmp = ebuf; *tmp; tmp++) {
|
||||||
|
if (*tmp == 127) {
|
||||||
|
memmove(tmp, tmp + 1, strlen(tmp));
|
||||||
|
tmp--;
|
||||||
|
}
|
||||||
|
}
|
||||||
res = write(ast_consock, ebuf, strlen(ebuf) + 1);
|
res = write(ast_consock, ebuf, strlen(ebuf) + 1);
|
||||||
if (res < 1) {
|
if (res < 1) {
|
||||||
ast_log(LOG_WARNING, "Unable to write: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "Unable to write: %s\n", strerror(errno));
|
||||||
|
@@ -128,7 +128,11 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
char *c, *c2;
|
char *c, *c2;
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
struct ast_variable *var;
|
struct ast_variable *var, *last = o->vars;
|
||||||
|
|
||||||
|
while (last && last->next) {
|
||||||
|
last = last->next;
|
||||||
|
}
|
||||||
|
|
||||||
while(fgets(buf, sizeof(buf), f)) {
|
while(fgets(buf, sizeof(buf), f)) {
|
||||||
lineno++;
|
lineno++;
|
||||||
@@ -222,8 +226,13 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
|
|||||||
if (c2) {
|
if (c2) {
|
||||||
var = ast_variable_new(c, c2);
|
var = ast_variable_new(c, c2);
|
||||||
if (var) {
|
if (var) {
|
||||||
var->next = o->vars;
|
/* Always insert at the end, because some people want to treat the spool file as a script */
|
||||||
o->vars = var;
|
if (last) {
|
||||||
|
last->next = var;
|
||||||
|
} else {
|
||||||
|
o->vars = var;
|
||||||
|
}
|
||||||
|
last = var;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Malformed \"%s\" argument. Should be \"%s: variable=value\"\n", buf, buf);
|
ast_log(LOG_WARNING, "Malformed \"%s\" argument. Should be \"%s: variable=value\"\n", buf, buf);
|
||||||
|
Reference in New Issue
Block a user