[asterisk-commits] may: branch may/chan_ooh323_rework r208015 - in /team/may/chan_ooh323_rework/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 21 19:36:26 CDT 2009
Author: may
Date: Tue Jul 21 19:36:22 2009
New Revision: 208015
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=208015
Log:
support t.38 both modes, use t38support = transparent or faxgw or
disabled, this parameter can be in global or peer/user section. transparent mode needed
timer interface (pthread_timing is too bad, pthread_dahdi is good for faxing, timerfd_timing
not tested while).
faxgw mode tested with t38 pass-through on h323 channels and with
RecvFax application.
There is point to pause implementing new features and work on more
testing.
Modified:
team/may/chan_ooh323_rework/addons/chan_ooh323.c
team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h
team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c
team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c
team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c
team/may/chan_ooh323_rework/addons/ooh323cDriver.c
team/may/chan_ooh323_rework/addons/ooh323cDriver.h
Modified: team/may/chan_ooh323_rework/addons/chan_ooh323.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/chan_ooh323.c?view=diff&rev=208015&r1=208014&r2=208015
==============================================================================
--- team/may/chan_ooh323_rework/addons/chan_ooh323.c (original)
+++ team/may/chan_ooh323_rework/addons/chan_ooh323.c Tue Jul 21 19:36:22 2009
@@ -53,6 +53,9 @@
#define MAXT30 240
#define T38TOAUDIOTIMEOUT 30
+#define T38_DISABLED 0
+#define T38_TRANSPARENT 1
+#define T38_FAXGW 2
/* Channel description */
static const char type[] = "OOH323";
@@ -71,6 +74,7 @@
static struct ast_frame *ooh323_read(struct ast_channel *ast);
static int ooh323_write(struct ast_channel *ast, struct ast_frame *f);
static int ooh323_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen);
+static int ooh323_queryoption(struct ast_channel *ast, int option, void *data, int *datalen);
static int ooh323_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static enum ast_rtp_glue_result ooh323_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **rtp);
@@ -101,6 +105,7 @@
.indicate = ooh323_indicate,
.fixup = ooh323_fixup,
.send_html = 0,
+ .queryoption = ooh323_queryoption,
/* .bridge = ast_rtp_bridge, */
};
@@ -127,12 +132,12 @@
struct ast_rtp_instance *rtp;
struct ast_rtp_instance *vrtp; /* Placeholder for now */
+ int t38support; /* T.38 mode - disable, transparent, faxgw */
struct ast_udptl *udptl;
int faxmode;
int t38_tx_enable;
int t38_init;
t38_gateway_state_t t38r_state;
- t38_gateway_state_t t38t_state;
struct sockaddr_in udptlredirip;
time_t lastTxT38;
int chmodepend;
@@ -191,6 +196,7 @@
int capability;
struct ast_codec_pref prefs;
int dtmfmode;
+ int t38support;
int rtptimeout;
int mUseIP; /* Use IP address or H323-ID to search user */
char mIP[20];
@@ -208,6 +214,7 @@
char accountcode[20];
int amaflags;
int dtmfmode;
+ int t38support;
int mFriend; /* indicates defined as friend */
char ip[20];
int port;
@@ -261,6 +268,7 @@
static int gCapability = AST_FORMAT_ULAW;
static struct ast_codec_pref gPrefs;
static int gDTMFMode = H323_DTMF_RFC2833;
+static int gT38Support = T38_FAXGW;
static char gGatekeeper[100];
static enum RasGatekeeperMode gRasGkMode = RasNoGatekeeper;
@@ -474,6 +482,7 @@
ast_udptl_set_error_correction_scheme(pvt->udptl, UDPTL_ERROR_CORRECTION_NONE);
pvt->faxmode = 0;
+ pvt->t38support = gT38Support;
pvt->call_reference = callref;
if (callToken)
@@ -596,10 +605,12 @@
/* } */
memcpy(&p->prefs, &peer->prefs, sizeof(struct ast_codec_pref));
p->dtmfmode |= peer->dtmfmode;
+ p->t38support = peer->t38support;
ast_copy_string(p->accountcode, peer->accountcode, sizeof(p->accountcode));
p->amaflags = peer->amaflags;
} else {
p->dtmfmode = gDTMFMode;
+ p->t38support = gT38Support;
p->capability = gCapability;
memcpy(&p->prefs, &gPrefs, sizeof(struct ast_codec_pref));
@@ -785,7 +796,7 @@
ast_mutex_lock(&p->lock);
- if (digit == 'e' && !p->faxmode) {
+ if (digit == 'e' && !p->faxmode && p->t38support != T38_DISABLED) {
if (!p->chmodepend) {
if (gH323Debug)
ast_verbose("request to change %s to t.38 because fax cng\n",
@@ -1079,13 +1090,13 @@
/* if we are in fax t30-t38 transparent mode */
- if (p->faxmode) {
+ if (p->faxmode && p->t38support == T38_TRANSPARENT) {
if (f->subclass == AST_FORMAT_SLINEAR) {
t38data = f->data.ptr;
t38samples = f->samples;
} else {
t38samples = 0;
- ast_verbose("Got non-slin frame for %s in fax mode\n",
+ ast_verbose("Got non-slin frame for %s in transparent fax mode\n",
ast->name);
ast_set_write_format(ast, AST_FORMAT_SLINEAR);
ast_set_read_format(ast, AST_FORMAT_SLINEAR);
@@ -1216,6 +1227,46 @@
case AST_CONTROL_SRCUPDATE:
ast_rtp_instance_new_source(p->rtp);
break;
+
+ case AST_CONTROL_T38:
+ if (p->t38support != T38_FAXGW) {
+ enum ast_control_t38 message = AST_T38_REFUSED;
+ ast_queue_control_data(ast, AST_CONTROL_T38, &message, sizeof(message));
+ break;
+ }
+ if (datalen != sizeof(enum ast_control_t38)) {
+ ast_log(LOG_ERROR, "Invalid datalen for AST_CONTROL_T38. "
+ "Expected %d, got %d\n",
+ (int)sizeof(enum ast_control_t38), (int)datalen);
+ } else {
+ const struct ast_control_t38_parameters *parameters = data;
+ enum ast_control_t38 message = parameters->request_response;
+ switch (message) {
+
+ case AST_T38_REQUEST_NEGOTIATE:
+
+ if (!p->chmodepend && !p->faxmode) {
+ ooRequestChangeMode(p->callToken, 1);
+ p->chmodepend = 1;
+ }
+ break;
+
+ case AST_T38_REQUEST_TERMINATE:
+
+ if (!p->chmodepend && p->faxmode) {
+ ooRequestChangeMode(p->callToken, 0);
+ p->chmodepend = 1;
+ }
+ break;
+
+
+ default:
+ ;
+
+ }
+
+ }
+ break;
case AST_CONTROL_PROCEEDING:
case -1:
break;
@@ -1224,14 +1275,75 @@
condition, callToken);
}
- ast_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
if (gH323Debug)
ast_verbose("++++ ooh323_indicate %d on %s\n", condition, callToken);
- free(callToken);
+ free(callToken);
return -1;
}
+
+static int ooh323_queryoption(struct ast_channel *ast, int option, void *data, int *datalen)
+{
+
+ struct ooh323_pvt *p = (struct ooh323_pvt *) ast->tech_pvt;
+ int res = -1;
+ enum ast_t38_state state = T38_STATE_UNAVAILABLE;
+ char* cp;
+
+ if (!p) return -1;
+
+ ast_mutex_lock(&p->lock);
+
+ if (gH323Debug)
+ ast_verbose("----- ooh323_queryoption %d on channel %s\n", option, ast->name);
+
+ switch (option) {
+
+ case AST_OPTION_T38_STATE:
+
+ if (*datalen != sizeof(enum ast_t38_state)) {
+ ast_log(LOG_ERROR, "Invalid datalen for AST_OPTION_T38_STATE option."
+ " Expected %d, got %d\n", (int)sizeof(enum ast_t38_state), *datalen);
+ break;
+ }
+ if (p->t38support != T38_DISABLED)
+ state = T38_STATE_UNKNOWN;
+ if (p->faxmode)
+ state = (p->chmodepend) ? T38_STATE_UNKNOWN : T38_STATE_NEGOTIATED;
+ else if (p->chmodepend)
+ state = T38_STATE_NEGOTIATING;
+
+
+ *((enum ast_t38_state *) data) = state;
+ res = 0;
+ break;
+
+
+ case AST_OPTION_DIGIT_DETECT:
+
+ cp = (char *) data;
+ *cp = p->vad ? 1 : 0;
+ ast_debug(1, "Reporting digit detection %sabled on %s\n",
+ *cp ? "en" : "dis", ast->name);
+
+ res = 0;
+ break;
+
+ default: ;
+
+ }
+
+ if (gH323Debug)
+ ast_verbose("+++++ ooh323_queryoption %d on channel %s\n", option, ast->name);
+
+ ast_mutex_unlock(&p->lock);
+
+ return res;
+}
+
+
static int ooh323_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
@@ -1602,6 +1714,7 @@
p->capability = user->capability;
memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref));
p->dtmfmode |= user->dtmfmode;
+ p->t38support = user->t38support;
/* Since, call is coming from a pbx user, no need to use gk */
/* OO_SETFLAG(p->flags, H323_DISABLEGK);
OO_SETFLAG(call->flags, OO_M_DISABLEGK); */
@@ -1625,7 +1738,7 @@
}
/* } */
- ooh323c_set_capability_for_call(call, &p->prefs, p->capability, p->dtmfmode);
+ ooh323c_set_capability_for_call(call, &p->prefs, p->capability, p->dtmfmode, p->t38support);
configure_local_rtp(p, call);
/* Incoming call */
@@ -1785,7 +1898,7 @@
}
ooh323c_set_capability_for_call(call, &p->prefs, p->capability,
- p->dtmfmode);
+ p->dtmfmode, p->t38support);
configure_local_rtp(p, call);
ast_mutex_unlock(&p->lock);
@@ -1984,6 +2097,7 @@
memcpy(&user->prefs, &gPrefs, sizeof(user->prefs));
user->rtptimeout = gRTPTimeout;
user->dtmfmode = gDTMFMode;
+ user->t38support = gT38Support;
/* set default context */
ast_copy_string(user->context, gContext, sizeof(user->context));
ast_copy_string(user->accountcode, gAccountcode, sizeof(user->accountcode));
@@ -2016,13 +2130,12 @@
} else if (!strcasecmp(v->name, "amaflags")) {
user->amaflags = ast_cdr_amaflags2int(v->value);
} else if (!strcasecmp(v->name, "ip")) {
- strncpy(user->mIP, v->value, sizeof(user->mIP)-1);
- user->mUseIP = 1;
- }
- else if (!strcasecmp(v->name, "host")) {
- strncpy(user->mIP, v->value, sizeof(user->mIP)-1);
+ strncpy(user->mIP, v->value, sizeof(user->mIP)-1);
+ user->mUseIP = 1;
+ } else if (!strcasecmp(v->name, "host")) {
+ strncpy(user->mIP, v->value, sizeof(user->mIP)-1);
user->mUseIP = 1;
- } else if (!strcasecmp(v->name, "dtmfmode")) {
+ } else if (!strcasecmp(v->name, "dtmfmode")) {
if (!strcasecmp(v->value, "rfc2833"))
user->dtmfmode = H323_DTMF_RFC2833;
else if (!strcasecmp(v->value, "q931keypad"))
@@ -2035,6 +2148,17 @@
user->dtmfmode = H323_DTMF_INBAND;
} else if (!strcasecmp(v->name, "relaxdtmf")) {
user->dtmfmode |= ast_true(v->value) ? H323_DTMF_INBANDRELAX : 0;
+ } else if (!strcasecmp(v->name, "t38support")) {
+ if (!strcasecmp(v->value, "disabled"))
+ user->t38support = T38_DISABLED;
+ if (!strcasecmp(v->value, "no"))
+ user->t38support = T38_DISABLED;
+ else if (!strcasecmp(v->value, "faxgw"))
+ user->t38support = T38_FAXGW;
+ else if (!strcasecmp(v->value, "yes"))
+ user->t38support = T38_FAXGW;
+ else if (!strcasecmp(v->value, "transparent"))
+ user->t38support = T38_TRANSPARENT;
}
v = v->next;
}
@@ -2064,6 +2188,7 @@
ast_copy_string(peer->accountcode, gAccountcode, sizeof(peer->accountcode));
peer->amaflags = gAMAFLAGS;
peer->dtmfmode = gDTMFMode;
+ peer->t38support = gT38Support;
peer->port = 1720;
if (0 == friend_type) {
peer->mFriend = 1;
@@ -2139,6 +2264,17 @@
peer->dtmfmode = H323_DTMF_INBAND;
} else if (!strcasecmp(v->name, "relaxdtmf")) {
peer->dtmfmode |= ast_true(v->value) ? H323_DTMF_INBANDRELAX : 0;
+ } else if (!strcasecmp(v->name, "t38support")) {
+ if (!strcasecmp(v->value, "disabled"))
+ peer->t38support = T38_DISABLED;
+ if (!strcasecmp(v->value, "no"))
+ peer->t38support = T38_DISABLED;
+ else if (!strcasecmp(v->value, "faxgw"))
+ peer->t38support = T38_FAXGW;
+ else if (!strcasecmp(v->value, "yes"))
+ peer->t38support = T38_FAXGW;
+ else if (!strcasecmp(v->value, "transparent"))
+ peer->t38support = T38_TRANSPARENT;
}
v = v->next;
}
@@ -2255,6 +2391,7 @@
gCapability = AST_FORMAT_ALAW;
memset(&gPrefs, 0, sizeof(struct ast_codec_pref));
gDTMFMode = H323_DTMF_RFC2833;
+ gT38Support = T38_FAXGW;
gRasGkMode = RasNoGatekeeper;
gGatekeeper[0] = '\0';
gRTPTimeout = 60;
@@ -2433,6 +2570,17 @@
}
} else if (!strcasecmp(v->name, "relaxdtmf")) {
gDTMFMode |= ast_true(v->value) ? H323_DTMF_INBANDRELAX : 0;
+ } else if (!strcasecmp(v->name, "t38support")) {
+ if (!strcasecmp(v->value, "disabled"))
+ gT38Support = T38_DISABLED;
+ if (!strcasecmp(v->value, "no"))
+ gT38Support = T38_DISABLED;
+ else if (!strcasecmp(v->value, "faxgw"))
+ gT38Support = T38_FAXGW;
+ else if (!strcasecmp(v->value, "yes"))
+ gT38Support = T38_FAXGW;
+ else if (!strcasecmp(v->value, "transparent"))
+ gT38Support = T38_TRANSPARENT;
}
v = v->next;
}
@@ -2543,6 +2691,15 @@
ast_cli(a->fd, "%s\n", "inband");
else
ast_cli(a->fd, "%s\n", "unknown");
+
+ ast_cli(a->fd,"%-15s", "T.38 Mode: ");
+ if (peer->t38support == T38_DISABLED)
+ ast_cli(a->fd, "%s\n", "disabled");
+ else if (peer->t38support == T38_TRANSPARENT)
+ ast_cli(a->fd, "%s\n", "audio-transparent");
+ else if (peer->t38support == T38_FAXGW)
+ ast_cli(a->fd, "%s\n", "faxgw/chan_sip compatible");
+
ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", peer->accountcode);
ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ",
ast_cdr_flags2str(peer->amaflags));
@@ -2671,6 +2828,15 @@
ast_cli(a->fd, "%s\n", "inband");
else
ast_cli(a->fd, "%s\n", "unknown");
+
+ ast_cli(a->fd,"%-15s", "T.38 Mode: ");
+ if (user->t38support == T38_DISABLED)
+ ast_cli(a->fd, "%s\n", "disabled");
+ else if (user->t38support == T38_TRANSPARENT)
+ ast_cli(a->fd, "%s\n", "audio-transparent");
+ else if (user->t38support == T38_FAXGW)
+ ast_cli(a->fd, "%s\n", "faxgw/chan_sip compatible");
+
ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", user->accountcode);
ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ",
ast_cdr_flags2str(user->amaflags));
@@ -2835,6 +3001,14 @@
else
ast_cli(a->fd, "%s\n", "unknown");
+ ast_cli(a->fd,"%-20s", "T.38 Mode: ");
+ if (gT38Support == T38_DISABLED)
+ ast_cli(a->fd, "%s\n", "disabled");
+ else if (gT38Support == T38_TRANSPARENT)
+ ast_cli(a->fd, "%s\n", "audio-transparent");
+ else if (gT38Support == T38_FAXGW)
+ ast_cli(a->fd, "%s\n", "faxgw/chan_sip compatible");
+
ast_cli(a->fd, "%-20s%ld\n", "Call counter: ", callnumber);
ast_cli(a->fd, "%-20s%s\n", "AccountCode: ", gAccountcode);
@@ -3695,6 +3869,23 @@
}
ast_mutex_lock(&p->lock);
+ if (p->owner) {
+ while (p->owner && ast_channel_trylock(p->owner)) {
+ ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_mutex_unlock(&p->lock);
+ usleep(1);
+ ast_mutex_lock(&p->lock);
+ }
+ if (!p->owner) {
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_ERROR, "Channel has no owner\n");
+ return;
+ }
+ } else {
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_ERROR, "Channel has no owner\n");
+ return;
+ }
them.sin_family = AF_INET;
them.sin_addr.s_addr = inet_addr(remoteIp); /* only works for IPv4 */
@@ -3702,9 +3893,18 @@
ast_udptl_set_peer(p->udptl, &them);
p->t38_tx_enable = 1;
p->lastTxT38 = time(NULL);
+ if (p->t38support == T38_FAXGW) {
+ enum ast_control_t38 message = AST_T38_NEGOTIATED;
+ struct ast_control_t38_parameters parameters = { 0, };
+ parameters.request_response = message;
+ ast_queue_control_data(p->owner, AST_CONTROL_T38, &message, sizeof(message));
+ ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, ¶meters, sizeof(parameters));
+ }
if (gH323Debug)
ast_debug(1, "Receiving UDPTL %s:%d\n", ast_inet_ntoa(them.sin_addr),
ntohs(them.sin_port));
+
+ ast_channel_unlock(p->owner);
ast_mutex_unlock(&p->lock);
if(gH323Debug)
@@ -3727,7 +3927,34 @@
return;
}
ast_mutex_lock(&p->lock);
+ if (p->owner) {
+ while (p->owner && ast_channel_trylock(p->owner)) {
+ ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_mutex_unlock(&p->lock);
+ usleep(1);
+ ast_mutex_lock(&p->lock);
+ }
+ if (!p->owner) {
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_ERROR, "Channel has no owner\n");
+ return;
+ }
+ } else {
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_ERROR, "Channel has no owner\n");
+ return;
+ }
+
p->t38_tx_enable = 0;
+ if (p->t38support == T38_FAXGW) {
+ enum ast_control_t38 message = AST_T38_TERMINATED;
+ struct ast_control_t38_parameters parameters = { 0, };
+ parameters.request_response = message;
+ ast_queue_control_data(p->owner, AST_CONTROL_T38, &message, sizeof(message));
+ ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, ¶meters, sizeof(parameters));
+ }
+
+ ast_channel_unlock(p->owner);
ast_mutex_unlock(&p->lock);
if(gH323Debug)
@@ -3789,6 +4016,11 @@
f = ast_udptl_read(p->udptl); /* UDPTL t.38 data */
if (gH323Debug) ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
f->frametype, f->subclass, f->datalen, ast->name);
+
+/* if not transparent audio t.38 mode */
+ if (p->t38support != T38_TRANSPARENT)
+ break;
+
if (!p->faxmode) p->faxmode = 1;
if (p->t38_init) {
t38_core_rx_ifp_packet(&p->t38r_state.t38x.t38, (uint8_t *)f->data.ptr,
@@ -3952,25 +4184,19 @@
return;
}
-#if 0
- f.frametype = AST_FRAME_MODEM;
- f.subclass = 'c';
- f.datalen = 0;
- f.samples = 0;
- f.offset = 0;
- f.data = NULL;
- f.mallocd = 0;
- f.src = "CHANGE_MODE";
- if (p->owner && !ast_channel_trylock(pvt->owner)) {
- ast_queue_frame(pvt->owner, &f);
- ast_mutex_unlock(&pvt->owner->lock);
- }
-#endif
-
if (t38mode) {
- if (t38_gateway_init(&p->t38r_state, t38_tx_packet_handler, p) &&
- t38_gateway_init(&p->t38t_state, t38_tx_packet_handler, p)) {
+
+ if (p->t38support == T38_FAXGW) {
+/* AST_T38_CONTROL mode */
+
+ enum ast_control_t38 message = AST_T38_REQUEST_NEGOTIATE;
+ ast_queue_control_data(p->owner, AST_CONTROL_T38, &message, sizeof(message));
+ p->faxmode = 1;
+
+ } else if (t38_gateway_init(&p->t38r_state, t38_tx_packet_handler, p)) {
+/* transparent slinear mode */
+
p->t38_init = 1;
t38_gateway_set_transmit_on_idle(&p->t38r_state, FALSE);
@@ -3996,32 +4222,6 @@
t38_gateway_set_tep_mode(&p->t38r_state, TRUE);
t38_gateway_set_supported_modems(&p->t38r_state,
- T30_SUPPORT_V17 | T30_SUPPORT_V29 | T30_SUPPORT_V27TER);
-
-
- t38_gateway_set_transmit_on_idle(&p->t38t_state, FALSE);
-
- span_log_set_tag(&p->t38t_state.logging, "T.38G");
- span_log_set_tag(&p->t38t_state.t38x.t38.logging, "T.38");
-
- span_log_set_message_handler(&p->t38t_state.logging, span_message);
- span_log_set_message_handler(&p->t38t_state.t38x.t38.logging, span_message);
-
- span_log_set_level(&p->t38t_state.logging,
- SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
- span_log_set_level(&p->t38t_state.t38x.t38.logging,
- SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
-
-
- t38_set_t38_version(&p->t38t_state.t38x.t38, 0);
-
- t38_set_sequence_number_handling(&p->t38t_state.t38x.t38,0);
-
- t38_gateway_set_ecm_capability(&p->t38t_state, 1);
-
- t38_gateway_set_tep_mode(&p->t38t_state, TRUE);
-
- t38_gateway_set_supported_modems(&p->t38t_state,
T30_SUPPORT_V17 | T30_SUPPORT_V29 | T30_SUPPORT_V27TER);
if (gH323Debug)
@@ -4038,6 +4238,10 @@
p->lastTxT38 = time(NULL);
}
} else {
+ if (p->t38support == T38_FAXGW) {
+ enum ast_control_t38 message = AST_T38_REQUEST_TERMINATE;
+ ast_queue_control_data(p->owner, AST_CONTROL_T38, &message, sizeof(message));
+ }
p->faxmode = 0;
p->t38_init = 0;
}
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h?view=diff&rev=208015&r1=208014&r2=208015
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h Tue Jul 21 19:36:22 2009
@@ -57,6 +57,7 @@
#define OO_M_TRYBEMASTER ASN1UINTCNT(0x00000010)
#define OO_M_AUDIOSESSION ASN1UINTCNT(0x00000100)
#define OO_M_DATASESSION ASN1UINTCNT(0x00000200)
+#define OO_M_T38SUPPORTED ASN1UINTCNT(0x00000400)
/**
* Call states.
@@ -202,6 +203,7 @@
ASN1UINT msdRetries;
ASN1UINT8 requestSequence;
ASN1UINT reqFlags;
+ ASN1UINT t38sides;
H235TimeStamp alertingTime, connectTime, endTime; /* time data for gatekeeper */
FastStartResponse *pFastStartRes; /* fast start response */
void *usrData; /*!<User can set this to user specific data*/
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c?view=diff&rev=208015&r1=208014&r2=208015
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c Tue Jul 21 19:36:22 2009
@@ -616,6 +616,7 @@
while(cur->next) cur = cur->next;
cur->next = epCap;
}
+ call->t38sides |= 2;
}
else{
/* Add as our capability */
@@ -632,6 +633,7 @@
cur->next = epCap;
}
ooAppendCapToCapPrefs(call, cap);
+ call->t38sides |= 1;
}
}
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c?view=diff&rev=208015&r1=208014&r2=208015
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c Tue Jul 21 19:36:22 2009
@@ -1270,6 +1270,9 @@
H245ModeElement pModeElem;
H245ModeElement* pModeElemRef = &pModeElem;
+ if (isT38Mode && !OO_TESTFLAG(call->flags, OO_M_T38SUPPORTED)) /* t38 req but we dont support */
+ return OO_OK;
+
ret = ooCreateH245Message(call, &ph245msg,
T_H245MultimediaSystemControlMessage_request);
if(ret != OO_OK)
@@ -1382,7 +1385,8 @@
call->callToken);
switch (pMode->t) {
case T_H245ModeElementType_dataMode:
- if (pMode->u.dataMode->application.t == T_H245DataMode_application_t38fax) {
+ if (pMode->u.dataMode->application.t == T_H245DataMode_application_t38fax &&
+ OO_TESTFLAG(call->flags, OO_M_T38SUPPORTED)) {
if (ooSendRequestModeAck(call, requestMode->sequenceNumber) == OO_OK &&
OO_TESTFLAG(call->flags, OO_M_AUDIOSESSION)) {
@@ -2891,6 +2895,10 @@
}
}
+ if (call->t38sides == 3) /* both side support t.38 */
+ OO_SETFLAG(call->flags, OO_M_T38SUPPORTED);
+ else
+ OO_CLRFLAG(call->flags, OO_M_T38SUPPORTED);
/* Update remoteTermCapSetState */
call->remoteTermCapState = OO_RemoteTermCapSetRecvd;
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c?view=diff&rev=208015&r1=208014&r2=208015
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c Tue Jul 21 19:36:22 2009
@@ -1740,6 +1740,13 @@
Q931Message *q931msg=NULL;
/* OOCTXT *pctxt = &gH323ep.msgctxt; */
OOCTXT *pctxt = call->msgctxt;
+
+/* May 20090722
+ this is needed to be tested more accurately
+ */
+
+ if(call->localTermCapState == OO_LocalTermCapExchange_Idle)
+ ooSendTermCapMsg(call);
ret = ooCreateQ931Message(pctxt, &q931msg, Q931ConnectMsg);
if(ret != OO_OK)
Modified: team/may/chan_ooh323_rework/addons/ooh323cDriver.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323cDriver.c?view=diff&rev=208015&r1=208014&r2=208015
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323cDriver.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323cDriver.c Tue Jul 21 19:36:22 2009
@@ -271,7 +271,7 @@
}
int ooh323c_set_capability_for_call
- (ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf)
+ (ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf, int t38support)
{
int ret, x, txframes;
int format=0;
@@ -285,7 +285,8 @@
if(dtmf & H323_DTMF_H245SIGNAL || 1)
ret |= ooCallEnableDTMFH245Signal(call);
- ooCapabilityAddT38Capability(call, OO_T38, OORXANDTX,
+ if (t38support)
+ ooCapabilityAddT38Capability(call, OO_T38, OORXANDTX,
&ooh323c_start_receive_datachannel,
&ooh323c_start_transmit_datachannel,
&ooh323c_stop_receive_datachannel,
Modified: team/may/chan_ooh323_rework/addons/ooh323cDriver.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323cDriver.h?view=diff&rev=208015&r1=208014&r2=208015
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323cDriver.h (original)
+++ team/may/chan_ooh323_rework/addons/ooh323cDriver.h Tue Jul 21 19:36:22 2009
@@ -36,5 +36,5 @@
(struct ast_codec_pref *prefs, int capability, int dtmf);
int convertH323CapToAsteriskCap(int cap);
int ooh323c_set_capability_for_call
- (ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf);
+ (ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf, int t38support);
#endif
More information about the asterisk-commits
mailing list