Added the possibility of declaring fake codecs.
Updated comments in config file. git-svn-id: http://yate.null.ro/svn/yate/trunk@163 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
d746501066
commit
8f0f52bb3c
|
@ -4,6 +4,9 @@
|
|||
; debug: int: OpenH323 debug level
|
||||
;debug=0
|
||||
|
||||
; dumpcodecs: int: Debug level to dump registered OpenH323 codecs, 0 disables
|
||||
;dumpcodecs=0
|
||||
|
||||
; vendor: string: Vendor name
|
||||
;vendor=Null Team
|
||||
|
||||
|
@ -32,23 +35,50 @@
|
|||
; passtrough_rtp: bool: default: no
|
||||
;passtrough_rtp=no
|
||||
|
||||
|
||||
[codecs]
|
||||
; This section allows to individually enable or disable the codecs
|
||||
; For all but the default setting you can specify the value "fake" so that
|
||||
; it will try to declare the capability even if it's no codec available
|
||||
|
||||
; mulaw: bool: Companded-only G711 mu-law
|
||||
;mulaw=enable
|
||||
; default: bool: Enable all unlisted codecs by default
|
||||
;default=enable
|
||||
|
||||
; alaw: bool: Companded-only G711 a-law
|
||||
;alaw=enable
|
||||
; mulaw: bool: Companded-only G711 mu-law (G.711-uLaw-64k)
|
||||
;mulaw=default
|
||||
|
||||
; gsm: bool: European GSM 06.10
|
||||
;gsm=enable
|
||||
; alaw: bool: Companded-only G711 a-law (G.711-ALaw-64k)
|
||||
;alaw=default
|
||||
|
||||
; speex: bool: Speex narrow
|
||||
;speex=enable
|
||||
; gsm: bool: European GSM 06.10 (GSM-06.10)
|
||||
;gsm=default
|
||||
|
||||
; lpc10: bool: LPC 10
|
||||
;lpc10=enable
|
||||
; msgsm: bool: Microsoft's proprietary verion of GSM (MS-GSM)
|
||||
;msgsm=default
|
||||
|
||||
; speex: bool: Speex narrow (SpeexNarrow)
|
||||
;speex=default
|
||||
|
||||
; lpc10: bool: Linear Prediction Codec (LPC-10)
|
||||
;lpc10=default
|
||||
|
||||
; ilbc: bool: Internet Low Bandwidth Codec (iLBC)
|
||||
;ilbc=default
|
||||
|
||||
; slin: bool: Signed Linear 16-bit uncompressed (PCM-16)
|
||||
;slin=default
|
||||
|
||||
; g723: bool: ITU G.723 all variations (G.723)
|
||||
;g723=default
|
||||
|
||||
; g726: bool: ITU G.726 all variations (G.726)
|
||||
;g726=default
|
||||
|
||||
; g728: bool: ITU G.728 all variations (G.728)
|
||||
;g728=default
|
||||
|
||||
; g729: bool: ITU G.729 all variations (G.729)
|
||||
;g729=default
|
||||
|
||||
|
||||
[ep]
|
||||
|
@ -66,6 +96,12 @@ ident = yate
|
|||
; maxconns: int: Maximum number of simultaneous connections (0 = no limit).
|
||||
;maxconns = 0
|
||||
|
||||
; faststart: bool: Enable Fast Start mode (offer media channels early)
|
||||
;faststart=false
|
||||
|
||||
; h245tunneling: bool: Enable H.245 tunneling mode
|
||||
;h245tunneling=false
|
||||
|
||||
; dtmfinband: bool: Wheter to decode inband DTMF (CPU intensive)
|
||||
;dtmfinband = false
|
||||
|
||||
|
@ -89,6 +125,7 @@ gkclient = false
|
|||
; using gkip; then, if gkip is unset or is not corect, will try gkname and
|
||||
; then will try to brodcast in the network.
|
||||
|
||||
|
||||
[gk]
|
||||
; If server is true the gatekeeper of yate will start. You must understand that
|
||||
; the H323EndPoint and H323GateKeeper share the calls. So you can make a call
|
||||
|
@ -108,6 +145,7 @@ server=false
|
|||
|
||||
interface1=10.0.0.1
|
||||
|
||||
|
||||
[incoming]
|
||||
; This section sets defaults for the incoming H.323 calls
|
||||
|
||||
|
|
|
@ -80,21 +80,35 @@ const char* h323_formats[] = {
|
|||
"G.711-ALaw-64k", "alaw",
|
||||
"G.711-uLaw-64k", "mulaw",
|
||||
"GSM-06.10", "gsm",
|
||||
"MS-GSM", "msgsm",
|
||||
"SpeexNarrow", "speex",
|
||||
"LPC-10", "lpc10",
|
||||
"MS-GSM", "msgsm",
|
||||
"PCM-16", "slin",
|
||||
"G.728", "g728",
|
||||
"G.729", "g729",
|
||||
"iLBC", "ilbc",
|
||||
"G.723", "g723",
|
||||
"G.726", "g726",
|
||||
"G.728", "g728",
|
||||
"G.729", "g729",
|
||||
"PCM-16", "slin",
|
||||
#if 0
|
||||
"G.729A", "g729a",
|
||||
"G.729B", "g729b",
|
||||
"G.729A/B", "g729ab",
|
||||
"G.723.1", "g723.1",
|
||||
"G.723.1(5.3k)", "g723.1-5k3",
|
||||
"G.723.1A(5.3k)", "g723.1a-5k3",
|
||||
"G.723.1A(6.3k)", "g723.1a-6k3",
|
||||
"G.723.1A(6.3k)-Cisco", "g723.1a-6k3-cisco",
|
||||
"G.726-16k", "g726-16k",
|
||||
"G.726-24k", "g726-24k",
|
||||
"G.726-32k", "g726-32k",
|
||||
"G.726-40k", "g726-40k",
|
||||
"iLBC-15k2", "ilbc-15k2",
|
||||
"iLBC-13k3", "ilbc-13k3",
|
||||
"SpeexNarrow-18.2k", "speex-18k2",
|
||||
"SpeexNarrow-15k", "speex-15k",
|
||||
"SpeexNarrow-11k", "speex-11k",
|
||||
"SpeexNarrow-8k", "speex-8k",
|
||||
"SpeexNarrow-5.95k", "speex-5k95",
|
||||
#endif
|
||||
0
|
||||
};
|
||||
|
@ -543,15 +557,73 @@ H323Connection *YateH323EndPoint::CreateConnection(unsigned callReference,
|
|||
return new YateH323Connection(*this,callReference,userData);
|
||||
}
|
||||
|
||||
// This class is used just to find out if a capability is registered
|
||||
class FakeH323CapabilityRegistration : public H323CapabilityRegistration
|
||||
{
|
||||
PCLASSINFO(FakeH323CapabilityRegistration,H323CapabilityRegistration);
|
||||
public:
|
||||
FakeH323CapabilityRegistration()
|
||||
: H323CapabilityRegistration("[fake]")
|
||||
{ }
|
||||
static void ListRegistered(int level);
|
||||
static bool IsRegistered(const PString& name);
|
||||
virtual H323Capability* Create(H323EndPoint& ep) const
|
||||
{ return 0; }
|
||||
};
|
||||
|
||||
void FakeH323CapabilityRegistration::ListRegistered(int level)
|
||||
{
|
||||
PWaitAndSignal mutex(H323CapabilityRegistration::GetMutex());
|
||||
H323CapabilityRegistration* find = registeredCapabilitiesListHead;
|
||||
for (; find; find = static_cast<FakeH323CapabilityRegistration*>(find)->link)
|
||||
Debug(level,"Registed capability: '%s'",(const char*)*find);
|
||||
}
|
||||
|
||||
bool FakeH323CapabilityRegistration::IsRegistered(const PString& name)
|
||||
{
|
||||
PWaitAndSignal mutex(H323CapabilityRegistration::GetMutex());
|
||||
H323CapabilityRegistration* find = registeredCapabilitiesListHead;
|
||||
for (; find; find = static_cast<FakeH323CapabilityRegistration*>(find)->link)
|
||||
if (*find == name)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool YateH323EndPoint::Init(void)
|
||||
{
|
||||
int dump = s_cfg.getIntValue("general","dumpcodecs");
|
||||
if (dump > 0)
|
||||
FakeH323CapabilityRegistration::ListRegistered(dump);
|
||||
bool defcodecs = s_cfg.getBoolValue("codecs","default",true);
|
||||
const char** f = h323_formats;
|
||||
for (; *f; f += 2) {
|
||||
if (s_cfg.getBoolValue("codecs",f[1],defcodecs)) {
|
||||
String tmp(f[0]);
|
||||
bool ok = false;
|
||||
bool fake = false;
|
||||
String tmp(s_cfg.getValue("codecs",f[1]));
|
||||
if ((tmp == "fake") || (tmp == "pretend")) {
|
||||
ok = true;
|
||||
fake = true;
|
||||
}
|
||||
else
|
||||
ok = tmp.toBoolean(defcodecs);
|
||||
if (ok) {
|
||||
tmp = f[0];
|
||||
tmp += "*{sw}";
|
||||
PINDEX init = GetCapabilities().GetSize();
|
||||
AddAllCapabilities(0, 0, tmp.c_str());
|
||||
PINDEX num = GetCapabilities().GetSize() - init;
|
||||
if (fake && !num) {
|
||||
// failed to add so pretend we support it in hardware
|
||||
tmp = f[0];
|
||||
tmp += "*{hw}";
|
||||
AddAllCapabilities(0, 0, tmp.c_str());
|
||||
num = GetCapabilities().GetSize() - init;
|
||||
}
|
||||
if (num)
|
||||
Debug(DebugAll,"H.323 added %d capabilities '%s'",num,tmp.c_str());
|
||||
else
|
||||
// warn if codecs were disabled by default
|
||||
Debug(defcodecs ? DebugInfo : DebugWarn,"H323 failed to add capability '%s'",tmp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -967,6 +1039,8 @@ BOOL YateH323Connection::decodeCapability(const H323Capability & capability, con
|
|||
// turn capability name into format name
|
||||
if (fname.endsWith("{sw}",false))
|
||||
fname = fname.substr(0,fname.length()-4);
|
||||
if (fname.endsWith("{hw}",false))
|
||||
fname = fname.substr(0,fname.length()-4);
|
||||
OpalMediaFormat oformat(fname, FALSE);
|
||||
int pload = oformat.GetPayloadType();
|
||||
const char *format = 0;
|
||||
|
|
Loading…
Reference in New Issue