Index: asterisk/res/res_agi.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_agi.c,v retrieving revision 1.40 diff -u -r1.40 res_agi.c --- asterisk/res/res_agi.c 21 Jun 2005 01:16:18 -0000 1.40 +++ asterisk/res/res_agi.c 10 Jul 2005 19:58:07 -0000 @@ -205,7 +205,11 @@ return 0; } +#ifndef __CYGWIN__ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *opid) +#else +static int launch_script(char *script, char *argv[], int *fds, int *efd, int *opid, void *winp) +#endif { char tmp[256]; int pid; @@ -222,18 +226,30 @@ snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_AGI_DIR, script); script = tmp; } - if (pipe(toast)) { +#ifdef __CYGWIN__ + if (socketpair(AF_LOCAL, SOCK_STREAM, 0, toast)) { +#else + if (pipe(toast)) { +#endif ast_log(LOG_WARNING, "Unable to create toast pipe: %s\n",strerror(errno)); return -1; } - if (pipe(fromast)) { +#ifdef __CYGWIN__ + if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fromast)) { +#else + if (pipe(fromast)) { +#endif ast_log(LOG_WARNING, "unable to create fromast pipe: %s\n", strerror(errno)); close(toast[0]); close(toast[1]); return -1; } if (efd) { +#ifdef __CYGWIN__ + if (socketpair(AF_LOCAL, SOCK_STREAM, 0, audio)) { +#else if (pipe(audio)) { +#endif ast_log(LOG_WARNING, "unable to create audio pipe: %s\n", strerror(errno)); close(fromast[0]); close(fromast[1]); @@ -1943,7 +1959,12 @@ } } #endif +#ifndef __CYGWIN__ res = launch_script(argv[0], argv, fds, enhanced ? &efd : NULL, &pid); +#else + void *winp = NULL; + res = launch_script(argv[0], argv, fds, enhanced ? &efd : NULL, &pid, winp); +#endif if (!res) { agi.fd = fds[1]; agi.ctrl = fds[0]; @@ -1952,6 +1973,10 @@ close(fds[1]); if (efd > -1) close(efd); +#ifdef __CYGWIN__ + if (winp) + wincons_clean(winp); +#endif } LOCAL_USER_REMOVE(u); return res; Index: asterisk/res/res_features.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_features.c,v retrieving revision 1.59 diff -u -r1.59 res_features.c --- asterisk/res/res_features.c 7 Jul 2005 22:32:20 -0000 1.59 +++ asterisk/res/res_features.c 10 Jul 2005 19:58:09 -0000 @@ -1486,6 +1486,9 @@ ast_mutex_unlock(&parking_lock); rfds = nrfds; efds = nefds; +#ifdef __CYGWIN__ + if (max <0) ms = 25; +#endif tv.tv_sec = ms / 1000; tv.tv_usec = (ms % 1000) * 1000; /* Wait for something to happen */ @@ -1886,6 +1889,10 @@ ast_cli_unregister(&showfeatures); ast_cli_unregister(&showparked); ast_unregister_application(parkcall); +#ifdef __CYGWIN__ + pthread_cancel(parking_thread); + pthread_join(parking_thread, NULL); +#endif return ast_unregister_application(parkedcall); } Index: asterisk/res/res_musiconhold.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v retrieving revision 1.62 diff -u -r1.62 res_musiconhold.c --- asterisk/res/res_musiconhold.c 30 Jun 2005 18:08:27 -0000 1.62 +++ asterisk/res/res_musiconhold.c 10 Jul 2005 19:58:09 -0000 @@ -32,6 +32,9 @@ #endif #include #include +#ifdef __CYGWIN__ +#include +#endif #include "asterisk.h" @@ -373,7 +376,11 @@ if (dir) { closedir(dir); } +#ifdef __CYGWIN__ + if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds)) { +#else if (pipe(fds)) { +#endif ast_log(LOG_WARNING, "Pipe failed\n"); return -1; } @@ -607,7 +614,11 @@ if (!moh) return NULL; memset(moh, 0, sizeof(struct mohdata)); +#ifdef __CYGWIN__ + if (socketpair(AF_LOCAL, SOCK_STREAM, 0, moh->pipe)) { +#else if (pipe(moh->pipe)) { +#endif ast_log(LOG_WARNING, "Failed to create pipe: %s\n", strerror(errno)); free(moh); return NULL;