[asterisk-commits] may: branch may/ooh323_qsig r313908 - in /team/may/ooh323_qsig/addons: ./ ooh...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Apr 16 20:00:33 CDT 2011
Author: may
Date: Sat Apr 16 20:00:30 2011
New Revision: 313908
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=313908
Log:
initial q.sig support
added modified libpri for using qsig functions
changed protocols version numbers (h.225 - 5, h.245 - 10)
changed capabilities directions to bidirectional in the tcs message
added terminal number assignment message
added functions to parse/generate FacilityIE
q.sig processing: get CallingName from Setup, get calledName from
Alerting/Progress,
get ConnectedName from Connect, get CompleteTransfer from Facility;
set CalledName on Alerting/Progress, set CallingName on Setup
(issue #19023)
Added:
team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/
team/may/ooh323_qsig/addons/ooh323c/src/qsig/LICENSE (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/Makefile (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/README (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/TODO (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/asn1.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/asn1_primitive.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/compat.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/compiler.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/copy_string.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/asn1.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/compat.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/compiler.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/libpri.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/pri_facility.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/pri_internal.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/pri_q921.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/pri_q931.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/rose.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/include/rose_internal.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/libpri.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pri.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pri_aoc.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pri_cc.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pri_facility.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pri_facility.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pri_internal.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pri_q921.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pri_q931.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pridump.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/prisched.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/pritest.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/q921.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/q931.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_address.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_etsi_aoc.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_etsi_cc.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_etsi_diversion.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_etsi_ect.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_etsi_mwi.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_internal.h (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_other.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_q931.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_qsig_aoc.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_qsig_cc.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_qsig_ct.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_qsig_diversion.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_qsig_mwi.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose_qsig_name.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rosetest.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/testprilib.c (with props)
team/may/ooh323_qsig/addons/ooh323c/src/qsig/version.c (with props)
Modified:
team/may/ooh323_qsig/addons/Makefile
team/may/ooh323_qsig/addons/chan_ooh323.c
team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.c
team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.h
team/may/ooh323_qsig/addons/ooh323c/src/ooCommon.h
team/may/ooh323_qsig/addons/ooh323c/src/ooh245.c
team/may/ooh323_qsig/addons/ooh323c/src/ooh245.h
team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c
team/may/ooh323_qsig/addons/ooh323c/src/ooh323ep.c
team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c
team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h
team/may/ooh323_qsig/addons/ooh323c/src/ootypes.h
Modified: team/may/ooh323_qsig/addons/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/Makefile?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/Makefile (original)
+++ team/may/ooh323_qsig/addons/Makefile Sat Apr 16 20:00:30 2011
@@ -22,9 +22,10 @@
rtctype.o ooTimer.o h323/H235-SECURITY-MESSAGESDec.o \
h323/H235-SECURITY-MESSAGESEnc.o h323/H323-MESSAGES.o h323/H323-MESSAGESDec.o \
h323/H323-MESSAGESEnc.o h323/MULTIMEDIA-SYSTEM-CONTROL.o \
- h323/MULTIMEDIA-SYSTEM-CONTROLDec.o h323/MULTIMEDIA-SYSTEM-CONTROLEnc.o
+ h323/MULTIMEDIA-SYSTEM-CONTROLDec.o h323/MULTIMEDIA-SYSTEM-CONTROLEnc.o \
+ ooqsig.o
-H323CFLAGS:=-Iooh323c/src -Iooh323c/src/h323
+H323CFLAGS:=-Iooh323c/src -Iooh323c/src/h323 -Iooh323c/src/qsig
ALL_C_MODS:=app_mysql \
app_saycountpl \
@@ -66,6 +67,8 @@
chan_ooh323.o: _ASTCFLAGS+=$(H323CFLAGS)
+chan_ooh323.so: _ASTLDFLAGS+=-Looh323c/src/qsig -lpri
+
$(if $(filter chan_ooh323,$(EMBEDDED_MODS)),modules.link,chan_ooh323.so): _ASTCFLAGS+=$(H323CFLAGS)
$(if $(filter chan_ooh323,$(EMBEDDED_MODS)),modules.link,chan_ooh323.so): $(addprefix ooh323c/src/,$(H323OBJS)) chan_ooh323.o ooh323cDriver.o
$(addprefix ooh323c/src/,$(H323OBJS)) chan_ooh323.o ooh323cDriver.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_ooh323)
Modified: team/may/ooh323_qsig/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/chan_ooh323.c?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/chan_ooh323.c (original)
+++ team/may/ooh323_qsig/addons/chan_ooh323.c Sat Apr 16 20:00:30 2011
@@ -190,6 +190,7 @@
char rtpmaskstr[120];
int rtdrcount, rtdrinterval; /* roundtripdelayreq */
int faststart, h245tunneling; /* faststart & h245 tunneling */
+ int qsig; /* q.sig support */
struct ooh323_pvt *next; /* Next entity */
} *iflist = NULL;
@@ -218,6 +219,7 @@
int rtdrcount, rtdrinterval;
int faststart, h245tunneling;
int g729onlyA;
+ int qsig; /* q.sig support */
struct ooh323_user *next;
};
@@ -247,6 +249,7 @@
int rtdrcount,rtdrinterval;
int faststart, h245tunneling;
int g729onlyA;
+ int qsig; /* q.sig support */
struct ooh323_peer *next;
};
@@ -283,6 +286,7 @@
int onCallEstablished(ooCallData *call);
int onCallCleared(ooCallData *call);
void onModeChanged(ooCallData *call, int t38mode);
+int onQSigData(ooCallData *call, int transfer, char *name, char *number);
static char gLogFile[256] = DEFAULT_LOGFILE;
static int gPort = 1720;
@@ -483,7 +487,6 @@
ast_mutex_init(&pvt->lock);
ast_mutex_lock(&pvt->lock);
- ast_udptl_set_far_max_datagram(pvt->udptl, 144);
pvt->faxmode = 0;
pvt->t38support = gT38Support;
pvt->rtptimeout = gRTPTimeout;
@@ -615,6 +618,7 @@
p->rtptimeout = peer->rtptimeout;
p->faststart = peer->faststart;
p->h245tunneling = peer->h245tunneling;
+ p->qsig = peer->qsig;
if (peer->rtpmask && peer->rtpmaskstr[0]) {
p->rtpmask = peer->rtpmask;
ast_copy_string(p->rtpmaskstr, peer->rtpmaskstr, sizeof(p->rtpmaskstr));
@@ -955,6 +959,7 @@
opts.transfercap = ast->transfercapability;
opts.fastStart = p->faststart;
opts.tunneling = p->h245tunneling;
+ opts.qsig = p->qsig;
for (i=0;i<480 && !isRunning(p->callToken);i++) usleep(12000);
@@ -1609,6 +1614,76 @@
if (gH323Debug)
ast_verbose("+++ onProgress %s\n", call->callToken);
+
+ return OO_OK;
+}
+
+int onQSigData(ooCallData *call, int transfer, char *name, char *number)
+{
+ struct ooh323_pvt *p = NULL;
+ struct ast_channel *c = NULL;
+
+ if (gH323Debug)
+ ast_verbose("--- onQSig %s\n", call->callToken);
+
+ p = find_call(call);
+
+ if(!p) {
+ ast_log(LOG_ERROR, "No matching call found\n");
+ return -1;
+ }
+ ast_mutex_lock(&p->lock);
+ if (!p->owner) {
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_ERROR, "Channel has no owner\n");
+ return 0;
+ }
+ while (p->owner && ast_channel_trylock(p->owner)) {
+ ast_debug(1,"Failed to grab lock, trying again\n");
+ DEADLOCK_AVOIDANCE(&p->lock);
+ }
+ if (!p->owner) {
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_ERROR, "Channel has no owner\n");
+ return 0;
+ }
+ c = p->owner;
+
+ if (name || number) {
+ struct ast_party_connected_line connected;
+ struct ast_set_party_connected_line update_connected;
+ ast_party_connected_line_init(&connected);
+ memset(&update_connected, 0, sizeof(update_connected));
+
+ if (name) {
+ update_connected.id.name = 1;
+ connected.id.name.valid = 1;
+ connected.id.name.str = name;
+ if (transfer) {
+ pbx_builtin_setvar_helper(c, "XFERNAME",
+ name);
+ }
+ }
+ if (number) {
+ update_connected.id.number = 1;
+ connected.id.number.valid = 1;
+ connected.id.number.str = number;
+ if (transfer) {
+ if (c->caller.id.number.valid && c->caller.id.number.str)
+ pbx_builtin_setvar_helper(c, "BLINDTRANSFER",
+ c->caller.id.number.str);
+ pbx_builtin_setvar_helper(c, "XFERNUM",
+ number);
+ }
+ }
+ connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+ ast_channel_queue_connected_line_update(c, &connected, &update_connected);
+ }
+ ast_channel_unlock(c);
+ ast_mutex_unlock(&p->lock);
+
+ if (gH323Debug)
+ ast_verbose("+++ onQSig %s\n", call->callToken);
return OO_OK;
}
@@ -1767,6 +1842,9 @@
if (!p->h245tunneling)
OO_CLRFLAG(call->flags, OO_M_TUNNELING);
+ if (p->qsig)
+ call->qsig = TRUE;
+
if (user->rtpmask && user->rtpmaskstr[0]) {
p->rtpmask = user->rtpmask;
ast_copy_string(p->rtpmaskstr, user->rtpmaskstr,
@@ -2212,6 +2290,8 @@
sizeof(user->accountcode)-1);
} else if (!strcasecmp(v->name, "roundtrip")) {
sscanf(v->value, "%d,%d", &user->rtdrcount, &user->rtdrinterval);
+ } else if (!strcasecmp(v->name, "qsig")) {
+ user->qsig = ast_true(v->value);
} else if (!strcasecmp(v->name, "faststart")) {
user->faststart = ast_true(v->value);
} else if (!strcasecmp(v->name, "h245tunneling")) {
@@ -2365,6 +2445,8 @@
peer->outgoinglimit = 0;
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode));
+ } else if (!strcasecmp(v->name, "qsig")) {
+ peer->qsig = ast_true(v->value);
} else if (!strcasecmp(v->name, "faststart")) {
peer->faststart = ast_true(v->value);
} else if (!strcasecmp(v->name, "h245tunneling")) {
@@ -2846,6 +2928,7 @@
ast_cli(a->fd, "%-15.15s%s\n", "Name: ", peer->name);
ast_cli(a->fd, "%s:%s,%s\n", "FastStart/H.245 Tunneling", peer->faststart?"yes":"no",
peer->h245tunneling?"yes":"no");
+ ast_cli(a->fd, "%s:%s\n", "Q.sig support", peer->qsig?"yes":"no");
ast_cli(a->fd, "%-15.15s%s", "Format Prefs: ", "(");
print_codec_to_cli(a->fd, &peer->prefs);
ast_cli(a->fd, ")\n");
@@ -2991,6 +3074,7 @@
ast_cli(a->fd, "%-15.15s%s\n", "Name: ", user->name);
ast_cli(a->fd, "%s:%s,%s\n", "FastStart/H.245 Tunneling", user->faststart?"yes":"no",
user->h245tunneling?"yes":"no");
+ ast_cli(a->fd, "%s:%s\n", "Q.sig support", user->qsig?"yes":"no");
ast_cli(a->fd, "%-15.15s%s", "Format Prefs: ", "(");
print_codec_to_cli(a->fd, &user->prefs);
ast_cli(a->fd, ")\n");
@@ -3253,7 +3337,8 @@
.onCallCleared = onCallCleared,
.openLogicalChannels = NULL,
.onReceivedDTMF = ooh323_onReceivedDigit,
- .onModeChanged = onModeChanged
+ .onModeChanged = onModeChanged,
+ .onQSigData = onQSigData
};
if (!(gCap = ast_format_cap_alloc())) {
return 1;
@@ -3963,6 +4048,7 @@
strerror(errno));
return 0;
}
+ ast_udptl_set_far_max_datagram(p->udptl, 144);
if (p->owner) {
while (p->owner && ast_channel_trylock(p->owner)) {
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.c?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.c Sat Apr 16 20:00:30 2011
@@ -16,6 +16,8 @@
#include "asterisk.h"
#include "asterisk/lock.h"
+#include "asterisk/utils.h"
+#include "asterisk/config.h"
#include "ootrace.h"
#include "ootypes.h"
@@ -171,6 +173,8 @@
call->msdRetries = 0;
call->pFastStartRes = NULL;
call->usrData = NULL;
+ call->pri = (struct pri*)memAllocZ(pctxt, sizeof(struct pri));
+ call->pri->switchtype = PRI_SWITCH_QSIG;
OOTRACEINFO3("Created a new call (%s, %s)\n", call->callType,
call->callToken);
/* Add new call to calllist */
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.h?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.h Sat Apr 16 20:00:30 2011
@@ -20,9 +20,16 @@
#ifndef _OOCALLS_H_
#define _OOCALLS_H_
+#include "asterisk.h"
+#include "asterisk/config.h"
+
#include "ooLogChan.h"
#include "ooCapability.h"
#include <regex.h>
+
+#include <libpri.h>
+#include <pri/pri_internal.h>
+#include <pri/rose.h>
#ifdef __cplusplus
extern "C" {
@@ -226,6 +233,10 @@
int rtdrInterval, rtdrCount; /* roundTripDelay interval and unreplied count */
ASN1UINT rtdrSend, rtdrRecv; /* last sended/replied RTD request */
void *usrData; /*!<User can set this to user specific data*/
+
+ struct pri *pri;
+ OOBOOL qsig;
+
struct OOH323CallData* next;
struct OOH323CallData* prev;
} OOH323CallData;
@@ -323,6 +334,9 @@
*/
typedef void (*cb_OnModeChanged)
(struct OOH323CallData *call, int isT38Mode);
+
+typedef int (*cb_OnQSigData)
+ (struct OOH323CallData *call, int transfer, char *name, char *number);
/**
* This structure holds all of the H.323 signaling callback function
@@ -341,6 +355,7 @@
cb_OpenLogicalChannels openLogicalChannels;
cb_OnReceivedDTMF onReceivedDTMF;
cb_OnModeChanged onModeChanged;
+ cb_OnQSigData onQSigData;
} OOH323CALLBACKS;
/**
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooCommon.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooCommon.h?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooCommon.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooCommon.h Sat Apr 16 20:00:30 2011
@@ -89,8 +89,8 @@
/* can be changed if a non-standard allocation/free function is to be */
/* used.. */
-#define OOMEMALLOC malloc
-#define OOMEMFREE free
+#define OOMEMALLOC ast_malloc
+#define OOMEMFREE ast_free
/* Min/max macros */
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooh245.c?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooh245.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooh245.c Sat Apr 16 20:00:30 2011
@@ -32,7 +32,7 @@
extern ooEndPoint gH323ep;
static ASN1OBJID gh245ProtocolID = {
- 6, { 0, 0, 8, 245, 0, 8 }
+ 6, { 0, 0, 8, 245, 0, 10 }
};
int ooCreateH245Message(OOH323CallData* call, H245Message **pph245msg, int type)
@@ -416,11 +416,7 @@
if(epCap->capType == OO_CAP_TYPE_AUDIO)
{
- /* Create audio capability. If capability supports receive, we only
- add it as receive capability in TCS. However, if it supports only
- transmit, we add it as transmit capability in TCS.
- */
- if((epCap->dir & OORX))
+ if((epCap->dir & OORX) && !(epCap->dir & OOTX))
{
OOTRACEDBGC4("Sending receive capability %s in TCS.(%s, %s)\n",
@@ -435,7 +431,7 @@
continue;
}
}
- else if(epCap->dir & OOTX)
+ else if((epCap->dir & OOTX) && !(epCap->dir & OORX))
{
OOTRACEDBGC4("Sending transmit capability %s in TCS.(%s, %s)\n",
ooGetCapTypeText(epCap->cap), call->callType, call->callToken);
@@ -448,12 +444,19 @@
continue;
}
}
- else{
- OOTRACEWARN3("Warn:Capability is not RX/TX/RXANDTX. Symmetric "
- "capabilities are not supported.(%s, %s)\n",
- call->callType, call->callToken);
- continue;
- }
+ else if((epCap->dir & OOTX) && (epCap->dir & OORX))
+ {
+ OOTRACEDBGC4("Sending transmit&received capability %s in TCS.(%s, %s)\n",
+ ooGetCapTypeText(epCap->cap), call->callType, call->callToken);
+ audioCap = ooCapabilityCreateAudioCapability(epCap, pctxt, OOTX|OORX);
+ if(!audioCap)
+ {
+ OOTRACEWARN4("WARN:Failed to create audio capability %s "
+ "(%s, %s)\n", ooGetCapTypeText(epCap->cap),
+ call->callType, call->callToken);
+ continue;
+ }
+ }
/* Add Capabilities to Capability Table */
entry = (H245CapabilityTableEntry*) memAlloc(pctxt,
sizeof(H245CapabilityTableEntry));
@@ -465,7 +468,12 @@
}
memset(entry, 0, sizeof(H245CapabilityTableEntry));
entry->m.capabilityPresent = 1;
- if((epCap->dir & OORX))
+ if((epCap->dir & OORX) && (epCap->dir & OOTX))
+ {
+ entry->capability.t = T_H245Capability_receiveAndTransmitAudioCapability;
+ entry->capability.u.receiveAndTransmitAudioCapability = audioCap;
+ }
+ else if((epCap->dir & OORX))
{
entry->capability.t = T_H245Capability_receiveAudioCapability;
entry->capability.u.receiveAudioCapability = audioCap;
@@ -518,7 +526,7 @@
else{
OOTRACEDBGC3("Sending transmit&recevie capability t38 in TCS.(%s, %s)\n",
call->callType, call->callToken);
- t38Cap = ooCapabilityCreateT38Capability(epCap, pctxt, OOTX&OORX);
+ t38Cap = ooCapabilityCreateT38Capability(epCap, pctxt, OOTX|OORX);
if(!t38Cap)
{
OOTRACEWARN3("WARN:Failed to create capability t38 "
@@ -817,6 +825,57 @@
return ret;
}
+int ooSendTerminalNumberAssign(OOH323CallData *call)
+{
+ int ret;
+ H245IndicationMessage *indication = NULL;
+ OOCTXT *pctxt=NULL;
+ H245Message *ph245msg=NULL;
+
+ ret = ooCreateH245Message(call, &ph245msg,
+ T_H245MultimediaSystemControlMessage_indication);
+
+ if(ret == OO_FAILED)
+ {
+ OOTRACEERR3("Error:Failed to create H245 message for Terminal "
+ "NA (%s, %s)\n", call->callType,call->callToken);
+ return OO_FAILED;
+ }
+
+ /* Set request type as TerminalCapabilitySet */
+ indication = ph245msg->h245Msg.u.indication;
+ pctxt = call->msgctxt;
+ ph245msg->msgType = OOTerminalNumberAssigned;
+ if(indication == NULL)
+ {
+ OOTRACEERR3("ERROR: No memory allocated for indication message (%s, %s)\n",
+ call->callType, call->callToken);
+ return OO_FAILED;
+ }
+
+ memset(indication, 0, sizeof(H245IndicationMessage));
+ indication->t = T_H245IndicationMessage_conferenceIndication;
+ indication->u.conferenceIndication = (H245ConferenceIndication *)
+ memAllocZ(pctxt, sizeof(H245ConferenceIndication));
+ indication->u.conferenceIndication->t = T_H245ConferenceIndication_terminalNumberAssign;
+ indication->u.conferenceIndication->u.terminalNumberAssign = (H245TerminalLabel *)
+ memAllocZ(pctxt, sizeof(H245TerminalLabel));
+ indication->u.conferenceIndication->u.terminalNumberAssign->mcuNumber = 1;
+ indication->u.conferenceIndication->u.terminalNumberAssign->terminalNumber = 2;
+
+
+ OOTRACEDBGA3("Built terminal number assign message (%s, %s)\n",
+ call->callType, call->callToken);
+ ret = ooSendH245Msg(call, ph245msg);
+ if(ret != OO_OK)
+ {
+ OOTRACEERR3("Error:Failed to enqueue TNA message to outbound queue. "
+ "(%s, %s)\n", call->callType, call->callToken);
+ }
+ ooFreeH245Message(call,ph245msg);
+
+ return ret;
+}
ASN1UINT ooGenerateStatusDeterminationNumber()
{
@@ -959,6 +1018,10 @@
gH323ep.h323Callbacks.openLogicalChannels(call);
if(!ooGetTransmitLogicalChannel(call))
ooOpenLogicalChannels(call);
+/* TNA indication on input calls only */
+ if(strcmp(call->callType, "outgoing") && call->qsig)
+ ooSendTerminalNumberAssign(call);
+/**/
#if 0
if(!call->logicalChans){
if(!gH323ep.h323Callbacks.openLogicalChannels)
@@ -2173,6 +2236,10 @@
gH323ep.h323Callbacks.openLogicalChannels(call);
if(!ooGetTransmitLogicalChannel(call))
ooOpenLogicalChannels(call);
+/* TNA indication here on input calls only */
+ if(strcmp(call->callType, "outgoing") && call->qsig)
+ ooSendTerminalNumberAssign(call);
+/**/
#if 0
if(!call->logicalChans){
if(!gH323ep.h323Callbacks.openLogicalChannels)
@@ -3208,6 +3275,10 @@
gH323ep.h323Callbacks.openLogicalChannels(call);
if(!ooGetTransmitLogicalChannel(call))
ooOpenLogicalChannels(call);
+/* TNA indication here on incoming call only */
+ if(strcmp(call->callType, "outgoing") && call->qsig)
+ ooSendTerminalNumberAssign(call);
+/**/
#if 0
if(!call->logicalChans){
if(!gH323ep.h323Callbacks.openLogicalChannels)
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooh245.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooh245.h?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooh245.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooh245.h Sat Apr 16 20:00:30 2011
@@ -649,6 +649,8 @@
int ooSendRoundTripDelayRequest(OOH323CallData *call);
+EXTERN int ooSendTerminalNumberAssign(OOH323CallData *call);
+
#ifdef __cplusplus
}
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c Sat Apr 16 20:00:30 2011
@@ -30,6 +30,7 @@
#include "ooh323ep.h"
#include "ooGkClient.h"
#include "ooTimer.h"
+#include "ooqsig.h"
/** Global endpoint structure */
extern OOH323EndPoint gH323ep;
@@ -53,6 +54,10 @@
call->remoteDisplayName = (char *) memAllocZ(call->pctxt,
pDisplayIE->length*sizeof(ASN1OCTET)+1);
strncpy(call->remoteDisplayName, (char *)pDisplayIE->data, pDisplayIE->length*sizeof(ASN1OCTET));
+/*
+ may be insert colp message back to asterisk core here???
+ May 20110329
+ */
}
return OO_OK;
@@ -369,9 +374,10 @@
ASN1OCTET msgbuf[MAXMSGLEN];
H225TransportAddress_ipAddress_ip *ip = NULL;
H225TransportAddress_ip6Address_ip *ip6 = NULL;
- Q931InformationElement* pDisplayIE=NULL;
+ Q931InformationElement* pDisplayIE=NULL, *QSigIE=NULL;
OOAliases *pAlias=NULL;
char remoteIP[2+8*4+7];
+ char *callingName = NULL;
call->callReference = q931Msg->callReference;
@@ -405,6 +411,18 @@
pDisplayIE->length*sizeof(ASN1OCTET)+1);
strncpy(call->remoteDisplayName, (char *)pDisplayIE->data, pDisplayIE->length*sizeof(ASN1OCTET));
}
+
+
+ if (call->qsig && (QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE)) && ((callingName = ooQsigGetCallingName(call, QSigIE)) != NULL) ) {
+ if (call->remoteDisplayName) {
+ memFreePtr(call->pctxt, call->remoteDisplayName);
+ call->remoteDisplayName = NULL;
+ }
+ if ((call->remoteDisplayName=(char *) memAllocZ(call->pctxt, strlen(callingName)))){
+ strcpy(call->remoteDisplayName, callingName);
+ }
+ }
+
/*Extract Remote Aliases, if present*/
if(setup->m.sourceAddressPresent)
{
@@ -849,6 +867,16 @@
ooLogicalChannel * pChannel = NULL;
H245H2250LogicalChannelParameters * h2250lcp = NULL;
int i=0, ret=0;
+ char *calledName = NULL;
+
+ Q931InformationElement* QSigIE;
+
+ if (call->qsig && (QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE)) &&
+ (calledName = ooQsigGetCalledName(call, QSigIE))) {
+ if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
+ gH323ep.h323Callbacks.onQSigData(call, 0, calledName, NULL);
+
+ }
ooHandleDisplayIE(call, q931Msg);
@@ -1086,6 +1114,16 @@
ooLogicalChannel * pChannel = NULL;
H245H2250LogicalChannelParameters * h2250lcp = NULL;
int i=0, ret=0;
+ char *calledName = NULL;
+
+ Q931InformationElement* QSigIE;
+
+ if (call->qsig && (QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE)) &&
+ (calledName = ooQsigGetCalledName(call, QSigIE))) {
+ if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
+ gH323ep.h323Callbacks.onQSigData(call, 0, calledName, NULL);
+
+ }
ooHandleDisplayIE(call, q931Msg);
@@ -1324,6 +1362,16 @@
ASN1OCTET msgbuf[MAXMSGLEN];
ooLogicalChannel * pChannel = NULL;
H245H2250LogicalChannelParameters * h2250lcp = NULL;
+ char* connectedName = NULL;
+
+ Q931InformationElement* QSigIE;
+
+ if (call->qsig && (QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE)) &&
+ (connectedName = ooQsigGetConnectedName(call, QSigIE))) {
+ if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
+ gH323ep.h323Callbacks.onQSigData(call, 0, connectedName, NULL);
+
+ }
ooHandleDisplayIE(call, q931Msg);
@@ -1681,7 +1729,7 @@
}
}
if (call->callState < OO_CALL_CLEAR) {
- ooSendCallProceeding(call);/* Send call proceeding message*/
+ ooSendCallProceeding(call); /* Send call proceeding message*/
ret = ooH323CallAdmitted (call);
}
@@ -1825,8 +1873,18 @@
int ret;
H225TransportAddress_ipAddress_ip *ip = NULL;
H225TransportAddress_ip6Address_ip *ip6 = NULL;
+ Q931InformationElement* QSigIE;
+ char *name = NULL, *number = NULL;
+
OOTRACEDBGC3("Received Facility Message.(%s, %s)\n", call->callType,
call->callToken);
+
+ if (call->qsig && (QSigIE = ooQ931GetIE(pQ931Msg, Q931FacilityIE)) &&
+ (ooQsigGetCTComplete(call, QSigIE, &name, &number)>0)) {
+ if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
+ gH323ep.h323Callbacks.onQSigData(call, 1, name, number);
+
+ }
ooHandleDisplayIE(call, pQ931Msg);
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooh323ep.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooh323ep.c?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooh323ep.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooh323ep.c Sat Apr 16 20:00:30 2011
@@ -346,6 +346,7 @@
gH323ep.h323Callbacks.openLogicalChannels = h323Callbacks.openLogicalChannels;
gH323ep.h323Callbacks.onReceivedDTMF = h323Callbacks.onReceivedDTMF;
gH323ep.h323Callbacks.onModeChanged = h323Callbacks.onModeChanged;
+ gH323ep.h323Callbacks.onQSigData = h323Callbacks.onQSigData;
return OO_OK;
}
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c Sat Apr 16 20:00:30 2011
@@ -34,19 +34,23 @@
#include "ooGkClient.h"
#include "ooUtils.h"
#include "ootypes.h"
+#include "ooqsig.h"
#include <time.h>
#include <ctype.h>
int ooSetFastStartResponse(OOH323CallData *pCall, Q931Message *pQ931msg,
ASN1UINT *fsCount, ASN1DynOctStr **fsElem);
+int ooQ931SetFacilityIE
+ (OOCTXT* pctxt, Q931Message *pmsg, const char *buffer, int len);
+
/** Global endpoint structure */
extern OOH323EndPoint gH323ep;
extern ast_mutex_t newCallLock;
static ASN1OBJID gProtocolID = {
- 6, { 0, 0, 8, 2250, 0, 4 }
+ 6, { 0, 0, 8, 2250, 0, 5 }
};
EXTERN int ooQ931Decode
@@ -164,6 +168,22 @@
OOTRACEDBGB2(", %x", ie->data[x]);
}
OOTRACEDBGB1(" }\n");
+ }
+ if(ie->discriminator == Q931FacilityIE)
+ {
+ OOTRACEDBGB1(" Facility IE = {\n");
+ for(x=0; x<ie->length; x++)
+ {
+ if(x==0)
+ OOTRACEDBGB2(" %x", ie->data[x]);
+ else
+ OOTRACEDBGB2(", %x", ie->data[x]);
+ }
+ OOTRACEDBGB1(" }\n");
+
+ if (docallbacks) {
+ ooQ931SetFacilityIE(call->pctxt, msg, (char *)ie->data, length);
+ }
}
if(ie->discriminator == Q931DisplayIE)
{
@@ -405,6 +425,7 @@
(*q931msg)->callingPartyNumberIE = NULL;
(*q931msg)->calledPartyNumberIE = NULL;
(*q931msg)->causeIE = NULL;
+ (*q931msg)->facilityIE = NULL;
return OO_OK;
}
}
@@ -744,17 +765,18 @@
i += pq931Msg->causeIE->length;
}
- /*Add progress indicator IE
- if(pq931Msg->messageType == Q931AlertingMsg || pq931Msg->messageType == Q931CallProceedingMsg)
+ /*Add progress indicator IE */
+ if(pq931Msg->messageType == Q931AlertingMsg || pq931Msg->messageType == Q931ProgressMsg)
{
msgbuf[i++] = Q931ProgressIndicatorIE;
msgbuf[i++] = 2; //Length is 2 octet
msgbuf[i++] = 0x80; //PI=8
msgbuf[i++] = 0x88;
- }*/
+ }
/*Add display ie. */
- if(!ooUtilsIsStrEmpty(call->ourCallerId))
+ /* 20110406 May - send displayIE in CONNECT packet only */
+ if(/* pq931Msg->messageType == Q931ConnectMsg && */ !ooUtilsIsStrEmpty(call->ourCallerId))
{
msgbuf[i++] = Q931DisplayIE;
ieLen = strlen(call->ourCallerId)+1;
@@ -791,6 +813,13 @@
msgbuf[i++] = pq931Msg->keypadIE->length;
memcpy(msgbuf+i, pq931Msg->keypadIE->data, pq931Msg->keypadIE->length);
i += pq931Msg->keypadIE->length;
+ }
+
+ if(pq931Msg->facilityIE) {
+ msgbuf[i++] = Q931FacilityIE;
+ msgbuf[i++] = pq931Msg->facilityIE->length;
+ memcpy(msgbuf+i, pq931Msg->facilityIE->data, pq931Msg->facilityIE->length);
+ i += pq931Msg->facilityIE->length;
}
/* Note: Have to fix this, though it works. Need to get rid of ie list.
@@ -1348,6 +1377,15 @@
return OO_FAILED;
}
+ if(call->qsig && !ooUtilsIsStrEmpty(call->ourCallerId)) {
+ unsigned char *iebuf = NULL, *ienextpoint = NULL;
+ if ((iebuf = (unsigned char*)memAllocZ(call->pctxt, 1024))) {
+ if ((ienextpoint = ooQsigSetCalledName(call, iebuf, call->ourCallerId)))
+ ooQ931SetFacilityIE(call->pctxt, q931msg, (char *)iebuf, ienextpoint - iebuf);
+ memFreePtr(call->pctxt, iebuf);
+ }
+ } else OOTRACEDBGC3("No ourCallerId for call (%s, %s)\n", call->callType, call->callToken);
+
call->alertingTime = (H235TimeStamp) time(NULL);
q931msg->callReference = call->callReference;
@@ -1485,6 +1523,15 @@
"Alerting message\n");
return OO_FAILED;
}
+
+ if(call->qsig && !ooUtilsIsStrEmpty(call->ourCallerId)) {
+ unsigned char *iebuf = NULL, *ienextpoint = NULL;
+ if ((iebuf = (unsigned char*)memAllocZ(call->pctxt, 1024))) {
+ if ((ienextpoint = ooQsigSetCalledName(call, iebuf, call->ourCallerId)))
+ ooQ931SetFacilityIE(call->pctxt, q931msg, (char *)iebuf, ienextpoint - iebuf);
+ memFreePtr(call->pctxt, iebuf);
+ }
+ } else OOTRACEDBGC3("No ourCallerId for call (%s, %s)\n", call->callType, call->callToken);
q931msg->callReference = call->callReference;
@@ -2225,6 +2272,11 @@
else
OO_CLRFLAG(call->flags, OO_M_DISABLEGK);
+ if(opts->qsig)
+ call->qsig = TRUE;
+ else
+ call->qsig = FALSE;
+
call->callMode = opts->callMode;
call->transfercap = opts->transfercap;
}
@@ -2431,6 +2483,16 @@
}
}
+
+ if(call->qsig && !ooUtilsIsStrEmpty(call->ourCallerId)) {
+ unsigned char *iebuf = NULL, *ienextpoint = NULL;
+ if ((iebuf = (unsigned char*)memAllocZ(call->pctxt, 1024))) {
+ if ((ienextpoint = ooQsigSetCallingName(call, iebuf, call->ourCallerId)))
+ ooQ931SetFacilityIE(call->pctxt, q931msg, (char *)iebuf, ienextpoint - iebuf);
+ memFreePtr(call->pctxt, iebuf);
+ }
+ } else OOTRACEDBGC3("No ourCallerId for call (%s, %s)\n", call->callType, call->callToken);
+
q931msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt,
sizeof(H225H323_UserInformation));
@@ -3244,6 +3306,30 @@
pmsg->calledPartyNumberIE->length = len+1;
pmsg->calledPartyNumberIE->data[0] = (0x80|((type&7)<<4)|(plan&15));
memcpy(pmsg->calledPartyNumberIE->data+1, number, len);
+
+ return OO_OK;
+}
+
+int ooQ931SetFacilityIE
+ (OOCTXT* pctxt, Q931Message *pmsg, const char *buffer, int len)
+{
+ if(pmsg->facilityIE)
+ {
+ memFreePtr(pctxt, pmsg->facilityIE);
+ pmsg->facilityIE = NULL;
+ }
+
+ pmsg->facilityIE = (Q931InformationElement*)
+ memAllocZ(pctxt, sizeof(Q931InformationElement)+len+8);
+ if(!pmsg->facilityIE)
+ {
+ OOTRACEERR1("Error:Memory - ooQ931SetCalledPartyNumberIE - "
+ "calledPartyNumberIE\n");
+ return OO_FAILED;
+ }
+ pmsg->facilityIE->discriminator = Q931FacilityIE;
+ pmsg->facilityIE->length = len;
+ memcpy(pmsg->facilityIE->data, buffer, len);
return OO_OK;
}
@@ -3829,7 +3915,8 @@
"OORequestModeReject",
"OORequestMode",
"OORequestDelayResponse",
- "OORequestDelayRequest"
+ "OORequestDelayRequest",
+ "OOTerminalNumberAssigned"
};
int idx = msgType - OO_MSGTYPE_MIN;
return ooUtilsGetText (idx, msgTypeText, OONUMBEROF(msgTypeText));
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h?view=diff&rev=313908&r1=313907&r2=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h Sat Apr 16 20:00:30 2011
@@ -246,6 +246,7 @@
Q931InformationElement *calledPartyNumberIE;
Q931InformationElement *causeIE;
Q931InformationElement *keypadIE;
+ Q931InformationElement *facilityIE;
H225H323_UserInformation *userInfo;
} Q931Message;
Added: team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c?view=auto&rev=313908
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c (added)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c Sat Apr 16 20:00:30 2011
@@ -1,0 +1,195 @@
+/*
+ Q.SIG processing routines
+ */
+
+
+#include "asterisk.h"
+#include "asterisk/lock.h"
+#include "asterisk/time.h"
+#include <time.h>
+
+#include "ootypes.h"
+#include "ooq931.h"
+#include "ootrace.h"
+#include "oochannels.h"
+#include "ooCalls.h"
+#include "printHandler.h"
+#include "ooh323.h"
+#include "ooh323ep.h"
+#include "ooTimer.h"
+#include "ooqsig.h"
+
+/* extract Q.SIG info methods */
+
+char* ooQsigGetCallingName(OOH323CallData *call, Q931InformationElement* QSigIE) {
+
+ struct fac_extension_header discard;
+ struct rose_message rose;
+ unsigned char* qtop, *qend;
+ char *res = NULL;
+
+OOTRACEDBGC3("Try to get QSIG-NA calling name for (%s, %s)\n",
+ call->callType, call->callToken);
+
+ qtop = QSigIE->data;
+ qend = qtop + QSigIE->length;
+ qtop = (unsigned char *) facility_decode_header(call->pri, qtop, qend, &discard);
+ while (qtop && qtop < qend) {
+ if ((qtop = (unsigned char *)rose_decode(call->pri, qtop, qend, &rose))) {
+ if (rose.type == ROSE_COMP_TYPE_INVOKE && rose.component.invoke.operation == ROSE_QSIG_CallingName &&
+ rose.component.invoke.args.qsig.CallingName.name.length) {
+ if ( (res = (char *) memAllocZ(call->pctxt,
+ rose.component.invoke.args.qsig.CallingName.name.length + 1)) != NULL) {
+ strncpy(res, (char *)rose.component.invoke.args.qsig.CallingName.name.data,
+ rose.component.invoke.args.qsig.CallingName.name.length);
+ OOTRACEDBGC4("Getting QSIG-NA calling name to %s (%s, %s)\n", call->remoteDisplayName,
+ call->callType, call->callToken);
+
+ }
+ }
+ }
+ }
+
+ return res;
+}
+
+char* ooQsigGetCalledName(OOH323CallData *call, Q931InformationElement* QSigIE) {
+
+ struct fac_extension_header discard;
+ struct rose_message rose;
+ unsigned char* qtop, *qend;
+ char *res = NULL;
+
+OOTRACEDBGC3("Try to get QSIG-NA called name for (%s, %s)\n",
+ call->callType, call->callToken);
+
+ qtop = QSigIE->data;
+ qend = qtop + QSigIE->length;
+ qtop = (unsigned char *) facility_decode_header(call->pri, qtop, qend, &discard);
+ while (qtop && qtop < qend) {
+ if ((qtop = (unsigned char *)rose_decode(call->pri, qtop, qend, &rose))) {
+ if (rose.type == ROSE_COMP_TYPE_INVOKE && rose.component.invoke.operation == ROSE_QSIG_CalledName &&
[... 74070 lines stripped ...]
More information about the asterisk-commits
mailing list