[Freeswitch-trunk] [commit] r14016 - in freeswitch/trunk/contrib/mod/endpoints/mod_khomp: . src

FreeSWITCH SVN raulfragoso at freeswitch.org
Sat Jun 27 19:55:30 PDT 2009


Author: raulfragoso
Date: Sat Jun 27 21:55:30 2009
New Revision: 14016

Log:
Fixed the find_channel function;

Modified:
   freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp
   freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp

Modified: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp
==============================================================================
--- freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp	(original)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp	Sat Jun 27 21:55:30 2009
@@ -396,7 +396,16 @@
 
         if (outbound_profile) 
         {
-            tech_pvt = KhompPvt::find_channel(outbound_profile->destination_number, *new_session, &cause);
+            snprintf(name, sizeof(name), "%s", outbound_profile->destination_number);
+            
+            if ((argc = switch_separate_string(outbound_profile->destination_number, '/', argv, (sizeof(argv) / sizeof(argv[0])))) < 3)
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string. Should be on the format:[Khomp/BoardID (or A for first free board)/CHANNEL (or A for first free channel)]\n");
+                switch_core_session_destroy(new_session);
+                return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+            }
+
+            tech_pvt = KhompPvt::find_channel(name, *new_session, &cause);
 
             if(tech_pvt == NULL || cause != SWITCH_CAUSE_SUCCESS)
             {

Modified: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp
==============================================================================
--- freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp	(original)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp	Sat Jun 27 21:55:30 2009
@@ -62,8 +62,10 @@
 
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel selection: board (%d-%d), channel (%d-%d)!\n", board_low, board_high, channel_low, channel_high);
     
-    for (int board = board_low ; board < board_high; board++)
+    for (int board = board_low ; board <= board_high; board++)
     {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking board %d\n", board);
+        
         if(pvt != NULL)
             break;
         
@@ -82,7 +84,7 @@
             }
         }
         
-        for (int channel = channel_low ; channel < channel_high ; channel++) 
+        for (int channel = channel_low ; channel <= channel_high ; channel++) 
         {
             switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking if (%d-%d) is free\n", board, channel);
             try 



More information about the Freeswitch-trunk mailing list