diff -Naur asterisk-addons-406.orig/asterisk-ooh323c/src/chan_h323.c asterisk-addons-406.patched-work/asterisk-ooh323c/src/chan_h323.c --- asterisk-addons-406.orig/asterisk-ooh323c/src/chan_h323.c 2007-06-13 15:18:30.000000000 +0700 +++ asterisk-addons-406.patched-work/asterisk-ooh323c/src/chan_h323.c 2007-06-29 07:54:57.000000000 +0700 @@ -866,8 +866,7 @@ { ast_mutex_lock(&ast->lock); ast_setstate(ast, AST_STATE_UP); - if (option_debug) - ast_log(LOG_DEBUG, "ooh323_answer(%s)\n", ast->name); + ast_debug(0, "ooh323_answer(%s)\n", ast->name); ast_mutex_unlock(&ast->lock); ast_mutex_lock(&ooh323c_cmd_lock); ooAnswerCall(p->callToken); diff -Naur asterisk-addons-406.orig/chan_mobile.c asterisk-addons-406.patched-work/chan_mobile.c --- asterisk-addons-406.orig/chan_mobile.c 2007-06-04 09:36:42.000000000 +0700 +++ asterisk-addons-406.patched-work/chan_mobile.c 2007-06-29 07:54:23.000000000 +0700 @@ -481,8 +481,7 @@ return -1; } - if (option_debug) - ast_log(LOG_DEBUG, "Calling %s on %s\n", dest, ast->name); + ast_debug(0, "Calling %s on %s\n", dest, ast->name); if (pvt->type == MBL_TYPE_PHONE) { ast_copy_string(pvt->dial_number, dest_num, sizeof(pvt->dial_number)); @@ -508,8 +507,7 @@ } pvt = ast->tech_pvt; - if (option_debug) - ast_log(LOG_DEBUG, "Hanging up device %s.\n", pvt->id); + ast_debug(0, "Hanging up device %s.\n", pvt->id); ast_channel_lock(ast); ast->fds[0] = -1; @@ -570,8 +568,7 @@ if (pvt->type == MBL_TYPE_HEADSET) return 0; - if (option_debug) - ast_log(LOG_DEBUG, "Dialed %c\n", digit); + ast_debug(0, "Dialed %c\n", digit); switch(digit) { case '0': @@ -635,23 +632,20 @@ pvt->fr.frametype = AST_FRAME_DTMF_END; pvt->fr.subclass = f->subclass; pvt->skip_frames = pvt->dtmf_skip; - if (option_debug) - ast_log(LOG_DEBUG, "DTMF digit %c detected.\n", pvt->fr.subclass); + ast_debug(0, "DTMF digit %c detected.\n", pvt->fr.subclass); } return &pvt->fr; } else pvt->skip_frames--; } else if (r == -1) { - if (option_debug) - ast_log(LOG_DEBUG, "mbl_read() read error %d.\n", errno); + ast_debug(0, "mbl_read() read error %d.\n", errno); close(pvt->sco_socket); pvt->sco_socket = -1; ast_channel_lock(ast); ast->fds[0] = -1; ast_channel_unlock(ast); } else { - if (option_debug) - ast_log(LOG_DEBUG, "mbl_read() read short frame. (%d)\n", r); + ast_debug(0, "mbl_read() read short frame. (%d)\n", r); } return &ast_null_frame; @@ -683,9 +677,7 @@ if (frame->datalen > sizeof(pvt->sco_out_buf) - pvt->sco_out_len) { frame->datalen = sizeof(pvt->sco_out_buf) - pvt->sco_out_len; - if (option_debug) { - ast_log(LOG_DEBUG, "Overrun on sco_out_buf detected.\n"); - } + ast_debug(0, "Overrun on sco_out_buf detected.\n"); } memmove(pvt->sco_out_ptr, frame->data, frame->datalen); @@ -730,8 +722,7 @@ device = ast_strdupa(S_OR(data, "")); - if (option_debug) - ast_log(LOG_DEBUG, "Checking device state for device %s\n", device); + ast_debug(0, "Checking device state for device %s\n", device); AST_LIST_TRAVERSE(&devices, pvt, entry) { if (!strcmp(pvt->id, device)) @@ -801,8 +792,7 @@ str2ba(bdaddr, &dst); if ((s = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0) { - if (option_debug) - ast_log(LOG_DEBUG, "socket() failed (%d).\n", errno); + ast_debug(0, "socket() failed (%d).\n", errno); return -1; } @@ -811,8 +801,7 @@ bacpy(&addr.rc_bdaddr, &dst); addr.rc_channel = remote_channel; if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - if (option_debug) - ast_log(LOG_DEBUG, "connect() failed (%d).\n", errno); + ast_debug(0, "connect() failed (%d).\n", errno); close(s); return -1; } @@ -828,8 +817,7 @@ ssize_t num_write; int len; - if (option_debug) - ast_log(LOG_DEBUG, "rfcomm_write() (%s) [%s]\n", pvt->id, buf); + ast_debug(0, "rfcomm_write() (%s) [%s]\n", pvt->id, buf); len = strlen(buf); p = buf; while (len > 0) { @@ -921,8 +909,7 @@ str2ba(bdaddr, &dst); if ((s = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO)) < 0) { - if (option_debug) - ast_log(LOG_DEBUG, "socket() failed (%d).\n", errno); + ast_debug(0, "socket() failed (%d).\n", errno); return -1; } @@ -931,8 +918,7 @@ bacpy(&addr.sco_bdaddr, &dst); if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - if (option_debug) - ast_log(LOG_DEBUG, "sco connect() failed (%d).\n", errno); + ast_debug(0, "sco connect() failed (%d).\n", errno); close(s); return -1; } @@ -964,8 +950,7 @@ port = 0; session = sdp_connect(BDADDR_ANY, &bdaddr, SDP_RETRY_IF_BUSY); if (!session) { - if (option_debug) - ast_log(LOG_DEBUG, "sdp_connect() failed on device %s.\n", addr); + ast_debug(0, "sdp_connect() failed on device %s.\n", addr); return 0; } @@ -984,14 +969,11 @@ } sdp_record_free(sdprec); sdp_list_free(response_list, 0); - } else { - if (option_debug) - ast_log(LOG_DEBUG, "No responses returned for device %s.\n", addr); - } - } else { - if (option_debug) - ast_log(LOG_DEBUG, "sdp_service_search_attr_req() failed on device %s.\n", addr); - } + } else + ast_debug(0, "No responses returned for device %s.\n", addr); + } else + ast_debug(0, "sdp_service_search_attr_req() failed on device %s.\n", addr); + sdp_list_free(search_list, 0); sdp_list_free(attrid_list, 0); @@ -1117,8 +1099,7 @@ s = rfcomm_read(pvt, buf, 0, t); if ((s > 0) && (buf[0] != 0x0) && (buf[0] != '\r')) { - if (option_debug) - ast_log(LOG_DEBUG, "rfcomm_read() (%s) [%s]\n", pvt->id, buf); + ast_debug(0, "rfcomm_read() (%s) [%s]\n", pvt->id, buf); switch (pvt->state) { case MBL_STATE_INIT: if (strstr(buf, "+BRSF:")) { @@ -1159,8 +1140,7 @@ sprintf(pvt->ciev_callsetup_3, "%d,3", callsetupp); if (callsetupp == 0) /* This phone has no call setup indication!! ... */ pvt->no_callsetup = 1; - if (option_debug) - ast_log(LOG_DEBUG, "CIEV_CALL=%d CIEV_CALLSETUP=%d\n", callp, callsetupp); + ast_debug(0, "CIEV_CALL=%d CIEV_CALLSETUP=%d\n", callp, callsetupp); } if (strstr(buf, "OK")) { rfcomm_write(pvt, "AT+CIND?\r"); @@ -1211,8 +1191,7 @@ case MBL_STATE_PREIDLE: /* Nothing handled here, wait for timeout, then off we go... */ break; case MBL_STATE_IDLE: - if (option_debug) - ast_log(LOG_DEBUG, "Device %s %s [%s]\n", pvt->bdaddr, pvt->id, buf); + ast_debug(0, "Device %s %s [%s]\n", pvt->bdaddr, pvt->id, buf); if (strstr(buf, "RING")) { pvt->state = MBL_STATE_RING; } else if (strstr(buf, "+CIEV:")) { @@ -1395,8 +1374,7 @@ pvt->state = MBL_STATE_RING2; } else if (pvt->state == MBL_STATE_HANGUP) { if (pvt->hangup_count == 6) { - if (option_debug) - ast_log(LOG_DEBUG, "Device %s failed to hangup after 6 tries, disconnecting.\n", pvt->id); + ast_debug(0, "Device %s failed to hangup after 6 tries, disconnecting.\n", pvt->id); monitor = 0; } rfcomm_write(pvt, "AT+CHUP\r"); @@ -1465,8 +1443,7 @@ s = rfcomm_read(pvt, buf, 0, t); if ((s > 0) && (buf[0] != 0x0) && (buf[0] != '\r')) { - if (option_debug) - ast_log(LOG_DEBUG, "rfcomm_read() (%s) [%s]\n", pvt->id, buf); + ast_debug(0, "rfcomm_read() (%s) [%s]\n", pvt->id, buf); switch (pvt->state) { case MBL_STATE_RING2: if (strstr(buf, "AT+CKPD=")) { @@ -1632,8 +1609,7 @@ len = sizeof(so); getsockopt(ns, SOL_SCO, SCO_OPTIONS, &so, &len); - if (option_debug) - ast_log(LOG_DEBUG, "Incoming Audio Connection from device %s MTU is %d\n", saddr, so.mtu); + ast_debug(0, "Incoming Audio Connection from device %s MTU is %d\n", saddr, so.mtu); pvt = NULL; AST_LIST_TRAVERSE(&devices, pvt, entry) { @@ -1649,8 +1625,8 @@ pvt->owner->fds[0] = ns; ast_channel_unlock(pvt->owner); } - } else if (option_debug) - ast_log(LOG_DEBUG, "Could not find device for incoming Audio Connection.\n"); + } else + ast_debug(0, "Could not find device for incoming Audio Connection.\n"); } } @@ -1679,8 +1655,7 @@ cat = ast_category_browse(cfg, NULL); while (cat) { if (strcasecmp(cat, "general")) { - if (option_debug) - ast_log(LOG_DEBUG, "Loading device %s.\n", cat); + ast_debug(0, "Loading device %s.\n", cat); address = ast_variable_retrieve(cfg, cat, "address"); port = ast_variable_retrieve(cfg, cat, "port"); context = ast_variable_retrieve(cfg, cat, "context");