- RTP debug message formatting

- Add rtcp report to SIP history


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@33371 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Olle Johansson
2006-06-09 21:09:42 +00:00
parent 8d88bf549d
commit 6d4ab87321
2 changed files with 28 additions and 8 deletions

View File

@@ -2968,6 +2968,14 @@ static int sip_hangup(struct ast_channel *ast)
if (!p->pendinginvite) { if (!p->pendinginvite) {
/* Send a hangup */ /* Send a hangup */
transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1); 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 { } else {
/* Note we will need a BYE when this all settles out /* Note we will need a BYE when this all settles out
but we can't send one while we have "INVITE" outstanding. */ 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 */ if (intended_method != SIP_OPTIONS) /* Peerpoke has it's own system */
p->timer_t1 = 500; /* Default SIP retransmission timer T1 (RFC 3261) */ p->timer_t1 = 500; /* Default SIP retransmission timer T1 (RFC 3261) */
if (sin) { if (sin) {
p->sa = *sin; p->sa = *sin;
if (ast_sip_ouraddrfor(&p->sa.sin_addr,&p->ourip)) if (ast_sip_ouraddrfor(&p->sa.sin_addr,&p->ourip))
p->ourip = __ourip; p->ourip = __ourip;
} else { } else
p->ourip = __ourip; 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[0], &global_flags[0], SIP_FLAGS_TO_COPY);
ast_copy_flags(&p->flags[1], &global_flags[1], SIP_PAGE2_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) { if (sip_methods[intended_method].need_rtp) {
p->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr); 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)) if (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT))
p->vrtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr); 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)) { 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"); ast_log(LOG_DEBUG, " * SIP Call\n");
if (dialog->history) if (dialog->history)
AST_LIST_TRAVERSE(dialog->history, hist, list) 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) if (!x)
ast_log(LOG_DEBUG, "Call '%s' has no history\n", dialog->callid); 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); 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); copy_request(&p->initreq, req);
check_via(p, req); check_via(p, req);
ast_set_flag(&p->flags[0], SIP_ALREADYGONE); 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) { if (p->rtp) {
/* Immediately stop RTP */ /* Immediately stop RTP */
ast_rtp_stop(p->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)) { if (create_addr(p, host)) {
*cause = AST_CAUSE_UNREGISTERED; *cause = AST_CAUSE_UNREGISTERED;
if (option_debug > 2)
ast_log(LOG_DEBUG, "Cant create SIP call - target device not registred\n");
sip_destroy(p); sip_destroy(p);
return NULL; return NULL;
} }

8
rtp.c
View File

@@ -428,7 +428,7 @@ static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *dat
attr = (struct stun_attr *)data; attr = (struct stun_attr *)data;
if (ntohs(attr->len) > len) { if (ntohs(attr->len) > len) {
if (option_debug) 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; break;
} }
if (stun_process_attr(&st, attr)) { 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 */ rtp->themssrc = ntohl(rtpheader[2]); /* Record their SSRC to put in future RR */
if (rtp_debug_test_addr(&sin)) 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); 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); rtpPT = ast_rtp_lookup_pt(rtp, payloadtype);
@@ -1086,7 +1086,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
event_end >>= 24; event_end >>= 24;
duration = ntohl(*((unsigned int *)(data))); duration = ntohl(*((unsigned int *)(data)));
duration &= 0xFFFF; 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)) { 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); 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)) 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); ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr), ntohs(rtp->them.sin_port), codec, rtp->seqno, rtp->lastts,res - hdrlen);
} }