diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a27780408059f874aeb910f568036fc2f10ff9b1..1930e3cd21b6961a39140f86182e6b6cc3e1cb1a 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2968,6 +2968,14 @@ static int sip_hangup(struct ast_channel *ast) if (!p->pendinginvite) { /* Send a hangup */ transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1); + + /* Get RTCP quality before end of call */ + if (recordhistory) { + if (p->rtp) + append_history(p, "RTCPaudio", "Quality:%s", ast_rtp_get_quality(p->rtp)); + if (p->vrtp) + append_history(p, "RTCPvideo", "Quality:%s", ast_rtp_get_quality(p->vrtp)); + } } else { /* Note we will need a BYE when this all settles out but we can't send one while we have "INVITE" outstanding. */ @@ -3665,14 +3673,15 @@ static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *si if (intended_method != SIP_OPTIONS) /* Peerpoke has it's own system */ p->timer_t1 = 500; /* Default SIP retransmission timer T1 (RFC 3261) */ + if (sin) { p->sa = *sin; if (ast_sip_ouraddrfor(&p->sa.sin_addr,&p->ourip)) p->ourip = __ourip; - } else { + } else p->ourip = __ourip; - } - + + /* Copy global flags to this PVT at setup. */ ast_copy_flags(&p->flags[0], &global_flags[0], SIP_FLAGS_TO_COPY); ast_copy_flags(&p->flags[1], &global_flags[1], SIP_PAGE2_FLAGS_TO_COPY); @@ -3682,6 +3691,7 @@ static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *si if (sip_methods[intended_method].need_rtp) { p->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr); + /* If the global videosupport flag is on, we always create a RTP interface for video */ if (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT)) p->vrtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr); if (!p->rtp || (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) && !p->vrtp)) { @@ -9551,7 +9561,7 @@ void sip_dump_history(struct sip_pvt *dialog) ast_log(LOG_DEBUG, " * SIP Call\n"); if (dialog->history) AST_LIST_TRAVERSE(dialog->history, hist, list) - ast_log(LOG_DEBUG, " %d. %s\n", ++x, hist->event); + ast_log(LOG_DEBUG, " %-3.3d. %s\n", ++x, hist->event); if (!x) ast_log(LOG_DEBUG, "Call '%s' has no history\n", dialog->callid); ast_log(LOG_DEBUG, "\n---------- END SIP HISTORY for '%s' \n", dialog->callid); @@ -12626,6 +12636,14 @@ static int handle_request_bye(struct sip_pvt *p, struct sip_request *req) copy_request(&p->initreq, req); check_via(p, req); ast_set_flag(&p->flags[0], SIP_ALREADYGONE); + + /* Get RTCP quality before end of call */ + if (recordhistory) { + if (p->rtp) + append_history(p, "RTCPaudio", "Quality:%s", ast_rtp_get_quality(p->rtp)); + if (p->vrtp) + append_history(p, "RTCPvideo", "Quality:%s", ast_rtp_get_quality(p->vrtp)); + } if (p->rtp) { /* Immediately stop RTP */ ast_rtp_stop(p->rtp); @@ -13700,6 +13718,8 @@ static struct ast_channel *sip_request_call(const char *type, int format, void * if (create_addr(p, host)) { *cause = AST_CAUSE_UNREGISTERED; + if (option_debug > 2) + ast_log(LOG_DEBUG, "Cant create SIP call - target device not registred\n"); sip_destroy(p); return NULL; } diff --git a/rtp.c b/rtp.c index d1c7a51be0c05af0da8821686cd9d94ab51e22f4..54fa5e61066dc4832d5b683bd14da3853ede3016 100644 --- a/rtp.c +++ b/rtp.c @@ -428,7 +428,7 @@ static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *dat attr = (struct stun_attr *)data; if (ntohs(attr->len) > len) { if (option_debug) - ast_log(LOG_DEBUG, "Inconsistant Attribute (length %d exceeds remaining msg len %zd)\n", ntohs(attr->len), len); + ast_log(LOG_DEBUG, "Inconsistent Attribute (length %d exceeds remaining msg len %zd)\n", ntohs(attr->len), len); break; } if (stun_process_attr(&st, attr)) { @@ -1063,7 +1063,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) rtp->themssrc = ntohl(rtpheader[2]); /* Record their SSRC to put in future RR */ if (rtp_debug_test_addr(&sin)) - ast_verbose("Got RTP packet from %s:%d (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", + ast_verbose("Got RTP packet from %s:%d (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp,res - hdrlen); rtpPT = ast_rtp_lookup_pt(rtp, payloadtype); @@ -1086,7 +1086,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) event_end >>= 24; duration = ntohl(*((unsigned int *)(data))); duration &= 0xFFFF; - ast_verbose("Got rfc2833 RTP packet from %s:%d (type %d, seq %d, ts %d, len %d, mark %d, event %08x, end %d, duration %d) \n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); + ast_verbose("Got RTP RFC2833 from %s:%d (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); } if (rtp->lasteventseqn <= seqno || rtp->resp == 0 || (rtp->lasteventseqn >= 65530 && seqno <= 6)) { f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno); @@ -2290,7 +2290,7 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec } if (rtp_debug_test_addr(&rtp->them)) - ast_verbose("Sent RTP packet to %s:%d (type %d, seq %u, ts %u, len %u)\n", + ast_verbose("Sent RTP packet to %s:%d (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr), ntohs(rtp->them.sin_port), codec, rtp->seqno, rtp->lastts,res - hdrlen); }