mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
(closes issue #10279)
Reported by: seanbright Patches: res_agi.carefulwrite.1.4.07252007.patch uploaded by seanbright (license 71) res_agi.carefulwrite.trunk.07252007.patch uploaded by seanbright (license 71) Allow the "agi_network: yes" line to be printed out in the AGI debug output. Also, allow partial writes to be handled when writing out this line just like it is for all of the others. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@77788 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -115,7 +115,7 @@ enum agi_result {
|
|||||||
AGI_RESULT_HANGUP
|
AGI_RESULT_HANGUP
|
||||||
};
|
};
|
||||||
|
|
||||||
static void agi_debug_cli(int fd, char *fmt, ...)
|
static int agi_debug_cli(int fd, char *fmt, ...)
|
||||||
{
|
{
|
||||||
char *stuff;
|
char *stuff;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
@@ -129,9 +129,11 @@ static void agi_debug_cli(int fd, char *fmt, ...)
|
|||||||
} else {
|
} else {
|
||||||
if (agidebug)
|
if (agidebug)
|
||||||
ast_verbose("AGI Tx >> %s", stuff); /* \n provided by caller */
|
ast_verbose("AGI Tx >> %s", stuff); /* \n provided by caller */
|
||||||
ast_carefulwrite(fd, stuff, strlen(stuff), 100);
|
res = ast_carefulwrite(fd, stuff, strlen(stuff), 100);
|
||||||
free(stuff);
|
free(stuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* launch_netscript: The fastagi handler.
|
/* launch_netscript: The fastagi handler.
|
||||||
@@ -210,8 +212,8 @@ static enum agi_result launch_netscript(char *agiurl, char *argv[], int *fds, in
|
|||||||
return AGI_RESULT_FAILURE;
|
return AGI_RESULT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* XXX in theory should check for partial writes... */
|
|
||||||
while (write(s, "agi_network: yes\n", strlen("agi_network: yes\n")) < 0) {
|
if (fdprintf(s, "agi_network: yes\n") < 0) {
|
||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
ast_log(LOG_WARNING, "Connect to '%s' failed: %s\n", agiurl, strerror(errno));
|
ast_log(LOG_WARNING, "Connect to '%s' failed: %s\n", agiurl, strerror(errno));
|
||||||
close(s);
|
close(s);
|
||||||
|
Reference in New Issue
Block a user