--- /usr/src/asterisk-1.4.33-rc1/channels/chan_sip.c 2010-06-01 17:57:49.000000000 +0300 +++ /usr/src/asterisk-1.4.33-rc1_patched/channels/chan_sip.c 2010-06-29 16:23:38.000000000 +0300 @@ -15966,7 +15968,12 @@ struct ast_channel *c=NULL; int res; struct ast_channel *bridged_to; - + + struct sip_pvt *pb; + char *baudioqos; + char leg1_data[1024] = ""; + char leg2_data[1024] = ""; + /* If we have an INCOMING invite that we haven't answered, terminate that transaction */ if (p->pendinginvite && !ast_test_flag(&p->flags[0], SIP_OUTGOING) && !ast_test_flag(req, SIP_PKT_IGNORE)) transmit_response_reliable(p, "487 Request Terminated", &p->initreq); @@ -15988,6 +15995,39 @@ append_history(p, "RTCPaudio", "Quality:%s", audioqos); if (p->owner) pbx_builtin_setvar_helper(p->owner, "RTPAUDIOQOS", audioqos); + + + sprintf(leg1_data, "%s|%s|%s|%s|%s|%s|%s|%i|%s|%s|%s|%s|%s|", p->owner->uniqueid, p->owner->accountcode, p->owner->tech->type, ast_getformatname(p->owner->nativeformats & AST_FORMAT_AUDIO_MASK), ast_getformatname(p->owner->readformat), ast_getformatname(p->owner->writeformat), p->owner->language, p->owner->hangupcause, p->sa.sin_addr.s_addr ? ast_inet_ntoa(p->sa.sin_addr) : "", p->recv.sin_addr.s_addr ? ast_inet_ntoa(p->recv.sin_addr) : "", p->from, p->uri, p->useragent); + pbx_builtin_setvar_helper(p->owner, "LEG1DATA", leg1_data); + + c = p->owner; + if (c) { + bridged_to = ast_bridged_channel(c); + if (bridged_to) { + pbx_builtin_setvar_helper(bridged_to, "RTPAUDIOQOS", audioqos); + pbx_builtin_setvar_helper(bridged_to, "LEG1DATA", leg1_data); + + if (bridged_to->cdr) { + + pb = bridged_to->tech_pvt; + + if (pb) { + sprintf(leg2_data, "%s|%s|%s|%s|%s|%s|%s|%i|%s|%s|%s|%s|%s|", bridged_to->uniqueid, bridged_to->accountcode, bridged_to->tech->type, ast_getformatname(bridged_to->nativeformats & AST_FORMAT_AUDIO_MASK), ast_getformatname(bridged_to->readformat), ast_getformatname(bridged_to->writeformat), bridged_to->language, bridged_to->hangupcause, pb->sa.sin_addr.s_addr ? ast_inet_ntoa(pb->sa.sin_addr) : "", pb->recv.sin_addr.s_addr ? ast_inet_ntoa(pb->recv.sin_addr) : "", pb->from, pb->uri, pb->useragent); + pbx_builtin_setvar_helper(p->owner, "LEG2DATA", leg2_data); + pbx_builtin_setvar_helper(bridged_to, "LEG2DATA", leg2_data); + } + + if ((pb) && (!strcmp(bridged_to->tech->type, "SIP")) && (pb->rtp)) { + baudioqos = ast_rtp_get_quality(pb->rtp, NULL); + pbx_builtin_setvar_helper(p->owner, "BRTPAUDIOQOS", baudioqos); + pbx_builtin_setvar_helper(bridged_to, "BRTPAUDIOQOS", baudioqos); + } + + } + + } + } + } if (p->vrtp) { videoqos = ast_rtp_get_quality(p->vrtp, NULL);