[svn-commits] pcadach: branch pcadach/chan_h323-live r39775 - in
/team/pcadach/chan_h323-li...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue Aug 15 05:10:33 MST 2006
Author: pcadach
Date: Tue Aug 15 07:10:33 2006
New Revision: 39775
URL: http://svn.digium.com/view/asterisk?rev=39775&view=rev
Log:
GSM codec get back, use codec priorities when building capability list
Modified:
team/pcadach/chan_h323-live/channels/chan_h323.c
team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
team/pcadach/chan_h323-live/channels/h323/ast_h323.h
team/pcadach/chan_h323-live/channels/h323/chan_h323.h
Modified: team/pcadach/chan_h323-live/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/chan_h323.c?rev=39775&r1=39774&r2=39775&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/chan_h323.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_h323.c Tue Aug 15 07:10:33 2006
@@ -114,6 +114,7 @@
rfc2833_cb on_set_rfc2833_payload;
hangup_cb on_hangup;
setcapabilities_cb on_setcapabilities;
+setpeercapabilities_cb on_setpeercapabilities;
/* global debug flag */
int h323debug;
@@ -178,6 +179,9 @@
int hangupcause; /* Hangup cause from OpenH323 layer */
int newstate; /* Pending state change */
int newcontrol; /* Pending control to send */
+ int pref_codec; /* Preferred codec */
+ int peercapability; /* Capabilities learned from peer */
+ int jointcapability; /* Common capabilities for local and remote side */
struct oh323_pvt *next; /* Next channel in list */
} *iflist = NULL;
@@ -638,6 +642,9 @@
}
}
if (pvt) {
+ if (h323debug)
+ ast_log(LOG_DEBUG, "Writing audio frame\n");
+
ast_mutex_lock(&pvt->lock);
if (pvt->rtp) {
res = ast_rtp_write(pvt->rtp, frame);
@@ -764,13 +771,24 @@
if (ch) {
ch->tech = &oh323_tech;
ast_string_field_build(ch, name, "H323/%s", host);
- ch->nativeformats = pvt->options.capability;
- if (!ch->nativeformats) {
- ch->nativeformats = global_options.capability;
- }
+ if (!(fmt = pvt->jointcapability) && !(fmt = pvt->options.capability))
+ fmt = global_options.capability;
+ ch->nativeformats = ast_codec_choose(&pvt->options.prefs, fmt, 1)/* | (pvt->jointcapability & AST_FORMAT_VIDEO_MASK)*/;
pvt->nativeformats = ch->nativeformats;
fmt = ast_best_codec(ch->nativeformats);
ch->fds[0] = ast_rtp_fd(pvt->rtp);
+ ch->fds[1] = ast_rtcp_fd(pvt->rtp);
+#ifdef VIDEO_SUPPORT
+ if (pvt->vrtp) {
+ ch->fds[2] = ast_rtp_fd(pvt->vrtp);
+ ch->fds[3] = ast_rtcp_fd(pvt->vrtp);
+ }
+#endif
+#ifdef T38_SUPPORT
+ if (pvt->udptl) {
+ ch->fds[4] = ast_udptl_fd(pvt->udptl);
+ }
+#endif
if (state == AST_STATE_RING) {
ch->rings = 1;
}
@@ -860,6 +878,7 @@
memset((char *)(pvt->cd).call_token, 0, 128);
pvt->cd.call_reference = callid;
memcpy(&pvt->options, &global_options, sizeof(pvt->options));
+ pvt->jointcapability = pvt->options.capability;
if (pvt->options.dtmfmode & H323_DTMF_RFC2833) {
pvt->nonCodecCapability |= AST_RTP_DTMF;
} else {
@@ -998,6 +1017,7 @@
if (p) {
found++;
memcpy(&pvt->options, &p->options, sizeof(pvt->options));
+ pvt->jointcapability = pvt->options.capability;
if (pvt->rtp) {
ast_log(LOG_DEBUG, "Setting NAT on RTP to %d\n", pvt->options.nat);
ast_rtp_setnat(pvt->rtp, pvt->options.nat);
@@ -1025,6 +1045,7 @@
hp = ast_gethostbyname(hostn, &ahp);
if (hp) {
memcpy(&pvt->options, &global_options, sizeof(pvt->options));
+ pvt->jointcapability = pvt->options.capability;
memcpy(&pvt->sa.sin_addr, hp->h_addr, sizeof(pvt->sa.sin_addr));
pvt->sa.sin_port = htons(portno);
return 0;
@@ -1086,6 +1107,7 @@
}
else {
memcpy(&pvt->options, &global_options, sizeof(pvt->options));
+ pvt->jointcapability = pvt->options.capability;
if (pvt->rtp) {
ast_log(LOG_DEBUG, "Setting NAT on RTP to %d\n", pvt->options.nat);
ast_rtp_setnat(pvt->rtp, pvt->options.nat);
@@ -1334,6 +1356,7 @@
/* Populate the call details in the private structure */
memcpy(&pvt->cd, cd, sizeof(pvt->cd));
memcpy(&pvt->options, &global_options, sizeof(pvt->options));
+ pvt->jointcapability = pvt->options.capability;
if (h323debug) {
ast_verbose(VERBOSE_PREFIX_3 "Setting up Call\n");
@@ -1342,6 +1365,7 @@
ast_verbose(VERBOSE_PREFIX_3 "\tCalling party number: [%s]\n", pvt->cd.call_source_e164);
ast_verbose(VERBOSE_PREFIX_3 "\tCalled party name: [%s]\n", pvt->cd.call_dest_alias);
ast_verbose(VERBOSE_PREFIX_3 "\tCalled party number: [%s]\n", pvt->cd.call_dest_e164);
+ ast_verbose(VERBOSE_PREFIX_3 "\tCalling party IP: [%s]\n", pvt->cd.sourceIp);
}
/* Decide if we are allowing Gatekeeper routed calls*/
@@ -1398,6 +1422,7 @@
}
strncpy(pvt->context, user->context, sizeof(pvt->context) - 1);
memcpy(&pvt->options, &user->options, sizeof(pvt->options));
+ pvt->jointcapability = pvt->options.capability;
if (!ast_strlen_zero(pvt->cd.call_dest_e164)) {
strncpy(pvt->exten, cd->call_dest_e164, sizeof(pvt->exten) - 1);
} else {
@@ -1581,21 +1606,39 @@
ast_log(LOG_DEBUG, "DTMF payload on %s set to %d\n", token, payload);
}
-static void set_local_capabilities(unsigned call_reference, const char *token)
+static void set_peer_capabilities(unsigned call_reference, const char *token, int capabilities)
{
struct oh323_pvt *pvt;
- int capability, dtmfmode;
if (h323debug)
- ast_log(LOG_DEBUG, "Setting capabilities for connection %s\n", token);
+ ast_log(LOG_DEBUG, "Got remote capabilities from connection %s\n", token);
pvt = find_call_locked(call_reference, token);
if (!pvt)
return;
- capability = pvt->options.capability;
+ pvt->peercapability = capabilities;
+ pvt->jointcapability = pvt->options.capability & capabilities;
+ ast_mutex_unlock(&pvt->lock);
+}
+
+static void set_local_capabilities(unsigned call_reference, const char *token)
+{
+ struct oh323_pvt *pvt;
+ int capability, dtmfmode, pref_codec;
+ struct ast_codec_pref prefs;
+
+ if (h323debug)
+ ast_log(LOG_DEBUG, "Setting capabilities for connection %s\n", token);
+
+ pvt = find_call_locked(call_reference, token);
+ if (!pvt)
+ return;
+ capability = (pvt->jointcapability) ? pvt->jointcapability : pvt->options.capability;
dtmfmode = pvt->options.dtmfmode;
+ prefs = pvt->options.prefs;
+ pref_codec = pvt->pref_codec;
ast_mutex_unlock(&pvt->lock);
- h323_set_capabilities(token, capability, dtmfmode);
+ h323_set_capabilities(token, capability, dtmfmode, &prefs, pref_codec);
if (h323debug)
ast_log(LOG_DEBUG, "Capabilities for connection %s is set\n", token);
@@ -1820,21 +1863,12 @@
static int update_common_options(struct ast_variable *v, struct call_options *options)
{
- unsigned int format;
int tmp;
if (!strcasecmp(v->name, "allow")) {
- format = ast_getformatbyname(v->value);
- if (format < 1)
- ast_log(LOG_WARNING, "Cannot allow unknown format '%s'\n", v->value);
- else
- options->capability |= format;
+ ast_parse_allow_disallow(&options->prefs, &options->capability, v->value, 1);
} else if (!strcasecmp(v->name, "disallow")) {
- format = ast_getformatbyname(v->value);
- if (format < 1)
- ast_log(LOG_WARNING, "Cannot disallow unknown format '%s'\n", v->value);
- else
- options->capability &= ~format;
+ ast_parse_allow_disallow(&options->prefs, &options->capability, v->value, 0);
} else if (!strcasecmp(v->name, "dtmfmode")) {
if (!strcasecmp(v->value, "inband")) {
options->dtmfmode = H323_DTMF_INBAND;
@@ -2064,7 +2098,7 @@
v = ast_variable_browse(cfg, "general");
while (v) {
/* handle jb conf */
- if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
v = v->next;
continue;
}
@@ -2397,7 +2431,8 @@
progress,
set_dtmf_payload,
hangup_connection,
- set_local_capabilities);
+ set_local_capabilities,
+ set_peer_capabilities);
/* start the h.323 listener */
if (h323_start_listener(h323_signalling_port, bindaddr)) {
ast_log(LOG_ERROR, "Unable to create H323 listener.\n");
@@ -2428,6 +2463,7 @@
ast_cli_unregister(&cli_h323_reload);
ast_channel_unregister(&oh323_tech);
+ ast_rtp_proto_unregister(&oh323_rtp);
if (!ast_mutex_lock(&iflock)) {
/* hangup all interfaces if they have an owner */
Modified: team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp?rev=39775&r1=39774&r2=39775&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp (original)
+++ team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp Tue Aug 15 07:10:33 2006
@@ -175,7 +175,11 @@
H323_REGISTER_CAPABILITY(H323_G7231Capability, OPAL_G7231);
H323_REGISTER_CAPABILITY(AST_G729Capability, OPAL_G729);
H323_REGISTER_CAPABILITY(AST_G729ACapability, OPAL_G729A);
-
+H323_REGISTER_CAPABILITY(AST_GSM0610Capability, OPAL_GSM0610);
+
+/*
+ * Capability: G.723.1
+ */
H323_G7231Capability::H323_G7231Capability(BOOL annexA_)
: H323AudioCapability(7, 4)
{
@@ -240,6 +244,9 @@
return NULL;
}
+/*
+ * Capability: G.729
+ */
AST_G729Capability::AST_G729Capability()
: H323AudioCapability(24, 2)
{
@@ -265,6 +272,9 @@
return NULL;
}
+/*
+ * Capability: G.729A
+ */
AST_G729ACapability::AST_G729ACapability()
: H323AudioCapability(24, 6)
{
@@ -289,6 +299,61 @@
{
return NULL;
}
+
+/*
+ * Capability: GSM full rate
+ */
+AST_GSM0610Capability::AST_GSM0610Capability(int comfortNoise_, int scrambled_)
+ : H323AudioCapability(24, 2)
+{
+ comfortNoise = comfortNoise_;
+ scrambled = scrambled_;
+}
+
+PObject * AST_GSM0610Capability::Clone() const
+{
+ return new AST_GSM0610Capability(*this);
+}
+
+unsigned AST_GSM0610Capability::GetSubType() const
+{
+ return H245_AudioCapability::e_gsmFullRate;
+}
+
+BOOL AST_GSM0610Capability::OnSendingPDU(H245_AudioCapability & cap,
+ unsigned packetSize) const
+{
+ cap.SetTag(H245_AudioCapability::e_gsmFullRate);
+ H245_GSMAudioCapability & gsm = cap;
+ gsm.m_audioUnitSize = packetSize;
+ gsm.m_comfortNoise = comfortNoise;
+ gsm.m_scrambled = scrambled;
+ return TRUE;
+}
+
+BOOL AST_GSM0610Capability::OnReceivedPDU(const H245_AudioCapability & cap,
+ unsigned & packetSize)
+{
+ if (cap.GetTag() != H245_AudioCapability::e_gsmFullRate)
+ return FALSE;
+ const H245_GSMAudioCapability & gsm = cap;
+ packetSize = gsm.m_audioUnitSize;
+ comfortNoise = gsm.m_comfortNoise;
+ scrambled = gsm.m_scrambled;
+
+ return TRUE;
+}
+
+PString AST_GSM0610Capability::GetFormatName() const
+{
+ return OPAL_GSM0610;
+}
+
+H323Codec * AST_GSM0610Capability::CreateCodec(H323Codec::Direction direction) const
+{
+ return NULL;
+}
+
/** MyH323EndPoint
*/
@@ -937,6 +1002,39 @@
const H245_MultiplexCapability * muxCap,
H245_TerminalCapabilitySetReject & reject)
{
+ struct __codec__ {
+ unsigned int asterisk_codec;
+ unsigned int h245_cap;
+ const char *oid;
+ };
+ static const struct __codec__ codecs[] = {
+ { AST_FORMAT_G723_1, H245_AudioCapability::e_g7231 },
+ { AST_FORMAT_GSM, H245_AudioCapability::e_gsmFullRate },
+ { AST_FORMAT_ULAW, H245_AudioCapability::e_g711Ulaw64k },
+ { AST_FORMAT_ALAW, H245_AudioCapability::e_g711Alaw64k },
+ { AST_FORMAT_G729A, H245_AudioCapability::e_g729AnnexA },
+ { AST_FORMAT_G729A, H245_AudioCapability::e_g729 },
+#ifdef AST_FORMAT_MODEM
+ { AST_FORMAT_MODEM, H245_DataApplicationCapability_application::e_t38fax },
+#endif
+ { 0 }
+ };
+
+#if 0
+ static const struct __codec__ vcodecs[] = {
+#ifdef HAVE_H261
+ { AST_FORMAT_H261, H245_VideoCapability::e_h261VideoCapability },
+#endif
+#ifdef HAVE_H263
+ { AST_FORMAT_H263, H245_VideoCapability::e_h263VideoCapability },
+#endif
+#ifdef HAVE_H264
+ { AST_FORMAT_H264, H245_VideoCapability::e_genericVideoCapability, "0.0.8.241.0.0.1" },
+#endif
+ { 0 }
+ };
+#endif
+
if (!H323Connection::OnReceivedCapabilitySet(remoteCaps, muxCap, reject)) {
return FALSE;
}
@@ -949,6 +1047,62 @@
cout << "\t-- Inbound RFC2833 on payload " << pt << endl;
}
}
+ int peer_capabilities = 0;
+ for (int i = 0; i < remoteCapabilities.GetSize(); ++i) {
+ unsigned int subType = remoteCapabilities[i].GetSubType();
+ if (h323debug) {
+ cout << "Peer capability is " << remoteCapabilities[i] << endl;
+ }
+ switch(remoteCapabilities[i].GetMainType()) {
+ case H323Capability::e_Audio:
+ for (int x = 0; codecs[x].asterisk_codec > 0; ++x) {
+ if (subType == codecs[x].h245_cap) {
+ if (h323debug) {
+ cout << "Found peer capability " << remoteCapabilities[i] << ", Asterisk code is " << codecs[x].asterisk_codec << endl;
+ }
+ peer_capabilities |= codecs[x].asterisk_codec;
+ }
+ }
+ break;
+#if 0
+ case H323Capability::e_Video:
+ for (int x = 0; vcodecs[x].asterisk_codec > 0; ++x) {
+ if (subType == vcodecs[x].h245_cap) {
+ H245_CapabilityIdentifier *cap = NULL;
+ H245_GenericCapability y;
+ if (vcodecs[x].oid) {
+ cap = new H245_CapabilityIdentifier(H245_CapabilityIdentifier::e_standard);
+ PASN_ObjectId &object_id = *cap;
+ object_id = vcodecs[x].oid;
+ y.m_capabilityIdentifier = *cap;
+ }
+ if ((subType != H245_VideoCapability::e_genericVideoCapability) ||
+ (vcodecs[x].oid && ((const H323GenericVideoCapability &)remoteCapabilities[i]).IsGenericMatch((const H245_GenericCapability)y))) {
+ if (h323debug) {
+ cout << "Found peer video capability " << remoteCapabilities[i] << ", Asterisk code is " << vcodecs[x].asterisk_codec << endl;
+ }
+ peer_capabilities |= vcodecs[x].asterisk_codec;
+ }
+ if (cap)
+ delete(cap);
+ }
+ }
+ break;
+#endif
+ default:
+ break;
+ }
+ }
+ if (h323debug) {
+ char caps_str[1024];
+ cout << "Peer capabilities = " << ast_getformatname_multiple(caps_str, sizeof(caps_str), peer_capabilities) << endl;
+ }
+#if 0
+ redir_capabilities &= peer_capabilities;
+#endif
+ if (on_setpeercapabilities)
+ on_setpeercapabilities(GetCallReference(), (const char *)callToken, peer_capabilities);
+
return TRUE;
}
@@ -978,53 +1132,87 @@
return connectionState != ShuttingDownConnection;
}
-void MyH323Connection::SetCapabilities(int cap, int dtmfMode)
+void MyH323Connection::SetCapabilities(int cap, int dtmfMode, struct ast_codec_pref *prefs, int pref_codec)
{
int g711Frames = 20;
-// int gsmFrames = 4;
+ int gsmFrames = 4;
PINDEX lastcap = -1; /* last common capability index */
-
+ int alreadysent = 0;
+ int codec;
+ int x;
+ char caps_str[1024];
+
+ localCapabilities.RemoveAll();
+
+ if (h323debug) {
+ cout << "Setting capabilities to " << ast_getformatname_multiple(caps_str, sizeof(caps_str), cap) << endl;
+ }
+ for (x = -1; x < 32; ++x) {
+ if (x < 0)
+ codec = pref_codec;
+ else if (!(codec = ast_codec_pref_index(prefs, x)))
+ break;
+ if (!(cap & codec) || (alreadysent & codec))
+ continue;
+ alreadysent |= codec;
+ switch(codec) {
#if 0
- if (cap & AST_FORMAT_SPEEX) {
- /* Not real sure if Asterisk acutally supports all
- of the various different bit rates so add them
- all and figure it out later*/
-
- localCapabilities.SetCapability(0, 0, new SpeexNarrow2AudioCapability());
- localCapabilities.SetCapability(0, 0, new SpeexNarrow3AudioCapability());
- localCapabilities.SetCapability(0, 0, new SpeexNarrow4AudioCapability());
- localCapabilities.SetCapability(0, 0, new SpeexNarrow5AudioCapability());
- localCapabilities.SetCapability(0, 0, new SpeexNarrow6AudioCapability());
- }
+ case AST_FORMAT_SPEEX:
+ /* Not real sure if Asterisk acutally supports all
+ of the various different bit rates so add them
+ all and figure it out later*/
+
+ lastcap = localCapabilities.SetCapability(0, 0, new SpeexNarrow2AudioCapability());
+ lastcap = localCapabilities.SetCapability(0, 0, new SpeexNarrow3AudioCapability());
+ lastcap = localCapabilities.SetCapability(0, 0, new SpeexNarrow4AudioCapability());
+ lastcap = localCapabilities.SetCapability(0, 0, new SpeexNarrow5AudioCapability());
+ lastcap = localCapabilities.SetCapability(0, 0, new SpeexNarrow6AudioCapability());
+ break;
#endif
- if (cap & AST_FORMAT_G729A) {
- AST_G729ACapability *g729aCap;
- AST_G729Capability *g729Cap;
- lastcap = localCapabilities.SetCapability(0, 0, g729aCap = new AST_G729ACapability);
- lastcap = localCapabilities.SetCapability(0, 0, g729Cap = new AST_G729Capability);
+ case AST_FORMAT_G729A:
+ AST_G729ACapability *g729aCap;
+ AST_G729Capability *g729Cap;
+ lastcap = localCapabilities.SetCapability(0, 0, g729aCap = new AST_G729ACapability);
+ lastcap = localCapabilities.SetCapability(0, 0, g729Cap = new AST_G729Capability);
+ break;
+ case AST_FORMAT_G723_1:
+ H323_G7231Capability *g7231Cap;
+ lastcap = localCapabilities.SetCapability(0, 0, g7231Cap = new H323_G7231Capability);
+ break;
+ case AST_FORMAT_GSM:
+ AST_GSM0610Capability *gsmCap;
+ lastcap = localCapabilities.SetCapability(0, 0, gsmCap = new AST_GSM0610Capability);
+ gsmCap->SetTxFramesInPacket(gsmFrames);
+ break;
+ case AST_FORMAT_ULAW:
+ H323_G711Capability *g711uCap;
+ lastcap = localCapabilities.SetCapability(0, 0, g711uCap = new H323_G711Capability(H323_G711Capability::muLaw));
+ g711uCap->SetTxFramesInPacket(g711Frames);
+ break;
+ case AST_FORMAT_ALAW:
+ H323_G711Capability *g711aCap;
+ lastcap = localCapabilities.SetCapability(0, 0, g711aCap = new H323_G711Capability(H323_G711Capability::ALaw));
+ g711aCap->SetTxFramesInPacket(g711Frames);
+ break;
+ default:
+ alreadysent &= ~codec;
+ break;
+ }
}
- if (cap & AST_FORMAT_G723_1) {
- H323_G7231Capability *g7231Cap;
- lastcap = localCapabilities.SetCapability(0, 0, g7231Cap = new H323_G7231Capability);
- }
-#if 0
- if (cap & AST_FORMAT_GSM) {
- H323_GSM0610Capability *gsmCap;
- lastcap = localCapabilities.SetCapability(0, 0, gsmCap = new H323_GSM0610Capability);
- gsmCap->SetTxFramesInPacket(gsmFrames);
- }
-#endif
- if (cap & AST_FORMAT_ULAW) {
- H323_G711Capability *g711uCap;
- lastcap = localCapabilities.SetCapability(0, 0, g711uCap = new H323_G711Capability(H323_G711Capability::muLaw));
- g711uCap->SetTxFramesInPacket(g711Frames);
- }
-
- if (cap & AST_FORMAT_ALAW) {
- H323_G711Capability *g711aCap;
- lastcap = localCapabilities.SetCapability(0, 0, g711aCap = new H323_G711Capability(H323_G711Capability::ALaw));
- g711aCap->SetTxFramesInPacket(g711Frames);
+ if ((alreadysent & cap) != cap) {
+ lastcap++;
+ for (x = 0; x < 32; ++x) {
+ if (!(codec = ast_codec_pref_index(prefs, x)))
+ break;
+ if (!(cap & codec) || (alreadysent & codec))
+ continue;
+
+ alreadysent |= codec;
+ switch(codec) {
+ /* Put video codecs here */
+ }
+ }
}
lastcap++;
@@ -1185,7 +1373,8 @@
progress_cb pgfunc,
rfc2833_cb dtmffunc,
hangup_cb hangupfunc,
- setcapabilities_cb capabilityfunc)
+ setcapabilities_cb capabilityfunc,
+ setpeercapabilities_cb peercapabilityfunc)
{
on_incoming_call = ifunc;
on_outgoing_call = sfunc;
@@ -1200,12 +1389,13 @@
on_set_rfc2833_payload = dtmffunc;
on_hangup = hangupfunc;
on_setcapabilities = capabilityfunc;
+ on_setpeercapabilities = peercapabilityfunc;
}
/**
* Add capability to the capability table of the end point.
*/
-int h323_set_capabilities(const char *token, int cap, int dtmfMode)
+int h323_set_capabilities(const char *token, int cap, int dtmfMode, struct ast_codec_pref *prefs, int pref_codec)
{
MyH323Connection *conn;
@@ -1224,7 +1414,7 @@
cout << " ERROR: [h323_set_capabilities] Unable to find connection " << token << endl;
return 1;
}
- conn->SetCapabilities(cap, dtmfMode);
+ conn->SetCapabilities((/*conn->bridging ? conn->redir_capabilities :*/ cap), dtmfMode, prefs, pref_codec);
conn->Unlock();
return 0;
Modified: team/pcadach/chan_h323-live/channels/h323/ast_h323.h
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/ast_h323.h?rev=39775&r1=39774&r2=39775&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/ast_h323.h (original)
+++ team/pcadach/chan_h323-live/channels/h323/ast_h323.h Tue Aug 15 07:10:33 2006
@@ -29,6 +29,7 @@
#ifndef AST_H323_H
#define AST_H323_H
+#if 0
/** These need to be redefined here because the C++
side of this driver is blind to the asterisk headers */
/*! G.723.1 compression */
@@ -53,74 +54,107 @@
#define AST_FORMAT_SPEEX (1 << 9)
/*! ILBC Free Codec */
#define AST_FORMAT_ILBC (1 << 10)
+#endif
/**This class describes the G.723.1 codec capability.
*/
class H323_G7231Capability : public H323AudioCapability
{
- PCLASSINFO(H323_G7231Capability, H323AudioCapability);
- public:
- H323_G7231Capability(BOOL annexA = TRUE);
- Comparison Compare(const PObject & obj) const;
- PObject * Clone() const;
- virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
+ PCLASSINFO(H323_G7231Capability, H323AudioCapability);
+ public:
+ H323_G7231Capability(BOOL annexA = TRUE);
+ Comparison Compare(const PObject & obj) const;
+ PObject * Clone() const;
+ virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
unsigned GetSubType() const;
PString GetFormatName() const;
+ BOOL OnSendingPDU(H245_AudioCapability & pdu, unsigned packetSize) const;
+ BOOL OnReceivedPDU(const H245_AudioCapability & pdu, unsigned & packetSize);
+ protected:
+ BOOL annexA;
+};
+
+/**This class describes the (fake) G729 codec capability.
+ */
+class AST_G729Capability : public H323AudioCapability
+{
+ PCLASSINFO(AST_G729Capability, H323AudioCapability);
+
+ public:
+ AST_G729Capability();
+ /* Create a copy of the object. */
+ virtual PObject * Clone() const;
+
+ /* Create the codec instance, allocating resources as required. */
+ virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
+
+ /* Get the sub-type of the capability. This is a code dependent on the
+ main type of the capability.
+
+ This returns one of the four possible combinations of mode and speed
+ using the enum values of the protocol ASN H245_AudioCapability class. */
+ virtual unsigned GetSubType() const;
+
+ /* Get the name of the media data format this class represents. */
+ virtual PString GetFormatName() const;
+};
+
+/* This class describes the VoiceAge G729A codec capability. */
+class AST_G729ACapability : public H323AudioCapability
+{
+ PCLASSINFO(AST_G729ACapability, H323AudioCapability);
+
+ public:
+ /* Create a new G.729A capability. */
+ AST_G729ACapability();
+
+ /* Create a copy of the object. */
+ virtual PObject * Clone() const;
+ /* Create the codec instance, allocating resources as required. */
+ virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
+
+ /* Get the sub-type of the capability. This is a code dependent on the
+ main type of the capability.
+
+ This returns one of the four possible combinations of mode and speed
+ using the enum values of the protocol ASN H245_AudioCapability class. */
+ virtual unsigned GetSubType() const;
+
+ /* Get the name of the media data format this class represents. */
+ virtual PString GetFormatName() const;
+};
+
+/* This class describes the GSM-06.10 codec capability. */
+class AST_GSM0610Capability : public H323AudioCapability
+{
+ PCLASSINFO(AST_GSM0610Capability, H323AudioCapability);
+
+ public:
+ /* Create a new GSM capability. */
+ AST_GSM0610Capability(int comfortNoise = 0, int scrambled = 0);
+
+ /* Create a copy of the object. */
+ virtual PObject * Clone() const;
+
+ /* Create the codec instance, allocating resources as required. */
+ virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
+
+ /* Get the sub-type of the capability. This is a code dependent on the
+ main type of the capability.
+
+ This returns one of the four possible combinations of mode and speed
+ using the enum values of the protocol ASN H245_AudioCapability class. */
+ virtual unsigned GetSubType() const;
+
+ /* Get the name of the media data format this class represents. */
+ virtual PString GetFormatName() const;
+
BOOL OnSendingPDU(H245_AudioCapability & pdu, unsigned packetSize) const;
BOOL OnReceivedPDU(const H245_AudioCapability & pdu, unsigned & packetSize);
+
protected:
- BOOL annexA;
-};
-
-/**This class describes the (fake) G729 codec capability.
- */
-class AST_G729Capability : public H323AudioCapability
-{
- PCLASSINFO(AST_G729Capability, H323AudioCapability);
-
- public:
- AST_G729Capability();
- /* Create a copy of the object. */
- virtual PObject * Clone() const;
-
- /* Create the codec instance, allocating resources as required. */
- virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
-
- /* Get the sub-type of the capability. This is a code dependent on the
- main type of the capability.
-
- This returns one of the four possible combinations of mode and speed
- using the enum values of the protocol ASN H245_AudioCapability class. */
- virtual unsigned GetSubType() const;
-
- /* Get the name of the media data format this class represents. */
- virtual PString GetFormatName() const;
-
-};
-
-/* This class describes the VoiceAge G729A codec capability. */
-class AST_G729ACapability : public H323AudioCapability
-{
- PCLASSINFO(AST_G729ACapability, H323AudioCapability);
-
- public:
- /* Create a new G.729A capability. */
- AST_G729ACapability();
-
- /* Create a copy of the object. */
- virtual PObject * Clone() const;
- /* Create the codec instance, allocating resources as required. */
- virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
-
- /* Get the sub-type of the capability. This is a code dependent on the
- main type of the capability.
-
- This returns one of the four possible combinations of mode and speed
- using the enum values of the protocol ASN H245_AudioCapability class. */
- virtual unsigned GetSubType() const;
-
- /* Get the name of the media data format this class represents. */
- virtual PString GetFormatName() const;
+ int comfortNoise;
+ int scrambled;
};
class MyH323EndPoint : public H323EndPoint {
@@ -174,7 +208,7 @@
BOOL OnReceivedProgress(const H323SignalPDU &);
void OnSendCapabilitySet(H245_TerminalCapabilitySet &);
void OnSetLocalCapabilities();
- void SetCapabilities(int, int);
+ void SetCapabilities(int, int, ast_codec_pref*, int);
BOOL OnReceivedCapabilitySet(const H323Capabilities &, const H245_MultiplexCapability *,
H245_TerminalCapabilitySetReject &);
void SetCause(int _cause) { cause = _cause; };
Modified: team/pcadach/chan_h323-live/channels/h323/chan_h323.h
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/chan_h323.h?rev=39775&r1=39774&r2=39775&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/chan_h323.h (original)
+++ team/pcadach/chan_h323-live/channels/h323/chan_h323.h Tue Aug 15 07:10:33 2006
@@ -44,6 +44,7 @@
int capability;
int bridge;
int nat;
+ struct ast_codec_pref prefs;
} call_options_t;
/* structure to hold the valid asterisk users */
@@ -167,6 +168,9 @@
typedef void (*setcapabilities_cb)(unsigned, const char *);
extern setcapabilities_cb on_setcapabilities;
+typedef void (*setpeercapabilities_cb)(unsigned, const char *, int);
+extern setpeercapabilities_cb on_setpeercapabilities;
+
/* debug flag */
extern int h323debug;
@@ -201,8 +205,9 @@
progress_cb,
rfc2833_cb,
hangup_cb,
- setcapabilities_cb);
- int h323_set_capabilities(const char *, int, int);
+ setcapabilities_cb,
+ setpeercapabilities_cb);
+ int h323_set_capabilities(const char *, int, int, struct ast_codec_pref *, int);
int h323_set_alias(struct oh323_alias *);
int h323_set_gk(int, char *, char *);
void h323_set_id(char *);
More information about the svn-commits
mailing list