[asterisk-commits] pcadach: branch pcadach/chan_h323-live r42475 -
in /team/pcadach/chan_h323-li...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Sep 8 12:25:54 MST 2006
Author: pcadach
Date: Fri Sep 8 14:25:54 2006
New Revision: 42475
URL: http://svn.digium.com/view/asterisk?rev=42475&view=rev
Log:
Formatting fixes
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
team/pcadach/chan_h323-live/channels/h323/compat_h323.cpp
team/pcadach/chan_h323-live/channels/h323/compat_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=42475&r1=42474&r2=42475&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/chan_h323.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_h323.c Fri Sep 8 14:25:54 2006
@@ -5,7 +5,7 @@
*
* OpenH323 Channel Driver for ASTERISK PBX.
* By Jeremy McNamara
- * For The NuFone Network
+ * For The NuFone Network
*
* chan_h323 has been derived from code created by
* Michael Manousos and Mark Spencer
@@ -39,7 +39,7 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
#include "asterisk.h"
@@ -72,7 +72,7 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
#include "asterisk/lock.h"
#include "asterisk/logger.h"
@@ -102,11 +102,11 @@
#include "h323/chan_h323.h"
-receive_digit_cb on_receive_digit;
-on_rtp_cb on_external_rtp_create;
-start_rtp_cb on_start_rtp_channel;
+receive_digit_cb on_receive_digit;
+on_rtp_cb on_external_rtp_create;
+start_rtp_cb on_start_rtp_channel;
setup_incoming_cb on_incoming_call;
-setup_outbound_cb on_outgoing_call;
+setup_outbound_cb on_outgoing_call;
chan_ringing_cb on_chan_ringing;
con_established_cb on_connection_established;
clear_con_cb on_connection_cleared;
@@ -156,24 +156,24 @@
/** Private structure of a OpenH323 channel */
struct oh323_pvt {
ast_mutex_t lock; /* Channel private lock */
- call_options_t options; /* Options to be used during call setup */
+ call_options_t options; /* Options to be used during call setup */
int alreadygone; /* Whether or not we've already been destroyed by our peer */
int needdestroy; /* if we need to be destroyed */
call_details_t cd; /* Call details */
- struct ast_channel *owner; /* Who owns us */
- struct sockaddr_in sa; /* Our peer */
- struct sockaddr_in redirip; /* Where our RTP should be going if not to us */
- int nonCodecCapability; /* non-audio capability */
+ struct ast_channel *owner; /* Who owns us */
+ struct sockaddr_in sa; /* Our peer */
+ struct sockaddr_in redirip; /* Where our RTP should be going if not to us */
+ int nonCodecCapability; /* non-audio capability */
int outgoing; /* Outgoing or incoming call? */
- char exten[AST_MAX_EXTENSION]; /* Requested extension */
- char context[AST_MAX_CONTEXT]; /* Context where to start */
- char accountcode[256]; /* Account code */
+ char exten[AST_MAX_EXTENSION]; /* Requested extension */
+ char context[AST_MAX_CONTEXT]; /* Context where to start */
+ char accountcode[256]; /* Account code */
char cid_num[80]; /* Caller*id number, if available */
char cid_name[80]; /* Caller*id name, if available */
char rdnis[80]; /* Referring DNIS, if available */
int amaflags; /* AMA Flags */
- struct ast_rtp *rtp; /* RTP Session */
- struct ast_dsp *vad; /* Used for in-band DTMF detection */
+ struct ast_rtp *rtp; /* RTP Session */
+ struct ast_dsp *vad; /* Used for in-band DTMF detection */
int nativeformats; /* Codec formats supported by a channel */
int needhangup; /* Send hangup when Asterisk is ready */
int hangupcause; /* Hangup cause from OpenH323 layer */
@@ -224,7 +224,7 @@
static int h323_reloading = 0;
/* This is the thread for the monitor which checks for input on the channels
- which are not currently in use. */
+ which are not currently in use. */
static pthread_t monitor_thread = AST_PTHREADT_NULL;
static int restart_monitor(void);
static int h323_do_reload(void);
@@ -391,36 +391,36 @@
}
}
-static void cleanup_call_details(call_details_t *cd)
-{
- if (cd->call_token) {
- free(cd->call_token);
- cd->call_token = NULL;
- }
- if (cd->call_source_aliases) {
- free(cd->call_source_aliases);
- cd->call_source_aliases = NULL;
- }
- if (cd->call_dest_alias) {
- free(cd->call_dest_alias);
- cd->call_dest_alias = NULL;
- }
- if (cd->call_source_name) {
- free(cd->call_source_name);
- cd->call_source_name = NULL;
- }
- if (cd->call_source_e164) {
- free(cd->call_source_e164);
- cd->call_source_e164 = NULL;
- }
- if (cd->call_dest_e164) {
- free(cd->call_dest_e164);
- cd->call_dest_e164 = NULL;
- }
- if (cd->sourceIp) {
- free(cd->sourceIp);
- cd->sourceIp = NULL;
- }
+static void cleanup_call_details(call_details_t *cd)
+{
+ if (cd->call_token) {
+ free(cd->call_token);
+ cd->call_token = NULL;
+ }
+ if (cd->call_source_aliases) {
+ free(cd->call_source_aliases);
+ cd->call_source_aliases = NULL;
+ }
+ if (cd->call_dest_alias) {
+ free(cd->call_dest_alias);
+ cd->call_dest_alias = NULL;
+ }
+ if (cd->call_source_name) {
+ free(cd->call_source_name);
+ cd->call_source_name = NULL;
+ }
+ if (cd->call_source_e164) {
+ free(cd->call_source_e164);
+ cd->call_source_e164 = NULL;
+ }
+ if (cd->call_dest_e164) {
+ free(cd->call_dest_e164);
+ cd->call_dest_e164 = NULL;
+ }
+ if (cd->sourceIp) {
+ free(cd->sourceIp);
+ cd->sourceIp = NULL;
+ }
}
static void __oh323_destroy(struct oh323_pvt *pvt)
@@ -509,7 +509,7 @@
/**
* Send (play) the specified digit to the channel.
- *
+ *
*/
static int oh323_digit_end(struct ast_channel *c, char digit)
{
@@ -545,12 +545,12 @@
}
/**
- * Make a call over the specified channel to the specified
+ * Make a call over the specified channel to the specified
* destination.
* Returns -1 on error, 0 on success.
*/
static int oh323_call(struct ast_channel *c, char *dest, int timeout)
-{
+{
int res = 0;
struct oh323_pvt *pvt = (struct oh323_pvt *)c->tech_pvt;
const char *addr;
@@ -580,7 +580,7 @@
}
}
/* make sure null terminated */
- called_addr[sizeof(called_addr) - 1] = '\0';
+ called_addr[sizeof(called_addr) - 1] = '\0';
if (c->cid.cid_num)
strncpy(pvt->options.cid_num, c->cid.cid_num, sizeof(pvt->options.cid_num));
@@ -676,13 +676,13 @@
if (call_token) {
/* Release lock to eliminate deadlock */
ast_mutex_unlock(&pvt->lock);
- if (h323_clear_call(call_token, q931cause)) {
+ if (h323_clear_call(call_token, q931cause)) {
ast_log(LOG_DEBUG, "ClearCall failed.\n");
}
free(call_token);
ast_mutex_lock(&pvt->lock);
}
- }
+ }
pvt->needdestroy = 1;
/* Update usage counter */
@@ -693,7 +693,7 @@
static struct ast_frame *oh323_rtp_read(struct oh323_pvt *pvt)
{
- /* Retrieve audio/etc from channel. Assumes pvt->lock is already held. */
+ /* Retrieve audio/etc from channel. Assumes pvt->lock is already held. */
struct ast_frame *f;
/* Only apply it for the first packet, we just need the correct ip/port */
@@ -786,7 +786,7 @@
if (pvt) {
ast_mutex_lock(&pvt->lock);
if (pvt->rtp && !pvt->recvonly)
- res = ast_rtp_write(pvt->rtp, frame);
+ res = ast_rtp_write(pvt->rtp, frame);
__oh323_update_info(c, pvt);
ast_mutex_unlock(&pvt->lock);
}
@@ -823,7 +823,6 @@
if (token)
free(token);
return -1;
-
case AST_CONTROL_BUSY:
if (c->_state != AST_STATE_UP) {
h323_answering_call(token, 1);
@@ -900,7 +899,7 @@
if (pvt->rtp)
return 0;
- if(ast_find_ourip(&our_addr, bindaddr)) {
+ if (ast_find_ourip(&our_addr, bindaddr)) {
ast_mutex_unlock(&pvt->lock);
ast_log(LOG_ERROR, "Unable to locate local IP address for RTP stream\n");
return -1;
@@ -983,7 +982,7 @@
}
/* Register channel functions. */
ch->tech_pvt = pvt;
- /* Set the owner of this channel */
+ /* Set the owner of this channel */
pvt->owner = ch;
strncpy(ch->context, pvt->context, sizeof(ch->context) - 1);
@@ -1023,7 +1022,7 @@
ch = NULL;
}
}
- } else {
+ } else {
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
}
return ch;
@@ -1081,14 +1080,14 @@
}
static struct oh323_pvt *find_call_locked(int call_reference, const char *token)
-{
+{
struct oh323_pvt *pvt;
ast_mutex_lock(&iflock);
- pvt = iflist;
+ pvt = iflist;
while(pvt) {
if (!pvt->needdestroy && ((signed int)pvt->cd.call_reference == call_reference)) {
- /* Found the call */
+ /* Found the call */
if ((token != NULL) && (!strcmp(pvt->cd.call_token, token))) {
ast_mutex_lock(&pvt->lock);
ast_mutex_unlock(&iflock);
@@ -1100,7 +1099,7 @@
return pvt;
}
}
- pvt = pvt->next;
+ pvt = pvt->next;
}
ast_mutex_unlock(&iflock);
return NULL;
@@ -1145,13 +1144,13 @@
strncpy(alias->name, name, sizeof(alias->name) - 1);
for (; v; v = v->next) {
if (!strcasecmp(v->name, "e164")) {
- strncpy(alias->e164, v->value, sizeof(alias->e164) - 1);
+ strncpy(alias->e164, v->value, sizeof(alias->e164) - 1);
} else if (!strcasecmp(v->name, "prefix")) {
- strncpy(alias->prefix, v->value, sizeof(alias->prefix) - 1);
+ strncpy(alias->prefix, v->value, sizeof(alias->prefix) - 1);
} else if (!strcasecmp(v->name, "context")) {
- strncpy(alias->context, v->value, sizeof(alias->context) - 1);
+ strncpy(alias->context, v->value, sizeof(alias->context) - 1);
} else if (!strcasecmp(v->name, "secret")) {
- strncpy(alias->secret, v->value, sizeof(alias->secret) - 1);
+ strncpy(alias->secret, v->value, sizeof(alias->secret) - 1);
} else {
if (strcasecmp(v->value, "h323")) {
ast_log(LOG_WARNING, "Keyword %s does not make sense in type=h323\n", v->value);
@@ -1292,7 +1291,7 @@
} else if (ast_get_ip(&user->addr, v->value)) {
ASTOBJ_UNREF(user, oh323_destroy_user);
return NULL;
- }
+ }
/* Let us know we need to use ip authentication */
user->host = 1;
} else if (!strcasecmp(v->name, "amaflags")) {
@@ -1303,7 +1302,7 @@
user->amaflags = format;
}
} else if (!strcasecmp(v->name, "permit") ||
- !strcasecmp(v->name, "deny")) {
+ !strcasecmp(v->name, "deny")) {
user->ha = ast_append_ha(v->name, v->value, user->ha);
}
}
@@ -1399,7 +1398,7 @@
} else if (!strcasecmp(v->name, "port")) {
peer->addr.sin_port = htons(atoi(v->value));
} else if (!strcasecmp(v->name, "permit") ||
- !strcasecmp(v->name, "deny")) {
+ !strcasecmp(v->name, "deny")) {
peer->ha = ast_append_ha(v->name, v->value, peer->ha);
} else if (!strcasecmp(v->name, "mailbox")) {
ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
@@ -1439,7 +1438,7 @@
}
}
- if (!peername) { /* Did not find peer in realtime */
+ if (!peername) { /* Did not find peer in realtime */
ast_log(LOG_WARNING, "Cannot determine peer name for IP address %s\n", addr);
ast_variables_destroy(var);
return NULL;
@@ -1545,7 +1544,7 @@
if (p->addr.sin_addr.s_addr) {
pvt->sa.sin_addr = p->addr.sin_addr;
pvt->sa.sin_port = p->addr.sin_port;
- }
+ }
ASTOBJ_UNREF(p, oh323_destroy_peer);
}
if (!p && !found) {
@@ -1561,7 +1560,7 @@
pvt->sa.sin_port = htons(portno);
/* Look peer by address */
p = find_peer(NULL, &pvt->sa, 1);
- memcpy(&pvt->options, (p ? &p->options : &global_options), sizeof(pvt->options));
+ memcpy(&pvt->options, (p ? &p->options : &global_options), sizeof(pvt->options));
pvt->jointcapability = pvt->options.capability;
if (p) {
ASTOBJ_UNREF(p, oh323_destroy_peer);
@@ -1633,7 +1632,7 @@
strncpy(pvt->exten, ext, sizeof(pvt->exten) - 1);
}
if (h323debug)
- ast_log(LOG_DEBUG, "Extension: %s Host: %s\n", pvt->exten, host);
+ ast_log(LOG_DEBUG, "Extension: %s Host: %s\n", pvt->exten, host);
if (!usingGk) {
if (create_addr(pvt, host)) {
@@ -1698,7 +1697,7 @@
struct oh323_pvt *pvt;
int res;
- pvt = find_call_locked(call_reference, token);
+ pvt = find_call_locked(call_reference, token);
if (!pvt) {
ast_log(LOG_ERROR, "Received digit '%c' (%u ms) for call %s without private structure\n", digit, duration, token);
return -1;
@@ -1765,7 +1764,7 @@
ast_log(LOG_ERROR, "Unable to allocated info structure, this is very bad\n");
return NULL;
}
- pvt = find_call_locked(call_reference, token);
+ pvt = find_call_locked(call_reference, token);
if (!pvt) {
free(info);
ast_log(LOG_ERROR, "Unable to find call %s(%d)\n", token, call_reference);
@@ -1795,14 +1794,14 @@
* 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 isAstFormat; /* whether the following code is an AST_FORMAT */
int code;
};
/**
- * Call-back function passing remote ip/port information from H.323 to asterisk
+ * Call-back function passing remote ip/port information from H.323 to asterisk
*
- * Returns nothing
+ * Returns nothing
*/
static void setup_rtp_connection(unsigned call_reference, const char *remoteIp, int remotePort, const char *token, int pt)
{
@@ -1816,7 +1815,7 @@
ast_log(LOG_DEBUG, "Setting up RTP connection for %s\n", token);
/* Find the call or allocate a private structure if call not found */
- pvt = find_call_locked(call_reference, token);
+ pvt = find_call_locked(call_reference, token);
if (!pvt) {
ast_log(LOG_ERROR, "Something is wrong: rtp\n");
return;
@@ -1831,7 +1830,7 @@
them.sin_family = AF_INET;
/* only works for IPv4 */
- them.sin_addr.s_addr = inet_addr(remoteIp);
+ them.sin_addr.s_addr = inet_addr(remoteIp);
them.sin_port = htons(remotePort);
if (them.sin_addr.s_addr) {
@@ -1905,8 +1904,8 @@
return;
}
-/**
- * Call-back function to signal asterisk that the channel has been answered
+/**
+ * Call-back function to signal asterisk that the channel has been answered
* Returns nothing
*/
static void connection_made(unsigned call_reference, const char *token)
@@ -1916,7 +1915,7 @@
if (h323debug)
ast_log(LOG_DEBUG, "Call %s answered\n", token);
- pvt = find_call_locked(call_reference, token);
+ pvt = find_call_locked(call_reference, token);
if (!pvt) {
ast_log(LOG_ERROR, "Something is wrong: connection\n");
return;
@@ -1994,14 +1993,14 @@
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);
+ ast_verbose(VERBOSE_PREFIX_3 "\tCalling party IP: [%s]\n", pvt->cd.sourceIp);
}
/* Decide if we are allowing Gatekeeper routed calls*/
if ((!strcasecmp(cd->sourceIp, gatekeeper)) && (gkroute == -1) && (usingGk)) {
if (!ast_strlen_zero(cd->call_dest_e164)) {
strncpy(pvt->exten, cd->call_dest_e164, sizeof(pvt->exten) - 1);
- strncpy(pvt->context, default_context, sizeof(pvt->context) - 1);
+ strncpy(pvt->context, default_context, sizeof(pvt->context) - 1);
} else {
alias = find_alias(cd->call_dest_alias, 1);
if (!alias) {
@@ -2013,9 +2012,9 @@
strncpy(pvt->context, alias->context, sizeof(pvt->context) - 1);
}
} else {
- /* Either this call is not from the Gatekeeper
+ /* Either this call is not from the Gatekeeper
or we are not allowing gk routed calls */
- user = find_user(cd, 1);
+ user = find_user(cd, 1);
if (!user) {
if (!ast_strlen_zero(pvt->cd.call_dest_e164)) {
strncpy(pvt->exten, cd->call_dest_e164, sizeof(pvt->exten) - 1);
@@ -2066,12 +2065,12 @@
}
if (!ast_strlen_zero(user->accountcode)) {
strncpy(pvt->accountcode, user->accountcode, sizeof(pvt->accountcode) - 1);
- }
+ }
if (user->amaflags) {
pvt->amaflags = user->amaflags;
}
ASTOBJ_UNREF(user, oh323_destroy_user);
- }
+ }
}
return &pvt->options;
}
@@ -2090,7 +2089,7 @@
ast_log(LOG_DEBUG, "Preparing Asterisk to answer for %s\n", token);
/* Find the call or allocate a private structure if call not found */
- pvt = find_call_locked(call_reference, token);
+ pvt = find_call_locked(call_reference, token);
if (!pvt) {
ast_log(LOG_ERROR, "Something is wrong: answer_call\n");
return 0;
@@ -2109,8 +2108,8 @@
/**
* Call-back function to establish an outgoing H.323 call
- *
- * Returns 1 on success
+ *
+ * Returns 1 on success
*/
static int setup_outgoing_call(call_details_t *cd)
{
@@ -2131,7 +2130,7 @@
if (h323debug)
ast_log(LOG_DEBUG, "Ringing on %s\n", token);
- pvt = find_call_locked(call_reference, token);
+ pvt = find_call_locked(call_reference, token);
if (!pvt) {
ast_log(LOG_ERROR, "Something is wrong: ringing\n");
return;
@@ -2157,7 +2156,7 @@
ast_log(LOG_DEBUG, "Cleaning connection to %s\n", call_token);
while (1) {
- pvt = find_call_locked(call_reference, call_token);
+ pvt = find_call_locked(call_reference, call_token);
if (!pvt) {
if (h323debug)
ast_log(LOG_DEBUG, "No connection for %s\n", call_token);
@@ -2207,7 +2206,7 @@
ast_log(LOG_DEBUG, "Hanging up connection to %s with cause %d\n", token, cause);
}
- pvt = find_call_locked(call_reference, token);
+ pvt = find_call_locked(call_reference, token);
if (!pvt) {
if (h323debug) {
ast_log(LOG_DEBUG, "Connection to %s already cleared\n", token);
@@ -2440,12 +2439,12 @@
static int h323_ep_hangup(int fd, int argc, char *argv[])
{
- if (argc != 3) {
- return RESULT_SHOWUSAGE;
+ if (argc != 3) {
+ return RESULT_SHOWUSAGE;
}
if (h323_soft_hangup(argv[2])) {
ast_verbose(VERBOSE_PREFIX_3 "Hangup succeeded on %s\n", argv[2]);
- } else {
+ } else {
ast_verbose(VERBOSE_PREFIX_3 "Hangup failed for %s\n", argv[2]);
}
return RESULT_SUCCESS;
@@ -2453,38 +2452,38 @@
static int h323_tokens_show(int fd, int argc, char *argv[])
{
- if (argc != 3) {
- return RESULT_SHOWUSAGE;
+ if (argc != 3) {
+ return RESULT_SHOWUSAGE;
}
h323_show_tokens();
return RESULT_SUCCESS;
}
-static char trace_usage[] =
+static char trace_usage[] =
"Usage: h.323 trace <level num>\n"
" Enables H.323 stack tracing for debugging purposes\n";
-static char no_trace_usage[] =
+static char no_trace_usage[] =
"Usage: h.323 no trace\n"
" Disables H.323 stack tracing for debugging purposes\n";
-static char debug_usage[] =
+static char debug_usage[] =
"Usage: h.323 debug\n"
" Enables H.323 debug output\n";
-static char no_debug_usage[] =
+static char no_debug_usage[] =
"Usage: h.323 no debug\n"
" Disables H.323 debug output\n";
-static char show_cycle_usage[] =
+static char show_cycle_usage[] =
"Usage: h.323 gk cycle\n"
" Manually re-register with the Gatekeper (Currently Disabled)\n";
-static char show_hangup_usage[] =
+static char show_hangup_usage[] =
"Usage: h.323 hangup <token>\n"
" Manually try to hang up call identified by <token>\n";
-static char show_tokens_usage[] =
+static char show_tokens_usage[] =
"Usage: h.323 show tokens\n"
" Print out all active call tokens\n";
@@ -2492,21 +2491,21 @@
"Usage: h323 reload\n"
" Reloads H.323 configuration from sip.conf\n";
-static struct ast_cli_entry h323_cli[] = {
+static struct ast_cli_entry h323_cli[] = {
{ { "h.323", "trace", NULL }, h323_do_trace,
- "Enable H.323 Stack Tracing", trace_usage },
+ "Enable H.323 Stack Tracing", trace_usage },
{ { "h.323", "no", "trace", NULL }, h323_no_trace,
- "Disable H.323 Stack Tracing", no_trace_usage },
+ "Disable H.323 Stack Tracing", no_trace_usage },
{ { "h.323", "debug", NULL }, h323_do_debug,
- "Enable H.323 debug", debug_usage },
+ "Enable H.323 debug", debug_usage },
{ { "h.323", "no", "debug", NULL }, h323_no_debug,
- "Disable H.323 debug", no_debug_usage },
+ "Disable H.323 debug", no_debug_usage },
{ { "h.323", "gk", "cycle", NULL }, h323_gk_cycle,
- "Manually re-register with the Gatekeper", show_cycle_usage },
+ "Manually re-register with the Gatekeper", show_cycle_usage },
{ { "h.323", "hangup", NULL }, h323_ep_hangup,
- "Manually try to hang up a call", show_hangup_usage },
+ "Manually try to hang up a call", show_hangup_usage },
{ { "h.323", "show", "tokens", NULL }, h323_tokens_show,
- "Show all active call tokens", show_tokens_usage },
+ "Show all active call tokens", show_tokens_usage },
};
static int reload_config(void)
@@ -2514,8 +2513,8 @@
int format;
struct ast_config *cfg;
struct ast_variable *v;
- struct oh323_peer *peer = NULL;
- struct oh323_user *user = NULL;
+ struct oh323_peer *peer = NULL;
+ struct oh323_user *user = NULL;
struct oh323_alias *alias = NULL;
struct ast_hostent ahp; struct hostent *hp;
char *cat;
@@ -2530,9 +2529,9 @@
return 1;
}
- /* fire up the H.323 Endpoint */
+ /* fire up the H.323 Endpoint */
if (!h323_end_point_exist()) {
- h323_end_point_create();
+ h323_end_point_create();
}
memset(&bindaddr, 0, sizeof(bindaddr));
memset(&global_options, 0, sizeof(global_options));
@@ -2753,7 +2752,7 @@
return h323_reload(0, 0, NULL);
}
-static struct ast_cli_entry cli_h323_reload =
+static struct ast_cli_entry cli_h323_reload =
{ { "h.323", "reload", NULL }, h323_reload, "Reload H.323 configuration", h323_reload_usage };
static enum ast_rtp_get_result oh323_get_rtp_peer(struct ast_channel *chan, struct ast_rtp **rtp)
@@ -2816,7 +2815,7 @@
return 0;
}
- mode = convertcap(chan->writeformat);
+ mode = convertcap(chan->writeformat);
pvt = (struct oh323_pvt *) chan->tech_pvt;
if (!pvt) {
ast_log(LOG_ERROR, "No Private Structure, this is bad\n");
@@ -2834,7 +2833,7 @@
.type = "H323",
.get_rtp_info = oh323_get_rtp_peer,
.get_vrtp_info = oh323_get_vrtp_peer,
- .set_rtp_peer= oh323_set_rtp_peer,
+ .set_rtp_peer = oh323_set_rtp_peer,
};
static enum ast_module_load_result load_module(void)
@@ -2882,13 +2881,13 @@
ast_rtp_proto_register(&oh323_rtp);
/* Register our callback functions */
- h323_callback_register(setup_incoming_call,
- setup_outgoing_call,
- external_rtp_create,
- setup_rtp_connection,
- cleanup_connection,
+ h323_callback_register(setup_incoming_call,
+ setup_outgoing_call,
+ external_rtp_create,
+ setup_rtp_connection,
+ cleanup_connection,
chan_ringing,
- connection_made,
+ connection_made,
receive_digit,
answer_call,
progress,
@@ -2998,8 +2997,8 @@
ASTOBJ_CONTAINER_DESTROYALL(&aliasl, oh323_destroy_alias);
ASTOBJ_CONTAINER_DESTROY(&aliasl);
- return 0;
-}
+ return 0;
+}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "The NuFone Network's OpenH323 Channel Driver",
.load = load_module,
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=42475&r1=42474&r2=42475&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp (original)
+++ team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp Fri Sep 8 14:25:54 2006
@@ -7,7 +7,7 @@
* OpenH323 Channel Driver for ASTERISK PBX.
* By Jeremy McNamara
* For The NuFone Network
- *
+ *
* chan_h323 has been derived from code created by
* Michael Manousos and Mark Spencer
*
@@ -16,15 +16,15 @@
* chan_h323 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * (at your option) any later version.
*
- * chan_h323 is distributed WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
+ * chan_h323 is distributed WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Version Info: $Id$
*/
@@ -145,8 +145,9 @@
#define cout (*logstream)
-MyProcess::MyProcess(): PProcess("The NuFone Network's", "H.323 Channel Driver for Asterisk",
- MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER)
+MyProcess::MyProcess(): PProcess("The NuFone Network's",
+ "H.323 Channel Driver for Asterisk",
+ MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER)
{
/* Fix missed one in PWLib */
PX_firstTimeStart = FALSE;
@@ -171,10 +172,9 @@
}
endPoint = new MyH323EndPoint();
/* Due to a bug in the H.323 recomendation/stack we should request a sane
- amount of bandwidth from the GK - this function is ignored if not using a GK
+ amount of bandwidth from the GK - this function is ignored if not using a GK
We are requesting 128 (64k in each direction), which is the worst case codec. */
- endPoint->SetInitialBandwidth(1280);
-
+ endPoint->SetInitialBandwidth(1280);
}
void PAssertFunc(const char *msg)
@@ -192,23 +192,23 @@
* Capability: G.723.1
*/
H323_G7231Capability::H323_G7231Capability(BOOL annexA_)
- : H323AudioCapability(7, 4)
-{
- annexA = annexA_;
+ : H323AudioCapability(7, 4)
+{
+ annexA = annexA_;
}
PObject::Comparison H323_G7231Capability::Compare(const PObject & obj) const
{
- Comparison result = H323AudioCapability::Compare(obj);
- if (result != EqualTo) {
- return result;
- }
- PINDEX otherAnnexA = ((const H323_G7231Capability &)obj).annexA;
- if (annexA < otherAnnexA) {
- return LessThan;
- }
- if (annexA > otherAnnexA) {
- return GreaterThan;
+ Comparison result = H323AudioCapability::Compare(obj);
+ if (result != EqualTo) {
+ return result;
+ }
+ PINDEX otherAnnexA = ((const H323_G7231Capability &)obj).annexA;
+ if (annexA < otherAnnexA) {
+ return LessThan;
+ }
+ if (annexA > otherAnnexA) {
+ return GreaterThan;
}
return EqualTo;
}
@@ -220,102 +220,102 @@
PString H323_G7231Capability::GetFormatName() const
{
- return OPAL_G7231;
+ return OPAL_G7231;
}
unsigned H323_G7231Capability::GetSubType() const
{
- return H245_AudioCapability::e_g7231;
+ return H245_AudioCapability::e_g7231;
}
BOOL H323_G7231Capability::OnSendingPDU(H245_AudioCapability & cap,
- unsigned packetSize) const
-{
- cap.SetTag(H245_AudioCapability::e_g7231);
- H245_AudioCapability_g7231 & g7231 = cap;
- g7231.m_maxAl_sduAudioFrames = packetSize;
- g7231.m_silenceSuppression = annexA;
- return TRUE;
+ unsigned packetSize) const
+{
+ cap.SetTag(H245_AudioCapability::e_g7231);
+ H245_AudioCapability_g7231 & g7231 = cap;
+ g7231.m_maxAl_sduAudioFrames = packetSize;
+ g7231.m_silenceSuppression = annexA;
+ return TRUE;
}
BOOL H323_G7231Capability::OnReceivedPDU(const H245_AudioCapability & cap,
- unsigned & packetSize)
+ unsigned & packetSize)
{
if (cap.GetTag() != H245_AudioCapability::e_g7231) {
- return FALSE;
- }
- const H245_AudioCapability_g7231 & g7231 = cap;
- packetSize = g7231.m_maxAl_sduAudioFrames;
- annexA = g7231.m_silenceSuppression;
- return TRUE;
+ return FALSE;
+ }
+ const H245_AudioCapability_g7231 & g7231 = cap;
+ packetSize = g7231.m_maxAl_sduAudioFrames;
+ annexA = g7231.m_silenceSuppression;
+ return TRUE;
}
H323Codec * H323_G7231Capability::CreateCodec(H323Codec::Direction direction) const
{
- return NULL;
+ return NULL;
}
/*
* Capability: G.729
*/
AST_G729Capability::AST_G729Capability()
- : H323AudioCapability(24, 2)
+ : H323AudioCapability(24, 2)
{
}
PObject * AST_G729Capability::Clone() const
{
- return new AST_G729Capability(*this);
+ return new AST_G729Capability(*this);
}
unsigned AST_G729Capability::GetSubType() const
{
- return H245_AudioCapability::e_g729;
+ return H245_AudioCapability::e_g729;
}
PString AST_G729Capability::GetFormatName() const
{
- return OPAL_G729;
+ return OPAL_G729;
}
H323Codec * AST_G729Capability::CreateCodec(H323Codec::Direction direction) const
{
- return NULL;
+ return NULL;
}
/*
* Capability: G.729A
*/
AST_G729ACapability::AST_G729ACapability()
- : H323AudioCapability(24, 6)
+ : H323AudioCapability(24, 6)
{
}
PObject * AST_G729ACapability::Clone() const
{
- return new AST_G729ACapability(*this);
+ return new AST_G729ACapability(*this);
}
unsigned AST_G729ACapability::GetSubType() const
{
- return H245_AudioCapability::e_g729AnnexA;
+ return H245_AudioCapability::e_g729AnnexA;
}
PString AST_G729ACapability::GetFormatName() const
{
- return OPAL_G729A;
+ return OPAL_G729A;
}
H323Codec * AST_G729ACapability::CreateCodec(H323Codec::Direction direction) const
{
- return NULL;
+ return NULL;
}
/*
* Capability: GSM full rate
*/
AST_GSM0610Capability::AST_GSM0610Capability(int comfortNoise_, int scrambled_)
- : H323AudioCapability(24, 2)
+ : H323AudioCapability(24, 2)
{
comfortNoise = comfortNoise_;
scrambled = scrambled_;
@@ -323,16 +323,16 @@
PObject * AST_GSM0610Capability::Clone() const
{
- return new AST_GSM0610Capability(*this);
+ return new AST_GSM0610Capability(*this);
}
unsigned AST_GSM0610Capability::GetSubType() const
{
- return H245_AudioCapability::e_gsmFullRate;
+ return H245_AudioCapability::e_gsmFullRate;
}
BOOL AST_GSM0610Capability::OnSendingPDU(H245_AudioCapability & cap,
- unsigned packetSize) const
+ unsigned packetSize) const
{
cap.SetTag(H245_AudioCapability::e_gsmFullRate);
H245_GSMAudioCapability & gsm = cap;
@@ -343,7 +343,7 @@
}
BOOL AST_GSM0610Capability::OnReceivedPDU(const H245_AudioCapability & cap,
- unsigned & packetSize)
+ unsigned & packetSize)
{
if (cap.GetTag() != H245_AudioCapability::e_gsmFullRate)
return FALSE;
@@ -357,16 +357,16 @@
PString AST_GSM0610Capability::GetFormatName() const
{
- return OPAL_GSM0610;
+ return OPAL_GSM0610;
}
H323Codec * AST_GSM0610Capability::CreateCodec(H323Codec::Direction direction) const
{
- return NULL;
-}
-
-
-/** MyH323EndPoint
+ return NULL;
+}
+
+
+/** MyH323EndPoint
*/
MyH323EndPoint::MyH323EndPoint()
: H323EndPoint()
@@ -397,7 +397,7 @@
cout << " -- Making call to " << fullAddress << " using gatekeeper." << endl;
}
} else {
- fullAddress = dest;
+ fullAddress = dest;
if (h323debug) {
cout << " -- Making call to " << fullAddress << " without gatekeeper." << endl;
}
@@ -439,22 +439,22 @@
void MyH323EndPoint::SetEndpointTypeInfo( H225_EndpointType & info ) const
{
- H323EndPoint::SetEndpointTypeInfo(info);
+ H323EndPoint::SetEndpointTypeInfo(info);
if (terminalType == e_GatewayOnly){
info.RemoveOptionalField(H225_EndpointType::e_terminal);
info.IncludeOptionalField(H225_EndpointType::e_gateway);
}
- info.m_gateway.IncludeOptionalField(H225_GatewayInfo::e_protocol);
- info.m_gateway.m_protocol.SetSize(1);
- H225_SupportedProtocols &protocol=info.m_gateway.m_protocol[0];
- protocol.SetTag(H225_SupportedProtocols::e_voice);
- PINDEX as=SupportedPrefixes.GetSize();
- ((H225_VoiceCaps &)protocol).m_supportedPrefixes.SetSize(as);
- for (PINDEX p=0; p<as; p++) {
+ info.m_gateway.IncludeOptionalField(H225_GatewayInfo::e_protocol);
+ info.m_gateway.m_protocol.SetSize(1);
+ H225_SupportedProtocols &protocol=info.m_gateway.m_protocol[0];
+ protocol.SetTag(H225_SupportedProtocols::e_voice);
+ PINDEX as=SupportedPrefixes.GetSize();
+ ((H225_VoiceCaps &)protocol).m_supportedPrefixes.SetSize(as);
+ for (PINDEX p=0; p<as; p++) {
H323SetAliasAddress(SupportedPrefixes[p], ((H225_VoiceCaps &)protocol).m_supportedPrefixes[p].m_prefix, H225_AliasAddress::e_dialedDigits);
- }
+ }
}
void MyH323EndPoint::SetGateway(void)
@@ -511,7 +511,7 @@
}
return FALSE;
}
-
+
BOOL MyH323EndPoint::ForwardConnection(H323Connection & connection,
const PString & forwardParty,
const H323SignalPDU & pdu)
@@ -532,7 +532,7 @@
}
/** OnConnectionCleared callback function is called upon the dropping of an established
- * H323 connection.
+ * H323 connection.
*/
void MyH323EndPoint::OnConnectionCleared(H323Connection & connection, const PString & clearedCallToken)
{
@@ -675,7 +675,7 @@
return conn;
}
-/* MyH323Connection Implementation */
+/* MyH323Connection Implementation */
MyH323Connection::MyH323Connection(MyH323EndPoint & ep, unsigned callReference,
unsigned options)
: H323Connection(ep, callReference, options)
@@ -724,13 +724,13 @@
}
H323Connection::AnswerCallResponse MyH323Connection::OnAnswerCall(const PString & caller,
- const H323SignalPDU & setupPDU,
- H323SignalPDU & /*connectPDU*/)
+ const H323SignalPDU & setupPDU,
+ H323SignalPDU & /*connectPDU*/)
{
unsigned pi;
if (h323debug) {
- cout << "\t=-= In OnAnswerCall for call " << GetCallReference() << endl;
+ cout << "\t=-= In OnAnswerCall for call " << GetCallReference() << endl;
}
if (connectionState == ShuttingDownConnection)
@@ -758,16 +758,16 @@
return H323Connection::AnswerCallDenied;
}
/* The call will be answered later with "AnsweringCall()" function.
- */
+ */
return H323Connection::AnswerCallDeferredWithMedia;
}
BOOL MyH323Connection::OnAlerting(const H323SignalPDU & alertingPDU, const PString & username)
{
if (h323debug) {
- cout << "\t=-= In OnAlerting for call " << GetCallReference()
- << ": sessionId=" << sessionId << endl;
- cout << "\t-- Ringing phone for \"" << username << "\"" << endl;
+ cout << "\t=-= In OnAlerting for call " << GetCallReference()
+ << ": sessionId=" << sessionId << endl;
+ cout << "\t-- Ringing phone for \"" << username << "\"" << endl;
}
if (on_progress) {
@@ -791,8 +791,8 @@
}
on_progress(GetCallReference(), (const char *)GetCallToken(), isInband);
}
- on_chan_ringing(GetCallReference(), (const char *)GetCallToken() );
- return connectionState != ShuttingDownConnection;
+ on_chan_ringing(GetCallReference(), (const char *)GetCallToken() );
+ return connectionState != ShuttingDownConnection;
}
void MyH323Connection::SetCallOptions(void *o, BOOL isIncoming)
@@ -863,7 +863,7 @@
}
/* Convert complex strings */
- // FIXME: deal more than one source alias
+ // FIXME: deal more than one source alias
sourceAliases = setupPDU.GetSourceAliases();
s1 = strdup((const char *)sourceAliases);
if ((s = strchr(s1, ' ')) != NULL)
@@ -913,7 +913,7 @@
{
call_details_t cd;
- if (h323debug) {
+ if (h323debug) {
cout << " -- Sending SETUP message" << endl;
}
@@ -957,7 +957,7 @@
void MyH323Connection::OnReceivedReleaseComplete(const H323SignalPDU & pdu)
{
if (h323debug) {
- cout << "\t-- Received RELEASE COMPLETE message..." << endl;
+ cout << "\t-- Received RELEASE COMPLETE message..." << endl;
}
if (on_hangup)
on_hangup(GetCallReference(), (const char *)GetCallToken(), pdu.GetQ931().GetCause());
@@ -998,7 +998,7 @@
void MyH323Connection::OnUserInputString(const PString &value)
{
if (h323debug) {
- cout << "\t-- Received user input string (" << value << ") from remote." << endl;
+ cout << "\t-- Received user input string (" << value << ") from remote." << endl;
}
on_receive_digit(GetCallReference(), value[0], (const char *)GetCallToken(), 0);
}
@@ -1035,8 +1035,8 @@
}
BOOL MyH323Connection::OnReceivedCapabilitySet(const H323Capabilities & remoteCaps,
- const H245_MultiplexCapability * muxCap,
- H245_TerminalCapabilitySetReject & reject)
+ const H245_MultiplexCapability * muxCap,
+ H245_TerminalCapabilitySetReject & reject)
{
struct __codec__ {
unsigned int asterisk_codec;
@@ -1115,7 +1115,7 @@
y.m_capabilityIdentifier = *cap;
}
if ((subType != H245_VideoCapability::e_genericVideoCapability) ||
- (vcodecs[x].oid && ((const H323GenericVideoCapability &)remoteCapabilities[i]).IsGenericMatch((const H245_GenericCapability)y))) {
+ (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;
}
@@ -1145,27 +1145,27 @@
}
H323Channel * MyH323Connection::CreateRealTimeLogicalChannel(const H323Capability & capability,
- H323Channel::Directions dir,
- unsigned sessionID,
- const H245_H2250LogicalChannelParameters * /*param*/,
- RTP_QOS * /*param*/ )
+ H323Channel::Directions dir,
+ unsigned sessionID,
+ const H245_H2250LogicalChannelParameters * /*param*/,
+ RTP_QOS * /*param*/ )
{
return new MyH323_ExternalRTPChannel(*this, capability, dir, sessionID);
}
/** This callback function is invoked once upon creation of each
- * channel for an H323 session
+ * channel for an H323 session
*/
BOOL MyH323Connection::OnStartLogicalChannel(H323Channel & channel)
-{
+{
/* Increase the count of channels we have open */
channelsOpen++;
if (h323debug) {
- cout << "\t-- Started logical channel: ";
- cout << ((channel.GetDirection()==H323Channel::IsTransmitter)?"sending ":((channel.GetDirection()==H323Channel::IsReceiver)?"receiving ":" "));
- cout << (const char *)(channel.GetCapability()).GetFormatName() << endl;
- cout << "\t\t-- channelsOpen = " << channelsOpen << endl;
+ cout << "\t-- Started logical channel: "
+ << ((channel.GetDirection() == H323Channel::IsTransmitter) ? "sending " : ((channel.GetDirection() == H323Channel::IsReceiver) ? "receiving " : " "))
+ << (const char *)(channel.GetCapability()).GetFormatName() << endl;
+ cout << "\t\t-- channelsOpen = " << channelsOpen << endl;
}
return connectionState != ShuttingDownConnection;
}
@@ -1173,7 +1173,7 @@
void MyH323Connection::SetCapabilities(int cap, int dtmf_mode, void *_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;
@@ -1209,7 +1209,7 @@
#if 0
case AST_FORMAT_SPEEX:
/* Not real sure if Asterisk acutally supports all
- of the various different bit rates so add them
+ of the various different bit rates so add them
all and figure it out later*/
lastcap = localCapabilities.SetCapability(0, 0, new SpeexNarrow2AudioCapability());
@@ -1218,7 +1218,7 @@
lastcap = localCapabilities.SetCapability(0, 0, new SpeexNarrow5AudioCapability());
lastcap = localCapabilities.SetCapability(0, 0, new SpeexNarrow6AudioCapability());
break;
-#endif
+#endif
case AST_FORMAT_G729A:
[... 752 lines stripped ...]
More information about the asterisk-commits
mailing list