[asterisk-commits] may: branch may/ooh323_qsig r316189 - in /team/may/ooh323_qsig/addons: ./ ooh...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 2 16:04:13 CDT 2011
Author: may
Date: Mon May 2 16:04:01 2011
New Revision: 316189
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=316189
Log:
SetConnectedName (send in connect message) implemented
SetCTUpdate (send in CTComplete reply) implemented
SetANI changed for both name and number
Parse Information message and HandleDisplayIE for this
(avaya said transfee info with q.931 packet for some cases)
Changed COLP/CLID logic for incoming/outgoing call:
if incoming we change both colp and clid
if outgoing we change colp only
Modified:
team/may/ooh323_qsig/addons/chan_ooh323.c
team/may/ooh323_qsig/addons/ooh323c/src/ooCmdChannel.c
team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.c
team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.h
team/may/ooh323_qsig/addons/ooh323c/src/ooh323.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/ooqsig.c
team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.h
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=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/chan_ooh323.c (original)
+++ team/may/ooh323_qsig/addons/chan_ooh323.c Mon May 2 16:04:01 2011
@@ -1243,11 +1243,15 @@
|| ast_strlen_zero(ast->connected.id.name.str)) {
break;
}
+ if (!ast->connected.id.number.valid
+ || ast_strlen_zero(ast->connected.id.number.str)) {
+ break;
+ }
if (gH323Debug) {
ast_debug(1, "Sending connected line info for %s (%s)\n",
callToken, ast->connected.id.name.str);
}
- ooSetANI(callToken, ast->connected.id.name.str);
+ ooSetANI(callToken, ast->connected.id.name.str, ast->connected.id.number.str);
break;
case AST_CONTROL_T38_PARAMETERS:
@@ -1665,8 +1669,8 @@
if (name) {
if (transfer) {
update_redirecting.from.name = 1;
- redirecting.from.name.valid = 1;
- redirecting.from.name.str = name;
+ redirecting.from.name.valid = c->caller.id.name.valid;
+ redirecting.from.name.str = ast_strdup(c->caller.id.name.str);
pbx_builtin_setvar_helper(c, "XFERNAME",
name);
} else {
@@ -1678,8 +1682,8 @@
if (number) {
if (transfer) {
update_redirecting.from.number = 1;
- redirecting.from.number.valid = 1;
- redirecting.from.number.str = number;
+ redirecting.from.number.valid = c->caller.id.number.valid;
+ redirecting.from.number.str = ast_strdup(c->caller.id.number.str);
if (c->caller.id.number.valid && c->caller.id.number.str)
pbx_builtin_setvar_helper(c, "BLINDTRANSFER",
c->caller.id.number.str);
@@ -1693,9 +1697,8 @@
}
if (transfer) {
redirecting.reason = AST_REDIRECTING_REASON_UNKNOWN;
- /* this is for outgoing call */
- /* ast_channel_queue_redirecting_update(c, &redirecting, &update_redirecting); */
ast_channel_set_redirecting(c, &redirecting, &update_redirecting);
+ ast_set_callerid(c, number, name, NULL);
} else {
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(c, &connected, &update_connected);
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooCmdChannel.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooCmdChannel.c?view=diff&rev=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooCmdChannel.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooCmdChannel.c Mon May 2 16:04:01 2011
@@ -403,12 +403,23 @@
break;
case OO_CMD_SETANI:
- OOTRACEINFO3("Processing SetANI command %s, ani is %s\n",
- (char *)cmd.param1, (char *)cmd.param2);
+ OOTRACEINFO4("Processing SetANI command %s, ani is %s, %s\n",
+ (char *)cmd.param1, (char *)cmd.param2, (char *)cmd.param3);
if(cmd.param2) {
strncpy(call->ourCallerId, cmd.param2, sizeof(call->ourCallerId)-1);
call->ourCallerId[sizeof(call->ourCallerId)-1] = '\0';
}
+ if(cmd.param3) {
+ char* cpn;
+ if ((cpn = memAllocZ(call->pctxt, strlen(cmd.param3)+1))) {
+ strncpy(cpn, cmd.param3, strlen(cmd.param3));
+ memFreePtr(call->pctxt, call->calledPartyNumber);
+ call->calledPartyNumber = cpn;
+ }
+ }
+ if (call->qsig) {
+ ooSendNAFacility(call);
+ }
break;
default: OOTRACEERR1("ERROR:Unknown command\n");
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.c?view=diff&rev=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.c Mon May 2 16:04:01 2011
@@ -497,7 +497,7 @@
return OO_STKCMD_SUCCESS;
}
-OOStkCmdStat ooSetANI(const char *callToken, const char* ani)
+OOStkCmdStat ooSetANI(const char *callToken, const char* ani, const char* anm)
{
OOStackCommand cmd;
OOH323CallData *call;
@@ -522,25 +522,31 @@
cmd.param1 = (void*) malloc(strlen(callToken)+1);
cmd.param2 = (void*) malloc(strlen(ani)+1);
- if(!cmd.param1 || !cmd.param2)
+ cmd.param3 = (void*) malloc(strlen(ani)+1);
+ if(!cmd.param1 || !cmd.param2 || !cmd.param3)
{
if(cmd.param1) free(cmd.param1); /* Release memory */
if(cmd.param2) free(cmd.param2);
+ if(cmd.param3) free(cmd.param3);
return OO_STKCMD_MEMERR;
}
strcpy((char*)cmd.param1, callToken);
cmd.plen1 = strlen(callToken);
strcpy((char*)cmd.param2, ani);
cmd.plen2 = strlen(ani);
+ strcpy((char*)cmd.param3, anm);
+ cmd.plen3 = strlen(anm);
if(ooWriteCallStackCommand(call,&cmd) != OO_OK)
{
free(cmd.param1);
free(cmd.param2);
+ free(cmd.param3);
return OO_STKCMD_WRITEERR;
}
free(cmd.param1);
free(cmd.param2);
+ free(cmd.param3);
return OO_STKCMD_SUCCESS;
}
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.h?view=diff&rev=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.h Mon May 2 16:04:01 2011
@@ -177,7 +177,7 @@
int ooGenerateOutgoingCallToken (char *callToken, size_t size);
-EXTERN OOStkCmdStat ooSetANI(const char *callToken, const char* ani);
+EXTERN OOStkCmdStat ooSetANI(const char *callToken, const char* ani, const char* anm);
#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=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c Mon May 2 16:04:01 2011
@@ -37,6 +37,7 @@
int ooHandleFastStart(OOH323CallData *call, H225Facility_UUIE *facility);
int ooOnReceivedReleaseComplete(OOH323CallData *call, Q931Message *q931Msg);
+int ooOnReceivedInformation(OOH323CallData *call, Q931Message *q931Msg);
int ooOnReceivedCallProceeding(OOH323CallData *call, Q931Message *q931Msg);
int ooOnReceivedAlerting(OOH323CallData *call, Q931Message *q931Msg);
int ooOnReceivedProgress(OOH323CallData *call, Q931Message *q931Msg);
@@ -49,15 +50,40 @@
/* check for display ie */
pDisplayIE = ooQ931GetIE(q931Msg, Q931DisplayIE, 1);
if(pDisplayIE) {
+ char strname[20 + 1], strnumber[14 + 1];
+ int number = 0;
+ char *dbuf = NULL;
+
+ if (q931Msg->messageType == Q931InformationMsg &&
+ (dbuf = memAllocZ(call->pctxt, pDisplayIE->length*sizeof(ASN1OCTET)+1)) ) {
+/*
+ May 20110501
+ special case for avaya media server
+ process avaya's presentation way for xmobile sta on asterisk
+ "%20s%14d" in displayIE on INFORMATION(7b) packet
+ */
+ strncpy(dbuf, (char *)pDisplayIE->data, pDisplayIE->length*sizeof(ASN1OCTET));
+ OOTRACEDBGC4("Parse info packet: %s, (%s, %s)\n", dbuf, call->callType, call->callToken);
+ memset(strname, 0, sizeof(strname));
+ strncpy(strname, dbuf, 20);
+ sscanf(&dbuf[21], "%d",&number);
+ if (number > 0 && strname[0] != 0) {
+ OOTRACEDBGC5("Setup QSIG name/number from information packet: %s/%d, (%s, %s)\n",
+ strname, number, call->callType, call->callToken);
+ sprintf(strnumber, "%d", number);
+ if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR) {
+ if (!strcmp(call->callType, "incoming"))
+ gH323ep.h323Callbacks.onQSigData(call, 1, strname, strnumber); /* update clid */
+ gH323ep.h323Callbacks.onQSigData(call, 0, strname, strnumber); /* update colp */
+ }
+ }
+ memFreePtr(call->pctxt, dbuf);
+ }
if (call->remoteDisplayName)
memFreePtr(call->pctxt, call->remoteDisplayName);
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;
@@ -636,6 +662,184 @@
+int ooOnReceivedInformation(OOH323CallData *call, Q931Message *q931Msg)
+{
+ H225Information_UUIE *information=NULL;
+ H245OpenLogicalChannel* olc;
+ ASN1OCTET msgbuf[MAXMSGLEN];
+ ooLogicalChannel * pChannel = NULL;
+ H245H2250LogicalChannelParameters * h2250lcp = NULL;
+ int i=0, ret=0;
+
+ if(!q931Msg->userInfo)
+ {
+ OOTRACEERR3("ERROR:No User-User IE in received Information message."
+ " (%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ information =
+ q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.information;
+ if(information == NULL)
+ {
+ OOTRACEERR3("Error: Received information message does not have "
+ "Information UUIE (%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;
+ }
+
+ ooHandleH2250ID(call, information->protocolIdentifier);
+ ooHandleDisplayIE(call, q931Msg);
+ /* Handle fast-start */
+ if(OO_TESTFLAG (call->flags, OO_M_FASTSTART))
+ {
+ if(information->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)information->fastStart.n; i++)
+ {
+ olc = NULL;
+
+ olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt,
+ sizeof(H245OpenLogicalChannel));
+ if(!olc)
+ {
+ OOTRACEERR3("ERROR:Memory - ooOnReceivedInformation - 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, information->fastStart.elem[i].data,
+ information->fastStart.elem[i].numocts);
+ setPERBuffer(call->pctxt, msgbuf,
+ information->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"))
+ {
+ 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);
+ }
+
+ }
+
+ /* Retrieve tunneling info/H.245 control channel address from the connect msg */
+ if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
+ !q931Msg->userInfo->h323_uu_pdu.h245Tunneling) {
+ if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+ OO_CLRFLAG (call->flags, OO_M_TUNNELING);
+ OOTRACEINFO3("Tunneling is disabled for call due to remote reject tunneling"
+ " (%s, %s)\n", call->callType, call->callToken);
+ }
+ }
+ return OO_OK;
+}
+
int ooOnReceivedCallProceeding(OOH323CallData *call, Q931Message *q931Msg)
{
H225CallProceeding_UUIE *callProceeding=NULL;
@@ -1836,6 +2040,7 @@
case Q931InformationMsg:
OOTRACEINFO3("H.225 Information msg received (%s, %s)\n",
call->callType, call->callToken);
+ ooOnReceivedInformation(call, q931Msg);
ooFreeQ931Message(call->msgctxt, q931Msg);
break;
@@ -1903,7 +2108,11 @@
while ((QSigIE = ooQ931GetIE(pQ931Msg, Q931FacilityIE, j++))) {
if (ooQsigGetCTComplete(call, QSigIE, &name, &number)>0) {
if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
- gH323ep.h323Callbacks.onQSigData(call, 1, name, number);
+ if (!strcmp(call->callType, "incoming"))
+ gH323ep.h323Callbacks.onQSigData(call, 1, name, number); /* update clid */
+ gH323ep.h323Callbacks.onQSigData(call, 1, name, number); /* update colp */
+ /* send transfer complete back */
+ ooSendCTUpdateFacility(call);
break;
}
if (ooQsigGetCTActive(call, QSigIE, &name, &number)>0) {
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=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c Mon May 2 16:04:01 2011
@@ -776,14 +776,13 @@
/*Add display ie. */
/* 20110406 May - send displayIE in CONNECT packet only */
- if(/* pq931Msg->messageType == Q931ConnectMsg && */ !ooUtilsIsStrEmpty(call->ourCallerId))
+ if(pq931Msg->messageType != Q931CallProceedingMsg && !ooUtilsIsStrEmpty(call->ourCallerId))
{
msgbuf[i++] = Q931DisplayIE;
- ieLen = strlen(call->ourCallerId)+1;
+ ieLen = strlen(call->ourCallerId);
msgbuf[i++] = ieLen;
- memcpy(msgbuf+i, call->ourCallerId, ieLen-1);
- i += ieLen-1;
- msgbuf[i++] = '\0';
+ memcpy(msgbuf+i, call->ourCallerId, ieLen);
+ i += ieLen;
}
/* Add calling Party ie */
@@ -1788,6 +1787,135 @@
return ret;
}
+int ooSendCTUpdateFacility(OOH323CallData *call)
+{
+ int ret=0;
+ Q931Message *pQ931Msg = NULL;
+ OOCTXT *pctxt = call->msgctxt;
+
+ OOTRACEDBGA3("Building Facility message (%s, %s)\n", call->callType,
+ call->callToken);
+ ret = ooCreateQ931Message(pctxt, &pQ931Msg, Q931FacilityMsg);
+ if(ret != OO_OK)
+ {
+ OOTRACEERR3
+ ("ERROR: In allocating memory for facility message (%s, %s)\n",
+ call->callType, call->callToken);
+ 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))) */
+
+ if (call->calledPartyNumber && call->calledPartyNumber[0] &&
+ (ienextpoint = ooQsigSetCTUpdate(call, iebuf, call->calledPartyNumber, call->ourCallerId)))
+ ooQ931SetFacilityIE(call->pctxt, pQ931Msg, (char *)iebuf, ienextpoint - iebuf);
+ memFreePtr(call->pctxt, iebuf);
+ }
+ } else OOTRACEDBGC3("No ourCallerId for call (%s, %s)\n", call->callType, call->callToken);
+
+
+
+ pQ931Msg->callReference = call->callReference;
+
+ pQ931Msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt,
+ sizeof(H225H323_UserInformation));
+ if(!pQ931Msg->userInfo)
+ {
+ OOTRACEERR3("ERROR:Memory - ooSendFacility - userInfo(%s, %s)\n",
+ call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ memset (pQ931Msg->userInfo, 0, sizeof(H225H323_UserInformation));
+ pQ931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent=1;
+
+ pQ931Msg->userInfo->h323_uu_pdu.h245Tunneling =
+ OO_TESTFLAG (call->flags, OO_M_TUNNELING);
+
+ pQ931Msg->userInfo->h323_uu_pdu.h323_message_body.t =
+ T_H225H323_UU_PDU_h323_message_body_empty;
+
+ OOTRACEDBGA3("Built Facility message to send (%s, %s)\n", call->callType,
+ call->callToken);
+
+ ret = ooSendH225Msg(call, pQ931Msg);
+ if(ret != OO_OK)
+ {
+ OOTRACEERR3
+ ("Error:Failed to enqueue Facility message to outbound "
+ "queue.(%s, %s)\n", call->callType, call->callToken);
+ }
+ memReset (call->msgctxt);
+ return ret;
+}
+
+int ooSendNAFacility(OOH323CallData *call)
+{
+ int ret=0;
+ Q931Message *pQ931Msg = NULL;
+ OOCTXT *pctxt = call->msgctxt;
+
+ OOTRACEDBGA3("Building Facility message (%s, %s)\n", call->callType,
+ call->callToken);
+ ret = ooCreateQ931Message(pctxt, &pQ931Msg, Q931FacilityMsg);
+ if(ret != OO_OK)
+ {
+ OOTRACEERR3
+ ("ERROR: In allocating memory for facility message (%s, %s)\n",
+ call->callType, call->callToken);
+ return OO_FAILED;
+ }
+
+ if(call->qsig && !ooUtilsIsStrEmpty(call->ourCallerId)) {
+ unsigned char *iebuf = NULL, *ienextpoint = NULL;
+ if ((iebuf = (unsigned char*)memAllocZ(call->pctxt, 1024))) {
+ if( ((call->callState == OO_CALL_CONNECTED) && /* answered */
+ (ienextpoint = ooQsigSetConnectedName(call, iebuf, call->ourCallerId))) ||
+ (!strcmp(call->callType, "incoming") &&
+ (ienextpoint = ooQsigSetCalledName(call, iebuf, call->ourCallerId))) || /* incoming */
+ (ienextpoint = ooQsigSetCallingName(call, iebuf, call->ourCallerId)) ) /* outgoing */
+ ooQ931SetFacilityIE(call->pctxt, pQ931Msg, (char *)iebuf, ienextpoint - iebuf);
+ memFreePtr(call->pctxt, iebuf);
+ }
+ } else OOTRACEDBGC3("No ourCallerId for call (%s, %s)\n", call->callType, call->callToken);
+
+
+ pQ931Msg->callReference = call->callReference;
+
+ pQ931Msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt,
+ sizeof(H225H323_UserInformation));
+ if(!pQ931Msg->userInfo)
+ {
+ OOTRACEERR3("ERROR:Memory - ooSendFacility - userInfo(%s, %s)\n",
+ call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ memset (pQ931Msg->userInfo, 0, sizeof(H225H323_UserInformation));
+ pQ931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent=1;
+
+ pQ931Msg->userInfo->h323_uu_pdu.h245Tunneling =
+ OO_TESTFLAG (call->flags, OO_M_TUNNELING);
+
+ pQ931Msg->userInfo->h323_uu_pdu.h323_message_body.t =
+ T_H225H323_UU_PDU_h323_message_body_empty;
+
+ OOTRACEDBGA3("Built Facility message to send (%s, %s)\n", call->callType,
+ call->callToken);
+
+ ret = ooSendH225Msg(call, pQ931Msg);
+ if(ret != OO_OK)
+ {
+ OOTRACEERR3
+ ("Error:Failed to enqueue Facility message to outbound "
+ "queue.(%s, %s)\n", call->callType, call->callToken);
+ }
+ memReset (call->msgctxt);
+ return ret;
+}
+
int ooSendReleaseComplete(OOH323CallData *call)
{
int ret;
@@ -1917,6 +2045,16 @@
return OO_FAILED;
}
q931msg->callReference = call->callReference;
+
+
+ if(call->qsig && !ooUtilsIsStrEmpty(call->ourCallerId)) {
+ unsigned char *iebuf = NULL, *ienextpoint = NULL;
+ if ((iebuf = (unsigned char*)memAllocZ(call->pctxt, 1024))) {
+ if ((ienextpoint = ooQsigSetConnectedName(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);
/* Set bearer capability */
if(OO_OK != ooSetBearerCapabilityIE(pctxt, q931msg, Q931CCITTStd,
@@ -2452,7 +2590,7 @@
/* Set calling party number Q931 IE */
if(call->callingPartyNumber && call->callingPartyNumber[0])
ooQ931SetCallingPartyNumberIE(pctxt, q931msg,
- (const char*)call->callingPartyNumber, 1, 0, 0, 0);
+ (const char*)call->callingPartyNumber, 1, 2, 0, 0);
/* Set called party number Q931 IE */
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=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h Mon May 2 16:04:01 2011
@@ -478,7 +478,9 @@
*
* @return Completion status - 0 on success, -1 on failure
*/
-EXTERN int ooSendFacility(struct OOH323CallData *call);
+EXTERN int ooSendStartH245Facility(struct OOH323CallData *call);
+EXTERN int ooSendCTUpdateFacility(struct OOH323CallData *call);
+EXTERN int ooSendNAFacility(struct OOH323CallData *call);
/**
Modified: 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=diff&rev=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c Mon May 2 16:04:01 2011
@@ -18,6 +18,7 @@
#include "ooh323ep.h"
#include "ooTimer.h"
#include "ooqsig.h"
+#include "qsig/pri_facility.h"
/* extract Q.SIG info methods */
@@ -241,3 +242,79 @@
return ienextpoint;
}
+
+unsigned char *ooQsigSetConnectedName(OOH323CallData *call, unsigned char *iebuf, char* name) {
+ unsigned char *ienextpoint = NULL;
+ struct q931_party_name called = {
+ .valid = 1, .presentation = 1, .char_set = 1, .str = ""
+ };
+ strncpy(called.str, name, 48);
+ if ( (ienextpoint = enc_qsig_connected_name(call->pri, iebuf, iebuf + 1024, &called)) != NULL) {
+ OOTRACEDBGC4("Setting QSIG-NA connected name to %s (%s, %s)\n", called.str, call->callType, call->callToken);
+ } else {
+ OOTRACEDBGC3("qsig encoding failed in call (%s, %s)\n", call->callType, call->callToken);
+ }
+ return ienextpoint;
+
+}
+
+unsigned char *ooQsigSetCTUpdate(OOH323CallData *call, unsigned char *iebuf, char *number, char* name) {
+ unsigned char *ienextpoint = iebuf + 1024;
+
+ struct q931_party_name q931name = {
+ .valid = 1, .presentation = 1, .char_set = 1, .str = ""
+ };
+ /* struct q931_party_number q931number = {
+ .valid = 1, .presentation = 1, .plan = 2, .str = ""
+ }; */
+
+ struct fac_extension_header header;
+ struct rose_msg_invoke msg;
+
+ memset(&header, 0, sizeof(header));
+ header.nfe_present = 1;
+ header.nfe.source_entity = 0; /* endPINX */
+ header.nfe.destination_entity = 0; /* endPINX */
+ header.interpretation_present = 1;
+ header.interpretation = 0; /* discardAnyUnrecognisedInvokePdu */
+ iebuf = facility_encode_header(call->pri, iebuf, ienextpoint, &header);
+ if (!iebuf) {
+ OOTRACEDBGC3("qsig encoding failed in call (%s, %s)\n", call->callType, call->callToken);
+ }
+
+ memset(&msg, 0, sizeof(msg));
+ msg.operation = ROSE_QSIG_CallTransferUpdate;
+ msg.invoke_id = get_invokeid(call->pri);
+ /* msg.args.qsig.CallTransferUpdate.end_designation = 0; */ /* primaryEnd */
+
+ /* redirectionNumber is the local_id.number */
+ /* strncpy(q931number.str, number, sizeof(q931number.str)-1);
+ q931_copy_presented_number_screened_to_rose(call->pri,
+ &msg.args.qsig.CallTransferUpdate.redirection, &q931number); */
+
+ msg.args.qsig.CallTransferUpdate.redirection.presentation = 0;
+ msg.args.qsig.CallTransferUpdate.redirection.screened.screening_indicator = 0;
+ msg.args.qsig.CallTransferUpdate.redirection.screened.number.plan = 1;
+ msg.args.qsig.CallTransferUpdate.redirection.screened.number.ton = 2;
+ msg.args.qsig.CallTransferUpdate.redirection.screened.number.length = strlen(number) >= 20 ? strlen(number)
+ : 20;
+ memset(msg.args.qsig.CallTransferUpdate.redirection.screened.number.str, 0, 21);
+ strncpy((char *)msg.args.qsig.CallTransferUpdate.redirection.screened.number.str, number, 20);
+
+ /* redirectionName is the local_id.name */
+ if (name) {
+ strncpy(q931name.str, name, 48);
+ msg.args.qsig.CallTransferUpdate.redirection_name_present = 1;
+ q931_copy_name_to_rose(call->pri,
+ &msg.args.qsig.CallTransferUpdate.redirection_name,
+ &q931name);
+ }
+ /* msg.args.qsig.CallTransferComplete.call_status = 1; */ /* alerting */
+
+ if ( (iebuf = rose_encode_invoke(call->pri, iebuf, ienextpoint, &msg)) != NULL) {
+ OOTRACEDBGC5("Setting QSIG-CTComplete to %s, %s (%s, %s)\n", number, name, call->callType, call->callToken);
+ } else {
+ OOTRACEDBGC3("qsig encoding failed in call (%s, %s)\n", call->callType, call->callToken);
+ }
+ return iebuf;
+}
Modified: team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.h?view=diff&rev=316189&r1=316188&r2=316189
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.h Mon May 2 16:04:01 2011
@@ -10,3 +10,5 @@
unsigned char *ooQsigSetCallingName(OOH323CallData *call, unsigned char *iebuf, char* name);
unsigned char *ooQsigSetCalledName(OOH323CallData *call, unsigned char *iebuf, char* name);
+unsigned char *ooQsigSetConnectedName(OOH323CallData *call, unsigned char *iebuf, char* name);
+unsigned char *ooQsigSetCTUpdate(OOH323CallData *call, unsigned char *iebuf, char *number, char* name);
More information about the asterisk-commits
mailing list