[asterisk-commits] may: trunk r255199 - in /trunk/addons: ./ ooh323c/src/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Mar 27 18:51:18 CDT 2010


Author: may
Date: Sat Mar 27 18:51:13 2010
New Revision: 255199

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=255199
Log:
corrections in gk interface, small fixes in call clearing.


Modified:
    trunk/addons/chan_ooh323.c
    trunk/addons/ooh323c/src/ooCalls.c
    trunk/addons/ooh323c/src/ooGkClient.c
    trunk/addons/ooh323c/src/ooh323.c
    trunk/addons/ooh323c/src/ooh323.h
    trunk/addons/ooh323c/src/ooq931.c

Modified: trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_ooh323.c?view=diff&rev=255199&r1=255198&r2=255199
==============================================================================
--- trunk/addons/chan_ooh323.c (original)
+++ trunk/addons/chan_ooh323.c Sat Mar 27 18:51:13 2010
@@ -609,6 +609,10 @@
 	if (dest) {
 		peer = find_peer(dest, port);
 	} else{
+		ast_mutex_lock(&iflock);
+		ast_mutex_unlock(&p->lock);
+		ooh323_destroy(p);
+		ast_mutex_unlock(&iflock);
 		ast_log(LOG_ERROR, "Destination format is not supported\n");
 		return NULL;
 	}
@@ -642,6 +646,15 @@
 		ast_copy_string(p->accountcode, peer->accountcode, sizeof(p->accountcode));
 		p->amaflags = peer->amaflags;
 	} else {
+		if (gRasGkMode ==  RasNoGatekeeper) {
+			/* no gk and no peer */
+			ast_log(LOG_ERROR, "Call to undefined peer %s", dest);
+			ast_mutex_lock(&iflock);
+			ast_mutex_unlock(&p->lock);
+			ooh323_destroy(p);
+			ast_mutex_unlock(&iflock);
+			return NULL;
+		}
 		p->dtmfmode = gDTMFMode;
 		p->dtmfcodec = gDTMFCodec;
 		p->t38support = gT38Support;
@@ -672,23 +685,22 @@
 		ast_mutex_lock(&iflock);
 		ooh323_destroy(p);
 		ast_mutex_unlock(&iflock);
-   } else {
-      ast_mutex_lock(&p->lock);
-      p->callToken = (char*)ast_malloc(AST_MAX_EXTENSION);
-      if(!p->callToken)
-      {
-       ast_mutex_unlock(&p->lock);
-       ast_mutex_lock(&iflock);
-       ooh323_destroy(p);
-       ast_mutex_unlock(&iflock);
-       ast_log(LOG_ERROR, "Failed to allocate memory for callToken\n");
-       return NULL;
-      }
-
-      ast_mutex_unlock(&p->lock);
-      ast_mutex_lock(&ooh323c_cmd_lock);
-      ooMakeCall(data, p->callToken, AST_MAX_EXTENSION, NULL);
-      ast_mutex_unlock(&ooh323c_cmd_lock);
+   	} else {
+      		ast_mutex_lock(&p->lock);
+      		p->callToken = (char*)ast_malloc(AST_MAX_EXTENSION);
+      		if(!p->callToken) {
+       			ast_mutex_unlock(&p->lock);
+       			ast_mutex_lock(&iflock);
+       			ooh323_destroy(p);
+       			ast_mutex_unlock(&iflock);
+       			ast_log(LOG_ERROR, "Failed to allocate memory for callToken\n");
+       			return NULL;
+      		}
+
+      		ast_mutex_unlock(&p->lock);
+      		ast_mutex_lock(&ooh323c_cmd_lock);
+      		ooMakeCall(data, p->callToken, AST_MAX_EXTENSION, NULL);
+      		ast_mutex_unlock(&ooh323c_cmd_lock);
 	}
 
 	restart_monitor();
@@ -955,17 +967,17 @@
 	else
 		ast_copy_string(destination, dest, sizeof(destination));
 
-   destination[sizeof(destination)-1]='\0';
-
-   opts.transfercap = ast->transfercapability;
-
-   for (i=0;i<480 && !isRunning(p->callToken);i++) usleep(12000);
-
-   if(OO_TESTFLAG(p->flags, H323_DISABLEGK)) {
-      res = ooRunCall(destination, p->callToken, AST_MAX_EXTENSION, &opts);
-   } else {
-      res = ooRunCall(destination, p->callToken, AST_MAX_EXTENSION, NULL);
-   }
+	destination[sizeof(destination)-1]='\0';
+
+	opts.transfercap = ast->transfercapability;
+
+	for (i=0;i<480 && !isRunning(p->callToken);i++) usleep(12000);
+
+	if(OO_TESTFLAG(p->flags, H323_DISABLEGK)) {
+		res = ooRunCall(destination, p->callToken, AST_MAX_EXTENSION, &opts);
+	} else {
+		res = ooRunCall(destination, p->callToken, AST_MAX_EXTENSION, NULL);
+ 	}
 
 	ast_mutex_unlock(&p->lock);
 	if (res != OO_OK) {

Modified: trunk/addons/ooh323c/src/ooCalls.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooCalls.c?view=diff&rev=255199&r1=255198&r2=255199
==============================================================================
--- trunk/addons/ooh323c/src/ooCalls.c (original)
+++ trunk/addons/ooh323c/src/ooCalls.c Sat Mar 27 18:51:13 2010
@@ -217,6 +217,11 @@
 
    if (call->callIdentifier.guid.numocts == 0) call->callState = OO_CALL_CLEARED;
 
+   if(!call->pH225Channel || call->pH225Channel->sock ==0)
+   {
+      call->callState = OO_CALL_CLEARED;
+   }
+
    if(call->callState == OO_CALL_CLEARED || call->callState == OO_CALL_CLEAR_RELEASESENT)
    {
       ooCleanCall(call); 
@@ -242,20 +247,14 @@
    }
 
 
-   if(!call->pH225Channel || call->pH225Channel->sock ==0)
-   {
-      call->callState = OO_CALL_CLEARED;
-   }
-   else{
-      if(!OO_TESTFLAG(call->flags, OO_M_RELEASE_BUILT))   
-      {
-         if(call->callState == OO_CALL_CLEAR || 
-            call->callState == OO_CALL_CLEAR_RELEASERECVD)
-         {
-            ooSendReleaseComplete(call);
-            OO_SETFLAG(call->flags, OO_M_RELEASE_BUILT);
-         }
-      }
+   if(!OO_TESTFLAG(call->flags, OO_M_RELEASE_BUILT))   
+   {
+     if(call->callState == OO_CALL_CLEAR || 
+        call->callState == OO_CALL_CLEAR_RELEASERECVD)
+     {
+        ooSendReleaseComplete(call);
+        OO_SETFLAG(call->flags, OO_M_RELEASE_BUILT);
+     }
    }
       
    return OO_OK;

Modified: trunk/addons/ooh323c/src/ooGkClient.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooGkClient.c?view=diff&rev=255199&r1=255198&r2=255199
==============================================================================
--- trunk/addons/ooh323c/src/ooGkClient.c (original)
+++ trunk/addons/ooh323c/src/ooGkClient.c Sat Mar 27 18:51:13 2010
@@ -686,7 +686,7 @@
 
    pGkReq->m.endpointAliasPresent=TRUE;
    if(OO_OK != ooPopulateAliasList(&pGkClient->msgCtxt, gH323ep.aliases, 
-                                      &pGkReq->endpointAlias))
+                                      &pGkReq->endpointAlias, 0))
    {
       OOTRACEERR1("Error Failed to fill alias information for GRQ message\n");
       memReset(&pGkClient->msgCtxt);
@@ -1010,7 +1010,7 @@
 
    pRegReq->m.terminalAliasPresent=TRUE;
    if(OO_OK != ooPopulateAliasList(pctxt, gH323ep.aliases, 
-                                     &pRegReq->terminalAlias)) {
+                                     &pRegReq->terminalAlias, 0)) {
      OOTRACEERR1("Error filling alias for RRQ\n");
      memReset(pctxt); 
      pGkClient->state = GkClientFailed;
@@ -1457,7 +1457,7 @@
    if(aliases)
    {
       pUnregReq->m.endpointAliasPresent = TRUE;
-      ooPopulateAliasList(pctxt, aliases, &pUnregReq->endpointAlias);
+      ooPopulateAliasList(pctxt, aliases, &pUnregReq->endpointAlias, 0);
    }
 
   
@@ -1716,7 +1716,7 @@
    {
       pAdmReq->m.destinationInfoPresent = 1;
       if(OO_OK != ooPopulateAliasList(&pGkClient->msgCtxt, destAliases,
-                                      &pAdmReq->destinationInfo))
+                      &pAdmReq->destinationInfo, T_H225AliasAddress_dialedDigits))
       {
          OOTRACEERR1("Error:Failed to populate destination aliases - "
                     "ARQ message\n");
@@ -1731,7 +1731,7 @@
    if(srcAliases)
    {
       iRet = ooPopulateAliasList(&pGkClient->msgCtxt, srcAliases,
-                                                          &pAdmReq->srcInfo);
+                              &pAdmReq->srcInfo, 0);
       if(OO_OK != iRet)
       {
          OOTRACEERR1("Error:Failed to populate source aliases -ARQ message\n");
@@ -2027,7 +2027,7 @@
                 "(%s, %s)\n", pAdmissionReject->rejectReason.t, call->callType,
                  call->callToken);
    
-   call->callState = OO_CALL_CLEAR;
+   call->callState = OO_CALL_CLEARED;
 
    switch(pAdmissionReject->rejectReason.t)
    {
@@ -2204,10 +2204,10 @@
    if(srcAliases)
    {
       iRet = ooPopulateAliasList(&pGkClient->msgCtxt, srcAliases,
-                                                          &pIRR->endpointAlias);
+                             &pIRR->endpointAlias, T_H225AliasAddress_h323_ID);
       if(OO_OK != iRet)
       {
-         OOTRACEERR1("Error:Failed to populate source aliases -ARQ message\n");
+         OOTRACEERR1("Error:Failed to populate source aliases -IRR message\n");
          memReset(pctxt);
          pGkClient->state = GkClientFailed;
 	 ast_mutex_unlock(&pGkClient->Lock);

Modified: trunk/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooh323.c?view=diff&rev=255199&r1=255198&r2=255199
==============================================================================
--- trunk/addons/ooh323c/src/ooh323.c (original)
+++ trunk/addons/ooh323c/src/ooh323.c Sat Mar 27 18:51:13 2010
@@ -2219,7 +2219,7 @@
    return OO_OK;
 }
 int ooPopulateAliasList(OOCTXT *pctxt, OOAliases *pAliases,
-                           H225_SeqOfH225AliasAddress *pAliasList )
+                           H225_SeqOfH225AliasAddress *pAliasList, int pAliasType)
 {
    H225AliasAddress *pAliasEntry=NULL;
    OOAliases * pAlias=NULL;
@@ -2243,23 +2243,27 @@
             OOTRACEERR1("ERROR:Memory - ooPopulateAliasList - pAliasEntry\n");
             return OO_FAILED;
          }
+
+	 if (pAliasType && pAlias->type != pAliasType) {
+		pAlias = pAlias->next;
+		continue;
+	 }
          switch(pAlias->type)
          {
-	 /* Don't populate DialedDigits as alias they populate as prefixes
             case T_H225AliasAddress_dialedDigits:
-            pAliasEntry->t = T_H225AliasAddress_dialedDigits;
-            pAliasEntry->u.dialedDigits = (ASN1IA5String)memAlloc(pctxt,
+             pAliasEntry->t = T_H225AliasAddress_dialedDigits;
+             pAliasEntry->u.dialedDigits = (ASN1IA5String)memAlloc(pctxt,
                                                      strlen(pAlias->value)+1);
-            if(!pAliasEntry->u.dialedDigits)
-            {
+             if(!pAliasEntry->u.dialedDigits)
+             {
                OOTRACEERR1("ERROR:Memory - ooPopulateAliasList - "
                            "dialedDigits\n");
                memFreePtr(pctxt, pAliasEntry);
                return OO_FAILED;
-            }
-            strcpy(*(char**)&pAliasEntry->u.dialedDigits, pAlias->value);
-            bValid = TRUE;
-            break; */
+             }
+             strcpy(*(char**)&pAliasEntry->u.dialedDigits, pAlias->value);
+             bValid = TRUE;
+            break;
          case T_H225AliasAddress_h323_ID:
             pAliasEntry->t = T_H225AliasAddress_h323_ID;
             pAliasEntry->u.h323_ID.nchars = strlen(pAlias->value);

Modified: trunk/addons/ooh323c/src/ooh323.h
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooh323.h?view=diff&rev=255199&r1=255198&r2=255199
==============================================================================
--- trunk/addons/ooh323c/src/ooh323.h (original)
+++ trunk/addons/ooh323c/src/ooh323.h Sat Mar 27 18:51:13 2010
@@ -136,7 +136,7 @@
  * @return           OO_OK, on success. OO_FAILED, otherwise. 
  */
 EXTERN int ooPopulateAliasList(OOCTXT *pctxt, OOAliases *pAliases,
-                               H225_SeqOfH225AliasAddress *pAliasList); 
+                               H225_SeqOfH225AliasAddress *pAliasList, int pAliasType); 
 
 /**
  * This function is used to search a particular alias in the alias list. The

Modified: trunk/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooq931.c?view=diff&rev=255199&r1=255198&r2=255199
==============================================================================
--- trunk/addons/ooh323c/src/ooq931.c (original)
+++ trunk/addons/ooh323c/src/ooq931.c Sat Mar 27 18:51:13 2010
@@ -1383,10 +1383,10 @@
    alerting->m.alertingAddressPresent = TRUE;
    if(call->ourAliases)
       ret = ooPopulateAliasList(pctxt, call->ourAliases, 
-                                       &alerting->alertingAddress);
+                                       &alerting->alertingAddress, 0);
    else
       ret = ooPopulateAliasList(pctxt, gH323ep.aliases,
-                                       &alerting->alertingAddress);
+                                       &alerting->alertingAddress, 0);
    if(OO_OK != ret)
    {
       OOTRACEERR1("Error:Failed to populate alias list in Alert message\n");
@@ -1889,10 +1889,10 @@
    connect->m.connectedAddressPresent = TRUE;
    if(call->ourAliases)
       ret = ooPopulateAliasList(pctxt, call->ourAliases, 
-                                      &connect->connectedAddress);
+                                      &connect->connectedAddress, 0);
    else
       ret =  ooPopulateAliasList(pctxt, gH323ep.aliases, 
-                                        &connect->connectedAddress);
+                                        &connect->connectedAddress, 0);
    if(OO_OK != ret)
    {
       OOTRACEERR1("Error:Failed to populate alias list in Connect message\n");
@@ -2114,7 +2114,7 @@
 {
    OOCTXT *pctxt;
    OOH323CallData *call;
-   int ret=0, i=0, irand=0;
+   int ret=OO_OK, i=0, irand=0;
    char tmp[30]="\0";
    char *ip=NULL, *port = NULL;
    struct timeval tv;
@@ -2211,14 +2211,15 @@
 
    /* Send as H225 message to calling endpoint */
    ast_mutex_lock(&call->Lock);
-   if (call->callState < OO_CALL_CLEAR) 
+   if (call->callState < OO_CALL_CLEAR) {
     if ((ret = ooH323CallAdmitted (call)) != OO_OK) {
      ast_mutex_unlock(&call->Lock);
      return ret;
     }
+   } else ret = OO_FAILED;
    ast_mutex_unlock(&call->Lock);
 
-   return OO_OK;
+   return ret;
 }
 
 
@@ -2376,10 +2377,10 @@
       setup->m.sourceAddressPresent = TRUE;
       if(call->ourAliases)
          ret = ooPopulateAliasList(pctxt, call->ourAliases, 
-                                                       &setup->sourceAddress);
+                                                       &setup->sourceAddress, 0);
       else if(gH323ep.aliases)
          ret =  ooPopulateAliasList(pctxt, gH323ep.aliases, 
-                                                       &setup->sourceAddress);
+                                                       &setup->sourceAddress, 0);
       if(OO_OK != ret)
       {
          OOTRACEERR1("Error:Failed to populate alias list in SETUP message\n");
@@ -2404,7 +2405,7 @@
    {
       setup->m.destinationAddressPresent = TRUE;
       ret = ooPopulateAliasList(pctxt, call->remoteAliases, 
-                                                 &setup->destinationAddress);
+                                                 &setup->destinationAddress, 0);
       if(OO_OK != ret)
       {
          OOTRACEERR1("Error:Failed to populate destination alias list in SETUP"
@@ -2953,7 +2954,7 @@
    {    
       facility->m.alternativeAliasAddressPresent = TRUE;
       ret = ooPopulateAliasList(pctxt, call->pCallFwdData->aliases, 
-                                        &facility->alternativeAliasAddress);
+                                        &facility->alternativeAliasAddress, 0);
       if(ret != OO_OK)
       {
          OOTRACEERR3("Error:Failed to populate alternate aliases in "




More information about the asterisk-commits mailing list