diff options
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_dahdi.c | 102 | ||||
-rw-r--r-- | channels/chan_gtalk.c | 6 | ||||
-rw-r--r-- | channels/chan_iax2.c | 122 | ||||
-rw-r--r-- | channels/chan_misdn.c | 84 | ||||
-rw-r--r-- | channels/chan_sip.c | 185 | ||||
-rw-r--r-- | channels/chan_skinny.c | 17 | ||||
-rw-r--r-- | channels/sig_pri.c | 26 |
7 files changed, 266 insertions, 276 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index b5f398fdf..6ebe7ff11 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -1734,7 +1734,7 @@ static int my_get_callerid(void *pvt, char *namebuf, char *numbuf, enum analog_e if (num) ast_copy_string(numbuf, num, ANALOG_MAX_CID); - ast_log(LOG_DEBUG, "CallerID number: %s, name: %s, flags=%d\n", num, name, flags); + ast_debug(1, "CallerID number: %s, name: %s, flags=%d\n", num, name, flags); return 0; } } @@ -2236,7 +2236,7 @@ static void my_set_waitingfordt(void *pvt, struct ast_channel *ast) struct dahdi_pvt *p = pvt; if (p->waitfordialtone && CANPROGRESSDETECT(p) && p->dsp) { - ast_log(LOG_DEBUG, "Defer dialing for %dms or dialtone\n", p->waitfordialtone); + ast_debug(1, "Defer dialing for %dms or dialtone\n", p->waitfordialtone); gettimeofday(&p->waitingfordt, NULL); ast_setstate(ast, AST_STATE_OFFHOOK); } @@ -2899,7 +2899,7 @@ static int my_dial_digits(void *pvt, enum analog_sub sub, struct analog_dialoper res = ioctl(p->subs[index].dfd, DAHDI_DIAL, &ddop); if (res == -1) - ast_log(LOG_DEBUG, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno)); + ast_debug(1, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno)); return res; } @@ -2924,7 +2924,7 @@ static int my_is_dialing(void *pvt, enum analog_sub sub) index = analogsub_to_dahdisub(sub); if (ioctl(p->subs[index].dfd, DAHDI_DIALING, &x)) { - ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed!\n"); + ast_debug(1, "DAHDI_DIALING ioctl failed!\n"); return -1; } @@ -3829,13 +3829,13 @@ static void dahdi_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, con p->mfcr2_recvd_category = category; /* if we're not supposed to use CID, clear whatever we have */ if (!p->use_callerid) { - ast_log(LOG_DEBUG, "No CID allowed in configuration, CID is being cleared!\n"); + ast_debug(1, "No CID allowed in configuration, CID is being cleared!\n"); p->cid_num[0] = 0; p->cid_name[0] = 0; } /* if we're supposed to answer immediately, clear DNIS and set 's' exten */ if (p->immediate || !openr2_context_get_max_dnis(openr2_chan_get_context(r2chan))) { - ast_log(LOG_DEBUG, "Setting exten => s because of immediate or 0 DNIS configured\n"); + ast_debug(1, "Setting exten => s because of immediate or 0 DNIS configured\n"); p->exten[0] = 's'; p->exten[1] = 0; } @@ -3858,10 +3858,10 @@ static void dahdi_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, con ast_log(LOG_WARNING, "Unable to create PBX channel in DAHDI channel %d\n", p->channel); dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER); } else if (p->mfcr2_charge_calls) { - ast_log(LOG_DEBUG, "Accepting MFC/R2 call with charge on chan %d\n", p->channel); + ast_debug(1, "Accepting MFC/R2 call with charge on chan %d\n", p->channel); openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE); } else { - ast_log(LOG_DEBUG, "Accepting MFC/R2 call with no charge on chan %d\n", p->channel); + ast_debug(1, "Accepting MFC/R2 call with no charge on chan %d\n", p->channel); openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE); } } @@ -3893,7 +3893,7 @@ static void dahdi_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t if (!p->mfcr2_accept_on_offer) { openr2_chan_disable_read(r2chan); if (p->mfcr2_answer_pending) { - ast_log(LOG_DEBUG, "Answering MFC/R2 call after accepting it on chan %d\n", openr2_chan_get_number(r2chan)); + ast_debug(1, "Answering MFC/R2 call after accepting it on chan %d\n", openr2_chan_get_number(r2chan)); dahdi_r2_answer(p); } return; @@ -3927,7 +3927,7 @@ static void dahdi_r2_on_call_answered(openr2_chan_t *r2chan) static void dahdi_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf, int buflen) { - /*ast_log(LOG_DEBUG, "Read data from dahdi channel %d\n", openr2_chan_get_number(r2chan));*/ + /*ast_debug(1, "Read data from dahdi channel %d\n", openr2_chan_get_number(r2chan));*/ } static int dahdi_r2_cause_to_ast_cause(openr2_call_disconnect_cause_t cause) @@ -4010,11 +4010,11 @@ static void dahdi_r2_write_log(openr2_log_level_t level, char *logmessage) case OR2_LOG_CAS_TRACE: case OR2_LOG_DEBUG: case OR2_LOG_EX_DEBUG: - ast_log(LOG_DEBUG, "%s", logmessage); + ast_debug(1, "%s", logmessage); break; default: ast_log(LOG_WARNING, "We should handle logging level %d here.\n", level); - ast_log(LOG_DEBUG, "%s", logmessage); + ast_debug(1, "%s", logmessage); break; } } @@ -5819,23 +5819,23 @@ static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, cons ); if (ast_strlen_zero(data)) { - ast_log(LOG_DEBUG, "No data sent to application!\n"); + ast_debug(1, "No data sent to application!\n"); return -1; } if (chan->tech != &dahdi_tech) { - ast_log(LOG_DEBUG, "Only DAHDI technology accepted!\n"); + ast_debug(1, "Only DAHDI technology accepted!\n"); return -1; } pvt = (struct dahdi_pvt *) chan->tech_pvt; if (!pvt) { - ast_log(LOG_DEBUG, "Unable to find technology private\n"); + ast_debug(1, "Unable to find technology private\n"); return -1; } switch (pvt->sig) { case SIG_PRI_LIB_HANDLE_CASES: break; default: - ast_log(LOG_DEBUG, "callrerouting attempted on non-ISDN channel %s\n", + ast_debug(1, "callrerouting attempted on non-ISDN channel %s\n", chan->name); return -1; } @@ -5882,18 +5882,18 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data) ); if (ast_strlen_zero(data)) { - ast_log(LOG_DEBUG, "No data sent to application!\n"); + ast_debug(1, "No data sent to application!\n"); return -1; } if (chan->tech != &dahdi_tech) { - ast_log(LOG_DEBUG, "Only DAHDI technology accepted!\n"); + ast_debug(1, "Only DAHDI technology accepted!\n"); return -1; } p = (struct dahdi_pvt *)chan->tech_pvt; if (!p) { - ast_log(LOG_DEBUG, "Unable to find technology private!\n"); + ast_debug(1, "Unable to find technology private!\n"); return -1; } @@ -5908,13 +5908,13 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data) ast_mutex_lock(&p->lock); if (!p->mfcr2 || !p->mfcr2call) { ast_mutex_unlock(&p->lock); - ast_log(LOG_DEBUG, "Channel %s does not seems to be an R2 active channel!\n", chan->name); + ast_debug(1, "Channel %s does not seems to be an R2 active channel!\n", chan->name); return -1; } if (p->mfcr2_call_accepted) { ast_mutex_unlock(&p->lock); - ast_log(LOG_DEBUG, "MFC/R2 call already accepted on channel %s!\n", chan->name); + ast_debug(1, "MFC/R2 call already accepted on channel %s!\n", chan->name); return 0; } accept_mode = ast_true(args.charge) ? OR2_CALL_WITH_CHARGE : OR2_CALL_NO_CHARGE; @@ -5936,7 +5936,7 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data) } res = ast_waitfor(chan, timeout); if (res < 0) { - ast_log(LOG_DEBUG, "ast_waitfor failed on channel %s, going out ...\n", chan->name); + ast_debug(1, "ast_waitfor failed on channel %s, going out ...\n", chan->name); res = -1; break; } @@ -5945,12 +5945,12 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data) } f = ast_read(chan); if (!f) { - ast_log(LOG_DEBUG, "No frame read on channel %s, going out ...\n", chan->name); + ast_debug(1, "No frame read on channel %s, going out ...\n", chan->name); res = -1; break; } if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) { - ast_log(LOG_DEBUG, "Got HANGUP frame on channel %s, going out ...\n", chan->name); + ast_debug(1, "Got HANGUP frame on channel %s, going out ...\n", chan->name); ast_frfree(f); res = -1; break; @@ -5959,7 +5959,7 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data) ast_mutex_lock(&p->lock); if (p->mfcr2_call_accepted) { ast_mutex_unlock(&p->lock); - ast_log(LOG_DEBUG, "Accepted MFC/R2 call!\n"); + ast_debug(1, "Accepted MFC/R2 call!\n"); break; } ast_mutex_unlock(&p->lock); @@ -6003,7 +6003,7 @@ static openr2_call_disconnect_cause_t dahdi_ast_cause_to_r2_cause(int cause) r2cause = OR2_CAUSE_NORMAL_CLEARING; break; } - ast_log(LOG_DEBUG, "ast cause %d resulted in openr2 cause %d/%s\n", + ast_debug(1, "ast cause %d resulted in openr2 cause %d/%s\n", cause, r2cause, openr2_proto_get_disconnect_string(r2cause)); return r2cause; } @@ -6305,7 +6305,7 @@ static int dahdi_hangup(struct ast_channel *ast) /* Perform low level hangup if no owner left */ #ifdef HAVE_OPENR2 if (p->mfcr2 && p->mfcr2call && openr2_chan_get_direction(p->r2chan) != OR2_DIR_STOPPED) { - ast_log(LOG_DEBUG, "disconnecting MFC/R2 call on chan %d\n", p->channel); + ast_debug(1, "disconnecting MFC/R2 call on chan %d\n", p->channel); /* If it's an incoming call, check the mfcr2_forced_release setting */ if (openr2_chan_get_direction(p->r2chan) == OR2_DIR_BACKWARD && p->mfcr2_forced_release) { dahdi_r2_disconnect_call(p, OR2_CAUSE_FORCED_RELEASE); @@ -6317,7 +6317,7 @@ static int dahdi_hangup(struct ast_channel *ast) dahdi_r2_disconnect_call(p, r2cause); } } else if (p->mfcr2call) { - ast_log(LOG_DEBUG, "Clearing call request on channel %d\n", p->channel); + ast_debug(1, "Clearing call request on channel %d\n", p->channel); /* since ast_request() was called but not ast_call() we have not yet dialed and the openr2 stack will not call on_call_end callback, we need to unset the mfcr2call flag and bump the monitor count so the monitor thread can take @@ -6464,14 +6464,14 @@ static int dahdi_answer(struct ast_channel *ast) openr2_chan_answer_call will be called when the callback on_call_accepted is executed */ p->mfcr2_answer_pending = 1; if (p->mfcr2_charge_calls) { - ast_log(LOG_DEBUG, "Accepting MFC/R2 call with charge before answering on chan %d\n", p->channel); + ast_debug(1, "Accepting MFC/R2 call with charge before answering on chan %d\n", p->channel); openr2_chan_accept_call(p->r2chan, OR2_CALL_WITH_CHARGE); } else { - ast_log(LOG_DEBUG, "Accepting MFC/R2 call with no charge before answering on chan %d\n", p->channel); + ast_debug(1, "Accepting MFC/R2 call with no charge before answering on chan %d\n", p->channel); openr2_chan_accept_call(p->r2chan, OR2_CALL_NO_CHARGE); } } else { - ast_log(LOG_DEBUG, "Answering MFC/R2 call on chan %d\n", p->channel); + ast_debug(1, "Answering MFC/R2 call on chan %d\n", p->channel); dahdi_r2_answer(p); } break; @@ -7771,7 +7771,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) if (p->sig != SIG_MFCR2) { ast_log(LOG_WARNING, "Received bits changed on %s signalling?\n", sig2str(p->sig)); } else { - ast_log(LOG_DEBUG, "bits changed in chan %d\n", p->channel); + ast_debug(1, "bits changed in chan %d\n", p->channel); openr2_chan_handle_cas(p->r2chan); } #else @@ -7793,7 +7793,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) if (p->inalarm) break; if ((p->radio || (p->oprmode < 0))) break; if (ioctl(p->subs[idx].dfd,DAHDI_DIALING,&x) == -1) { - ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed on %s: %s\n",ast->name, strerror(errno)); + ast_debug(1, "DAHDI_DIALING ioctl failed on %s: %s\n",ast->name, strerror(errno)); return NULL; } if (!x) { /* if not still dialing in driver */ @@ -8744,7 +8744,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) if (p->mfcr2_call_accepted && !p->mfcr2_progress_sent && ast->_state == AST_STATE_RINGING) { - ast_log(LOG_DEBUG, "Enqueuing progress frame after R2 accept in chan %d\n", p->channel); + ast_debug(1, "Enqueuing progress frame after R2 accept in chan %d\n", p->channel); ast_queue_frame(p->owner, &fr); p->mfcr2_progress_sent = 1; } @@ -9009,7 +9009,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) p->waitingfordt.tv_sec = 0; p->dsp_features &= ~DSP_FEATURE_WAITDIALTONE; ast_dsp_set_features(p->dsp, p->dsp_features); - ast_log(LOG_DEBUG, "Got 10 samples of dialtone!\n"); + ast_debug(1, "Got 10 samples of dialtone!\n"); if (!ast_strlen_zero(p->dop.dialstr)) { /* Dial deferred digits */ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop); if (res < 0) { @@ -9018,7 +9018,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) ast_mutex_unlock(&p->lock); return NULL; } else { - ast_log(LOG_DEBUG, "Sent deferred digit string: %s\n", p->dop.dialstr); + ast_debug(1, "Sent deferred digit string: %s\n", p->dop.dialstr); p->dialing = 1; p->dop.dialstr[0] = '\0'; p->dop.op = DAHDI_DIAL_OP_REPLACE; @@ -10462,7 +10462,7 @@ static void *analog_ss_thread(void *data) f = ast_read(chan); if (f->frametype == AST_FRAME_DTMF) { dtmfbuf[k++] = f->subclass.integer; - ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass.integer); + ast_debug(1, "CID got digit '%c'\n", f->subclass.integer); res = 2000; } ast_frfree(f); @@ -10474,7 +10474,7 @@ static void *analog_ss_thread(void *data) dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear); /* Got cid and ring. */ callerid_get_dtmf(dtmfbuf, dtmfcid, &flags); - ast_log(LOG_DEBUG, "CID is '%s', flags %d\n", + ast_debug(1, "CID is '%s', flags %d\n", dtmfcid, flags); /* If first byte is NULL, we have no cid */ if (!ast_strlen_zero(dtmfcid)) @@ -10522,7 +10522,7 @@ static void *analog_ss_thread(void *data) } /* If we get a PR event, they hung up while processing calerid */ if ( res == DAHDI_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) { - ast_log(LOG_DEBUG, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel); + ast_debug(1, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel); p->polarity = POLARITY_IDLE; callerid_free(cs); ast_hangup(chan); @@ -11537,7 +11537,7 @@ static void *do_monitor(void *data) pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - ast_log(LOG_DEBUG, "Maybe some MWI on port %d!\n", i->channel); + ast_debug(1, "Maybe some MWI on port %d!\n", i->channel); if ((mtd = ast_calloc(1, sizeof(*mtd)))) { mtd->pvt = i; memcpy(mtd->buf, buf, res); @@ -11844,7 +11844,7 @@ static struct dahdi_mfcr2 *dahdi_r2_get_link(void) new_r2link->r2master = AST_PTHREADT_NULL; r2links[r2links_count] = new_r2link; r2links_count++; - ast_log(LOG_DEBUG, "Created new R2 link!\n"); + ast_debug(1, "Created new R2 link!\n"); } return r2links[r2links_count - 1]; } @@ -11942,7 +11942,7 @@ static int device2chan(const char *subdir, int channel, char *path, int pathlen) return -EINVAL; } num = minor(stbuf.st_rdev); - ast_log(LOG_DEBUG, "%s -> %d\n", path, num); + ast_debug(1, "%s -> %d\n", path, num); return num; } @@ -13339,7 +13339,7 @@ static struct ast_channel *dahdi_request(const char *type, struct ast_format_cap ast_mutex_lock(&p->lock); if (p->mfcr2call) { ast_mutex_unlock(&p->lock); - ast_log(LOG_DEBUG, "Yay!, someone just beat us in the race for channel %d.\n", p->channel); + ast_debug(1, "Yay!, someone just beat us in the race for channel %d.\n", p->channel); goto next; } p->mfcr2call = 1; @@ -13676,7 +13676,7 @@ static void *mfcr2_monitor(void *data) continue; } if (!mfcr2->pvts[i]->r2chan) { - ast_log(LOG_DEBUG, "Wow, no r2chan on channel %d\n", mfcr2->pvts[i]->channel); + ast_debug(1, "Wow, no r2chan on channel %d\n", mfcr2->pvts[i]->channel); quit_loop = 1; break; } @@ -13690,7 +13690,7 @@ static void *mfcr2_monitor(void *data) } if (pollsize == 0) { if (!was_idle) { - ast_log(LOG_DEBUG, "Monitor thread going idle since everybody has an owner\n"); + ast_debug(1, "Monitor thread going idle since everybody has an owner\n"); was_idle = 1; } poll(NULL, 0, maxsleep); @@ -16485,19 +16485,19 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct /* Create the interface list */ if (!strcasecmp(v->name, "channel") || !strcasecmp(v->name, "channels")) { - if (options & PROC_DAHDI_OPT_NOCHAN) { + if (options & PROC_DAHDI_OPT_NOCHAN) { ast_log(LOG_WARNING, "Channel '%s' ignored.\n", v->value); - continue; + continue; } if (build_channels(confp, v->value, reload, v->lineno, &found_pseudo)) { if (confp->ignore_failed_channels) { ast_log(LOG_WARNING, "Channel '%s' failure ignored: ignore_failed_channels.\n", v->value); continue; } else { - return -1; + return -1; } } - ast_log(LOG_DEBUG, "Channel '%s' configured.\n", v->value); + ast_debug(1, "Channel '%s' configured.\n", v->value); } else if (!strcasecmp(v->name, "ignore_failed_channels")) { confp->ignore_failed_channels = ast_true(v->value); } else if (!strcasecmp(v->name, "buffers")) { @@ -16510,8 +16510,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct if (!parse_buffers_policy(v->value, &confp->chan.faxbuf_no, &confp->chan.faxbuf_policy)) { confp->chan.usefaxbuffers = 1; } - } else if (!strcasecmp(v->name, "dahdichan")) { - ast_copy_string(dahdichan, v->value, sizeof(dahdichan)); + } else if (!strcasecmp(v->name, "dahdichan")) { + ast_copy_string(dahdichan, v->value, sizeof(dahdichan)); } else if (!strcasecmp(v->name, "usedistinctiveringdetection")) { usedistinctiveringdetection = ast_true(v->value); } else if (!strcasecmp(v->name, "distinctiveringaftercid")) { diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index 3bbf16192..a284520af 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -498,7 +498,7 @@ static int gtalk_ringing_ack(void *data, ikspak *pak) (redirect = iks_find_cdata(traversenodes, "redirect")) && (redirect = strstr(redirect, "xmpp:"))) { redirect += 5; - ast_log(LOG_DEBUG, "redirect %s\n", redirect); + ast_debug(1, "redirect %s\n", redirect); ast_copy_string(p->them, redirect, sizeof(p->them)); gtalk_invite(p, p->them, p->us, p->sid, 1); @@ -626,7 +626,7 @@ static int gtalk_is_answered(struct gtalk *client, ikspak *pak) char s1[BUFSIZ], s2[BUFSIZ], s3[BUFSIZ]; int peernoncodeccapability; - ast_log(LOG_DEBUG, "The client is %s\n", client->name); + ast_debug(1, "The client is %s\n", client->name); /* Make sure our new call does exist */ for (tmp = client->p; tmp; tmp = tmp->next) { @@ -701,7 +701,7 @@ static int gtalk_is_accepted(struct gtalk *client, ikspak *pak) struct gtalk_pvt *tmp; char *from; - ast_log(LOG_DEBUG, "The client is %s\n", client->name); + ast_debug(1, "The client is %s\n", client->name); /* find corresponding call */ for (tmp = client->p; tmp; tmp = tmp->next) { if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid)) { diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 49434d678..6087a823a 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1320,7 +1320,7 @@ static void network_change_event_cb(const struct ast_event *event, void *userdat /*! \brief Send manager event at call setup to link between Asterisk channel name and IAX2 call identifiers */ -static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt) +static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt) { manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: IAX2\r\nIAX2-callno-local: %d\r\nIAX2-callno-remote: %d\r\nIAX2-peer: %s\r\n", @@ -1477,7 +1477,7 @@ static int __schedule_action(void (*func)(const void *data), const void *data, c return 0; } time(&t); - if (t != lasterror) + if (t != lasterror) ast_debug(1, "Out of idle IAX2 threads for scheduling!\n"); lasterror = t; @@ -1890,9 +1890,7 @@ static int scheduled_destroy(const void *vid) unsigned short callno = PTR_TO_CALLNO(vid); ast_mutex_lock(&iaxsl[callno]); if (iaxs[callno]) { - if (option_debug) { - ast_log(LOG_DEBUG, "Really destroying %d now...\n", callno); - } + ast_debug(1, "Really destroying %d now...\n", callno); iax2_destroy(callno); } ast_mutex_unlock(&iaxsl[callno]); @@ -3399,11 +3397,11 @@ static int send_packet(struct iax_frame *f) /* Don't send if there was an error, but return error instead */ if (!callno || !iaxs[callno] || iaxs[callno]->error) return -1; - + /* Called with iaxsl held */ if (iaxdebug) ast_debug(3, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port)); - + if (f->transfer) { if (iaxdebug) iax_showframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr)); @@ -4106,21 +4104,21 @@ static int get_from_jb(const void *p); static void update_jbsched(struct chan_iax2_pvt *pvt) { int when; - + when = ast_tvdiff_ms(ast_tvnow(), pvt->rxcore); - + when = jb_next(pvt->jb) - when; if (when <= 0) { /* XXX should really just empty until when > 0.. */ when = 1; } - - pvt->jbid = iax2_sched_replace(pvt->jbid, sched, when, get_from_jb, + + pvt->jbid = iax2_sched_replace(pvt->jbid, sched, when, get_from_jb, CALLNO_TO_PTR(pvt->callno)); } -static void __get_from_jb(const void *p) +static void __get_from_jb(const void *p) { int callno = PTR_TO_CALLNO(p); struct chan_iax2_pvt *pvt = NULL; @@ -4220,7 +4218,7 @@ static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtr int needfree = 0; struct ast_channel *owner = NULL; struct ast_channel *bridge = NULL; - + /* Attempt to recover wrapped timestamps */ unwrap_timestamp(fr); @@ -5286,20 +5284,20 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout) return 0; } -static int iax2_hangup(struct ast_channel *c) +static int iax2_hangup(struct ast_channel *c) { unsigned short callno = PTR_TO_CALLNO(c->tech_pvt); - struct iax_ie_data ied; + struct iax_ie_data ied; int alreadygone; - memset(&ied, 0, sizeof(ied)); + memset(&ied, 0, sizeof(ied)); ast_mutex_lock(&iaxsl[callno]); if (callno && iaxs[callno]) { ast_debug(1, "We're hanging up %s now...\n", c->name); alreadygone = ast_test_flag64(iaxs[callno], IAX_ALREADYGONE); /* Send the hangup unless we have had a transmission error or are already gone */ - iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause); + iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause); if (!iaxs[callno]->error && !alreadygone) { - if (send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1)) { + if (send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1)) { ast_log(LOG_WARNING, "No final packet could be sent for callno %d\n", callno); } if (!iaxs[callno]) { @@ -5493,7 +5491,7 @@ static int iax2_start_transfer(unsigned short callno0, unsigned short callno1, i iax_ie_append_addr(&ied1, IAX_IE_APPARENT_ADDR, &iaxs[callno0]->addr); iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[callno0]->peercallno); iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, transferid); - + res = send_command(iaxs[callno0], AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos, -1); if (res) return -1; @@ -5728,7 +5726,7 @@ done: return res; } - + static int iax2_transfer(struct ast_channel *c, const char *dest) { unsigned short callno = PTR_TO_CALLNO(c->tech_pvt); @@ -5748,7 +5746,7 @@ static int iax2_transfer(struct ast_channel *c, const char *dest) ast_queue_control_data(c, AST_CONTROL_TRANSFER, &message, sizeof(message)); return send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1); } - + static int iax2_getpeertrunk(struct sockaddr_in sin) { struct iax2_peer *peer; @@ -5970,7 +5968,7 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str } else if (f->frametype == AST_FRAME_IAX) { genuine = 1; } else if (f->frametype == AST_FRAME_CNG) { - p->notsilenttx = 0; + p->notsilenttx = 0; } } if (ast_tvzero(p->offset)) { @@ -6161,7 +6159,7 @@ static int iax2_trunk_queue(struct chan_iax2_pvt *pvt, struct iax_frame *fr) struct iax2_trunk_peer *tpeer; void *tmp, *ptr; struct timeval now; - int res; + int res; struct ast_iax2_meta_trunk_entry *met; struct ast_iax2_meta_trunk_mini *mtm; @@ -6175,7 +6173,7 @@ static int iax2_trunk_queue(struct chan_iax2_pvt *pvt, struct iax_frame *fr) ast_mutex_unlock(&tpeer->lock); return -1; } - + tpeer->trunkdataalloc += DEFAULT_TRUNKDATA; tpeer->trunkdata = tmp; ast_debug(1, "Expanded trunk '%s:%d' to %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc); @@ -7531,7 +7529,7 @@ static int iax2_write(struct ast_channel *c, struct ast_frame *f) return res; } -static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno, +static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno, int now, int transfer, int final) { struct ast_frame f = { 0, }; @@ -7838,11 +7836,8 @@ static int raw_hangup(struct sockaddr_in *sin, unsigned short src, unsigned shor fh.type = AST_FRAME_IAX; fh.csub = compress_subclass(IAX_COMMAND_INVAL); iax_outputframe(NULL, &fh, 0, sin, 0); -#if 0 - if (option_debug) -#endif - ast_debug(1, "Raw Hangup %s:%d, src=%d, dst=%d\n", - ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), src, dst); + ast_debug(1, "Raw Hangup %s:%d, src=%d, dst=%d\n", + ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), src, dst); return sendto(sockfd, &fh, sizeof(fh), 0, (struct sockaddr *)sin, sizeof(*sin)); } @@ -9192,7 +9187,7 @@ static int send_trunk(struct iax2_trunk_peer *tpeer, struct timeval *now) calls = tpeer->calls; #if 0 ast_debug(1, "Trunking %d call chunks in %d bytes to %s:%d, ts=%d\n", calls, fr->datalen, ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), ntohl(mth->ts)); -#endif +#endif /* Reset transmit trunk side data */ tpeer->trunkdatalen = 0; tpeer->calls = 0; @@ -9238,11 +9233,11 @@ static int timing_read(int *id, int fd, short events, void *cbdata) drop = tpeer; } else { res = send_trunk(tpeer, &now); - trunk_timed++; + trunk_timed++; if (iaxtrunkdebug) ast_verbose(" - Trunk peer (%s:%d) has %d call chunk%s in transit, %d bytes backloged and has hit a high water mark of %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), res, (res != 1) ? "s" : "", tpeer->trunkdatalen, tpeer->trunkdataalloc); - } - totalcalls += res; + } + totalcalls += res; res = 0; ast_mutex_unlock(&tpeer->lock); } @@ -9261,7 +9256,6 @@ static int timing_read(int *id, int fd, short events, void *cbdata) ast_mutex_unlock(&drop->lock); ast_mutex_destroy(&drop->lock); ast_free(drop); - } if (iaxtrunkdebug) @@ -9424,16 +9418,16 @@ static int check_provisioning(struct sockaddr_in *sin, int sockfd, char *si, uns if (iax_provision_version(&ourver, rsi, 1)) return 0; ast_debug(1, "Service identifier '%s', we think '%08x', they think '%08x'\n", si, ourver, ver); - if (ourver != ver) + if (ourver != ver) iax2_provision(sin, sockfd, NULL, rsi, 1); return 0; } -static void construct_rr(struct chan_iax2_pvt *pvt, struct iax_ie_data *iep) +static void construct_rr(struct chan_iax2_pvt *pvt, struct iax_ie_data *iep) { jb_info stats; jb_getinfo(pvt->jb, &stats); - + memset(iep, 0, sizeof(*iep)); iax_ie_append_int(iep,IAX_IE_RR_JITTER, stats.jitter); @@ -9600,7 +9594,7 @@ static void defer_full_frame(struct iax2_thread *from_here, struct iax2_thread * if (!cur_pkt_buf) AST_LIST_INSERT_TAIL(&to_here->full_frames, pkt_buf, entry); - + ast_mutex_unlock(&to_here->lock); } @@ -10121,7 +10115,7 @@ static int socket_process(struct iax2_thread *thread) f.subclass.integer != IAX_COMMAND_TXCNT && /* for attended transfer */ f.subclass.integer != IAX_COMMAND_TXACC) { /* for attended transfer */ unsigned short new_peercallno; - + new_peercallno = (unsigned short) (ntohs(mh->callno) & ~IAX_FLAG_FULL); if (new_peercallno && new_peercallno != iaxs[fr->callno]->peercallno) { if (iaxs[fr->callno]->peercallno) { @@ -10172,14 +10166,14 @@ static int socket_process(struct iax2_thread *thread) (f.subclass.integer != IAX_COMMAND_TXACC) && (f.subclass.integer != IAX_COMMAND_VNAK)) || (f.frametype != AST_FRAME_IAX)) { - /* If it's not an ACK packet, it's out of order. */ - ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", + /* If it's not an ACK packet, it's out of order. */ + ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", iaxs[fr->callno]->iseqno, fr->oseqno, f.frametype, f.subclass.integer); /* Check to see if we need to request retransmission, * and take sequence number wraparound into account */ if ((unsigned char) (iaxs[fr->callno]->iseqno - fr->oseqno) < 128) { /* If we've already seen it, ack it XXX There's a border condition here XXX */ - if ((f.frametype != AST_FRAME_IAX) || + if ((f.frametype != AST_FRAME_IAX) || ((f.subclass.integer != IAX_COMMAND_ACK) && (f.subclass.integer != IAX_COMMAND_INVAL))) { ast_debug(1, "Acking anyway\n"); /* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if @@ -10214,7 +10208,7 @@ static int socket_process(struct iax2_thread *thread) /* Handle implicit ACKing unless this is an INVAL, and only if this is from the real peer, not the transfer peer */ - if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) && + if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) && ((f.subclass.integer != IAX_COMMAND_INVAL) || (f.frametype != AST_FRAME_IAX))) { unsigned char x; @@ -10222,7 +10216,7 @@ static int socket_process(struct iax2_thread *thread) /* First we have to qualify that the ACKed value is within our window */ if (iaxs[fr->callno]->rseqno >= iaxs[fr->callno]->oseqno || (fr->iseqno >= iaxs[fr->callno]->rseqno && fr->iseqno < iaxs[fr->callno]->oseqno)) x = fr->iseqno; - else + else x = iaxs[fr->callno]->oseqno; if ((x != iaxs[fr->callno]->oseqno) || (iaxs[fr->callno]->oseqno == fr->iseqno)) { /* The acknowledgement is within our window. Time to acknowledge everything @@ -10262,8 +10256,8 @@ static int socket_process(struct iax2_thread *thread) ast_debug(1, "Received iseqno %d not within window %d->%d\n", fr->iseqno, iaxs[fr->callno]->rseqno, iaxs[fr->callno]->oseqno); } } - if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) && - ((f.frametype != AST_FRAME_IAX) || + if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) && + ((f.frametype != AST_FRAME_IAX) || ((f.subclass.integer != IAX_COMMAND_TXACC) && (f.subclass.integer != IAX_COMMAND_TXCNT)))) { /* Only messages we accept from a transfer host are TXACC and TXCNT */ @@ -10942,7 +10936,7 @@ static int socket_process(struct iax2_thread *thread) } } /* Schedule the next cycle */ - if ((peer->lastms < 0) || (peer->historicms > peer->maxms)) + if ((peer->lastms < 0) || (peer->historicms > peer->maxms)) peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_peer_s, peer_ref(peer)); else peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqok, iax2_poke_peer_s, peer_ref(peer)); @@ -11498,12 +11492,12 @@ immediatedial: } /* Don't actually pass these frames along */ - if ((f.subclass.integer != IAX_COMMAND_ACK) && - (f.subclass.integer != IAX_COMMAND_TXCNT) && - (f.subclass.integer != IAX_COMMAND_TXACC) && + if ((f.subclass.integer != IAX_COMMAND_ACK) && + (f.subclass.integer != IAX_COMMAND_TXCNT) && + (f.subclass.integer != IAX_COMMAND_TXACC) && (f.subclass.integer != IAX_COMMAND_INVAL) && - (f.subclass.integer != IAX_COMMAND_VNAK)) { - if (iaxs[fr->callno] && iaxs[fr->callno]->aseqno != iaxs[fr->callno]->iseqno) + (f.subclass.integer != IAX_COMMAND_VNAK)) { + if (iaxs[fr->callno] && iaxs[fr->callno]->aseqno != iaxs[fr->callno]->iseqno) send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno); } ast_mutex_unlock(&iaxsl[fr->callno]); @@ -11804,12 +11798,12 @@ static int iax2_do_register(struct iax2_registry *reg) if (iaxdebug) ast_debug(1, "Sending registration request for '%s'\n", reg->username); - if (reg->dnsmgr && + if (reg->dnsmgr && ((reg->regstate == REG_STATE_TIMEOUT) || !ast_sockaddr_ipv4(®->addr))) { /* Maybe the IP has changed, force DNS refresh */ ast_dnsmgr_refresh(reg->dnsmgr); } - + /* * if IP has Changed, free allocated call to create a new one with new IP * call has the pointer to IP and must be updated to the new one @@ -11825,7 +11819,7 @@ static int iax2_do_register(struct iax2_registry *reg) if (iaxdebug) ast_debug(1, "Unable to send registration request for '%s' without IP address\n", reg->username); /* Setup the next registration attempt */ - reg->expire = iax2_sched_replace(reg->expire, sched, + reg->expire = iax2_sched_replace(reg->expire, sched, (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg); return -1; } @@ -11847,7 +11841,7 @@ static int iax2_do_register(struct iax2_registry *reg) ast_mutex_unlock(&iaxsl[reg->callno]); } /* Setup the next registration a little early */ - reg->expire = iax2_sched_replace(reg->expire, sched, + reg->expire = iax2_sched_replace(reg->expire, sched, (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg); /* Send the request */ memset(&ied, 0, sizeof(ied)); @@ -12266,7 +12260,7 @@ static int check_srcaddr(struct sockaddr *sa, socklen_t salen) { int sd; int res; - + sd = socket(AF_INET, SOCK_DGRAM, 0); if (sd < 0) { ast_log(LOG_ERROR, "Socket: %s\n", strerror(errno)); @@ -12344,7 +12338,7 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr) } } } - + peer->sockfd = sockfd; if (nonlocal == 1) { @@ -13991,7 +13985,7 @@ static int acf_channel_read(struct ast_channel *chan, const char *funcname, char } /*! \brief Part of the device state notification system ---*/ -static int iax2_devicestate(void *data) +static int iax2_devicestate(void *data) { struct parsed_dial_string pds; char *tmp = ast_strdupa(data); @@ -14005,7 +13999,7 @@ static int iax2_devicestate(void *data) ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", (char *) data); return res; } - + ast_debug(3, "Checking device state for device %s\n", pds.peer); /* SLD: FIXME: second call to find_peer during registration */ @@ -14015,14 +14009,14 @@ static int iax2_devicestate(void *data) res = AST_DEVICE_UNAVAILABLE; ast_debug(3, "iax2_devicestate: Found peer. What's device state of %s? addr=%d, defaddr=%d maxms=%d, lastms=%d\n", pds.peer, ast_sockaddr_ipv4(&p->addr), p->defaddr.sin_addr.s_addr, p->maxms, p->lastms); - + if ((ast_sockaddr_ipv4(&p->addr) || p->defaddr.sin_addr.s_addr) && (!p->maxms || ((p->lastms > -1) && (p->historicms <= p->maxms)))) { /* Peer is registered, or have default IP address and a valid registration */ if (p->historicms == 0 || p->historicms <= p->maxms) /* let the core figure out whether it is in use or not */ - res = AST_DEVICE_UNKNOWN; + res = AST_DEVICE_UNKNOWN; } peer_unref(p); @@ -14030,7 +14024,7 @@ static int iax2_devicestate(void *data) return res; } -static struct ast_switch iax2_switch = +static struct ast_switch iax2_switch = { name: "IAX2", description: "IAX Remote Dialplan Switch", diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 91bcf8703..91ee823a9 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -7233,9 +7233,9 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame { struct ast_frame *f; - if (tmp->dsp) { - f = ast_dsp_process(tmp->ast, tmp->dsp, frame); - } else { + if (tmp->dsp) { + f = ast_dsp_process(tmp->ast, tmp->dsp, frame); + } else { chan_misdn_log(0, tmp->bc->port, "No DSP-Path found\n"); return NULL; } @@ -7246,59 +7246,59 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame ast_debug(1, "Detected inband DTMF digit: %c\n", f->subclass.integer); - if (tmp->faxdetect && (f->subclass.integer == 'f')) { - /* Fax tone -- Handle and return NULL */ - if (!tmp->faxhandled) { - struct ast_channel *ast = tmp->ast; - tmp->faxhandled++; - chan_misdn_log(0, tmp->bc->port, "Fax detected, preparing %s for fax transfer.\n", ast->name); - tmp->bc->rxgain = 0; - isdn_lib_update_rxgain(tmp->bc); - tmp->bc->txgain = 0; - isdn_lib_update_txgain(tmp->bc); + if (tmp->faxdetect && (f->subclass.integer == 'f')) { + /* Fax tone -- Handle and return NULL */ + if (!tmp->faxhandled) { + struct ast_channel *ast = tmp->ast; + tmp->faxhandled++; + chan_misdn_log(0, tmp->bc->port, "Fax detected, preparing %s for fax transfer.\n", ast->name); + tmp->bc->rxgain = 0; + isdn_lib_update_rxgain(tmp->bc); + tmp->bc->txgain = 0; + isdn_lib_update_txgain(tmp->bc); #ifdef MISDN_1_2 *tmp->bc->pipeline = 0; #else - tmp->bc->ec_enable = 0; + tmp->bc->ec_enable = 0; #endif - isdn_lib_update_ec(tmp->bc); - isdn_lib_stop_dtmf(tmp->bc); - switch (tmp->faxdetect) { - case 1: - if (strcmp(ast->exten, "fax")) { - char *context; - char context_tmp[BUFFERSIZE]; - misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp)); - context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext) : context_tmp; + isdn_lib_update_ec(tmp->bc); + isdn_lib_stop_dtmf(tmp->bc); + switch (tmp->faxdetect) { + case 1: + if (strcmp(ast->exten, "fax")) { + char *context; + char context_tmp[BUFFERSIZE]; + misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp)); + context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext) : context_tmp; if (ast_exists_extension(ast, context, "fax", 1, S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { - ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast->name, context); - /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ - pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten); - if (ast_async_goto(ast, context, "fax", 1)) { - ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, context); + ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast->name, context); + /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ + pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten); + if (ast_async_goto(ast, context, "fax", 1)) { + ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, context); } - } else { - ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast->exten); + } else { + ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast->exten); } - } else { + } else { ast_debug(1, "Already in a fax extension, not redirecting\n"); } - break; - case 2: - ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast->name); - break; + break; + case 2: + ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast->name); + break; default: break; - } - } else { + } + } else { ast_debug(1, "Fax already handled\n"); } - } + } - if (tmp->ast_dsp && (f->subclass.integer != 'f')) { - chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass.integer); - } + if (tmp->ast_dsp && (f->subclass.integer != 'f')) { + chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass.integer); + } return f; } @@ -11988,7 +11988,7 @@ static int misdn_command_exec(struct ast_channel *chan, const char *data) return -1; } - ast_log(LOG_DEBUG, "%s(%s)\n", misdn_command_name, (char *) data); + ast_debug(1, "%s(%s)\n", misdn_command_name, (char *) data); parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(subcommand, parse); diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d9304b66e..f9cd26a23 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3136,9 +3136,9 @@ static int __sip_xmit(struct sip_pvt *p, struct ast_str *data, int len) if (res == -1) { switch (errno) { - case EBADF: /* Bad file descriptor - seems like this is generated when the host exist, but doesn't accept the UDP packet */ - case EHOSTUNREACH: /* Host can't be reached */ - case ENETDOWN: /* Interface down */ + case EBADF: /* Bad file descriptor - seems like this is generated when the host exist, but doesn't accept the UDP packet */ + case EHOSTUNREACH: /* Host can't be reached */ + case ENETDOWN: /* Interface down */ case ENETUNREACH: /* Network failure */ case ECONNREFUSED: /* ICMP port unreachable */ res = XMIT_ERROR; /* Don't bother with trying to transmit again */ @@ -4182,8 +4182,8 @@ static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data if (!p->pendinginvite) { /* We are up, and have no outstanding invite */ transmit_reinvite_with_sdp(p, FALSE, FALSE); } else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) { - ast_set_flag(&p->flags[0], SIP_NEEDREINVITE); - } + ast_set_flag(&p->flags[0], SIP_NEEDREINVITE); + } break; default: ast_log(LOG_WARNING, "Don't know how to send URI when state is %d!\n", chan->_state); @@ -4218,7 +4218,7 @@ static int sip_sendtext(struct ast_channel *ast, const char *text) if (debug) ast_verbose("Sending text %s on %s\n", text, ast->name); transmit_message_with_text(dialog, text); - return 0; + return 0; } /*! \brief Update peer object in realtime storage @@ -4348,18 +4348,17 @@ static void sip_destroy_peer(struct sip_peer *peer) dialog_unlink_all(peer->call, TRUE, TRUE); peer->call = dialog_unref(peer->call, "peer->call is being unset"); } - if (peer->mwipvt) { /* We have an active subscription, delete it */ dialog_unlink_all(peer->mwipvt, TRUE, TRUE); peer->mwipvt = dialog_unref(peer->mwipvt, "unreffing peer->mwipvt"); } - + if (peer->chanvars) { ast_variables_destroy(peer->chanvars); peer->chanvars = NULL; } - + register_peer_exten(peer, FALSE); ast_free_ha(peer->ha); ast_free_ha(peer->directmediaha); @@ -5296,9 +5295,9 @@ static void sip_registry_destroy(struct sip_registry *reg) reg->call = dialog_unref(reg->call, "unref reg->call"); /* reg->call = sip_destroy(reg->call); */ } - AST_SCHED_DEL(sched, reg->expire); + AST_SCHED_DEL(sched, reg->expire); AST_SCHED_DEL(sched, reg->timeout); - + ast_string_field_free_memory(reg); ast_atomic_fetchadd_int(®objs, -1); ast_dnsmgr_release(reg->dnsmgr); @@ -5806,7 +5805,7 @@ const char *hangup_cause2sip(int cause) return "488 Not Acceptable Here"; case AST_CAUSE_INTERWORKING: /* Unspecified Interworking issues */ return "500 Network error"; - + case AST_CAUSE_NOTDEFINED: default: ast_debug(1, "AST hangup cause %d (no match found in SIP)\n", cause); @@ -6055,7 +6054,7 @@ static void try_suggested_sip_codec(struct sip_pvt *p) ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because it is not shared by both ends.\n"); } else ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because of unrecognized/not configured codec (check allow/disallow in sip.conf): %s\n", codec); - return; + return; } /*! \brief sip_answer: Answer SIP call , send 200 OK on Invite @@ -6067,7 +6066,7 @@ static int sip_answer(struct ast_channel *ast) sip_pvt_lock(p); if (ast->_state != AST_STATE_UP) { - try_suggested_sip_codec(p); + try_suggested_sip_codec(p); ast_setstate(ast, AST_STATE_UP); ast_debug(1, "SIP answering channel: %s\n", ast->name); @@ -6613,14 +6612,14 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit needvideo = 1; else if (!ast_format_cap_is_empty(i->prefcaps)) needvideo = ast_format_cap_has_type(i->prefcaps, AST_FORMAT_TYPE_VIDEO); /* Outbound call */ - else + else needvideo = ast_format_cap_has_type(i->jointcaps, AST_FORMAT_TYPE_VIDEO); /* Inbound call */ } if (i->trtp) { if (!ast_format_cap_is_empty(i->prefcaps)) needtext = ast_format_cap_has_type(i->prefcaps, AST_FORMAT_TYPE_TEXT); /* Outbound call */ - else + else needtext = ast_format_cap_has_type(i->jointcaps, AST_FORMAT_TYPE_TEXT); /* Inbound call */ } @@ -7010,7 +7009,7 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p } } } - + return f; } @@ -7292,7 +7291,7 @@ struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *addr, /* Add to active dialog list */ ao2_t_link(dialogs, p, "link pvt into dialogs table"); - + ast_debug(1, "Allocating new SIP dialog for %s - %s (%s)\n", callid ? callid : p->callid, sip_methods[intended_method].text, p->rtp ? "With RTP" : "No RTP"); return p; } @@ -8426,7 +8425,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action } ast_debug(3, "Processing session-level SDP %c=%s... %s\n", type, value, (processed == TRUE)? "OK." : "UNSUPPORTED."); - } + } @@ -8888,7 +8887,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action ast_set_read_format(p->owner, &p->owner->readformat); ast_set_write_format(p->owner, &p->owner->writeformat); } - + if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && (!ast_sockaddr_isnull(sa) || !ast_sockaddr_isnull(vsa) || !ast_sockaddr_isnull(tsa) || !ast_sockaddr_isnull(isa)) && (!sendonly || sendonly == -1)) { ast_queue_control(p->owner, AST_CONTROL_UNHOLD); /* Activate a re-invite */ @@ -9821,14 +9820,14 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in int is_outbound = ast_test_flag(&p->flags[0], SIP_OUTGOING); /* Session direction */ memset(req, 0, sizeof(struct sip_request)); - + snprintf(p->lastmsg, sizeof(p->lastmsg), "Tx: %s", sip_methods[sipmethod].text); - + if (!seqno) { p->ocseq++; seqno = p->ocseq; } - + /* A CANCEL must have the same branch as the INVITE that it is canceling. */ if (sipmethod == SIP_CANCEL) { p->branch = p->invite_branch; @@ -9848,7 +9847,7 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in if (sipdebug) ast_debug(1, "Strict routing enforced for session %s\n", p->callid); } - + if (sipmethod == SIP_CANCEL) c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2); /* Use original URI */ else if (sipmethod == SIP_ACK) { @@ -9856,8 +9855,8 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in (we only have the contacturi on INVITEs) */ if (!ast_strlen_zero(p->okcontacturi)) c = is_strict ? p->route->hop : p->okcontacturi; - else - c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2); + else + c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2); } else if (!ast_strlen_zero(p->okcontacturi)) c = is_strict ? p->route->hop : p->okcontacturi; /* Use for BYE or REINVITE */ else if (!ast_strlen_zero(p->uri)) @@ -11124,7 +11123,7 @@ static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct s { struct sip_request resp; int seqno; - + if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) { ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq")); return -1; @@ -11723,17 +11722,17 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init, /* Strip of the starting " (if it's there) */ if (*headdup == '"') { - headdup++; + headdup++; } if ((content = strchr(headdup, ':'))) { *content++ = '\0'; content = ast_skip_blanks(content); /* Skip white space */ /* Strip the ending " (if it's there) */ - end = content + strlen(content) -1; + end = content + strlen(content) -1; if (*end == '"') { *end = '\0'; } - + add_header(&req, headdup, content); if (sipdebug) { ast_debug(1, "Adding SIP Header \"%s\" with content :%s: \n", headdup, content); @@ -12725,7 +12724,7 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char * if (!ast_strlen_zero(global_useragent)) add_header(&req, "User-Agent", global_useragent); - if (auth) { /* Add auth header */ + if (auth) { /* Add auth header */ add_header(&req, authheader, auth); } else if (!ast_strlen_zero(r->nonce)) { char digest[1024]; @@ -12804,7 +12803,7 @@ static int sip_notify_allocate(struct sip_pvt *p) static int transmit_refer(struct sip_pvt *p, const char *dest) { struct sip_request req = { - .headers = 0, + .headers = 0, }; char from[256]; const char *of; @@ -13533,7 +13532,7 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward /* We only want to create the route set the first time this is called */ p->route_persistent = 1; - + /* Build a tailq, then assign it to p->route when done. * If backwards, we add entries from the head so they end up * in reverse order. However, we do need to maintain a correct @@ -14770,7 +14769,7 @@ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *t } /* Search dialogs and find the match */ - + sip_pvt_ptr = ao2_t_find(dialogs, &tmp_dialog, OBJ_POINTER, "ao2_find of dialog in dialogs table"); if (sip_pvt_ptr) { /* Go ahead and lock it (and its owner) before returning */ @@ -14823,7 +14822,7 @@ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *t return NULL; } } - + if (totag) ast_debug(4, "Matched %s call - their tag is %s Our tag is %s\n", sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING", @@ -14948,7 +14947,7 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi } ast_copy_string(referdata->replaces_callid_totag, ptr, sizeof(referdata->replaces_callid_totag)); } - + if (from) { ptr = from + 9; if ((to = strchr(ptr, '&'))) { @@ -14959,14 +14958,14 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi } ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag)); } - + if (!sip_cfg.pedanticsipchecking) { ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s (No check of from/to tags)\n", referdata->replaces_callid ); } else { ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s F-tag: %s T-tag: %s\n", referdata->replaces_callid, referdata->replaces_callid_fromtag ? referdata->replaces_callid_fromtag : "<none>", referdata->replaces_callid_totag ? referdata->replaces_callid_totag : "<none>" ); } } - + if ((ptr = strchr(refer_to, '@'))) { /* Separate domain */ char *urioption = NULL, *domain; int bracket = 0; @@ -16274,7 +16273,7 @@ static int dialog_needdestroy(void *dialogobj, void *arg, int flags) sip_pvt_unlock(dialog); return 0; } - + if (dialog->vrtp && ast_rtp_instance_get_bridged(dialog->vrtp)) { ast_debug(2, "Bridge still active. Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text); sip_pvt_unlock(dialog); @@ -18326,16 +18325,16 @@ static int do_register_auth(struct sip_pvt *p, struct sip_request *req, enum sip memset(digest, 0, sizeof(digest)); if (reply_digest(p, req, header, SIP_REGISTER, digest, sizeof(digest))) { /* There's nothing to use for authentication */ - /* No digest challenge in request */ - if (sip_debug_test_pvt(p) && p->registry) - ast_verbose("No authentication challenge, sending blank registration to domain/host name %s\n", p->registry->hostname); - /* No old challenge */ + /* No digest challenge in request */ + if (sip_debug_test_pvt(p) && p->registry) + ast_verbose("No authentication challenge, sending blank registration to domain/host name %s\n", p->registry->hostname); + /* No old challenge */ return -1; } if (p->do_history) append_history(p, "RegistryAuth", "Try: %d", p->authtries); - if (sip_debug_test_pvt(p) && p->registry) - ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname); + if (sip_debug_test_pvt(p) && p->registry) + ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname); return transmit_register(p->registry, SIP_REGISTER, digest, respheader); } @@ -18465,28 +18464,28 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random()); - /* Check if we have separate auth credentials */ - if(!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */ - auth = find_realm_authentication(authl, p->realm); /* If not, global list */ + /* Check if we have separate auth credentials */ + if(!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */ + auth = find_realm_authentication(authl, p->realm); /* If not, global list */ - if (auth) { + if (auth) { ast_debug(3, "use realm [%s] from peer [%s][%s]\n", auth->username, p->peername, p->username); - username = auth->username; - secret = auth->secret; - md5secret = auth->md5secret; + username = auth->username; + secret = auth->secret; + md5secret = auth->md5secret; if (sipdebug) - ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid); - } else { - /* No authentication, use peer or register= config */ - username = p->authname; - secret = p->peersecret; - md5secret = p->peermd5secret; - } + ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid); + } else { + /* No authentication, use peer or register= config */ + username = p->authname; + secret = p->peersecret; + md5secret = p->peermd5secret; + } if (ast_strlen_zero(username)) /* We have no authentication */ return -1; - /* Calculate SIP digest response */ - snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret); + /* Calculate SIP digest response */ + snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret); snprintf(a2, sizeof(a2), "%s:%s", sip_methods[method].text, uri); if (!ast_strlen_zero(md5secret)) ast_copy_string(a1_hash, md5secret, sizeof(a1_hash)); @@ -18970,7 +18969,7 @@ static void check_pendings(struct sip_pvt *p) /* Perhaps there is an SD change INVITE outstanding */ transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, TRUE); } - ast_clear_flag(&p->flags[0], SIP_PENDINGBYE); + ast_clear_flag(&p->flags[0], SIP_PENDINGBYE); sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); } else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) { /* if we can't REINVITE, hold it for later */ @@ -18980,7 +18979,7 @@ static void check_pendings(struct sip_pvt *p) ast_debug(2, "Sending pending reinvite on '%s'\n", p->callid); /* Didn't get to reinvite yet, so do it now */ transmit_reinvite_with_sdp(p, (p->t38.state == T38_LOCAL_REINVITE ? TRUE : FALSE), FALSE); - ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE); + ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE); } } } @@ -19834,7 +19833,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, const char *res pvt_set_needdestroy(p, "received erroneous 200 response"); return 0; } - + r->regstate = REG_STATE_REGISTERED; r->regtime = ast_tvnow(); /* Reset time of last successful registration */ manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: SIP\r\nDomain: %s\r\nStatus: %s\r\n", r->hostname, regstate2str(r->regstate)); @@ -19850,7 +19849,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, const char *res /* Let this one hang around until we have all the responses */ sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); /* p->needdestroy = 1; */ - + /* set us up for re-registering * figure out how long we got registered for * according to section 6.13 of RFC, contact headers override @@ -20408,7 +20407,7 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc break; default: /* Errors without handlers */ if ((resp >= 100) && (resp < 200)) { - if (sipmethod == SIP_INVITE) { /* re-invite */ + if (sipmethod == SIP_INVITE) { /* re-invite */ if (!req->ignore && sip_cancel_destroy(p)) ast_log(LOG_WARNING, "Unable to cancel SIP destruction. Expect bad things.\n"); } @@ -20475,7 +20474,6 @@ static void *sip_park_thread(void *stuff) } res = ast_park_call(transferee, transferer, 0, d->parkexten, &ext); - #ifdef WHEN_WE_KNOW_THAT_THE_CLIENT_SUPPORTS_MESSAGE if (!res) { @@ -20622,14 +20620,14 @@ static void ast_quiet_chan(struct ast_channel *chan) static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target) { int res = 0; - struct ast_channel *peera = NULL, + struct ast_channel *peera = NULL, *peerb = NULL, *peerc = NULL, *peerd = NULL; /* We will try to connect the transferee with the target and hangup - all channels to the transferer */ + all channels to the transferer */ ast_debug(4, "Sip transfer:--------------------\n"); if (transferer->chan1) ast_debug(4, "-- Transferer to PBX channel: %s State %s\n", transferer->chan1->name, ast_state2str(transferer->chan1->_state)); @@ -20664,7 +20662,7 @@ static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target if (peera && peerb && peerc && (peerb != peerc)) { ast_quiet_chan(peera); /* Stop generators */ - ast_quiet_chan(peerb); + ast_quiet_chan(peerb); ast_quiet_chan(peerc); if (peerd) ast_quiet_chan(peerd); @@ -20783,7 +20781,7 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str *sep++ = '\0'; eventid = sep; } - + if (sipdebug) ast_debug(2, "Got NOTIFY Event: %s\n", event); @@ -20803,7 +20801,7 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str We are getting notifications on a call that we transfered We should hangup when we are getting a 200 OK in a sipfrag Check if we have an owner of this event */ - + /* Check the content type */ if (strncasecmp(get_header(req, "Content-Type"), "message/sipfrag", strlen("message/sipfrag"))) { /* We need a sipfrag */ @@ -22427,7 +22425,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int transmit_response(p, "202 Accepted", req); append_history(p, "Xfer", "Refer failed. Bad extension."); transmit_notify_with_sipfrag(p, seqno, "404 Not found", TRUE); - ast_clear_flag(&p->flags[0], SIP_GOTREFER); + ast_clear_flag(&p->flags[0], SIP_GOTREFER); if (req->debug) ast_debug(1, "SIP transfer to bad extension: %s\n", p->refer->refer_to); break; @@ -22665,7 +22663,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int if (p->owner) p->owner->hangupcause = AST_CAUSE_NORMAL_CLEARING; append_history(p, "Xfer", "Refer succeeded."); - ast_clear_flag(&p->flags[0], SIP_GOTREFER); + ast_clear_flag(&p->flags[0], SIP_GOTREFER); /* Do not hangup call, the other side do that when we say 200 OK */ /* We could possibly implement a timer here, auto congestion */ res = 0; @@ -22676,7 +22674,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int /* Failure of some kind */ p->refer->status = REFER_FAILED; transmit_notify_with_sipfrag(p, seqno, "503 Service Unavailable", TRUE); - ast_clear_flag(&p->flags[0], SIP_GOTREFER); + ast_clear_flag(&p->flags[0], SIP_GOTREFER); res = -1; } @@ -23481,12 +23479,12 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, int resubscribe = (p->subscribed != NONE) && !req->ignore; char *temp, *event; - if (p->initreq.headers) { + if (p->initreq.headers) { /* We already have a dialog */ if (p->initreq.method != SIP_SUBSCRIBE) { /* This is a SUBSCRIBE within another SIP dialog, which we do not support */ /* For transfers, this could happen, but since we haven't seen it happening, let us just refuse this */ - transmit_response(p, "403 Forbidden (within dialog)", req); + transmit_response(p, "403 Forbidden (within dialog)", req); /* Do not destroy session, since we will break the call if we do */ ast_debug(1, "Got a subscription within the context of another call, can't handle that - %s (Method %s)\n", p->callid, sip_methods[p->initreq.method].text); return 0; @@ -23502,7 +23500,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, if so, we don't have to check peer settings after auth, which saves a lot of processing */ if (!sip_cfg.allowsubscribe) { - transmit_response(p, "403 Forbidden (policy)", req); + transmit_response(p, "403 Forbidden (policy)", req); pvt_set_needdestroy(p, "forbidden"); return 0; } @@ -23543,7 +23541,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, if ( (strchr(eventheader, ';'))) { event = ast_strdupa(eventheader); /* Since eventheader is a const, we can't change it */ - temp = strchr(event, ';'); + temp = strchr(event, ';'); *temp = '\0'; /* Remove any options for now */ /* We might need to use them later :-) */ } else @@ -23695,7 +23693,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, while (!found_supported && !ast_strlen_zero(acceptheader)) { found_supported = strcmp(acceptheader, "application/simple-message-summary") ? 0 : 1; if (!found_supported && (option_debug > 2)) { - ast_log(LOG_DEBUG, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader); + ast_debug(1, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader); } acceptheader = __get_header(req, "Accept", &start); } @@ -24006,8 +24004,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct as /* New SIP request coming in (could be new request in existing SIP dialog as well...) - */ - + */ p->method = req->method; /* Find out which SIP method they are using */ ast_debug(4, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, cmd); @@ -24402,7 +24399,7 @@ static int handle_request_do(struct sip_request *req, struct ast_sockaddr *addr) /* Request failed */ ast_debug(1, "SIP message could not be handled, bad request: %-70.70s\n", p->callid[0] ? p->callid : "<no callid>"); } - + if (recount) ast_update_use_count(); @@ -25352,7 +25349,7 @@ static int sip_devicestate(void *data) if ((p = find_peer(host, NULL, FALSE, FINDALLDEVICES, TRUE, 0))) { if (!(ast_sockaddr_isnull(&p->addr) && ast_sockaddr_isnull(&p->defaddr))) { /* we have an address for the peer */ - + /* Check status in this order - Hold - Ringing @@ -25565,7 +25562,7 @@ static struct ast_channel *sip_request_call(const char *type, struct ast_format_ ao2_t_unlink(dialogs, p, "About to change the callid -- remove the old name"); build_callid_pvt(p); ao2_t_link(dialogs, p, "Linking in under new name"); - + /* We have an extension to call, don't use the full contact here */ /* This to enable dialing registered peers with extension dialling, like SIP/peername/extension @@ -25850,7 +25847,7 @@ static int add_sip_domain(const char *domain, const enum domain_mode mode, const AST_LIST_INSERT_TAIL(&domain_list, d, list); AST_LIST_UNLOCK(&domain_list); - if (sipdebug) + if (sipdebug) ast_debug(1, "Added local SIP domain '%s'\n", domain); return 1; @@ -25869,7 +25866,7 @@ static int check_sip_domain(const char *domain, char *context, size_t len) if (len && !ast_strlen_zero(d->context)) ast_copy_string(context, d->context, len); - + result = 1; break; } @@ -27093,7 +27090,7 @@ static int reload_config(enum channelreloadreason reason) sip_cfg.allowguest = ast_true(v->value) ? 1 : 0; } else if (!strcasecmp(v->name, "realm")) { ast_copy_string(sip_cfg.realm, v->value, sizeof(sip_cfg.realm)); - } else if (!strcasecmp(v->name, "domainsasrealm")) { + } else if (!strcasecmp(v->name, "domainsasrealm")) { sip_cfg.domainsasrealm = ast_true(v->value); } else if (!strcasecmp(v->name, "useragent")) { ast_copy_string(global_useragent, v->value, sizeof(global_useragent)); @@ -27685,7 +27682,7 @@ static int reload_config(enum channelreloadreason reason) STANDARD_TLS_PORT); } ast_tcptls_server_start(&sip_tls_desc); - if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) { + if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) { ast_log(LOG_ERROR, "TLS Server start failed. Not listening on TLS socket.\n"); sip_tls_desc.tls_cfg = NULL; } @@ -27911,7 +27908,7 @@ static struct ast_udptl *sip_get_udptl_peer(struct ast_channel *chan) static int sip_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl) { struct sip_pvt *p; - + p = chan->tech_pvt; if (!p) { return -1; @@ -28231,7 +28228,7 @@ static int sip_removeheader(struct ast_channel *chan, const char *data) { struct ast_var_t *newvariable; struct varshead *headp; - int removeall = 0; + int removeall = 0; char *inbuf = (char *) data; if (ast_strlen_zero(inbuf)) { @@ -28450,7 +28447,7 @@ static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struc static int sip_do_reload(enum channelreloadreason reason) { time_t start_poke, end_poke; - + reload_config(reason); ast_sched_dump(sched); @@ -28469,7 +28466,7 @@ static int sip_do_reload(enum channelreloadreason reason) sip_send_all_mwi_subscriptions(); end_poke = time(0); - + ast_debug(4, "do_reload finished. peer poke/prune reg contact time = %d sec.\n", (int)(end_poke-start_poke)); ast_debug(4, "--------------- SIP reload done\n"); @@ -28480,7 +28477,7 @@ static int sip_do_reload(enum channelreloadreason reason) /*! \brief Force reload of module from cli */ static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - + switch (cmd) { case CLI_INIT: e->command = "sip reload"; diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 3eb76820c..3d485fff3 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -4454,7 +4454,7 @@ static int skinny_transfer(struct skinny_subchannel *sub) struct skinny_subchannel *xferor; /* the sub doing the transferring */ struct skinny_subchannel *xferee; /* the sub being transferred */ struct ast_tone_zone_sound *ts = NULL; - + if (ast_bridged_channel(sub->owner) || ast_bridged_channel(sub->related->owner)) { if (sub->xferor) { xferor = sub; @@ -4463,7 +4463,7 @@ static int skinny_transfer(struct skinny_subchannel *sub) xferor = sub; xferee = sub->related; } - + if (skinnydebug) { ast_debug(1, "Transferee channels (local/remote): %s and %s\n", xferee->owner->name, ast_bridged_channel(xferee->owner)?ast_bridged_channel(xferee->owner)->name:""); @@ -4508,9 +4508,8 @@ static int skinny_transfer(struct skinny_subchannel *sub) } return 0; } else { - if (option_debug) - ast_log(LOG_DEBUG, "Neither %s nor %s are in a bridge, nothing to transfer\n", - xferor->owner->name, xferee->owner->name); + ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n", + xferor->owner->name, xferee->owner->name); } } return 0; @@ -5410,7 +5409,7 @@ static int handle_offhook_message(struct skinny_req *req, struct skinnysession * } else { /* Not ideal, but let's send updated time at onhook and offhook, as it clears the display */ transmit_definetimedate(d); - + if (sub && sub->owner) { ast_debug(1, "Current sub [%s] already has owner\n", sub->owner->name); } else { @@ -6402,7 +6401,7 @@ static int get_input(struct skinnysession *s) } else if (res != 4) { ast_log(LOG_WARNING, "Skinny Client sent less data than expected. Expected 4 but got %d.\n", res); ast_mutex_unlock(&s->lock); - + if (res == 0) { if (skinnydebug) ast_verb(1, "Skinny Client was lost, unregistering\n"); @@ -6492,9 +6491,9 @@ static void *skinny_session(void *data) } ast_debug(3, "Skinny Session returned: %s\n", strerror(errno)); - if (s) + if (s) destroy_session(s); - + return 0; } diff --git a/channels/sig_pri.c b/channels/sig_pri.c index cc3214a8b..e66068bca 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -913,7 +913,7 @@ struct ast_channel *sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law { struct ast_channel *ast; - ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel); + ast_debug(1, "%s %d\n", __FUNCTION__, p->channel); p->outgoing = 1; ast = sig_pri_new_ast_channel(p, AST_STATE_RESERVED, law, transfercapability, p->exten, requestor); @@ -1594,7 +1594,7 @@ static void *pri_ss_thread(void *data) timeout = pri_gendigittimeout; res = ast_waitfordigit(chan, timeout); if (res < 0) { - ast_log(LOG_DEBUG, "waitfordigit returned < 0...\n"); + ast_debug(1, "waitfordigit returned < 0...\n"); ast_hangup(chan); return NULL; } else if (res) { @@ -1666,7 +1666,7 @@ static void *pri_ss_thread(void *data) ast_log(LOG_WARNING, "PBX exited non-zero!\n"); } } else { - ast_log(LOG_DEBUG, "No such possible extension '%s' in context '%s'\n", exten, chan->context); + ast_debug(1, "No such possible extension '%s' in context '%s'\n", exten, chan->context); chan->hangupcause = AST_CAUSE_UNALLOCATED; ast_hangup(chan); p->exten[0] = '\0'; @@ -3471,7 +3471,7 @@ static void sig_pri_send_aoce_termination_request(struct sig_pri_span *pri, int pvt->waiting_for_aoce = 1; ast_channel_setwhentohangup_tv(pvt->owner, whentohangup); - ast_log(LOG_DEBUG, "Delaying hangup on %s for aoc-e msg\n", pvt->owner->name); + ast_debug(1, "Delaying hangup on %s for aoc-e msg\n", pvt->owner->name); cleanup_termination_request: ast_channel_unlock(pvt->owner); @@ -6776,7 +6776,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast) const char *useruser = pbx_builtin_getvar_helper(ast, "USERUSERINFO"); #endif - ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel); + ast_debug(1, "%s %d\n", __FUNCTION__, p->channel); if (!ast->tech_pvt) { ast_log(LOG_WARNING, "Asked to hangup channel not connected\n"); return 0; @@ -6805,7 +6805,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast) sig_pri_moh_fsm_event(ast, p, SIG_PRI_MOH_EVENT_RESET); if (p->call) { if (p->alreadyhungup) { - ast_log(LOG_DEBUG, "Already hungup... Calling hangup once, and clearing call\n"); + ast_debug(1, "Already hungup... Calling hangup once, and clearing call\n"); #ifdef SUPPORT_USERUSER pri_call_set_useruser(p->call, useruser); @@ -6821,7 +6821,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast) } else { const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE"); int icause = ast->hangupcause ? ast->hangupcause : -1; - ast_log(LOG_DEBUG, "Not yet hungup... Calling hangup once with icause, and clearing call\n"); + ast_debug(1, "Not yet hungup... Calling hangup once with icause, and clearing call\n"); #ifdef SUPPORT_USERUSER pri_call_set_useruser(p->call, useruser); @@ -6976,7 +6976,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i struct ast_flags opts; char *opt_args[OPT_ARG_ARRAY_SIZE]; - ast_log(LOG_DEBUG, "CALLER NAME: %s NUM: %s\n", + ast_debug(1, "CALLER NAME: %s NUM: %s\n", S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, "")); @@ -7438,7 +7438,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi } break; case AST_CONTROL_PROCEEDING: - ast_debug(1,"Received AST_CONTROL_PROCEEDING on %s\n",chan->name); + ast_debug(1, "Received AST_CONTROL_PROCEEDING on %s\n",chan->name); if (p->call_level < SIG_PRI_CALL_LEVEL_PROCEEDING && !p->outgoing) { p->call_level = SIG_PRI_CALL_LEVEL_PROCEEDING; if (p->pri && p->pri->pri) { @@ -7458,7 +7458,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi res = 0; break; case AST_CONTROL_PROGRESS: - ast_debug(1,"Received AST_CONTROL_PROGRESS on %s\n",chan->name); + ast_debug(1, "Received AST_CONTROL_PROGRESS on %s\n",chan->name); sig_pri_set_digital(p, 0); /* Digital-only calls isn't allowing any inband progress messages */ if (!p->progress && p->call_level < SIG_PRI_CALL_LEVEL_ALERTING && !p->outgoing && !p->no_b_channel) { @@ -7640,7 +7640,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi * and initiate the softhangup since the delay is no longer necessary */ if (p->waiting_for_aoce) { p->waiting_for_aoce = 0; - ast_log(LOG_DEBUG, + ast_debug(1, "Received final AOC-E msg, continue with hangup on %s\n", chan->name); ast_softhangup_nolock(chan, AST_SOFTHANGUP_DEV); @@ -8349,7 +8349,7 @@ int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channe sig_pri_lock_private(p); if (!p->pri || !p->call) { - ast_log(LOG_DEBUG, "Unable to find pri or call on channel!\n"); + ast_debug(1, "Unable to find pri or call on channel!\n"); sig_pri_unlock_private(p); return -1; } @@ -8358,7 +8358,7 @@ int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channe res = pri_callrerouting_facility(p->pri->pri, p->call, destination, original, reason); pri_rel(p->pri); } else { - ast_log(LOG_DEBUG, "Unable to grab pri to send callrerouting facility on span %d!\n", p->pri->span); + ast_debug(1, "Unable to grab pri to send callrerouting facility on span %d!\n", p->pri->span); } sig_pri_unlock_private(p); |