Index: utils.c =================================================================== RCS file: /usr/cvsroot/asterisk/utils.c,v retrieving revision 1.23 diff -u -r1.23 utils.c --- utils.c 14 Dec 2004 23:36:29 -0000 1.23 +++ utils.c 2 Jan 2005 18:42:34 -0000 @@ -430,3 +430,29 @@ } #endif + +/*--- ast_print_group: Print call group and pickup group ---*/ +char *ast_print_group(char *buf, int buflen, unsigned int group) +{ + unsigned int i; + int first=1; + char num[3]; + + buf[0] = '\0'; + + if (!group) /* Return empty string if no group */ + return(buf); + + for (i=0; i<=31; i++) { /* Max group is 31 */ + if (group & (1 << i)) { + if (!first) { + strncat(buf, ", ", buflen); + } else { + first=0; + } + snprintf(num, sizeof(num), "%u", i); + strncat(buf, num, buflen); + } + } + return(buf); +} Index: include/asterisk/utils.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/utils.h,v retrieving revision 1.13 diff -u -r1.13 utils.h --- include/asterisk/utils.h 23 Dec 2004 11:32:22 -0000 1.13 +++ include/asterisk/utils.h 2 Jan 2005 18:42:34 -0000 @@ -73,3 +77,6 @@ extern char *ast_strcasestr(const char *, const char *); #endif + +/* print call- and pickup groups into buffer */ +char *ast_print_group(char *buf, int buflen, unsigned int group); Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.609 diff -u -r1.609 chan_sip.c --- channels/chan_sip.c 2 Jan 2005 00:48:11 -0000 1.609 +++ channels/chan_sip.c 2 Jan 2005 18:42:37 -0000 @@ -5902,20 +5902,8 @@ /*--- print_group: Print call group and pickup group ---*/ static void print_group(int fd, unsigned int group) { - unsigned int i; - int first=1; - - for (i=0; i<=31; i++) { /* Max group is 31 */ - if (group & (1 << i)) { - if (!first) { - ast_cli(fd, ", "); - } else { - first=0; - } - ast_cli(fd, "%u", i); - } - } - ast_cli(fd, " (%u)\n", group); + char buf[256]; + ast_cli(fd, ast_print_group(buf, sizeof(buf), group) ); } static const char *dtmfmode2str(int mode) @@ -5928,6 +5916,7 @@ case SIP_DTMF_INBAND: return "inband"; } + return ""; } static const char *insecure2str(int mode) @@ -5940,6 +5929,7 @@ case SIP_INSECURE_VERY: return "very"; } + return ""; } /*--- sip_show_peer: Show one peer in detail ---*/ @@ -9065,6 +9055,7 @@ return 0; } +/*--- sip_get_rtp_peer: Returns null if we can't reinvite */ static struct ast_rtp *sip_get_rtp_peer(struct ast_channel *chan) { struct sip_pvt *p; @@ -9287,12 +9278,14 @@ return 0; } +/*--- sip_get_codec: Return peers codec ---*/ static int sip_get_codec(struct ast_channel *chan) { struct sip_pvt *p = chan->pvt->pvt; return p->peercapability; } +/*--- sip_rtp: Interface structure with callbacks used to connect to rtp module --*/ static struct ast_rtp_protocol sip_rtp = { get_rtp_info: sip_get_rtp_peer, get_vrtp_info: sip_get_vrtp_peer, Index: apps/app_dumpchan.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_dumpchan.c,v retrieving revision 1.4 diff -u -r1.4 app_dumpchan.c --- apps/app_dumpchan.c 7 Dec 2004 20:38:43 -0000 1.4 +++ apps/app_dumpchan.c 2 Jan 2005 18:42:37 -0000 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -29,14 +30,20 @@ static char *desc = " DumpChan([])\n" "Displays information on channel and listing of all channel\n" -"variables. If min_verbose_level is specified, output is only\n" +"variables. If min_verbose_level is specified, output is only\n" "displayed when the verbose level is currently set to that number\n" -"or greater. Always returns 0.\n\n"; +"or greater. Always returns 0.\n\n"; STANDARD_LOCAL_USER; LOCAL_USER_DECL; +char *print_group(int group) +{ + char buf[256]; + return(ast_print_group(buf, sizeof(buf), group)); +} + static int ast_serialize_showchan(struct ast_channel *c, char *buf, size_t size) { struct timeval now; @@ -55,30 +62,30 @@ } snprintf(buf,size, - "Name=%s\n" - "Type=%s\n" - "UniqueID=%s\n" - "CallerID=%s\n" - "CallerIDName=%s\n" - "DNIDDigits=%s\n" - "State=%s(%d)\n" - "Rings=%d\n" - "NativeFormat=%d\n" - "WriteFormat=%d\n" - "ReadFormat=%d\n" - "1stFileDescriptor=%d\n" - "Framesin=%d%s\n" - "Framesout=%d%s\n" - "TimetoHangup=%ld\n" - "ElapsedTime=%dh%dm%ds\n" - "Context=%s\n" - "Extension=%s\n" - "Priority=%d\n" - "CallGroup=%d\n" - "PickupGroup=%d\n" - "Application=%s\n" - "Data=%s\n" - "Blocking_in=%s\n", + "Name= %s\n" + "Type= %s\n" + "UniqueID= %s\n" + "CallerID= %s\n" + "CallerIDName= %s\n" + "DNIDDigits= %s\n" + "State= %s (%d)\n" + "Rings= %d\n" + "NativeFormat= %d\n" + "WriteFormat= %d\n" + "ReadFormat= %d\n" + "1stFileDescriptor= %d\n" + "Framesin= %d %s\n" + "Framesout= %d %s\n" + "TimetoHangup= %ld\n" + "ElapsedTime= %dh%dm%ds\n" + "Context= %s\n" + "Extension= %s\n" + "Priority= %d\n" + "CallGroup= %s\n" + "PickupGroup= %s\n" + "Application= %s\n" + "Data= %s\n" + "Blocking_in= %s\n", c->name, c->type, c->uniqueid, @@ -99,8 +106,8 @@ c->context, c->exten, c->priority, - c->callgroup, - c->pickupgroup, + print_group(c->callgroup), + print_group(c->pickupgroup), ( c->appl ? c->appl : "(N/A)" ), ( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"), (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); @@ -125,7 +132,7 @@ pbx_builtin_serialize_variables(chan, vars, sizeof(vars)); ast_serialize_showchan(chan, info, sizeof(info)); if (option_verbose >= level) - ast_verbose("\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n",chan->name,line,info,vars,line); + ast_verbose("\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n",chan->name, line, info, vars, line); LOCAL_USER_REMOVE(u); return res;