aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-21 00:07:56 +0000
committerjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-21 00:07:56 +0000
commit9e8b32b39c3ee7a83f4d00febfe7d1d6e421516e (patch)
tree369252e4ce57f37a8e9e1d3ff7b800a667fb016a
parent625e2c693e6230c2e0aafd11089fafbd09229d19 (diff)
Fix G.729 name annoucement to Open H.323 and inform Asterisk's RTP stack specifically which codec we are expecting.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4508 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xchannels/chan_h323.c26
-rwxr-xr-xchannels/h323/ast_h323.cpp20
-rwxr-xr-xchannels/h323/chan_h323.h4
3 files changed, 36 insertions, 14 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 6b6730481..6309404ed 100755
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -1167,14 +1167,24 @@ struct rtp_info *external_rtp_create(unsigned call_reference, const char * token
int progress(unsigned call_reference, const char *token, int inband);
/**
+ * Definition taken from rtp.c for rtpPayloadType because we need it here.
+ */
+struct rtpPayloadType {
+ int isAstFormat; /* whether the following code is an AST_FORMAT */
+ int code;
+};
+
+/**
* Call-back function passing remote ip/port information from H.323 to asterisk
*
* Returns nothing
*/
-void setup_rtp_connection(unsigned call_reference, const char *remoteIp, int remotePort, const char *token)
+void setup_rtp_connection(unsigned call_reference, const char *remoteIp, int remotePort, const char *token, int pt)
{
struct oh323_pvt *pvt = NULL;
struct sockaddr_in them;
+ struct rtpPayloadType rtptype;
+ int fmt;
/* Find the call or allocate a private structure if call not found */
pvt = find_call(call_reference, token);
@@ -1182,6 +1192,19 @@ void setup_rtp_connection(unsigned call_reference, const char *remoteIp, int rem
ast_log(LOG_ERROR, "Something is wrong: rtp\n");
return;
}
+
+ rtptype = ast_rtp_lookup_pt(pvt->rtp, pt);
+
+ fmt = ast_best_codec(pvt->owner->nativeformats);
+
+ ast_mutex_lock(&pvt->lock);
+ pvt->owner->nativeformats = rtptype.code;
+ pvt->owner->readformat = fmt;
+ pvt->owner->writeformat = fmt;
+ ast_set_read_format(pvt->owner, pvt->owner->readformat);
+ ast_set_write_format(pvt->owner, pvt->owner->writeformat);
+ ast_mutex_unlock(&pvt->lock);
+
them.sin_family = AF_INET;
/* only works for IPv4 */
them.sin_addr.s_addr = inet_addr(remoteIp);
@@ -1191,6 +1214,7 @@ void setup_rtp_connection(unsigned call_reference, const char *remoteIp, int rem
if (pvt->options.progress_audio) {
progress(call_reference, token, 1);
}
+
return;
}
diff --git a/channels/h323/ast_h323.cpp b/channels/h323/ast_h323.cpp
index 91e8b85c1..20118837a 100755
--- a/channels/h323/ast_h323.cpp
+++ b/channels/h323/ast_h323.cpp
@@ -83,13 +83,9 @@ void MyProcess::Main()
PTrace::Initialise(0, NULL, PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine);
}
-#define H323_G7231 OPAL_G7231_6k3 "{sw}"
-#define H323_G729 OPAL_G729 "{sw}"
-#define H323_G729A OPAL_G729A "{sw}"
-
-H323_REGISTER_CAPABILITY(H323_G7231Capability, H323_G7231);
-H323_REGISTER_CAPABILITY(AST_G729Capability, H323_G729);
-H323_REGISTER_CAPABILITY(AST_G729ACapability, H323_G729A);
+H323_REGISTER_CAPABILITY(H323_G7231Capability, OPAL_G7231);
+H323_REGISTER_CAPABILITY(AST_G729Capability, OPAL_G729);
+H323_REGISTER_CAPABILITY(AST_G729ACapability, OPAL_G729A);
H323_G7231Capability::H323_G7231Capability(BOOL annexA_)
: H323AudioCapability(7, 4)
@@ -120,7 +116,7 @@ PObject * H323_G7231Capability::Clone() const
PString H323_G7231Capability::GetFormatName() const
{
- return H323_G7231;
+ return OPAL_G7231;
}
unsigned H323_G7231Capability::GetSubType() const
@@ -172,7 +168,7 @@ unsigned AST_G729Capability::GetSubType() const
PString AST_G729Capability::GetFormatName() const
{
- return H323_G729;
+ return OPAL_G729;
}
H323Codec * AST_G729Capability::CreateCodec(H323Codec::Direction direction) const
@@ -197,7 +193,7 @@ unsigned AST_G729ACapability::GetSubType() const
PString AST_G729ACapability::GetFormatName() const
{
- return H323_G729A;
+ return OPAL_G729A;
}
H323Codec * AST_G729ACapability::CreateCodec(H323Codec::Direction direction) const
@@ -945,7 +941,7 @@ BOOL MyH323_ExternalRTPChannel::Start(void)
/* Notify Asterisk of remote RTP information */
on_start_rtp_channel(connection.GetCallReference(), (const char *)remoteIpAddr.AsString(), remotePort,
- (const char *)connection.GetCallToken());
+ (const char *)connection.GetCallToken(), (int)payloadCode);
return TRUE;
}
@@ -965,7 +961,7 @@ BOOL MyH323_ExternalRTPChannel::OnReceivedAckPDU(const H245_H2250LogicalChannelA
cout << " -- remotePort: " << remotePort << endl;
}
on_start_rtp_channel(connection.GetCallReference(), (const char *)remoteIpAddress.AsString(),
- remotePort, (const char *)connection.GetCallToken());
+ remotePort, (const char *)connection.GetCallToken(), (int)payloadCode);
return TRUE;
}
return FALSE;
diff --git a/channels/h323/chan_h323.h b/channels/h323/chan_h323.h
index fca116ea9..a59da67fc 100755
--- a/channels/h323/chan_h323.h
+++ b/channels/h323/chan_h323.h
@@ -99,6 +99,8 @@ typedef struct call_details {
char *call_source_name;
char *call_source_e164;
char *call_dest_e164;
+ int presentation;
+ int screening;
char *sourceIp;
} call_details_t;
@@ -119,7 +121,7 @@ extern on_rtp_cb on_external_rtp_create;
/* This is a callback prototype function, called to send
the remote IP and RTP port from H.323 to Asterisk */
-typedef void (*start_rtp_cb)(unsigned int, const char *, int, const char *);
+typedef void (*start_rtp_cb)(unsigned int, const char *, int, const char *, int);
extern start_rtp_cb on_start_rtp_channel;
/* This is a callback that happens when call progress is