[asterisk-commits] may: branch may/ooh323_qsig r319023 - in /team/may/ooh323_qsig/addons: ./ ooh...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun May 15 14:49:47 CDT 2011


Author: may
Date: Sun May 15 14:49:42 2011
New Revision: 319023

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=319023
Log:
process q.931 notify msg (call hold/unhold for now)
few changed process of avaya information message
reminder to implement TON/NPI configurable
(may be get from dp vars?)

Modified:
    team/may/ooh323_qsig/addons/chan_ooh323.c
    team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.h
    team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.c
    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

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=319023&r1=319022&r2=319023
==============================================================================
--- team/may/ooh323_qsig/addons/chan_ooh323.c (original)
+++ team/may/ooh323_qsig/addons/chan_ooh323.c Sun May 15 14:49:42 2011
@@ -287,6 +287,7 @@
 int onCallCleared(ooCallData *call);
 void onModeChanged(ooCallData *call, int t38mode);
 int onQSigData(ooCallData *call, int transfer, char *name, char *number);
+int onNotify(ooCallData *call, int hold);
 
 static char gLogFile[256] = DEFAULT_LOGFILE;
 static int  gPort = 1720;
@@ -1618,6 +1619,62 @@
 
 	if (gH323Debug)
 		ast_verbose("+++ onProgress %s\n", call->callToken);
+
+	return OO_OK;
+}
+
+int onNotify(ooCallData *call, int hold)
+{
+	struct ooh323_pvt *p = NULL;
+	struct ast_channel *c = NULL;
+
+	if (gH323Debug)
+		ast_verbose("--- onNotify %s, %d\n", call->callToken, hold);
+
+   	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 (call->remoteDisplayName) {
+		struct ast_party_connected_line connected;
+		struct ast_set_party_connected_line update_connected;
+
+		memset(&update_connected, 0, sizeof(update_connected));
+		update_connected.id.name = 1;
+		ast_party_connected_line_init(&connected);
+		connected.id.name.valid = 1;
+		connected.id.name.str = (char *) call->remoteDisplayName;
+		connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+		ast_channel_queue_connected_line_update(c, &connected, &update_connected);
+	}
+	if (c->_state != AST_STATE_UP)
+		ast_setstate(c, AST_STATE_RINGING);
+
+	ast_queue_control(c, (hold) ? AST_CONTROL_HOLD : AST_CONTROL_UNHOLD);
+      	ast_channel_unlock(c);
+      	ast_mutex_unlock(&p->lock);
+
+	if (gH323Debug)
+		ast_verbose("+++ onNotify %s\n", call->callToken);
 
 	return OO_OK;
 }
@@ -3366,7 +3423,8 @@
 		.openLogicalChannels = NULL,
 		.onReceivedDTMF = ooh323_onReceivedDigit,
 		.onModeChanged = onModeChanged,
-		.onQSigData = onQSigData
+		.onQSigData = onQSigData,
+		.onNotify = onNotify
 	};
 	if (!(gCap = ast_format_cap_alloc())) {
 		return 1; 

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=319023&r1=319022&r2=319023
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooCalls.h Sun May 15 14:49:42 2011
@@ -338,6 +338,9 @@
 typedef int (*cb_OnQSigData)
    (struct OOH323CallData *call, int transfer, char *name, char *number);
 
+typedef int (*cb_OnNotify)
+   (struct OOH323CallData *call, int hold);
+
 /**
  * This structure holds all of the H.323 signaling callback function 
  * addresses.
@@ -356,6 +359,7 @@
    cb_OnReceivedDTMF onReceivedDTMF;
    cb_OnModeChanged onModeChanged;
    cb_OnQSigData onQSigData;
+   cb_OnNotify onNotify;
 } OOH323CALLBACKS;
 
 /**

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=319023&r1=319022&r2=319023
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooStackCmds.c Sun May 15 14:49:42 2011
@@ -511,6 +511,10 @@
       return OO_STKCMD_INVALIDPARAM;
    }
 
+   if (strlen(ani) == 0 && strlen(anm) == 0) {
+      return OO_STKCMD_INVALIDPARAM;
+   }
+
    if(call->CmdChan == 0)
    {
       if(ooCreateCallCmdConnection(call) != OO_OK)

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=319023&r1=319022&r2=319023
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooh323.c Sun May 15 14:49:42 2011
@@ -50,9 +50,9 @@
    /* check for display ie */
    pDisplayIE = ooQ931GetIE(q931Msg, Q931DisplayIE, 1);
    if(pDisplayIE) {
-      char strname[20 + 1], strnumber[14 + 1];
+      char strname[60 + 1], strnumber[14 + 1];
       int number = 0;
-      char *dbuf = NULL;
+      char *dbuf = NULL, *spaces = NULL;
       
       if (q931Msg->messageType == Q931InformationMsg && 
           (dbuf = memAllocZ(call->pctxt, pDisplayIE->length*sizeof(ASN1OCTET)+1)) ) {
@@ -65,8 +65,15 @@
 	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);
+	strncpy(strname, dbuf, sizeof(strname));
+	if ((spaces = strstr(strname, "  "))) {
+          sscanf(&spaces[2], "%d",&number);
+          if (number > 0) {
+            spaces[0] = 0;
+          } else {
+            sscanf(&strname[20], "%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);

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=319023&r1=319022&r2=319023
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooh323ep.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooh323ep.c Sun May 15 14:49:42 2011
@@ -347,6 +347,7 @@
    gH323ep.h323Callbacks.onReceivedDTMF = h323Callbacks.onReceivedDTMF;
    gH323ep.h323Callbacks.onModeChanged = h323Callbacks.onModeChanged;
    gH323ep.h323Callbacks.onQSigData = h323Callbacks.onQSigData;
+   gH323ep.h323Callbacks.onNotify = h323Callbacks.onNotify;
    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=319023&r1=319022&r2=319023
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooq931.c Sun May 15 14:49:42 2011
@@ -2589,8 +2589,9 @@
 
    /* Set calling party number  Q931 IE */
    if(call->callingPartyNumber && call->callingPartyNumber[0])
+/* Fix me!! Do configurable ton/npi ! */
      ooQ931SetCallingPartyNumberIE(pctxt, q931msg,
-			    (const char*)call->callingPartyNumber, 1, 2, 0, 0);
+			    (const char*)call->callingPartyNumber, 1, 0, 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=319023&r1=319022&r2=319023
==============================================================================
--- team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h (original)
+++ team/may/ooh323_qsig/addons/ooh323c/src/ooq931.h Sun May 15 14:49:42 2011
@@ -90,6 +90,7 @@
    Q931FacilityIE           = 0x1c,
    Q931ProgressIndicatorIE  = 0x1e,
    Q931CallStateIE          = 0x14,
+   Q931NotifyIE		    = 0x27,
    Q931DisplayIE            = 0x28,
    Q931SignalIE             = 0x34,
    Q931CallingPartyNumberIE = 0x6c,
@@ -215,6 +216,12 @@
   Q931UserInfoLayer1X31
 };
 
+
+enum Q931Notifies {
+  Q931NotifyRemoteHold = 0x79,
+  Q931NotifyRemoteRetreival = 0x7a
+};
+
 /*
   Structure to build store outgoing encoded UUIE
   The different fields in the structure have octet lengths 




More information about the asterisk-commits mailing list