[asterisk-commits] may: branch may/ooh323_qsig r314157 - in /team/may/ooh323_qsig/addons: ./ ooh...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 18 16:58:08 CDT 2011
Author: may
Date: Mon Apr 18 16:58:06 2011
New Revision: 314157
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=314157
Log:
few bug fixes
implement parsing CallTransferActive packets additional to
CallTransferComplete
implement parsing number of facility info elements (any types ie) in the
same Q.931 packet
set redirecting info on channel by CTComplete received
Modified:
team/may/ooh323_qsig/addons/chan_ooh323.c
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
team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose.c
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=314157&r1=314156&r2=314157
==============================================================================
--- team/may/ooh323_qsig/addons/chan_ooh323.c (original)
+++ team/may/ooh323_qsig/addons/chan_ooh323.c Mon Apr 18 16:58:06 2011
@@ -1652,32 +1652,56 @@
if (name || number) {
struct ast_party_connected_line connected;
struct ast_set_party_connected_line update_connected;
+
+ struct ast_party_redirecting redirecting;
+ struct ast_set_party_redirecting update_redirecting;
+
ast_party_connected_line_init(&connected);
memset(&update_connected, 0, sizeof(update_connected));
+ ast_party_redirecting_init(&redirecting);
+ memset(&update_redirecting, 0, sizeof(update_redirecting));
+
if (name) {
- update_connected.id.name = 1;
- connected.id.name.valid = 1;
- connected.id.name.str = name;
if (transfer) {
+ update_redirecting.from.name = 1;
+ redirecting.from.name.valid = 1;
+ redirecting.from.name.str = name;
pbx_builtin_setvar_helper(c, "XFERNAME",
name);
+ } else {
+ update_connected.id.name = 1;
+ connected.id.name.valid = 1;
+ connected.id.name.str = name;
}
}
if (number) {
- update_connected.id.number = 1;
- connected.id.number.valid = 1;
- connected.id.number.str = number;
if (transfer) {
+ update_redirecting.from.number = 1;
+ redirecting.from.number.valid = 1;
+ redirecting.from.number.str = number;
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);
+ } else {
+ update_connected.id.number = 1;
+ connected.id.number.valid = 1;
+ connected.id.number.str = number;
}
}
- connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
- ast_channel_queue_connected_line_update(c, &connected, &update_connected);
+ 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);
+ } else {
+ connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+ ast_channel_queue_connected_line_update(c, &connected, &update_connected);
+ }
+ ast_party_redirecting_free(&redirecting);
+ ast_party_connected_line_free(&connected);
}
ast_channel_unlock(c);
ast_mutex_unlock(&p->lock);
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=314157&r1=314156&r2=314157
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c Mon Apr 18 16:58:06 2011
@@ -47,7 +47,7 @@
Q931InformationElement* pDisplayIE;
/* check for display ie */
- pDisplayIE = ooQ931GetIE(q931Msg, Q931DisplayIE);
+ pDisplayIE = ooQ931GetIE(q931Msg, Q931DisplayIE, 1);
if(pDisplayIE) {
if (call->remoteDisplayName)
memFreePtr(call->pctxt, call->remoteDisplayName);
@@ -404,7 +404,7 @@
call->confIdentifier.numocts = setup->conferenceID.numocts;
/* check for display ie */
- pDisplayIE = ooQ931GetIE(q931Msg, Q931DisplayIE);
+ pDisplayIE = ooQ931GetIE(q931Msg, Q931DisplayIE, 1);
if(pDisplayIE)
{
call->remoteDisplayName = (char *) memAllocZ(call->pctxt,
@@ -413,13 +413,19 @@
}
- if (call->qsig && (QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE)) && ((callingName = ooQsigGetCallingName(call, QSigIE)) != NULL) ) {
- if (call->remoteDisplayName) {
+ if (call->qsig) {
+ int j=1;
+ while ((QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE, j++))) {
+ if ((callingName = ooQsigGetCallingName(call, QSigIE))) {
+ if (call->remoteDisplayName) {
memFreePtr(call->pctxt, call->remoteDisplayName);
call->remoteDisplayName = NULL;
- }
- if ((call->remoteDisplayName=(char *) memAllocZ(call->pctxt, strlen(callingName)))){
+ }
+ if ((call->remoteDisplayName=(char *) memAllocZ(call->pctxt, strlen(callingName)))){
strcpy(call->remoteDisplayName, callingName);
+ }
+ break;
+ }
}
}
@@ -868,14 +874,17 @@
H245H2250LogicalChannelParameters * h2250lcp = NULL;
int i=0, ret=0;
char *calledName = NULL;
-
- Q931InformationElement* QSigIE;
-
- if (call->qsig && (QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE)) &&
- (calledName = ooQsigGetCalledName(call, QSigIE))) {
+ Q931InformationElement* QSigIE = NULL;
+
+ if (call->qsig) {
+ int j=1;
+ while ((QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE, j++))) {
+ if ((calledName = ooQsigGetCalledName(call, QSigIE))) {
if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
gH323ep.h323Callbacks.onQSigData(call, 0, calledName, NULL);
-
+ break;
+ }
+ }
}
ooHandleDisplayIE(call, q931Msg);
@@ -1116,14 +1125,19 @@
int i=0, ret=0;
char *calledName = NULL;
- Q931InformationElement* QSigIE;
-
- if (call->qsig && (QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE)) &&
- (calledName = ooQsigGetCalledName(call, QSigIE))) {
+ Q931InformationElement* QSigIE = NULL;
+
+ if (call->qsig) {
+ int j=1;
+ while ((QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE, j++))) {
+ if ((calledName = ooQsigGetCalledName(call, QSigIE))) {
if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
- gH323ep.h323Callbacks.onQSigData(call, 0, calledName, NULL);
-
- }
+ gH323ep.h323Callbacks.onQSigData(call, 0, calledName, NULL);
+ break;
+ }
+ }
+ }
+
ooHandleDisplayIE(call, q931Msg);
@@ -1364,14 +1378,19 @@
H245H2250LogicalChannelParameters * h2250lcp = NULL;
char* connectedName = NULL;
- Q931InformationElement* QSigIE;
-
- if (call->qsig && (QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE)) &&
- (connectedName = ooQsigGetConnectedName(call, QSigIE))) {
+ Q931InformationElement* QSigIE = NULL;
+
+ if (call->qsig) {
+ int j=1;
+ while ((QSigIE = ooQ931GetIE(q931Msg, Q931FacilityIE, j++))) {
+ if ((connectedName = ooQsigGetConnectedName(call, QSigIE))) {
if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
- gH323ep.h323Callbacks.onQSigData(call, 0, connectedName, NULL);
-
- }
+ gH323ep.h323Callbacks.onQSigData(call, 0, connectedName, NULL);
+ break;
+ }
+ }
+ }
+
ooHandleDisplayIE(call, q931Msg);
@@ -1873,18 +1892,28 @@
int ret;
H225TransportAddress_ipAddress_ip *ip = NULL;
H225TransportAddress_ip6Address_ip *ip6 = NULL;
- Q931InformationElement* QSigIE;
+ Q931InformationElement* QSigIE = NULL;
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)
+ if (call->qsig) {
+ int j=1;
+ 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);
-
- }
+ break;
+ }
+ if (ooQsigGetCTActive(call, QSigIE, &name, &number)>0) {
+ if(gH323ep.h323Callbacks.onQSigData && call->callState<OO_CALL_CLEAR)
+ gH323ep.h323Callbacks.onQSigData(call, 0, name, number);
+ break;
+ }
+ }
+ }
+
ooHandleDisplayIE(call, pQ931Msg);
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=314157&r1=314156&r2=314157
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c Mon Apr 18 16:58:06 2011
@@ -182,7 +182,7 @@
OOTRACEDBGB1(" }\n");
if (docallbacks) {
- ooQ931SetFacilityIE(call->pctxt, msg, (char *)ie->data, length);
+ ooQ931SetFacilityIE(call->pctxt, msg, (char *)ie->data, ie->length);
}
}
if(ie->discriminator == Q931DisplayIE)
@@ -273,14 +273,14 @@
}
EXTERN Q931InformationElement* ooQ931GetIE (const Q931Message* q931msg,
- int ieCode)
+ int ieCode, int ieNumber)
{
DListNode* curNode;
unsigned int i;
for(i = 0, curNode = q931msg->ies.head; i < q931msg->ies.count; i++) {
Q931InformationElement *ie = (Q931InformationElement*) curNode->data;
- if (ie->discriminator == ieCode) {
+ if (ie->discriminator == ieCode && --ieNumber <= 0) {
return ie;
}
curNode = curNode->next;
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=314157&r1=314156&r2=314157
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h Mon Apr 18 16:58:06 2011
@@ -369,7 +369,7 @@
* the IE element.
*/
EXTERN Q931InformationElement* ooQ931GetIE (const Q931Message* q931msg,
- int ieCode);
+ int ieCode, int ieNumber);
/**
* This function is invoked to print a Q931 message.
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=314157&r1=314156&r2=314157
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.c Mon Apr 18 16:58:06 2011
@@ -59,22 +59,26 @@
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) {
+OOTRACEDBGC4("Try to get QSIG-NA called name for (%s, %s) %d\n",
+ call->callType, call->callToken, QSigIE->length);
+
+ qtop = QSigIE->data;
+ qend = qtop + QSigIE->length;
+ qtop = (unsigned char *) facility_decode_header(call->pri, qtop, qend, &discard);
+ while (qtop && qtop < qend) {
+ OOTRACEDBGC5("QSIG for (%s, %s) is %d %d\n", call->callType, call->callToken,
+ rose.type, rose.component.invoke.operation);
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 &&
- rose.component.invoke.args.qsig.CalledName.name.length) {
+ if (rose.type == ROSE_COMP_TYPE_INVOKE &&
+ rose.component.invoke.operation == ROSE_QSIG_CalledName &&
+ rose.component.invoke.args.qsig.CalledName.name.length) {
if ( (res = (char *) memAllocZ(call->pctxt,
- rose.component.invoke.args.qsig.CalledName.name.length + 1)) != NULL) {
- strncpy(res, (char *)rose.component.invoke.args.qsig.CalledName.name.data,
- rose.component.invoke.args.qsig.CalledName.name.length);
- OOTRACEDBGC4("Getting QSIG-NA called name to %s (%s, %s)\n", call->remoteDisplayName,
- call->callType, call->callToken);
+ rose.component.invoke.args.qsig.CalledName.name.length + 2)) != NULL) {
+ strncpy(res,
+ (char *)rose.component.invoke.args.qsig.CalledName.name.data,
+ rose.component.invoke.args.qsig.CalledName.name.length);
+ OOTRACEDBGC4("Getting QSIG-NA called name to %s (%s, %s)\n",
+ res, call->callType, call->callToken);
}
}
@@ -91,7 +95,7 @@
unsigned char* qtop, *qend;
char *res = NULL;
-OOTRACEDBGC3("Try to get QSIG-NA called name for (%s, %s)\n",
+OOTRACEDBGC3("Try to get QSIG-NA connected name for (%s, %s)\n",
call->callType, call->callToken);
qtop = QSigIE->data;
@@ -102,11 +106,12 @@
if (rose.type == ROSE_COMP_TYPE_INVOKE && rose.component.invoke.operation == ROSE_QSIG_ConnectedName &&
rose.component.invoke.args.qsig.ConnectedName.name.length) {
if ( (res = (char *) memAllocZ(call->pctxt,
- rose.component.invoke.args.qsig.ConnectedName.name.length + 1)) != NULL) {
- strncpy(res, (char *)rose.component.invoke.args.qsig.ConnectedName.name.data,
- rose.component.invoke.args.qsig.ConnectedName.name.length);
- OOTRACEDBGC4("Getting QSIG-NA called name to %s (%s, %s)\n", call->remoteDisplayName,
- call->callType, call->callToken);
+ rose.component.invoke.args.qsig.ConnectedName.name.length + 2)) != NULL) {
+ strncpy(res,
+ (char *)rose.component.invoke.args.qsig.ConnectedName.name.data,
+ rose.component.invoke.args.qsig.ConnectedName.name.length);
+ OOTRACEDBGC4("Getting QSIG-NA connected name to %s (%s, %s)\n",
+ res, call->callType, call->callToken);
}
}
@@ -140,7 +145,7 @@
strncpy(*number,
(char *)rose.component.invoke.args.qsig.CallTransferComplete.redirection.screened.number.str,
rose.component.invoke.args.qsig.CallTransferComplete.redirection.screened.number.length);
- OOTRACEDBGC4("QSIG-CT redirection number: %s for (%s, %s)\n", number,
+ OOTRACEDBGC4("QSIG-CT redirection number: %s for (%s, %s)\n", *number,
call->callType, call->callToken);
res = 1;
}
@@ -149,7 +154,51 @@
(*name=memAllocZ(call->pctxt, 1024))) {
strncpy(*name, (char *)rose.component.invoke.args.qsig.CallTransferComplete.redirection_name.data,
rose.component.invoke.args.qsig.CallTransferComplete.redirection_name.length);
- OOTRACEDBGC4("QSIG-CT redirection name: %s for (%s, %s)\n", name,
+ OOTRACEDBGC4("QSIG-CT redirection name: %s for (%s, %s)\n", *name,
+ call->callType, call->callToken);
+ res = 1;
+
+ }
+ }
+ }
+ }
+ return res;
+}
+
+int ooQsigGetCTActive(OOH323CallData *call, Q931InformationElement* QSigIE, char* *name, char* *number) {
+
+ struct fac_extension_header discard;
+ struct rose_message rose;
+ unsigned char* qtop, *qend;
+ int res = 0;
+
+
+ OOTRACEDBGC3("Try to get QSIG-CTA Info 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_CallTransferActive) {
+ if (rose.component.invoke.args.qsig.CallTransferActive.connected.screened.number.length &&
+ rose.component.invoke.args.qsig.CallTransferActive.connected.screened.number.length < 1023 &&
+ (*number=memAllocZ(call->pctxt, 1024))) {
+ strncpy(*number,
+ (char *)rose.component.invoke.args.qsig.CallTransferActive.connected.screened.number.str,
+ rose.component.invoke.args.qsig.CallTransferActive.connected.screened.number.length);
+ OOTRACEDBGC4("QSIG-CTA connected number: %s for (%s, %s)\n", *number,
+ call->callType, call->callToken);
+ res = 1;
+ }
+ if (rose.component.invoke.args.qsig.CallTransferActive.connected_name_present &&
+ rose.component.invoke.args.qsig.CallTransferActive.connected_name.length < 1023 &&
+ (*name=memAllocZ(call->pctxt, 1024))) {
+ strncpy(*name, (char *)rose.component.invoke.args.qsig.CallTransferActive.connected_name.data,
+ rose.component.invoke.args.qsig.CallTransferActive.connected_name.length);
+ OOTRACEDBGC4("QSIG-CTA connected name: %s for (%s, %s)\n", *name,
call->callType, call->callToken);
res = 1;
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=314157&r1=314156&r2=314157
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooqsig.h Mon Apr 18 16:58:06 2011
@@ -6,6 +6,7 @@
char* ooQsigGetCalledName(OOH323CallData *call, Q931InformationElement* QSigIE);
char* ooQsigGetConnectedName(OOH323CallData *call, Q931InformationElement* QSigIE);
int ooQsigGetCTComplete(OOH323CallData *call, Q931InformationElement* QSigIE, char* *name, char* *number);
+int ooQsigGetCTActive(OOH323CallData *call, Q931InformationElement* QSigIE, char* *name, char* *number);
unsigned char *ooQsigSetCallingName(OOH323CallData *call, unsigned char *iebuf, char* name);
unsigned char *ooQsigSetCalledName(OOH323CallData *call, unsigned char *iebuf, char* name);
Modified: team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose.c?view=diff&rev=314157&r1=314156&r2=314157
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/qsig/rose.c Mon Apr 18 16:58:06 2011
@@ -41,6 +41,10 @@
#include "rose_internal.h"
#include "asn1.h"
#include "pri_facility.h"
+
+extern const unsigned char *rose_decode(struct pri *ctrl, const unsigned char *pos,
+ const unsigned char *end, struct rose_message *msg);
+
#define ROSE_TAG_COMPONENT_INVOKE (ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 1)
More information about the asterisk-commits
mailing list