Changeset 5630
Make callweaver -r -q be quiet
-q causes a remote callweaver to not print connect and disconnect
messages, nor does it receive event messages at all.
Note 1: -q has no effect on the built in console.
Note 2: there is currently no way to enable or disable event reporting
from within a running cli.
Committed by:
mjagdis
Date:
Feb 10 2010 * 19:09 (6 months ago)
Affected files:
callweaver/trunk/corelib/callweaver.c (unified diff)
| r5627 | r5630 | |
|---|---|---|
| 1440 | 1440 | option_highpriority++; |
| 1441 | 1441 | break; |
| 1442 | 1442 | case 'v': |
| 1443 | option_quiet = 0; | |
| 1443 | 1444 | option_verbose++; |
| 1444 | 1445 | break; |
| 1445 | 1446 | case 'M': |
callweaver/trunk/corelib/console.c (unified diff)
| r5629 | r5630 | |
|---|---|---|
| 346 | 346 | |
| 347 | 347 | set_title(key); |
| 348 | 348 | |
| 349 | putc('\n', stdout); | |
| 350 | fputs(key, stdout); | |
| 351 | putc('\n', stdout); | |
| 349 | if (!option_quiet) { | |
| 350 | putc('\n', stdout); | |
| 351 | fputs(key, stdout); | |
| 352 | putc('\n', stdout); | |
| 352 | 353 | |
| 353 | while (lkey > 0) key[--lkey] = '='; | |
| 354 | fputs(key, stdout); | |
| 355 | fputs("\n\n", stdout); | |
| 354 | while (lkey > 0) key[--lkey] = '='; | |
| 355 | fputs(key, stdout); | |
| 356 | fputs("\n\n", stdout); | |
| 357 | } | |
| 356 | 358 | } |
| 357 | 359 | } |
| 358 | 360 | msgtype = MSG_UNKNOWN; |
| --- | --- | |
| 792 | 794 | } |
| 793 | 795 | |
| 794 | 796 | do { |
| 795 | if (console_address) | |
| 797 | if (console_address && !option_quiet) | |
| 796 | 798 | fprintf(stderr, "Connecting to Callweaver at %s...\n", console_address); |
| 797 | 799 | |
| 798 | 800 | if ((console_sock = console_connect(console_address, EVENT_FLAG_LOG_ALL | EVENT_FLAG_PROGRESS, reconnect_time)) < 0) |
| --- | --- | |
| 803 | 805 | /* Dump the connection banner. We don't need it here */ |
| 804 | 806 | while (read(console_sock, &c, 1) == 1 && c != '\n'); |
| 805 | 807 | |
| 806 | /* Make sure verbose and debug settings are what we want or higher | |
| 807 | * and enable events | |
| 808 | */ | |
| 809 | iov[0].iov_base = (void *)"Action: Version\r\n\r\nAction: Events\r\nEventmask: log,progress\r\n\r\nAction: Command\r\nCommand: set verbose atleast "; | |
| 810 | iov[0].iov_len = sizeof("Action: Version\r\n\r\nAction: Events\r\nEventmask: log,progress\r\n\r\nAction: Command\r\nCommand: set verbose atleast ") - 1; | |
| 811 | iov[1].iov_base = buf; | |
| 812 | iov[1].iov_len = snprintf(buf, sizeof(buf), "%d", option_verbose); | |
| 813 | iov[2].iov_base = (void *)"\r\n\r\n"; | |
| 814 | iov[2].iov_len = sizeof("\r\n\r\n") - 1; | |
| 815 | iov[3].iov_base = (void *)"Action: Command\r\nCommand: set debug atleast "; | |
| 816 | iov[3].iov_len = sizeof("Action: Command\r\nCommand: set debug atleast ") - 1; | |
| 817 | iov[4].iov_base = buf + iov[1].iov_len; | |
| 818 | iov[4].iov_len = snprintf(buf + iov[1].iov_len, sizeof(buf) - iov[1].iov_len, "%d", option_debug); | |
| 819 | iov[5].iov_base = (void *)"\r\n\r\n"; | |
| 820 | iov[5].iov_len = sizeof("\r\n\r\n") - 1; | |
| 821 | cw_writev_all(console_sock, iov, 6); | |
| 822 | read_message(console_sock, 4); | |
| 808 | cw_write_all(console_sock, "Action: Version\r\n\r\n", sizeof("Action: Version\r\n\r\n") - 1); | |
| 809 | read_message(console_sock, 1); | |
| 823 | 810 | |
| 811 | if (!option_quiet) { | |
| 812 | /* Make sure verbose and debug settings are what we want or higher | |
| 813 | * and enable events | |
| 814 | */ | |
| 815 | iov[0].iov_base = (void *)"Action: Events\r\nEventmask: log,progress\r\n\r\nAction: Command\r\nCommand: set verbose atleast "; | |
| 816 | iov[0].iov_len = sizeof("Action: Events\r\nEventmask: log,progress\r\n\r\nAction: Command\r\nCommand: set verbose atleast ") - 1; | |
| 817 | iov[1].iov_base = buf; | |
| 818 | iov[1].iov_len = snprintf(buf, sizeof(buf), "%d", option_verbose); | |
| 819 | iov[2].iov_base = (void *)"\r\n\r\n"; | |
| 820 | iov[2].iov_len = sizeof("\r\n\r\n") - 1; | |
| 821 | iov[3].iov_base = (void *)"Action: Command\r\nCommand: set debug atleast "; | |
| 822 | iov[3].iov_len = sizeof("Action: Command\r\nCommand: set debug atleast ") - 1; | |
| 823 | iov[4].iov_base = buf + iov[1].iov_len; | |
| 824 | iov[4].iov_len = snprintf(buf + iov[1].iov_len, sizeof(buf) - iov[1].iov_len, "%d", option_debug); | |
| 825 | iov[5].iov_base = (void *)"\r\n\r\n"; | |
| 826 | iov[5].iov_len = sizeof("\r\n\r\n") - 1; | |
| 827 | cw_writev_all(console_sock, iov, 6); | |
| 828 | read_message(console_sock, 3); | |
| 829 | } | |
| 830 | ||
| 824 | 831 | /* Ok, we're ready. If we are the internal console tell the core to boot if it hasn't already */ |
| 825 | 832 | if (option_console && !fully_booted) |
| 826 | 833 | kill(cw_mainpid, SIGHUP); |
| --- | --- | |
| 867 | 874 | |
| 868 | 875 | rl_callback_handler_remove(); |
| 869 | 876 | fflush(stdout); |
| 870 | fprintf(stderr, "\nDisconnected from CallWeaver server\n"); | |
| 877 | if (!option_quiet) | |
| 878 | fprintf(stderr, "\nDisconnected from CallWeaver server\n"); | |
| 871 | 879 | set_title(""); |
| 872 | 880 | close(console_sock); |
| 873 | 881 | console_sock = -1; |
![Home changeset 5630 [home]](/images/logo.png?1180520111)
RSS Feeds