[asterisk-commits] may: branch may/chan_ooh323_rework r223615 - in /team/may/chan_ooh323_rework/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Oct 11 14:36:44 CDT 2009
Author: may
Date: Sun Oct 11 14:36:42 2009
New Revision: 223615
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=223615
Log:
Cisco RTP DTMF support,
use dtmfmode=cisco (global, peer, user)
(untested)
dtmfcodec option for RFC2833 dtmf (global, peer, user)
Modified:
team/may/chan_ooh323_rework/addons/chan_ooh323.c
team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.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/ooCapability.h
team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c
team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c
team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323ep.c
team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c
team/may/chan_ooh323_rework/addons/ooh323cDriver.c
Modified: team/may/chan_ooh323_rework/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/chan_ooh323.c?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/chan_ooh323.c (original)
+++ team/may/chan_ooh323_rework/addons/chan_ooh323.c Sun Oct 11 14:36:42 2009
@@ -164,6 +164,7 @@
int capability;
struct ast_codec_pref prefs;
int dtmfmode;
+ int dtmfcodec;
char exten[AST_MAX_EXTENSION]; /* Requested extension */
char context[AST_MAX_EXTENSION]; /* Context where to start */
char accountcode[256]; /* Account code */
@@ -190,6 +191,7 @@
int capability;
struct ast_codec_pref prefs;
int dtmfmode;
+ int dtmfcodec;
int t38support;
int rtptimeout;
int mUseIP; /* Use IP address or H323-ID to search user */
@@ -209,6 +211,7 @@
char accountcode[20];
int amaflags;
int dtmfmode;
+ int dtmfcodec;
int t38support;
int mFriend; /* indicates defined as friend */
char ip[20];
@@ -264,6 +267,7 @@
static int gCapability = AST_FORMAT_ULAW;
static struct ast_codec_pref gPrefs;
static int gDTMFMode = H323_DTMF_RFC2833;
+static int gDTMFCodec = 101;
static int gT38Support = T38_FAXGW;
static char gGatekeeper[100];
static enum RasGatekeeperMode gRasGkMode = RasNoGatekeeper;
@@ -488,6 +492,7 @@
OO_SETFLAG(pvt->flags, H323_DISABLEGK);
pvt->dtmfmode = gDTMFMode;
+ pvt->dtmfcodec = gDTMFCodec;
ast_copy_string(pvt->context, gContext, sizeof(pvt->context));
ast_copy_string(pvt->accountcode, gAccountcode, sizeof(pvt->accountcode));
@@ -596,6 +601,7 @@
p->capability = peer->capability;
memcpy(&p->prefs, &peer->prefs, sizeof(struct ast_codec_pref));
p->dtmfmode |= peer->dtmfmode;
+ p->dtmfcodec = peer->dtmfcodec;
p->t38support = peer->t38support;
if (peer->rtpmask)
p->rtpmask = ast_strdup(peer->rtpmask);
@@ -603,6 +609,7 @@
p->amaflags = peer->amaflags;
} else {
p->dtmfmode = gDTMFMode;
+ p->dtmfcodec = gDTMFCodec;
p->t38support = gT38Support;
p->capability = gCapability;
@@ -798,7 +805,7 @@
ooRequestChangeMode(p->callToken, 1);
}
- } else if (p->rtp && (p->dtmfmode & H323_DTMF_RFC2833)) {
+ } else if (p->rtp && ((p->dtmfmode & H323_DTMF_RFC2833) || (p->dtmfmode & H323_DTMF_CISCO))) {
ast_rtp_instance_dtmf_begin(p->rtp, digit);
} else if (((p->dtmfmode & H323_DTMF_Q931) ||
(p->dtmfmode & H323_DTMF_H245ALPHANUMERIC) ||
@@ -826,7 +833,7 @@
return -1;
}
ast_mutex_lock(&p->lock);
- if (p->rtp && (p->dtmfmode & H323_DTMF_RFC2833))
+ if (p->rtp && ((p->dtmfmode & H323_DTMF_RFC2833) || (p->dtmfmode & H323_DTMF_CISCO)) )
ast_rtp_instance_dtmf_end(p->rtp, digit);
ast_mutex_unlock(&p->lock);
@@ -1410,6 +1417,14 @@
if (txframes)
ast_codec_pref_setsize(&p->prefs, fmt, txframes);
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &p->prefs);
+ if (p->dtmfmode & H323_DTMF_RFC2833 && p->dtmfcodec) {
+ ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp),
+ p->rtp, p->dtmfcodec, "audio", "telephone-event", 0);
+ }
+ if (p->dtmfmode & H323_DTMF_CISCO && p->dtmfcodec) {
+ ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp),
+ p->rtp, p->dtmfcodec, "audio", "cisco-telephone-event", 0);
+ }
p->owner->nativeformats = fmt;
ast_set_write_format(p->owner, p->owner->writeformat);
@@ -1708,6 +1723,7 @@
p->capability = user->capability;
memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref));
p->dtmfmode |= user->dtmfmode;
+ p->dtmfcodec = user->dtmfcodec;
p->t38support = user->t38support;
if (user->rtpmask)
p->rtpmask = ast_strdup(user->rtpmask);
@@ -1734,7 +1750,8 @@
}
/* } */
- ooh323c_set_capability_for_call(call, &p->prefs, p->capability, p->dtmfmode, p->t38support);
+ ooh323c_set_capability_for_call(call, &p->prefs, p->capability, p->dtmfmode, p->dtmfcodec,
+ p->t38support);
configure_local_rtp(p, call);
/* Incoming call */
@@ -1896,7 +1913,7 @@
}
ooh323c_set_capability_for_call(call, &p->prefs, p->capability,
- p->dtmfmode, p->t38support);
+ p->dtmfmode, p->dtmfcodec, p->t38support);
configure_local_rtp(p, call);
ast_mutex_unlock(&p->lock);
@@ -2096,6 +2113,7 @@
memcpy(&user->prefs, &gPrefs, sizeof(user->prefs));
user->rtptimeout = gRTPTimeout;
user->dtmfmode = gDTMFMode;
+ user->dtmfcodec = gDTMFCodec;
user->t38support = gT38Support;
/* set default context */
ast_copy_string(user->context, gContext, sizeof(user->context));
@@ -2139,6 +2157,8 @@
} else if (!strcasecmp(v->name, "dtmfmode")) {
if (!strcasecmp(v->value, "rfc2833"))
user->dtmfmode = H323_DTMF_RFC2833;
+ if (!strcasecmp(v->value, "cisco"))
+ user->dtmfmode = H323_DTMF_CISCO;
else if (!strcasecmp(v->value, "q931keypad"))
user->dtmfmode = H323_DTMF_Q931;
else if (!strcasecmp(v->value, "h245alphanumeric"))
@@ -2149,6 +2169,8 @@
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, "dtmfcodec") && atoi(v->value)) {
+ user->dtmfcodec = atoi(v->value);
} else if (!strcasecmp(v->name, "t38support")) {
if (!strcasecmp(v->value, "disabled"))
user->t38support = T38_DISABLED;
@@ -2189,6 +2211,7 @@
ast_copy_string(peer->accountcode, gAccountcode, sizeof(peer->accountcode));
peer->amaflags = gAMAFLAGS;
peer->dtmfmode = gDTMFMode;
+ peer->dtmfcodec = gDTMFCodec;
peer->t38support = gT38Support;
peer->port = 1720;
if (0 == friend_type) {
@@ -2257,6 +2280,8 @@
} else if (!strcasecmp(v->name, "dtmfmode")) {
if (!strcasecmp(v->value, "rfc2833"))
peer->dtmfmode = H323_DTMF_RFC2833;
+ if (!strcasecmp(v->value, "cisco"))
+ peer->dtmfmode = H323_DTMF_CISCO;
else if (!strcasecmp(v->value, "q931keypad"))
peer->dtmfmode = H323_DTMF_Q931;
else if (!strcasecmp(v->value, "h245alphanumeric"))
@@ -2267,6 +2292,8 @@
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, "dtmfcodec") && atoi(v->value)) {
+ peer->dtmfcodec = atoi(v->value);
} else if (!strcasecmp(v->name, "t38support")) {
if (!strcasecmp(v->value, "disabled"))
peer->t38support = T38_DISABLED;
@@ -2394,6 +2421,7 @@
gCapability = AST_FORMAT_ALAW;
memset(&gPrefs, 0, sizeof(struct ast_codec_pref));
gDTMFMode = H323_DTMF_RFC2833;
+ gDTMFCodec = 101;
gT38Support = T38_FAXGW;
gTRCLVL = OOTRCLVLERR;
gRasGkMode = RasNoGatekeeper;
@@ -2561,6 +2589,8 @@
gDTMFMode = H323_DTMF_INBAND;
else if (!strcasecmp(v->value, "rfc2833"))
gDTMFMode = H323_DTMF_RFC2833;
+ else if (!strcasecmp(v->value, "cisco"))
+ gDTMFMode = H323_DTMF_CISCO;
else if (!strcasecmp(v->value, "q931keypad"))
gDTMFMode = H323_DTMF_Q931;
else if (!strcasecmp(v->value, "h245alphanumeric"))
@@ -2574,6 +2604,8 @@
}
} else if (!strcasecmp(v->name, "relaxdtmf")) {
gDTMFMode |= ast_true(v->value) ? H323_DTMF_INBANDRELAX : 0;
+ } else if (!strcasecmp(v->name, "dtmfcodec") && atoi(v->value)) {
+ gDTMFCodec = atoi(v->value);
} else if (!strcasecmp(v->name, "t38support")) {
if (!strcasecmp(v->value, "disabled"))
gT38Support = T38_DISABLED;
@@ -2684,9 +2716,13 @@
print_codec_to_cli(a->fd, &peer->prefs);
ast_cli(a->fd, ")\n");
ast_cli(a->fd, "%-15.15s", "DTMF Mode: ");
- if (peer->dtmfmode & H323_DTMF_RFC2833)
+ if (peer->dtmfmode & H323_DTMF_CISCO) {
+ ast_cli(a->fd, "%s\n", "cisco");
+ ast_cli(a->fd, "%-15.15s%d\n", "DTMF Codec: ", peer->dtmfcodec);
+ } else if (peer->dtmfmode & H323_DTMF_RFC2833) {
ast_cli(a->fd, "%s\n", "rfc2833");
- else if (peer->dtmfmode & H323_DTMF_Q931)
+ ast_cli(a->fd, "%-15.15s%d\n", "DTMF Codec: ", peer->dtmfcodec);
+ } else if (peer->dtmfmode & H323_DTMF_Q931)
ast_cli(a->fd, "%s\n", "q931keypad");
else if (peer->dtmfmode & H323_DTMF_H245ALPHANUMERIC)
ast_cli(a->fd, "%s\n", "h245alphanumeric");
@@ -2823,9 +2859,13 @@
print_codec_to_cli(a->fd, &user->prefs);
ast_cli(a->fd, ")\n");
ast_cli(a->fd, "%-15.15s", "DTMF Mode: ");
- if (user->dtmfmode & H323_DTMF_RFC2833)
+ if (user->dtmfmode & H323_DTMF_CISCO) {
+ ast_cli(a->fd, "%s\n", "cisco");
+ ast_cli(a->fd, "%-15.15s%d\n", "DTMF Codec: ", user->dtmfcodec);
+ } else if (user->dtmfmode & H323_DTMF_RFC2833) {
ast_cli(a->fd, "%s\n", "rfc2833");
- else if (user->dtmfmode & H323_DTMF_Q931)
+ ast_cli(a->fd, "%-15.15s%d\n", "DTMF Codec: ", user->dtmfcodec);
+ } else if (user->dtmfmode & H323_DTMF_Q931)
ast_cli(a->fd, "%s\n", "q931keypad");
else if (user->dtmfmode & H323_DTMF_H245ALPHANUMERIC)
ast_cli(a->fd, "%s\n", "h245alphanumeric");
@@ -2997,9 +3037,13 @@
ast_getformatname_multiple(value,512,gCapability));
ast_cli(a->fd, "%-20s", "DTMF Mode: ");
- if (gDTMFMode & H323_DTMF_RFC2833)
+ if (gDTMFMode & H323_DTMF_CISCO) {
+ ast_cli(a->fd, "%s\n", "cisco");
+ ast_cli(a->fd, "%-15.15s%d\n", "DTMF Codec: ", gDTMFCodec);
+ } else if (gDTMFMode & H323_DTMF_RFC2833) {
ast_cli(a->fd, "%s\n", "rfc2833");
- else if (gDTMFMode & H323_DTMF_Q931)
+ ast_cli(a->fd, "%-15.15s%d\n", "DTMF Codec: ", gDTMFCodec);
+ } else if (gDTMFMode & H323_DTMF_Q931)
ast_cli(a->fd, "%s\n", "q931keypad");
else if (gDTMFMode & H323_DTMF_H245ALPHANUMERIC)
ast_cli(a->fd, "%s\n", "h245alphanumeric");
@@ -3192,7 +3236,7 @@
ooH323EpSetH323Callbacks(h323Callbacks);
/* Add endpoint capabilities */
- if (ooh323c_set_capability(&gPrefs, gCapability, gDTMFMode) < 0) {
+ if (ooh323c_set_capability(&gPrefs, gCapability, gDTMFMode, gDTMFCodec) < 0) {
ast_log(LOG_ERROR, "Capabilities failure for OOH323. OOH323 Disabled.\n");
return 1;
}
@@ -3731,6 +3775,14 @@
if (p->rtp) {
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &p->prefs);
+ if (p->dtmfmode & H323_DTMF_RFC2833 && p->dtmfcodec) {
+ ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp),
+ p->rtp, p->dtmfcodec, "audio", "telephone-event", 0);
+ }
+ if (p->dtmfmode & H323_DTMF_CISCO && p->dtmfcodec) {
+ ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp),
+ p->rtp, p->dtmfcodec, "audio", "cisco-telephone-event", 0);
+ }
}
/* figure out our local RTP port and tell the H.323 stack about it*/
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c Sun Oct 11 14:36:42 2009
@@ -682,6 +682,16 @@
return ooCapabilityDisableDTMFRFC2833(call);
}
+int ooCallEnableDTMFCISCO(OOH323CallData *call, int dynamicRTPPayloadType)
+{
+ return ooCapabilityEnableDTMFCISCO(call, dynamicRTPPayloadType);
+}
+
+int ooCallDisableDTMFCISCO(OOH323CallData *call)
+{
+ return ooCapabilityDisableDTMFCISCO(call);
+}
+
int ooCallEnableDTMFH245Alphanumeric(OOH323CallData *call)
{
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h Sun Oct 11 14:36:42 2009
@@ -168,6 +168,7 @@
unsigned h245ConnectionAttempts;
OOH245SessionState h245SessionState;
int dtmfmode;
+ int dtmfcodec;
OOMediaInfo *mediaInfo;
OOCallFwdData *pCallFwdData;
char localIP[20];/* Local IP address */
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c Sun Oct 11 14:36:42 2009
@@ -25,6 +25,7 @@
extern OOH323EndPoint gH323ep;
static int giDynamicRTPPayloadType = 101;
+static int gcDynamicRTPPayloadType = 121;
int ooCapabilityEnableDTMFRFC2833
(OOH323CallData *call, int dynamicRTPPayloadType)
@@ -33,16 +34,47 @@
{
gH323ep.dtmfmode |= OO_CAP_DTMF_RFC2833;
OOTRACEINFO1("Enabled RFC2833 DTMF capability for end-point\n");
+ /*Dynamic RTP payload type range is from 96 - 127 */
+ if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127)
+ giDynamicRTPPayloadType = dynamicRTPPayloadType;
}
else{
call->dtmfmode |= OO_CAP_DTMF_RFC2833;
OOTRACEINFO3("Enabled RFC2833 DTMF capability for (%s, %s) \n",
call->callType, call->callToken);
- }
-
- /*Dynamic RTP payload type range is from 96 - 127 */
if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127)
- giDynamicRTPPayloadType = dynamicRTPPayloadType;
+ call->dtmfcodec = dynamicRTPPayloadType;
+ else
+ call->dtmfcodec = giDynamicRTPPayloadType;
+ }
+
+
+ return OO_OK;
+}
+
+int ooCapabilityEnableDTMFCISCO
+ (OOH323CallData *call, int dynamicRTPPayloadType)
+{
+ if(!call)
+ {
+ gH323ep.dtmfmode |= OO_CAP_DTMF_CISCO;
+ OOTRACEINFO1("Enabled RTP/CISCO DTMF capability for end-point\n");
+ /*Dynamic RTP payload type range is from 96 - 127 */
+ if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127)
+ gcDynamicRTPPayloadType = dynamicRTPPayloadType;
+ else
+ call->dtmfcodec = dynamicRTPPayloadType;
+ }
+ else{
+ call->dtmfmode |= OO_CAP_DTMF_CISCO;
+ OOTRACEINFO3("Enabled RTP/CISCO DTMF capability for (%s, %s) \n",
+ call->callType, call->callToken);
+ if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127)
+ call->dtmfcodec = dynamicRTPPayloadType;
+ else
+ call->dtmfcodec = gcDynamicRTPPayloadType;
+ }
+
return OO_OK;
}
@@ -58,6 +90,21 @@
else{
call->dtmfmode ^= OO_CAP_DTMF_RFC2833;
OOTRACEINFO3("Disabled RFC2833 DTMF capability for (%s, %s)\n",
+ call->callType, call->callToken);
+ }
+
+ return OO_OK;
+}
+
+int ooCapabilityDisableDTMFCISCO(OOH323CallData *call)
+{
+ if(!call){
+ gH323ep.dtmfmode ^= OO_CAP_DTMF_CISCO;
+ OOTRACEINFO1("Disabled RTP/CISCO DTMF capability for end-point\n");
+ }
+ else{
+ call->dtmfmode ^= OO_CAP_DTMF_CISCO;
+ OOTRACEINFO3("Disabled RTP/CISCO DTMF capability for (%s, %s)\n",
call->callType, call->callToken);
}
@@ -743,9 +790,10 @@
-void* ooCapabilityCreateDTMFCapability(int cap, OOCTXT *pctxt)
+void* ooCapabilityCreateDTMFCapability(int cap, int dtmfcodec, OOCTXT *pctxt)
{
H245AudioTelephonyEventCapability *pATECap=NULL;
+ H245DataApplicationCapability *pCSDTMFCap=NULL;
H245UserInputCapability *userInput = NULL;
char *events=NULL;
switch(cap)
@@ -759,7 +807,7 @@
return NULL;
}
memset(pATECap, 0, sizeof(H245AudioTelephonyEventCapability));
- pATECap->dynamicRTPPayloadType = giDynamicRTPPayloadType;
+ pATECap->dynamicRTPPayloadType = dtmfcodec;
events = (char*)memAlloc(pctxt, strlen("0-16")+1);
memset(events, 0, strlen("0-16")+1);
if(!events)
@@ -771,6 +819,40 @@
strncpy(events, "0-16", strlen("0-16"));
pATECap->audioTelephoneEvent = events;
return pATECap;
+ case OO_CAP_DTMF_CISCO:
+ pCSDTMFCap = (H245DataApplicationCapability*)memAlloc(pctxt,
+ sizeof(H245DataApplicationCapability));
+ if(!pCSDTMFCap)
+ {
+ OOTRACEERR1("Error:Memory - ooCapabilityCreateDTMFCapability - pCSDTMFCap\n");
+ return NULL;
+ }
+ memset(pCSDTMFCap, 0, sizeof(H245DataApplicationCapability));
+ pCSDTMFCap->application.t = T_H245DataApplicationCapability_application_nonStandard;
+ if ( (pCSDTMFCap->application.u.nonStandard = (H245NonStandardParameter *)
+ memAllocZ(pctxt, sizeof(H245NonStandardParameter))) == NULL) {
+ OOTRACEERR1("Error:Memory-ooCapabilityCreateDTMFCapability-H245NonStandardParameter\n");
+ memFreePtr(pctxt, pCSDTMFCap);
+ return NULL;
+ }
+
+ pCSDTMFCap->application.u.nonStandard->nonStandardIdentifier.t=T_H245NonStandardIdentifier_h221NonStandard;
+ pCSDTMFCap->application.u.nonStandard->nonStandardIdentifier.u.h221NonStandard =
+ (H245NonStandardIdentifier_h221NonStandard *) memAllocZ(pctxt,
+ sizeof(H245NonStandardIdentifier_h221NonStandard));
+ if (!pCSDTMFCap->application.u.nonStandard->nonStandardIdentifier.u.h221NonStandard) {
+ OOTRACEERR1("Error:Memory-ooCapabilityCreateDTMFCapability-H245NonStandardParameter\n");
+ memFreePtr(pctxt, pCSDTMFCap);
+ return NULL;
+ }
+
+ pCSDTMFCap->application.u.nonStandard->data.data = "RtpDtmfRelay";
+ pCSDTMFCap->application.u.nonStandard->data.numocts = sizeof("RtpDtmfRelay")-1;
+ pCSDTMFCap->application.u.nonStandard->nonStandardIdentifier.u.h221NonStandard->t35CountryCode = 181;
+ pCSDTMFCap->application.u.nonStandard->nonStandardIdentifier.u.h221NonStandard->t35Extension = 0;
+ pCSDTMFCap->application.u.nonStandard->nonStandardIdentifier.u.h221NonStandard->manufacturerCode = 18;
+
+ return pCSDTMFCap;
case OO_CAP_DTMF_H245_alphanumeric:
userInput = (H245UserInputCapability*)memAllocZ(pctxt,
sizeof(H245UserInputCapability));
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h Sun Oct 11 14:36:42 2009
@@ -85,6 +85,7 @@
#define OO_CAP_DTMF_Q931 (1<<1)
#define OO_CAP_DTMF_H245_alphanumeric (1<<2)
#define OO_CAP_DTMF_H245_signal (1<<3)
+#define OO_CAP_DTMF_CISCO (1<<4)
/**
* This structure defines the preference order for capabilities.
@@ -559,7 +560,7 @@
* @return Pointer to the created DTMF capability, NULL in case of
* failure.
*/
-void * ooCapabilityCreateDTMFCapability(int cap, OOCTXT *pctxt);
+void * ooCapabilityCreateDTMFCapability(int cap, int dtmfcodec, OOCTXT *pctxt);
/**
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c Sun Oct 11 14:36:42 2009
@@ -323,7 +323,7 @@
ooH323EpCapability *epCap=NULL;
H245TerminalCapabilitySet *termCap=NULL;
H245AudioCapability *audioCap=NULL;
- H245DataApplicationCapability *t38Cap = NULL;
+ H245DataApplicationCapability *t38Cap, *rtdCap = NULL;
H245AudioTelephonyEventCapability *ateCap=NULL;
H245UserInputCapability *userInputCap = NULL;
H245CapabilityTableEntry *entry=NULL;
@@ -619,7 +619,7 @@
if(call->dtmfmode & OO_CAP_DTMF_RFC2833)
{
ateCap = (H245AudioTelephonyEventCapability*)
- ooCapabilityCreateDTMFCapability(OO_CAP_DTMF_RFC2833, pctxt);
+ ooCapabilityCreateDTMFCapability(OO_CAP_DTMF_RFC2833, call->dtmfcodec, pctxt);
if(!ateCap)
{
OOTRACEWARN3("WARN:Failed to add RFC2833 cap to TCS(%s, %s)\n",
@@ -652,14 +652,14 @@
}
}
- if(call->dtmfmode & OO_CAP_DTMF_H245_alphanumeric)
- {
- userInputCap = (H245UserInputCapability*)ooCapabilityCreateDTMFCapability
- (OO_CAP_DTMF_H245_alphanumeric, pctxt);
- if(!userInputCap)
+ if(call->dtmfmode & OO_CAP_DTMF_CISCO)
+ {
+ rtdCap = (H245DataApplicationCapability*)
+ ooCapabilityCreateDTMFCapability(OO_CAP_DTMF_CISCO, call->dtmfcodec, pctxt);
+ if(!rtdCap)
{
- OOTRACEWARN3("WARN:Failed to add H245(alphanumeric) cap to "
- "TCS(%s, %s)\n", call->callType, call->callToken);
+ OOTRACEWARN3("WARN:Failed to add RTP/CISCO DTMF cap to TCS(%s, %s)\n",
+ call->callType, call->callToken);
}
else {
entry = (H245CapabilityTableEntry*) memAlloc(pctxt,
@@ -676,6 +676,42 @@
memset(entry, 0, sizeof(H245CapabilityTableEntry));
entry->m.capabilityPresent = 1;
+ entry->capability.t = T_H245Capability_receiveDataApplicationCapability;
+ entry->capability.u.receiveDataApplicationCapability = rtdCap;
+
+ entry->capabilityTableEntryNumber = i+1;
+ dListAppend(pctxt , &(termCap->capabilityTable), entry);
+ altSetDtmf->elem[altSetDtmf->n] = i+1;
+ altSetDtmf->n++;
+
+ i++;
+ }
+ }
+
+ if(call->dtmfmode & OO_CAP_DTMF_H245_alphanumeric)
+ {
+ userInputCap = (H245UserInputCapability*)ooCapabilityCreateDTMFCapability
+ (OO_CAP_DTMF_H245_alphanumeric, 0, pctxt);
+ if(!userInputCap)
+ {
+ OOTRACEWARN3("WARN:Failed to add H245(alphanumeric) cap to "
+ "TCS(%s, %s)\n", call->callType, call->callToken);
+ }
+ else {
+ entry = (H245CapabilityTableEntry*) memAlloc(pctxt,
+ sizeof(H245CapabilityTableEntry));
+ if(!entry)
+ {
+ OOTRACEERR3("Error:Failed to allocate memory for new capability "
+ "table entry. (%s, %s)\n", call->callType,
+ call->callToken);
+ ooFreeH245Message(call, ph245msg);
+ return OO_FAILED;
+ }
+
+ memset(entry, 0, sizeof(H245CapabilityTableEntry));
+ entry->m.capabilityPresent = 1;
+
entry->capability.t = T_H245Capability_receiveUserInputCapability;
entry->capability.u.receiveUserInputCapability = userInputCap;
@@ -691,7 +727,7 @@
if(call->dtmfmode & OO_CAP_DTMF_H245_signal)
{
userInputCap = (H245UserInputCapability*)ooCapabilityCreateDTMFCapability
- (OO_CAP_DTMF_H245_signal, pctxt);
+ (OO_CAP_DTMF_H245_signal, 0, pctxt);
if(!userInputCap)
{
OOTRACEWARN3("WARN:Failed to add H245(signal) cap to "
@@ -2880,6 +2916,7 @@
we can accept new capability set only. We must remember also that new join caps
will be previously joined caps with new cap set.
*/
+ if(call->remoteTermCapSeqNo == tcs->sequenceNumber)
call->localTermCapState = OO_LocalTermCapExchange_Idle;
}
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c Sun Oct 11 14:36:42 2009
@@ -33,6 +33,198 @@
/** Global endpoint structure */
extern OOH323EndPoint gH323ep;
+int ooHandleFastStart(OOH323CallData *call, H225Facility_UUIE *facility)
+{
+ H245OpenLogicalChannel* olc;
+ ASN1OCTET msgbuf[MAXMSGLEN];
+ ooLogicalChannel * pChannel = NULL;
+ H245H2250LogicalChannelParameters * h2250lcp = NULL;
+ int i=0, ret=0;
+
+ /* Handle fast-start */
+ if(OO_TESTFLAG (call->flags, OO_M_FASTSTART))
+ {
+ if(facility->m.fastStartPresent)
+ {
+ /* For printing the decoded message to log, initialize handler. */
+ initializePrintHandler(&printHandler, "FastStart Elements");
+
+ /* Set print handler */
+ setEventHandler (call->pctxt, &printHandler);
+
+ for(i=0; i<(int)facility->fastStart.n; i++)
+ {
+ olc = NULL;
+
+ olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt,
+ sizeof(H245OpenLogicalChannel));
+ if(!olc)
+ {
+ OOTRACEERR3("ERROR:Memory - ooHandleFastStart - olc"
+ "(%s, %s)\n", call->callType, call->callToken);
+ /*Mark call for clearing */
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_LOCAL_CLEARED;
+ call->callState = OO_CALL_CLEAR;
+ }
+ return OO_FAILED;
+ }
+ memset(olc, 0, sizeof(H245OpenLogicalChannel));
+ memcpy(msgbuf, facility->fastStart.elem[i].data,
+ facility->fastStart.elem[i].numocts);
+ setPERBuffer(call->pctxt, msgbuf,
+ facility->fastStart.elem[i].numocts, 1);
+ ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc);
+ if(ret != ASN_OK)
+ {
+ OOTRACEERR3("ERROR:Failed to decode fast start olc element "
+ "(%s, %s)\n", call->callType, call->callToken);
+ /* Mark call for clearing */
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_INVALIDMESSAGE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ return OO_FAILED;
+ }
+
+ dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc);
+
+ pChannel = ooFindLogicalChannelByOLC(call, olc);
+ if(!pChannel)
+ {
+ OOTRACEERR4("ERROR: Logical Channel %d not found, fast start. "
+ "(%s, %s)\n",
+ olc->forwardLogicalChannelNumber, call->callType,
+ call->callToken);
+ return OO_FAILED;
+ }
+ if(pChannel->channelNo != olc->forwardLogicalChannelNumber)
+ {
+ OOTRACEINFO5("Remote endpoint changed forwardLogicalChannel"
+ "Number from %d to %d (%s, %s)\n",
+ pChannel->channelNo,
+ olc->forwardLogicalChannelNumber, call->callType,
+ call->callToken);
+ pChannel->channelNo = olc->forwardLogicalChannelNumber;
+ }
+ if(!strcmp(pChannel->dir, "transmit"))
+ {
+ /* May 20090728 */
+ if (!epCapIsPreferred(call, pChannel->chanCap)) {
+ ret =ooSendCapsAndMSdeterm(call);
+ if (ret != OO_OK)
+ return ret;
+ }
+
+ if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
+ T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
+ {
+ OOTRACEERR4("ERROR:Unknown multiplex parameter type for "
+ "channel %d (%s, %s)\n",
+ olc->forwardLogicalChannelNumber, call->callType,
+ call->callToken);
+ continue;
+ }
+
+ /* Extract the remote media endpoint address */
+ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
+ if(!h2250lcp)
+ {
+ OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
+ "forward Logical Channel Parameters found. "
+ "(%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ if(!h2250lcp->m.mediaChannelPresent)
+ {
+ OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
+ "reverse media channel information found."
+ "(%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ ret = ooGetIpPortFromH245TransportAddress(call,
+ &h2250lcp->mediaChannel, pChannel->remoteIP,
+ &pChannel->remoteMediaPort);
+
+ if(ret != OO_OK)
+ {
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_INVALIDMESSAGE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ OOTRACEERR3("ERROR:Unsupported media channel address type "
+ "(%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+
+ if(!pChannel->chanCap->startTransmitChannel)
+ {
+ OOTRACEERR3("ERROR:No callback registered to start transmit "
+ "channel (%s, %s)\n",call->callType,
+ call->callToken);
+ return OO_FAILED;
+ }
+ pChannel->chanCap->startTransmitChannel(call, pChannel);
+ }
+ /* Mark the current channel as established and close all other
+ logical channels with same session id and in same direction.
+ */
+ ooOnLogicalChannelEstablished(call, pChannel);
+ }
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ OO_SETFLAG(call->flags, OO_M_FASTSTARTANSWERED);
+ }
+
+ }
+
+ if(facility->m.h245AddressPresent)
+ {
+ if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
+ {
+ OO_CLRFLAG (call->flags, OO_M_TUNNELING);
+ OOTRACEINFO3("Tunneling is disabled for call as H245 address is "
+ "provided in facility message (%s, %s)\n",
+ call->callType, call->callToken);
+ }
+ ret = ooH323GetIpPortFromH225TransportAddress(call,
+ &facility->h245Address, call->remoteIP,
+ &call->remoteH245Port);
+ if(ret != OO_OK)
+ {
+ OOTRACEERR3("Error: Unknown H245 address type in received "
+ "CallProceeding message (%s, %s)", call->callType,
+ call->callToken);
+ /* Mark call for clearing */
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_INVALIDMESSAGE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ return OO_FAILED;
+ }
+ if(call->remoteH245Port != 0 && !call->pH245Channel) {
+ /* Create an H.245 connection.
+ */
+ if(ooCreateH245Connection(call)== OO_FAILED)
+ {
+ OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n",
+ call->callType, call->callToken);
+
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_TRANSPORTFAILURE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ return OO_FAILED;
+ }
+ }
+ }
+ return OO_OK;
+}
int ooOnReceivedReleaseComplete(OOH323CallData *call, Q931Message *q931Msg)
{
@@ -476,22 +668,9 @@
{
/* May 20090728 */
if (!epCapIsPreferred(call, pChannel->chanCap)) {
- if(call->localTermCapState == OO_LocalTermCapExchange_Idle) {
- ret = ooSendTermCapMsg(call);
- if(ret != OO_OK) {
- OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n",
- call->callType, call->callToken);
- return ret;
- }
- }
- if(call->masterSlaveState == OO_MasterSlave_Idle) {
- ret = ooSendMasterSlaveDetermination(call);
- if(ret != OO_OK) {
- OOTRACEERR3("ERROR:Sending Master-slave determination message "
- "(%s, %s)\n", call->callType, call->callToken);
- return ret;
- }
- }
+ ret =ooSendCapsAndMSdeterm(call);
+ if (ret != OO_OK)
+ return ret;
}
if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
@@ -714,22 +893,9 @@
{
/* May 20090728 */
if (!epCapIsPreferred(call, pChannel->chanCap)) {
- if(call->localTermCapState == OO_LocalTermCapExchange_Idle) {
- ret = ooSendTermCapMsg(call);
- if(ret != OO_OK) {
- OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n",
- call->callType, call->callToken);
- return ret;
- }
- }
- if(call->masterSlaveState == OO_MasterSlave_Idle) {
- ret = ooSendMasterSlaveDetermination(call);
- if(ret != OO_OK) {
- OOTRACEERR3("ERROR:Sending Master-slave determination message "
- "(%s, %s)\n", call->callType, call->callToken);
- return ret;
- }
- }
+ ret =ooSendCapsAndMSdeterm(call);
+ if (ret != OO_OK)
+ return ret;
}
if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
@@ -953,23 +1119,11 @@
{
/* May 20090728 */
if (!epCapIsPreferred(call, pChannel->chanCap)) {
- if(call->localTermCapState == OO_LocalTermCapExchange_Idle) {
- ret = ooSendTermCapMsg(call);
- if(ret != OO_OK) {
- OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n",
- call->callType, call->callToken);
- return ret;
- }
- }
- if(call->masterSlaveState == OO_MasterSlave_Idle) {
- ret = ooSendMasterSlaveDetermination(call);
- if(ret != OO_OK) {
- OOTRACEERR3("ERROR:Sending Master-slave determination message "
- "(%s, %s)\n", call->callType, call->callToken);
- return ret;
- }
- }
+ ret =ooSendCapsAndMSdeterm(call);
+ if (ret != OO_OK)
+ return ret;
}
+
if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
@@ -1692,6 +1846,19 @@
return OO_OK;
}
}
+ else if(facility->reason.t == T_H225FacilityReason_forwardedElements)
+ {
+ OOTRACEINFO3("Handling fast start in forwardedElem facility for "
+ "(%s, %s)\n", call->callType, call->callToken);
+ /*start H.245 channel*/
+ ret = ooHandleFastStart(call, facility);
+ if(ret != OO_OK)
+ {
+ OOTRACEERR3("ERROR: Handling transportedInformation facility message "
+ "(%s, %s)\n", call->callType, call->callToken);
+ return ret;
+ }
+ }
else{
OOTRACEINFO3("Unhandled Facility reason type received (%s, %s)\n",
call->callType, call->callToken);
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323ep.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323ep.c?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323ep.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323ep.c Sun Oct 11 14:36:42 2009
@@ -729,6 +729,16 @@
}
+int ooH323EpEnableDTMFCISCO(int dynamicRTPPayloadType)
+{
+ return ooCapabilityEnableDTMFCISCO(NULL, dynamicRTPPayloadType);
+}
+
+int ooH323EpDisableDTMFCISCO(void)
+{
+ return ooCapabilityDisableDTMFCISCO(NULL);
+}
+
int ooH323EpEnableDTMFRFC2833(int dynamicRTPPayloadType)
{
return ooCapabilityEnableDTMFRFC2833(NULL, dynamicRTPPayloadType);
Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c?view=diff&rev=223615&r1=223614&r2=223615
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c Sun Oct 11 14:36:42 2009
@@ -1192,6 +1192,35 @@
return ASN_OK;
}
+/*
+
+H225 CapSet/MS determination helper function
+
+*/
+
+int ooSendCapsAndMSdeterm(OOH323CallData *call)
+{
+ int ret;
+ if(call->localTermCapState == OO_LocalTermCapExchange_Idle) {
+ ret = ooSendTermCapMsg(call);
+ if(ret != OO_OK) {
+ OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n",
+ call->callType, call->callToken);
+ return ret;
+ }
+ }
+ if(call->masterSlaveState == OO_MasterSlave_Idle) {
+ ret = ooSendMasterSlaveDetermination(call);
+ if(ret != OO_OK) {
+ OOTRACEERR3("ERROR:Sending Master-slave determination message "
+ "(%s, %s)\n", call->callType, call->callToken);
+ return ret;
+ }
+ }
+
+ return OO_OK;
+}
+
/*
@@ -1426,6 +1455,8 @@
OOTRACEERR3("Error: Failed to enqueue Alerting message to outbound queue. (%s, %s)\n", call->callType, call->callToken);
}
+ ooSendCapsAndMSdeterm(call);
+
/* memReset(&gH323ep.msgctxt); */
memReset(call->msgctxt);
@@ -1438,7 +1469,7 @@
H225Progress_UUIE *progress;
H225VendorIdentifier *vendor;
Q931Message *q931msg=NULL;
- /* OOCTXT *pctxt = &gH323ep.msgctxt; */
+ H225TransportAddress_ipAddress *h245IpAddr;
OOCTXT *pctxt = call->msgctxt;
ret = ooCreateQ931Message(pctxt, &q931msg, Q931ProgressMsg);
@@ -1527,6 +1558,32 @@
} else {
progress->m.fastStartPresent = FALSE;
}
+
[... 191 lines stripped ...]
More information about the asterisk-commits
mailing list