Patch to filter codec via cisco vsa radius attribute,
like Cisco-AVPair = "h323-ivr-in=codec-disable:g711Ulaw64k;g729;g711Alaw64k;gsmFullRate;g729AnnexA;"
codec names from H245_AudioCapability class from h245.h without e_ prefix.
diff -c openh323gk/ProxyChannel.cxx openh323gk_p/ProxyChannel.cxx
*** openh323gk/ProxyChannel.cxx Mon Apr 20 21:01:22 2009
--- openh323gk_p/ProxyChannel.cxx Mon May 11 11:31:46 2009
***************
*** 1155,1160 ****
--- 1155,1161 ----
bool CallSignalSocket::HandleH245Mesg(PPER_Stream & strm, bool & suppress)
{
+ bool carchen = false;
H245_MultimediaSystemControlMessage h245msg;
if (!h245msg.Decode(strm)) {
PTRACE(3, "H245\tERROR DECODING H.245 from " << GetName());
***************
*** 1162,1168 ****
}
PTRACE(4, "H245\tReceived from " << GetName() << ": " << setprecision(2) << h245msg);
!
if (h245msg.GetTag() == H245_MultimediaSystemControlMessage::e_request
&& ((H245_RequestMessage&)h245msg).GetTag() == H245_RequestMessage::e_openLogicalChannel) {
H245_OpenLogicalChannel &olc = (H245_RequestMessage&)h245msg;
--- 1163,1169 ----
}
PTRACE(4, "H245\tReceived from " << GetName() << ": " << setprecision(2) << h245msg);
!
if (h245msg.GetTag() == H245_MultimediaSystemControlMessage::e_request
&& ((H245_RequestMessage&)h245msg).GetTag() == H245_RequestMessage::e_openLogicalChannel) {
H245_OpenLogicalChannel &olc = (H245_RequestMessage&)h245msg;
***************
*** 1212,1218 ****
}
}
! if (!m_h245handler || !m_h245handler->HandleMesg(h245msg, suppress))
return false;
strm.BeginEncoding();
--- 1213,1256 ----
}
}
!
!
! if (h245msg.GetTag() == H245_MultimediaSystemControlMessage::e_request
! && ((H245_RequestMessage&)h245msg).GetTag() == H245_RequestMessage::e_terminalCapabilitySet) {
!
! H245_TerminalCapabilitySet &tcs = (H245_RequestMessage&)h245msg;
!
! H245_ArrayOf_CapabilityTableEntry & CapabilityTables = tcs.m_capabilityTable;
! for (PINDEX i = 0; i < CapabilityTables.GetSize(); i++) {
! PTRACE(4, "CapabilityTable: " << setprecision(2) << CapabilityTables[i]);
! int cten = CapabilityTables[i].m_capabilityTableEntryNumber.GetValue();
! H245_Capability & H245Capability = CapabilityTables[i].m_capability;
! if (H245Capability.GetTag() == H245_Capability::e_receiveAudioCapability ){
! H245_AudioCapability &H245AudioCapability = (H245_Capability&)H245Capability;
! if (m_call->GetDisableCodec().Find(H245AudioCapability.GetTagName()+";",0) != P_MAX_INDEX){
! PTRACE(4, "Delete Carability");
! carchen = true;
! CapabilityTables.RemoveAt(i);
! i--;
! H245_ArrayOf_CapabilityDescriptor & CapabilityDescriptor = tcs.m_capabilityDescriptors;
! for (PINDEX n = 0; n < CapabilityDescriptor.GetSize(); n++){
! H245_ArrayOf_AlternativeCapabilitySet & AlternativeCapabilitySet = CapabilityDescriptor[n].m_simultaneousCapabilities;
! for (PINDEX j = 0; j < AlternativeCapabilitySet.GetSize(); j++){
! for (PINDEX m = 0; m < AlternativeCapabilitySet[j].GetSize(); m++){
! if (cten == AlternativeCapabilitySet[j][m].GetValue()){
! PTRACE(4, "Capability Descriptors Number");
! AlternativeCapabilitySet[j].RemoveAt(m);
! }
! }
! }
! }
! }
! }
! }
! PTRACE(4, "New Capability Table: " << setprecision(2) << tcs);
! }
!
! if ((!m_h245handler || !m_h245handler->HandleMesg(h245msg, suppress)) && !carchen)
return false;
strm.BeginEncoding();
***************
*** 2124,2129 ****
--- 2162,2170 ----
return;
}
+ if (!rejectCall && strlen(authData.m_disablecodecs) > 0)
+ m_call->SetDisableCodec(authData.m_disablecodecs);
+
// perform outbound rewrite
PIPSocket::Address calleeAddr;
WORD calleePort = 0;
***************
*** 3226,3233 ****
bool CallSignalSocket::OnFastStart(H225_ArrayOf_PASN_OctetString & fastStart, bool fromCaller)
{
bool changed = false;
! PINDEX sz = fastStart.GetSize();
! for (PINDEX i = 0; i < sz; ++i) {
PPER_Stream strm = fastStart[i].GetValue();
H245_OpenLogicalChannel olc;
if (!olc.Decode(strm)) {
--- 3267,3273 ----
bool CallSignalSocket::OnFastStart(H225_ArrayOf_PASN_OctetString & fastStart, bool fromCaller)
{
bool changed = false;
! for (PINDEX i = 0; i < fastStart.GetSize(); ++i) {
PPER_Stream strm = fastStart[i].GetValue();
H245_OpenLogicalChannel olc;
if (!olc.Decode(strm)) {
***************
*** 3235,3240 ****
--- 3275,3301 ----
return false;
}
PTRACE(4, "Q931\nfastStart[" << i << "] received: " << setprecision(2) << olc);
+
+ if (olc.m_forwardLogicalChannelParameters.m_dataType.GetTag() == H245_DataType::e_audioData && olc.m_forwardLogicalChannelParameters.m_dataType.GetTag() != H245_DataType::e_nullData){
+ H245_AudioCapability & ac = (H245_DataType&)olc.m_forwardLogicalChannelParameters.m_dataType;
+ if (m_call->GetDisableCodec().Find(ac.GetTagName()+";",0) != P_MAX_INDEX){
+ PTRACE(4, "Delete Forward Logical Channel");
+ fastStart.RemoveAt(i);
+ i--;
+ continue;
+ }
+ }
+
+ if (olc.m_reverseLogicalChannelParameters.m_dataType.GetTag() == H245_DataType::e_audioData && olc.m_reverseLogicalChannelParameters.m_dataType.GetTag() != H245_DataType::e_nullData){
+ H245_AudioCapability & ac = (H245_DataType&)olc.m_reverseLogicalChannelParameters.m_dataType;
+ if (m_call->GetDisableCodec().Find(ac.GetTagName()+";",0) != P_MAX_INDEX){
+ PTRACE(4, "Delete Reverse Logical Channel");
+ fastStart.RemoveAt(i);
+ i--;
+ continue;
+ }
+ }
+
H245Handler::pMem handlefs = (fromCaller) ? &H245Handler::HandleFastStartSetup : &H245Handler::HandleFastStartResponse;
if ((m_h245handler->*handlefs)(olc)) {
PPER_Stream wtstrm;
***************
*** 3271,3276 ****
--- 3332,3338 ----
m_call->SetCodec(GetH245CodecName(*audioCap));
}
}
+ PTRACE(4, "New FastStart: " << setprecision(2) <<fastStart);
return changed;
}
***************
*** 4024,4029 ****
--- 4086,4094 ----
if (hnat && Request.GetTag() == H245_RequestMessage::e_openLogicalChannel)
return hnat->HandleOpenLogicalChannel(Request);
else
+ if (Request.GetTag() == H245_RequestMessage::e_terminalCapabilitySet)
+ return true;
+ else
return false;
}
diff -c openh323gk/RasSrv.cxx openh323gk_p/RasSrv.cxx
*** openh323gk/RasSrv.cxx Wed Apr 22 16:21:49 2009
--- openh323gk_p/RasSrv.cxx Fri May 8 16:19:16 2009
***************
*** 2590,2595 ****
--- 2590,2598 ----
pCallRec->SetNewRoutes(arq.GetRoutes());
+ if (strlen(authData.m_disablecodecs) > 0)
+ pCallRec->SetDisableCodec(authData.m_disablecodecs);
+
if (authData.m_callDurationLimit > 0)
pCallRec->SetDurationLimit(authData.m_callDurationLimit);
if (!authData.m_callingStationId)
diff -c openh323gk/RasTbl.cxx openh323gk_p/RasTbl.cxx
*** openh323gk/RasTbl.cxx Mon Apr 20 21:01:22 2009
--- openh323gk_p/RasTbl.cxx Thu May 7 15:36:10 2009
***************
*** 2354,2359 ****
--- 2354,2364 ----
m_timeout = sec;
}
+ void CallRec::SetDisableCodec(PString dcodec)
+ {
+ m_disablecodec = dcodec.Trim();
+ }
+
void CallRec::InternalSetEP(endptr & ep, const endptr & nep)
{
if (ep != nep) {
diff -c openh323gk/RasTbl.h openh323gk_p/RasTbl.h
*** openh323gk/RasTbl.h Mon Apr 20 13:28:49 2009
--- openh323gk_p/RasTbl.h Thu May 7 15:37:38 2009
***************
*** 770,775 ****
--- 770,783 ----
has not been yet received.
Meaningful only in GK routed mode.
*/
+
+ /** Set disable codec for this call */
+ void SetDisableCodec(
+ PString dcodec /// codec to be set
+ );
+
+ PString GetDisableCodec() const;
+
time_t GetSetupTime() const;
/** Set timestamp for a Setup message associated with this call. */
***************
*** 1089,1094 ****
--- 1097,1106 ----
PString m_inbound_rewrite_id;
// rewrite id for outbound leg of call
PString m_outbound_rewrite_id;
+
+
+ /// desable-codec
+ PString m_disablecodec;
/// current timeout (or duration limit) for the call
long m_timeout;
***************
*** 1566,1571 ****
--- 1578,1588 ----
(m_Called && m_Called->GetCallSignalAddress() == *adr);
}
+ inline PString CallRec::GetDisableCodec() const
+ {
+ return m_disablecodec;
+ }
+
inline time_t CallRec::GetSetupTime() const
{
return m_setupTime;
diff -c openh323gk/gkauth.h openh323gk_p/gkauth.h
*** openh323gk/gkauth.h Mon Feb 9 18:26:21 2009
--- openh323gk_p/gkauth.h Fri May 8 16:20:57 2009
***************
*** 97,102 ****
--- 97,104 ----
int m_rejectReason;
/// -1 if not set, max allowe call duration in seconds otherwise
long m_callDurationLimit;
+ /// disable codec
+ PString m_disablecodecs;
/// endpoint that sent the request
endptr m_requestingEP;
/// call associated with the request (if any, only for answering ARQ)
***************
*** 153,158 ****
--- 155,162 ----
int m_rejectCause;
/// -1 if not set, max allowe call duration in seconds otherwise
long m_callDurationLimit;
+ /// disable codec
+ PString m_disablecodecs;
/// call associated with the message (if any)
callptr m_call;
/// is the Setup message from a registered endpoint
Only in openh323gk_p/: gnugkbuildopts.h
diff -c openh323gk/radauth.cxx openh323gk_p/radauth.cxx
*** openh323gk/radauth.cxx Mon Feb 9 16:25:59 2009
--- openh323gk_p/radauth.cxx Fri May 8 15:17:26 2009
***************
*** 731,736 ****
--- 731,758 ----
}
}
}
+ // process h323-ivr-in=codec-disable attribute
+ if (result) {
+ attr = response->FindVsaAttr(RadiusAttr::CiscoVendorId,
+ RadiusAttr::CiscoVSA_AV_Pair);
+ while (attr != NULL) {
+ PINDEX index;
+ value = attr->AsCiscoString();
+ if (value.Find("h323-ivr-in=") == 0
+ && ((index = value.Find("codec-disable:")) != P_MAX_INDEX)) {
+ index += strlen("codec-disable:");
+ const PINDEX semicolonpos = value.FindLast(';', index);
+ value = value.Mid(index, semicolonpos == P_MAX_INDEX
+ ? P_MAX_INDEX : (semicolonpos-index));
+ PTRACE(4, "RADAUTH\t" << GetName() << " Setup check set codec-disable: " << value);
+ authData.m_disablecodecs = value;
+ break;
+ }
+ attr = response->FindVsaAttr(RadiusAttr::CiscoVendorId,
+ RadiusAttr::CiscoVSA_AV_Pair, attr);
+ }
+ }
+
// check for h323-credit-time attribute (call duration limit)
if (result) {
attr = response->FindVsaAttr(RadiusAttr::CiscoVendorId,
***************
*** 1053,1058 ****
--- 1075,1102 ----
}
}
}
+
+ // process h323-ivr-in=codec-disable attribute
+ if (result) {
+ attr = response->FindVsaAttr(RadiusAttr::CiscoVendorId,
+ RadiusAttr::CiscoVSA_AV_Pair);
+ while (attr != NULL) {
+ PINDEX index;
+ value = attr->AsCiscoString();
+ if (value.Find("h323-ivr-in=") == 0
+ && ((index = value.Find("codec-disable:")) != P_MAX_INDEX)) {
+ index += strlen("codec-disable:");
+ const PINDEX semicolonpos = value.FindLast(';', index);
+ value = value.Mid(index, semicolonpos == P_MAX_INDEX
+ ? P_MAX_INDEX : (semicolonpos-index));
+ PTRACE(4, "RADAUTH\t" << GetName() << " Setup check set codec-disable: " << value);
+ authData.m_disablecodecs = value;
+ break;
+ }
+ attr = response->FindVsaAttr(RadiusAttr::CiscoVendorId,
+ RadiusAttr::CiscoVSA_AV_Pair, attr);
+ }
+ }
// check for h323-credit-time attribute (call duration limit)
if (result) {
attr = response->FindVsaAttr(RadiusAttr::CiscoVendorId,
***************
*** 1076,1081 ****
--- 1120,1126 ----
}
}
}
+
// check for Session-Timeout attribute (alternate call duration limit)
if (result) {
const RadiusAttr* const tattr = response->FindAttr(RadiusAttr::SessionTimeout);
C уважением With Best Regards
Георгиевский Юрий. Georgiewskiy Yuriy
+7 4872 711666 +7 4872 711666
факс +7 4872 711143 fax +7 4872 711143
Компания ООО "Ай Ти Сервис" IT Service Ltd
http://nkoort.ru http://nkoort.ru
JID: GHhost@xxxxxxxxxxxxxx JID: GHhost@xxxxxxxxxxxxxx
YG129-RIPE YG129-RIPE
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________________
Posting: mailto:Openh323gk-users@xxxxxxxxxxxxxxxxxxxxx
Archive: http://sourceforge.net/mailarchive/forum.php?forum_name=openh323gk-users
Unsubscribe: http://lists.sourceforge.net/lists/listinfo/openh323gk-users
Homepage: http://www.gnugk.org/