--- /usr/src/asterisk/res/res_agi.c 2006-07-12 13:54:10.000000000 +0000 +++ /root/dror/asterisk/res/res_agi.c 2007-11-05 13:17:02.000000000 +0000 @@ -70,6 +70,18 @@ /* Recycle some stuff from the CLI interface */ #define fdprintf agi_debug_cli +#if defined(__linux__) && !defined(__NR_gettid) +#include +#endif + +#if defined(__linux__) && defined(__NR_gettid) +#define GETTID() syscall(__NR_gettid) +#else +#define GETTID() getpid() +#endif + + + static char *tdesc = "Asterisk Gateway Interface (AGI)"; static char *app = "AGI"; @@ -359,6 +371,8 @@ /* User information */ fdprintf(fd, "agi_accountcode: %s\n", chan->accountcode ? chan->accountcode : ""); + fdprintf(fd, "agi_asteriskthreadid: %d\n", GETTID()); + /* End with empty return */ fdprintf(fd, "\n");