[Freeswitch-svn] [commit] r11751 - in freeswitch/branches/gmaruzz/mod_skypiax: . configs

FreeSWITCH SVN gmaruzz at freeswitch.org
Wed Feb 11 04:32:35 PST 2009


Author: gmaruzz
Date: Wed Feb 11 06:32:35 2009
New Revision: 11751

Log:
skypiax: outbound interface automatic selection, Seven Du patch: you can call skypiax/ANY/another_skypename, it will automatically chose first available channel.

Modified:
   freeswitch/branches/gmaruzz/mod_skypiax/configs/default.xml
   freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c

Modified: freeswitch/branches/gmaruzz/mod_skypiax/configs/default.xml
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/configs/default.xml	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/configs/default.xml	Wed Feb 11 06:32:35 2009
@@ -266,14 +266,21 @@
 
     <!-- dial via skypiax -->
     <extension name="skypiax">
-      <condition field="destination_number" expression="^2908$">
+      <condition field="destination_number" expression="^2909$">
 	<action application="bridge" data="skypiax/skypiax1/echo123"/>
       </condition>
     </extension>
-    <!-- dial via SKYPE uri -->
+
+    <!-- dial via skypiax ANY interface -->
+    <extension name="skypiax">
+      <condition field="destination_number" expression="^2908$">
+	<action application="bridge" data="skypiax/ANY/echo123"/>
+      </condition>
+    </extension>
+    <!-- dial via SKYPE uri with skypiax ANY interface-->
     <extension name="skype_uri">
       <condition field="destination_number" expression="^skype/(.*)$">
-	<action application="bridge" data="skypiax/skypiax1/$1"/>
+	<action application="bridge" data="skypiax/ANY/$1"/>
       </condition>
     </extension>
 

Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c	Wed Feb 11 06:32:35 2009
@@ -491,8 +491,30 @@
         slash = strrchr(interface_name, '/');
         *slash = '\0';
 
-        for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
+	if (strncmp("ANY", interface_name,  strlen(interface_name)) == 0) {
+		DEBUGA_SKYPE("Finding one available skype interface\n",
+				SKYPIAX_P_LOG);
+		//find an available one, allowing call like originate skypiax/ANY/another_skypename
+
+		for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+			if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+				int skype_state = 0;
+
+				tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+				skype_state = tech_pvt->interface_state;
+				DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n",
+						SKYPIAX_P_LOG,
+						i, globals.SKYPIAX_INTERFACES[i].name, skype_state);
+				if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
+					found=1;
+					break;
+				}
+			}
+		}
+	}
+
 
+        for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
           if (strlen(globals.SKYPIAX_INTERFACES[i].name)
               &&
               (strncmp



More information about the Freeswitch-svn mailing list