Index: main/asterisk.c =================================================================== --- main/asterisk.c (revision 84691) +++ main/asterisk.c (working copy) @@ -909,7 +909,7 @@ break; } tmp[res] = 0; - ast_cli_command(con->fd, tmp); + ast_cli_command_multiple(con->fd, res, tmp); } if (fds[1].revents) { res = read(con->p[0], tmp, sizeof(tmp)); Index: main/cli.c =================================================================== --- main/cli.c (revision 84689) +++ main/cli.c (working copy) @@ -1868,3 +1868,20 @@ ast_free(dup); return 0; } + +int ast_cli_command_multiple(int fd, size_t size, const char *s) +{ + char cmd[512]; + int x, y = 0, count = 0; + + for (x = 0; x < size; x++) { + cmd[y] = s[x]; + y++; + if (s[x] == '\0') { + ast_cli_command(fd, cmd); + y = 0; + count++; + } + } + return count; +} Index: include/asterisk/cli.h =================================================================== --- include/asterisk/cli.h (revision 84149) +++ include/asterisk/cli.h (working copy) @@ -226,6 +226,14 @@ int ast_cli_command(int fd, const char *s); /*! + * \brief Executes multiple CLI commands + * Interpret strings separated by '\0' and execute each one, sending output to fd + * \param size is the total size of the string + * \retval number of commands executed + */ +int ast_cli_command_multiple(int fd, size_t size, const char *s); + +/*! * \brief Registers a command or an array of commands * \param e which cli entry to register * Register your own command