[asterisk-commits] rmudgett: branch rmudgett/misdn_facility r168749 - /team/rmudgett/misdn_facil...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 15 18:56:35 CST 2009
Author: rmudgett
Date: Thu Jan 15 18:56:35 2009
New Revision: 168749
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168749
Log:
* Fixed "misdn show config 0" command to display the general config
like it used to do.
* Some formatting changes.
Modified:
team/rmudgett/misdn_facility/channels/chan_misdn.c
Modified: team/rmudgett/misdn_facility/channels/chan_misdn.c
URL: http://svn.digium.com/svn-view/asterisk/team/rmudgett/misdn_facility/channels/chan_misdn.c?view=diff&rev=168749&r1=168748&r2=168749
==============================================================================
--- team/rmudgett/misdn_facility/channels/chan_misdn.c (original)
+++ team/rmudgett/misdn_facility/channels/chan_misdn.c Thu Jan 15 18:56:35 2009
@@ -610,7 +610,7 @@
robin = NULL;
}
-static struct robin_list* get_robin_position(char *group)
+static struct robin_list *get_robin_position(char *group)
{
struct robin_list *new;
struct robin_list *iter = robin;
@@ -641,7 +641,7 @@
__attribute__((format(printf, 3, 4)));
static struct ast_channel *misdn_new(struct chan_list *cl, int state, char *exten, char *callerid, int format, int port, int c);
-static void send_digit_to_chan(struct chan_list *cl, char digit );
+static void send_digit_to_chan(struct chan_list *cl, char digit);
static void hangup_chan(struct chan_list *ch);
static int pbx_start_chan(struct chan_list *ch);
@@ -718,7 +718,7 @@
/*************** Helpers *****************/
-static struct chan_list * get_chan_by_ast(struct ast_channel *ast)
+static struct chan_list *get_chan_by_ast(struct ast_channel *ast)
{
struct chan_list *tmp;
@@ -731,7 +731,7 @@
return NULL;
}
-static struct chan_list * get_chan_by_ast_name(char *name)
+static struct chan_list *get_chan_by_ast_name(char *name)
{
struct chan_list *tmp;
@@ -3652,7 +3652,8 @@
misdn_tasks = sched_context_create();
pthread_create(&misdn_tasks_thread, NULL, misdn_tasks_thread_func, &blocker);
- while (sem_wait(&blocker) && --i);
+ while (sem_wait(&blocker) && --i) {
+ } /* end while */
sem_destroy(&blocker);
}
@@ -3660,7 +3661,7 @@
{
if (misdn_tasks) {
chan_misdn_log(4, 0, "Killing misdn_tasks thread\n");
- if ( pthread_cancel(misdn_tasks_thread) == 0 ) {
+ if (pthread_cancel(misdn_tasks_thread) == 0) {
cb_log(4, 0, "Joining misdn_tasks thread\n");
pthread_join(misdn_tasks_thread, NULL);
}
@@ -3766,6 +3767,7 @@
static void send_digit_to_chan(struct chan_list *cl, char digit)
{
static const char *dtmf_tones[] = {
+/* *INDENT-OFF* */
"!941+1336/100,!0/100", /* 0 */
"!697+1209/100,!0/100", /* 1 */
"!697+1336/100,!0/100", /* 2 */
@@ -3782,6 +3784,7 @@
"!941+1633/100,!0/100", /* D */
"!941+1209/100,!0/100", /* * */
"!941+1477/100,!0/100", /* # */
+/* *INDENT-ON* */
};
struct ast_channel *chan = cl->ast;
@@ -4118,7 +4121,9 @@
ast_cli(a->fd, "Unknown option: %s\n", a->argv[3]);
return CLI_SHOWUSAGE;
}
- } else if (a->argc == 3 || onlyport == 0) {
+ }
+
+ if (a->argc == 3 || onlyport == 0) {
ast_cli(a->fd, "mISDN General-Config:\n");
for (elem = MISDN_GEN_FIRST + 1, linebreak = 1; elem < MISDN_GEN_LAST; elem++, linebreak++) {
misdn_cfg_get_config_string(0, elem, buffer, sizeof(buffer));
@@ -4129,6 +4134,7 @@
if (onlyport < 0) {
int port = misdn_cfg_get_next_port(0);
+
for (; port > 0; port = misdn_cfg_get_next_port(port)) {
ast_cli(a->fd, "\n[PORT %d]\n", port);
for (elem = MISDN_CFG_FIRST + 1, linebreak = 1; elem < MISDN_CFG_LAST; elem++, linebreak++) {
@@ -4251,7 +4257,7 @@
return CLI_SUCCESS;
}
-static void print_bc_info (int fd, struct chan_list *help, struct misdn_bchannel *bc)
+static void print_bc_info(int fd, struct chan_list *help, struct misdn_bchannel *bc)
{
struct ast_channel *ast = help->ast;
@@ -4457,8 +4463,9 @@
ast_cli(a->fd, "BEGIN STACK_LIST:\n");
for (port = misdn_cfg_get_next_port(0); port > 0;
- port = misdn_cfg_get_next_port(port)) {
+ port = misdn_cfg_get_next_port(port)) {
char buf[128];
+
get_show_stack_details(port, buf);
ast_cli(a->fd, " %s Debug:%d%s\n", buf, misdn_debug[port], misdn_debug_only[port] ? "(only)" : "");
}
@@ -4487,7 +4494,7 @@
ast_cli(a->fd, "Port\tin_calls\tout_calls\n");
for (port = misdn_cfg_get_next_port(0); port > 0;
- port = misdn_cfg_get_next_port(port)) {
+ port = misdn_cfg_get_next_port(port)) {
ast_cli(a->fd, "%d\t%d\t\t%d\n", port, misdn_in_calls[port], misdn_out_calls[port]);
}
ast_cli(a->fd, "\n");
@@ -4526,6 +4533,7 @@
#if defined(AST_MISDN_ENHANCEMENTS) && defined(CCBS_TEST_MESSAGES)
static const struct FacParm Fac_Msgs[] = {
+/* *INDENT-OFF* */
[0].Function = Fac_ERROR,
[0].u.ERROR.invokeId = 8,
[0].u.ERROR.errorValue = FacError_CCBS_AlreadyAccepted,
@@ -5252,6 +5260,7 @@
[95].Function = Fac_DivertingLegInformation3,
[95].u.DivertingLegInformation3.InvokeID = 98,
[95].u.DivertingLegInformation3.PresentationAllowedIndicator = 1,
+/* *INDENT-ON* */
};
#endif /* defined(AST_MISDN_ENHANCEMENTS) && defined(CCBS_TEST_MESSAGES) */
@@ -5726,6 +5735,7 @@
}
static struct ast_cli_entry chan_misdn_clis[] = {
+/* *INDENT-OFF* */
AST_CLI_DEFINE(handle_cli_misdn_port_block, "Block the given port"),
AST_CLI_DEFINE(handle_cli_misdn_port_down, "Try to deactivate the L1 on the given port"),
AST_CLI_DEFINE(handle_cli_misdn_port_unblock, "Unblock the given port"),
@@ -5747,6 +5757,7 @@
AST_CLI_DEFINE(handle_cli_misdn_set_debug, "Set Debuglevel of chan_misdn"),
AST_CLI_DEFINE(handle_cli_misdn_set_tics, "???"),
AST_CLI_DEFINE(handle_cli_misdn_toggle_echocancel, "Toggle EchoCancel on mISDN Channel"),
+/* *INDENT-ON* */
};
/*! \brief Updates caller ID information from config */
@@ -6532,7 +6543,7 @@
newbc->capability = ast->transfercapability;
pbx_builtin_setvar_helper(ast, "TRANSFERCAPABILITY", ast_transfercapability2str(newbc->capability));
- if ( ast->transfercapability == INFO_CAPABILITY_DIGITAL_UNRESTRICTED) {
+ if (ast->transfercapability == INFO_CAPABILITY_DIGITAL_UNRESTRICTED) {
chan_misdn_log(2, port, " --> * Call with flag Digital\n");
}
@@ -6714,7 +6725,7 @@
return -1;
}
- switch (p->state ) {
+ switch (p->state) {
case MISDN_CALLING:
if (strlen(bc->infos_pending) < sizeof(bc->infos_pending) - 1) {
strncat(bc->infos_pending, buf, sizeof(bc->infos_pending) - strlen(bc->infos_pending) - 1);
@@ -6766,12 +6777,12 @@
{
struct chan_list *p;
- if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast))) {
+ if (!ast || !(p = MISDN_ASTERISK_TECH_PVT(ast))) {
ast_log(LOG_WARNING, "Returned -1 in misdn_indication\n");
return -1;
}
- if (!p->bc ) {
+ if (!p->bc) {
chan_misdn_log(1, 0, "* IND : Indication from %s\n", ast->exten);
ast_log(LOG_WARNING, "Private Pointer but no bc ?\n");
return -1;
@@ -6787,7 +6798,7 @@
p->bc->out_cause = AST_CAUSE_USER_BUSY;
if (p->state != MISDN_CONNECTED) {
start_bc_tones(p);
- misdn_lib_send_event( p->bc, EVENT_DISCONNECT);
+ misdn_lib_send_event(p->bc, EVENT_DISCONNECT);
} else {
chan_misdn_log(-1, p->bc->port, " --> !! Got Busy in Connected State !?! ast:%s\n", ast->name);
}
@@ -6807,7 +6818,7 @@
default:
p->state = MISDN_ALERTING;
chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d\n", p->bc->pid);
- misdn_lib_send_event( p->bc, EVENT_ALERTING);
+ misdn_lib_send_event(p->bc, EVENT_ALERTING);
if (p->other_ch && p->other_ch->bc) {
if (misdn_inband_avail(p->other_ch->bc)) {
@@ -6846,18 +6857,18 @@
break;
case AST_CONTROL_PROGRESS:
chan_misdn_log(1, p->bc->port, " --> * IND :\tprogress pid:%d\n", p->bc->pid);
- misdn_lib_send_event( p->bc, EVENT_PROGRESS);
+ misdn_lib_send_event(p->bc, EVENT_PROGRESS);
break;
case AST_CONTROL_PROCEEDING:
chan_misdn_log(1, p->bc->port, " --> * IND :\tproceeding pid:%d\n", p->bc->pid);
- misdn_lib_send_event( p->bc, EVENT_PROCEEDING);
+ misdn_lib_send_event(p->bc, EVENT_PROCEEDING);
break;
case AST_CONTROL_CONGESTION:
chan_misdn_log(1, p->bc->port, " --> * IND :\tcongestion pid:%d\n", p->bc->pid);
p->bc->out_cause = AST_CAUSE_SWITCH_CONGESTION;
start_bc_tones(p);
- misdn_lib_send_event( p->bc, EVENT_DISCONNECT);
+ misdn_lib_send_event(p->bc, EVENT_DISCONNECT);
if (p->bc->nt) {
hanguptone_indicate(p);
@@ -6934,7 +6945,7 @@
if (ast->_state == AST_STATE_RESERVED ||
p->state == MISDN_NOTHING ||
p->state == MISDN_HOLDED ||
- p->state == MISDN_HOLD_DISCONNECT ) {
+ p->state == MISDN_HOLD_DISCONNECT) {
CLEAN_CH:
/* between request and call */
@@ -7274,7 +7285,7 @@
return 0;
}
- if (!ch->bc ) {
+ if (!ch->bc) {
ast_log(LOG_WARNING, "private but no bc\n");
return -1;
}
@@ -7296,7 +7307,7 @@
}
- if (!frame->samples ) {
+ if (!frame->samples) {
chan_misdn_log(4, ch->bc->port, "misdn_write: zero write\n");
if (!strcmp(frame->src,"ast_prod")) {
@@ -7336,7 +7347,9 @@
break;
default:
if (!ch->dropped_frame_cnt) {
- chan_misdn_log(5, ch->bc->port, "BC not active (nor bridged) dropping: %d frames addr:%x exten:%s cid:%s ch->state:%s bc_state:%d l3id:%x\n", frame->samples, ch->bc->addr, ast->exten, ast->cid.cid_num, misdn_get_ch_state( ch), ch->bc->bc_state, ch->bc->l3_id);
+ chan_misdn_log(5, ch->bc->port,
+ "BC not active (nor bridged) dropping: %d frames addr:%x exten:%s cid:%s ch->state:%s bc_state:%d l3id:%x\n",
+ frame->samples, ch->bc->addr, ast->exten, ast->cid.cid_num, misdn_get_ch_state(ch), ch->bc->bc_state, ch->bc->l3_id);
}
if (++ch->dropped_frame_cnt > 100) {
@@ -7357,7 +7370,7 @@
}
} else {
- /*transmit without jitterbuffer*/
+ /* transmit without jitterbuffer */
i = misdn_lib_tx2misdn_frm(ch->bc, frame->data.ptr, frame->samples);
}
@@ -7413,11 +7426,11 @@
ch2->bc->caller.name,
ch2->bc->caller.number);
- if (! (flags & AST_BRIDGE_DTMF_CHANNEL_0) ) {
+ if (!(flags & AST_BRIDGE_DTMF_CHANNEL_0)) {
ch1->ignore_dtmf = 1;
}
- if (! (flags & AST_BRIDGE_DTMF_CHANNEL_1) ) {
+ if (!(flags & AST_BRIDGE_DTMF_CHANNEL_1)) {
ch2->ignore_dtmf = 1;
}
@@ -7434,17 +7447,18 @@
if (!f || f->frametype == AST_FRAME_CONTROL) {
/* got hangup .. */
- if (!f)
+ if (!f) {
chan_misdn_log(4, ch1->bc->port, "Read Null Frame\n");
- else
+ } else {
chan_misdn_log(4, ch1->bc->port, "Read Frame Control class:%d\n", f->subclass);
+ }
*fo = f;
*rc = who;
break;
}
- if ( f->frametype == AST_FRAME_DTMF ) {
+ if (f->frametype == AST_FRAME_DTMF) {
chan_misdn_log(1, 0, "Read DTMF %d from %s\n", f->subclass, who->exten);
*fo = f;
@@ -7616,7 +7630,7 @@
}
if (!ast_strlen_zero(args.intf)) {
- if (args.intf[0] == 'g' && args.intf[1] == ':' ) {
+ if (args.intf[0] == 'g' && args.intf[1] == ':') {
/* We make a group call lets checkout which ports are in my group */
args.intf += 2;
ast_copy_string(group, args.intf, sizeof(group));
@@ -7883,6 +7897,7 @@
int chan_offset = 0;
int tmp_port = misdn_cfg_get_next_port(0);
char newname[255];
+
for (; tmp_port > 0; tmp_port = misdn_cfg_get_next_port(tmp_port)) {
if (tmp_port == port) {
break;
@@ -8247,14 +8262,12 @@
if (!ch->noautorespond_on_setup) {
if (bc->nt) {
- int ret;
- ret = misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
+ misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE);
} else {
- int ret;
- if ( misdn_lib_is_ptp(bc->port)) {
- ret = misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
+ if (misdn_lib_is_ptp(bc->port)) {
+ misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE);
} else {
- ret = misdn_lib_send_event(bc, EVENT_PROCEEDING );
+ misdn_lib_send_event(bc, EVENT_PROCEEDING);
}
}
} else {
@@ -8279,7 +8292,7 @@
}
- while (!ast_strlen_zero(predial) ) {
+ while (!ast_strlen_zero(predial)) {
fr.frametype = AST_FRAME_DTMF;
fr.subclass = *predial;
fr.src = NULL;
@@ -9347,7 +9360,7 @@
}
if (bc) {
- ch->bc = (struct misdn_bchannel *)user_data;
+ ch->bc = (struct misdn_bchannel *) user_data;
}
break;
@@ -9387,7 +9400,7 @@
break;
}
- if (ch->state == MISDN_WAITING4DIGS ) {
+ if (ch->state == MISDN_WAITING4DIGS) {
/* Ok, incomplete Setup, waiting till extension exists */
if (ast_strlen_zero(bc->info_dad) && ! ast_strlen_zero(bc->keypad)) {
chan_misdn_log(1, bc->port, " --> using keypad as info\n");
@@ -9465,7 +9478,7 @@
fr.delivery = ast_tv(0,0);
misdn_cfg_get(0, MISDN_GEN_APPEND_DIGITS2EXTEN, &digits, sizeof(digits));
- if (ch->state != MISDN_CONNECTED ) {
+ if (ch->state != MISDN_CONNECTED) {
if (digits) {
strncat(bc->dialed.number, bc->info_dad, sizeof(bc->dialed.number) - strlen(bc->dialed.number) - 1);
ast_copy_string(ch->ast->exten, bc->dialed.number, sizeof(ch->ast->exten));
@@ -9613,8 +9626,8 @@
/* Check for Pickup Request first */
if (!strcmp(chan->exten, ast_pickup_ext())) {
if (!ch->noautorespond_on_setup) {
- int ret;/** Sending SETUP_ACK**/
- ret = misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
+ /* Sending SETUP_ACK */
+ misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE);
} else {
ch->state = MISDN_INCOMING_SETUP;
}
@@ -9667,7 +9680,6 @@
bc->out_cause = AST_CAUSE_UNALLOCATED;
misdn_lib_send_event(bc, bc->nt ? EVENT_RELEASE_COMPLETE : EVENT_RELEASE);
-
break;
}
@@ -9677,7 +9689,7 @@
if (bc->sending_complete || (!bc->nt && !misdn_lib_is_ptp(bc->port))) {
if (!ch->noautorespond_on_setup) {
ch->state=MISDN_DIALING;
- misdn_lib_send_event(bc, EVENT_PROCEEDING );
+ misdn_lib_send_event(bc, EVENT_PROCEEDING);
} else {
ch->state = MISDN_INCOMING_SETUP;
}
@@ -9691,7 +9703,7 @@
* the number is empty, we wait for the ISDN timeout
* instead of our own timer.
*/
- if (ch->overlap_dial && bc->nt && !bc->dialed.number[0] ) {
+ if (ch->overlap_dial && bc->nt && !bc->dialed.number[0]) {
wait_for_digits(ch, bc, chan);
break;
}
@@ -9776,7 +9788,7 @@
break;
case EVENT_PROCEEDING:
if (misdn_cap_is_speech(bc->capability) &&
- misdn_inband_avail(bc) ) {
+ misdn_inband_avail(bc)) {
start_bc_tones(ch);
}
@@ -9801,7 +9813,7 @@
misdn_facility_ie_handler(event, bc, ch);
}
- if (!bc->nt ) {
+ if (!bc->nt) {
if (misdn_cap_is_speech(bc->capability) &&
misdn_inband_avail(bc)) {
start_bc_tones(ch);
@@ -10040,7 +10052,7 @@
ast->generatordata = NULL;
generate = ast->generator->generate;
- if (tone_len < 0 || tone_len > 512 ) {
+ if (tone_len < 0 || tone_len > 512) {
ast_log(LOG_NOTICE, "TONE_GEN: len was %d, set to 128\n", tone_len);
tone_len = 128;
}
@@ -10433,7 +10445,7 @@
misdn_cfg_get(0, MISDN_GEN_NTDEBUGFLAGS, &ntflags, sizeof(ntflags));
misdn_cfg_get(0, MISDN_GEN_NTDEBUGFILE, &ntfile, sizeof(ntfile));
- misdn_cfg_get( 0, MISDN_GEN_NTKEEPCALLS, &ntkc, sizeof(ntkc));
+ misdn_cfg_get(0, MISDN_GEN_NTKEEPCALLS, &ntkc, sizeof(ntkc));
misdn_lib_nt_keepcalls(ntkc);
misdn_lib_nt_debug_init(ntflags, ntfile);
@@ -11321,7 +11333,7 @@
timeout = atoi(args.timeout);
port_str = args.grouppar;
- if (port_str[0] == 'g' && port_str[1] == ':' ) {
+ if (port_str[0] == 'g' && port_str[1] == ':') {
/* We make a group call lets checkout which ports are in my group */
port_str += 2;
ast_copy_string(group, port_str, sizeof(group));
@@ -11387,10 +11399,10 @@
parse = ast_strdupa(data);
for (tok = strtok_r(parse, ":", &tokb);
tok;
- tok = strtok_r(NULL, ":", &tokb) ) {
+ tok = strtok_r(NULL, ":", &tokb)) {
int neglect = 0;
- if (tok[0] == '!' ) {
+ if (tok[0] == '!') {
neglect = 1;
tok++;
}
@@ -11576,7 +11588,7 @@
}
-int chan_misdn_jb_empty ( struct misdn_bchannel *bc, char *buf, int len)
+int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len)
{
struct chan_list *ch = find_chan_by_bc(cl_te, bc);
More information about the asterisk-commits
mailing list