[asterisk-addons-commits] tilghman: branch 1.4 r599 - in /branches/1.4: ./ channels/chan_ooh323.c

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Fri May 23 17:55:47 CDT 2008


Author: tilghman
Date: Fri May 23 17:55:47 2008
New Revision: 599

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=599
Log:
Merging changes to ooh323 driver, as requested by softins
(Related to issue #12715)

Modified:
    branches/1.4/   (props changed)
    branches/1.4/channels/chan_ooh323.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
--- branch-1.2-merged (original)
+++ branch-1.2-merged Fri May 23 17:55:47 2008
@@ -1,1 +1,1 @@
-/branches/1.2:1-183,209,211,257-258,264,268-273,305-328,332-336,339-344,346-351,357,404,465
+/branches/1.2:1-183,209,211,257-258,264,268-273,305-328,332-336,339-344,346-351,357,370-378,404,465

Modified: branches/1.4/channels/chan_ooh323.c
URL: http://svn.digium.com/view/asterisk-addons/branches/1.4/channels/chan_ooh323.c?view=diff&rev=599&r1=598&r2=599
==============================================================================
--- branches/1.4/channels/chan_ooh323.c (original)
+++ branches/1.4/channels/chan_ooh323.c Fri May 23 17:55:47 2008
@@ -222,6 +222,11 @@
 static int  gOutgoingLimit = 4;
 OOBOOL gH323Debug = FALSE;
 
+static struct ooh323_config
+{
+   int  mTCPPortStart;
+   int  mTCPPortEnd;
+}ooconfig;
 
 /** Asterisk RTP stuff*/
 static struct sched_context *sched;
@@ -1670,8 +1675,12 @@
                                      v->value, 0);
          }
          else if (!strcasecmp(v->name, "allow")) {
+            const char* tcodecs = v->value;
+            if(!strcasecmp(v->value, "all")) {
+               tcodecs = "ulaw,alaw,g729,g723,gsm";
+            }
             ast_parse_allow_disallow(&user->prefs, &user->capability, 
-                                     v->value, 1);
+                                     tcodecs, 1);
          }
          else if (!strcasecmp(v->name, "amaflags")) {
             user->amaflags = ast_cdr_amaflags2int(v->value);
@@ -1791,8 +1800,12 @@
                                      v->value, 0); 
          }
          else if (!strcasecmp(v->name, "allow")) {
+            const char* tcodecs = v->value;
+            if(!strcasecmp(v->value, "all")) {
+               tcodecs = "ulaw,alaw,g729,g723,gsm";
+            }
             ast_parse_allow_disallow(&peer->prefs, &peer->capability, 
-                                     v->value, 1);             
+                                     tcodecs, 1);             
          }
          else if (!strcasecmp(v->name,  "amaflags")) {
             peer->amaflags = ast_cdr_amaflags2int(v->value);
@@ -1902,6 +1915,8 @@
    strcpy(gContext, DEFAULT_CONTEXT);
    gAliasList = NULL;
    gMediaWaitForConnect = 0;
+   ooconfig.mTCPPortStart = 12030;
+   ooconfig.mTCPPortEnd = 12230;
 
    v = ast_variable_browse(cfg, "general");
    while(v) {
@@ -1912,6 +1927,27 @@
       else if (!strcasecmp(v->name, "bindaddr")) {
          strncpy(gIP, v->value, sizeof(gIP)-1);
       } 
+      else if (!strcasecmp(v->name, "h225portrange")) {
+         char* endlimit = 0;
+         char temp[512];
+         strncpy(temp, v->value, sizeof(temp) - 1);	
+      	//char *temp = ast_strdupa(v->value);
+         endlimit = strchr(temp, ',');
+         if (endlimit) {
+            *endlimit = '\0';
+            endlimit++;
+            ooconfig.mTCPPortStart = atoi(temp);
+            ooconfig.mTCPPortEnd = atoi(endlimit);
+
+            if(ooH323EpSetTCPPortRange(ooconfig.mTCPPortStart, 
+                                       ooconfig.mTCPPortEnd) == OO_FAILED) {
+               ast_log(LOG_ERROR, "h225portrange: Failed to set range\n");
+            }
+         } 
+         else {
+            ast_log(LOG_ERROR, "h225portrange: Invalid format, seperate port range with \",\"\n");
+         }
+      }
       else if (!strcasecmp(v->name, "gateway")) {
          gIsGateway = ast_true(v->value);
       } 
@@ -2034,7 +2070,11 @@
          ast_parse_allow_disallow(&gPrefs, &gCapability, v->value, 0);
       }
       else if (!strcasecmp(v->name, "allow")) {
-         ast_parse_allow_disallow(&gPrefs, &gCapability, v->value, 1);
+         const char* tcodecs = v->value;
+         if(!strcasecmp(v->value, "all")) {
+            tcodecs = "ulaw,alaw,g729,g723,gsm";
+         }
+         ast_parse_allow_disallow(&gPrefs, &gCapability, tcodecs, 1);
       }
       else if (!strcasecmp(v->name, "dtmfmode")) {
          if (!strcasecmp(v->value, "inband"))
@@ -2165,7 +2205,7 @@
       ast_cli(fd, "%-15.15s%s\n", "AccountCode: ", peer->accountcode);
       ast_cli(fd, "%-15.15s%s\n", "AMA flags: ", 
                                             ast_cdr_flags2str(peer->amaflags));
-      ast_cli(fd, "%-15.15s%s\n", "Ip:Port: ", ip_port);
+      ast_cli(fd, "%-15.15s%s\n", "IP:Port: ", ip_port);
       ast_cli(fd, "%-15.15s%d\n", "OutgoingLimit: ", peer->outgoinglimit);
       ast_cli(fd, "%-15.15s%d\n", "rtptimeout: ", peer->rtptimeout);
       ast_mutex_unlock(&peer->lock);
@@ -2350,6 +2390,8 @@
    ast_cli(fd, "\nObjective Open H.323 Channel Driver's Config:\n");
    sprintf(value, "%s:%d", gIP, gPort);
    ast_cli(fd, "%-20s%s\n", "IP:Port: ", value);
+   ast_cli(fd, "%-20s%d-%d\n", "H.225 port range: ", 
+      ooconfig.mTCPPortStart, ooconfig.mTCPPortEnd);
    ast_cli(fd, "%-20s%s\n", "FastStart", gFastStart?"yes":"no");
    ast_cli(fd, "%-20s%s\n", "Tunneling", gTunneling?"yes":"no");
    ast_cli(fd, "%-20s%s\n", "CallerId", gCallerID);
@@ -2768,28 +2810,46 @@
       else
          iflist = cur->next;
 
-      if(cur->callToken)
+      if(cur->callToken) {
          free(cur->callToken);
-
-      if(cur->username)
+         cur->callToken = 0;
+      }
+
+      if(cur->username) {
          free(cur->username);
-
-      if(cur->host)
+         cur->username = 0;
+      }
+
+      if(cur->host) {
          free(cur->host);
-
-      if(cur->callerid_name)
+         cur->host = 0;
+      }
+
+      if(cur->callerid_name) {
          free(cur->callerid_name);
+         cur->callerid_name = 0;
+      }
       
-      if(cur->callerid_num)
+      if(cur->callerid_num) {
          free(cur->callerid_num);
-
-
-      if (cur->rtp)
+         cur->callerid_num = 0;
+      }
+
+
+      if (cur->rtp) {
          ast_rtp_destroy(cur->rtp);
+         cur->rtp = 0;
+      }
 	
       /* Unlink us from the owner if we have one */
       if (cur->owner) {
-         ast_mutex_lock(&cur->owner->lock);
+         while(ast_mutex_trylock(&cur->owner->lock))
+         {
+            ast_log(LOG_DEBUG,"Failed to grab lock, trying again\n");
+            ast_mutex_unlock(&cur->lock);
+            usleep(1);
+            ast_mutex_lock(&cur->lock);
+         }           
          ast_log(LOG_DEBUG, "Detaching from %s\n", cur->owner->name);
          cur->owner->tech_pvt = NULL;
          ast_mutex_unlock(&cur->owner->lock);




More information about the asterisk-addons-commits mailing list