Project "FreeSWITCH Source" received a push.

branch: master updated

       via: 05a8a9455695ae8e6b63fe78bead1a92bee9183b (commit)
       via: 4b941542a309a8c7f7ad5d01cfef9d1c487376a8 (commit)
       via: b889b44f1d632810662359f6becce869056a076c (commit)
       via: 22c05ad542e3a36dd7dbb71bef5aca5ff009b1b9 (commit)
       via: 008e527c0f5c86e20521c4ebacf69adcb269b08a (commit)
       via: 425df0c78389d30561a7f025a1a3e3b2fbc5e413 (commit)
       via: a01814794c1fb49b77a6015edc8e1ad6c925bae3 (commit)
       via: 9ffca057f109725986b741cb6019dce620c056b7 (commit)
       via: 6f58e6aa425283137effa286d7f8638aa035aff4 (commit)
       via: 0e0431ecc66d04236cf4940b65977bad424fdc86 (commit)
       via: 7c624767116b30dc9074c1cfbbe7c3a5771950f9 (commit)
       via: 83d5cd6ff6f2f6e23c09ee387098a59d7764a84f (commit)
       via: 4b731fd64c1bf16a0da20f1c10de8d382faed3a4 (commit)
       via: 636c1ecb4e9cace5967390a8a8125fa783f6d0b9 (commit)
       via: 02d1af647bac6b937de02608d53ea1831f51b968 (commit)
       via: 28465f38a08df99a76864bbf6a9ae5e4e7bcd720 (commit)
       via: d164a79764c49dd11bbffcd26d6ca98770181c67 (commit)
       via: e78f2bfb5d5f17d0646f0bc2a9fad03546eac646 (commit)
       via: 9509befbfa43810dcde11532663561838d267f2c (commit)
       via: 0d098a5110e095bb9334196978289e081d5a022b (commit)
       via: 80a6279993f2369e79e70bc9b61bfcaf2f3e5f4c (commit)
       via: 7ce63feadf86bf4321aa184311996d010aab59f8 (commit)
       via: 6477d3f87e32cc623638073fc1983ebfc4fa54cd (commit)
       via: 24bcd10582193ef6dac5a124ad03323066e355f8 (commit)
       via: 4eb5bbf41c3fcb6bfd33704a18bd2e7e52acd437 (commit)
       via: 976859bb45f08382424c9c4b0dbf6acb3fba64fb (commit)
      from: d6cfc2f1e9cfd6462ae4b65753cafee45bfd5a5c (commit)


= COMMIT LOG ===========================================================
committer: Michael S Collins
comments: 
Merge branch 'master' of git://git.freeswitch.org/freeswitch
committer: Anthony Minessale
comments: 
fix out of place parens in logic test

diff --git a/src/switch_channel.c b/src/switch_channel.c
index 918ad82..de472a9 100644
--- a/src/switch_channel.c
+++ b/src/switch_channel.c
@@ -2564,8 +2564,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi
 	char *app;
 	switch_event_t *event;
 
-	if (!switch_channel_test_flag(channel, CF_RING_READY) && !switch_channel_test_flag(channel, CF_EARLY_MEDIA &&
-																					   !switch_channel_test_flag(channel, CF_ANSWERED))) {
+	if (!switch_channel_test_flag(channel, CF_RING_READY) && 
+		!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
 		switch_channel_set_flag_value(channel, CF_RING_READY, rv);
 		if (channel->caller_profile && channel->caller_profile->times) {
committer: Anthony Minessale
comments: 
add channel data to speech events when chosen to fire

diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c
index 4354f0d..0a646b6 100644
--- a/src/switch_ivr_async.c
+++ b/src/switch_ivr_async.c
@@ -3129,6 +3129,7 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj
 					switch_event_t *dup;
 
 					if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) {
+						switch_channel_event_set_data(channel, dup);
 						switch_event_fire(&dup);
 					}
 
committer: Brian West
comments: 
fixes from tony

diff --git a/scripts/perl/dhcp-inform.pl b/scripts/perl/dhcp-inform.pl
index 3f977ca..2ca4bb8 100644
--- a/scripts/perl/dhcp-inform.pl
+++ b/scripts/perl/dhcp-inform.pl
@@ -61,12 +61,7 @@ while ($sock->recv($newmsg, 1024)) {
     }
     print "Sending option 66 as $opt_u\n";
 
-    $handle = IO::Socket::INET->new(Proto => 'udp',
-				    PeerPort => '68',
-				    LocalPort => '67',
-				    ReuseAddr => 1,
-				    PeerAddr => $dhcpreq->ciaddr(),
-				   ) or die "socket: $@";
-    $handle->send($dhcpresp->serialize())
+
+    $sock->send($dhcpresp->serialize())
   }
 }
committer: Anthony Minessale
comments: 
FS-3012

diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c
index 643b3dd..47f94b1 100644
--- a/src/mod/endpoints/mod_sofia/sofia.c
+++ b/src/mod/endpoints/mod_sofia/sofia.c
@@ -808,6 +808,18 @@ void sofia_event_callback(nua_event_t event,
 		}
 	}
 	
+	if ((event == nua_i_invite) && (!session)) {
+		uint32_t sess_count = switch_core_session_count();
+		uint32_t sess_max = switch_core_session_limit(0);
+		
+		if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready()) {
+			nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No more sessions allowed at this time.\n");
+
+			goto done;
+		}
+	}
 	
 	if (sofia_test_pflag(profile, PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
 		sip_authorization_t const *authorization = NULL;
committer: Leon de Rooij
comments: 
Added test_reactive to mod_lua freeswitch.Dbh

diff --git a/src/mod/languages/mod_lua/freeswitch.i b/src/mod/languages/mod_lua/freeswitch.i
index 9ccaf8e..25faa5a 100644
--- a/src/mod/languages/mod_lua/freeswitch.i
+++ b/src/mod/languages/mod_lua/freeswitch.i
@@ -89,6 +89,7 @@ class Dbh {
     ~Dbh();
     bool release();
     bool connected();
+    bool test_reactive(char *test_sql, char *drop_sql = NULL, char *reactive_sql = NULL);
     bool query(char *sql, SWIGLUA_FN lua_fun);
     int affected_rows();
 };
diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp
index 01f708d..b388f2e 100644
--- a/src/mod/languages/mod_lua/freeswitch_lua.cpp
+++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp
@@ -350,6 +350,16 @@ bool Dbh::connected()
   return m_connected;
 }
 
+bool Dbh::test_reactive(char *test_sql, char *drop_sql, char *reactive_sql)
+{
+  if (m_connected) {
+    if (switch_cache_db_test_reactive(dbh, test_sql, drop_sql, reactive_sql) == SWITCH_TRUE) {
+      return true;
+    }
+  }
+  return false;
+}
+
 int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv)
 {
   SWIGLUA_FN *lua_fun = (SWIGLUA_FN *)pArg;
diff --git a/src/mod/languages/mod_lua/freeswitch_lua.h b/src/mod/languages/mod_lua/freeswitch_lua.h
index 5f79662..6411d69 100644
--- a/src/mod/languages/mod_lua/freeswitch_lua.h
+++ b/src/mod/languages/mod_lua/freeswitch_lua.h
@@ -62,6 +62,7 @@ namespace LUA {
       ~Dbh();
       bool release();
       bool connected();
+      bool test_reactive(char *test_sql, char *drop_sql = NULL, char *reactive_sql = NULL);
       bool query(char *sql, SWIGLUA_FN lua_fun);
       int affected_rows();
   };
diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp
index f10ed63..1d84a39 100644
--- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp
+++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp
@@ -7254,6 +7254,184 @@ fail:
 }
 
 
+static int _wrap_Dbh_test_reactive__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Dbh *arg1 = (LUA::Dbh *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("test_reactive",4,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("test_reactive",3,"char *");
+  if(!lua_isstring(L,4)) SWIG_fail_arg("test_reactive",4,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){
+    SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (char *)lua_tostring(L, 4);
+  result = (bool)(arg1)->test_reactive(arg2,arg3,arg4);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_Dbh_test_reactive__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Dbh *arg1 = (LUA::Dbh *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("test_reactive",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("test_reactive",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){
+    SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  result = (bool)(arg1)->test_reactive(arg2,arg3);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_Dbh_test_reactive__SWIG_2(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Dbh *arg1 = (LUA::Dbh *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("test_reactive",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){
+    SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (bool)(arg1)->test_reactive(arg2);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_Dbh_test_reactive(lua_State* L) {
+  int argc;
+  int argv[5]={
+    1,2,3,4,5
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_Dbh_test_reactive__SWIG_2(L);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_Dbh_test_reactive__SWIG_1(L);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          {
+            _v = lua_isstring(L,argv[3]);
+          }
+          if (_v) {
+            return _wrap_Dbh_test_reactive__SWIG_0(L);
+          }
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'Dbh_test_reactive'");
+  lua_error(L);return 0;
+}
+
+
 static int _wrap_Dbh_query(lua_State* L) {
   int SWIG_arg = -1;
   LUA::Dbh *arg1 = (LUA::Dbh *) 0 ;
@@ -7328,6 +7506,7 @@ delete arg1;
 static swig_lua_method swig_LUA_Dbh_methods[] = {
     {"release", _wrap_Dbh_release}, 
     {"connected", _wrap_Dbh_connected}, 
+    {"test_reactive", _wrap_Dbh_test_reactive}, 
     {"query", _wrap_Dbh_query}, 
     {"affected_rows", _wrap_Dbh_affected_rows}, 
     {0,0}
committer: Leon de Rooij
comments: 
Added optional core: prefix to first arg passed to freeswitch.Dbh for giving direct access to sqlite db

diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp
index 1a170dc..01f708d 100644
--- a/src/mod/languages/mod_lua/freeswitch_lua.cpp
+++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp
@@ -312,15 +312,21 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
 Dbh::Dbh(char *dsn, char *user, char *pass)
 {
   switch_cache_db_connection_options_t options = { {0} };
+  const char *prefix = "core:";
+  m_connected = false;
 
-  options.odbc_options.dsn = dsn;
-  options.odbc_options.user = user;
-  options.odbc_options.pass = pass;
-
-  if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) == SWITCH_STATUS_SUCCESS) {
-    m_connected = true;
+  if (strstr(dsn, prefix) == dsn) {
+    options.core_db_options.db_path = &dsn[strlen(prefix)];
+    if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) == SWITCH_STATUS_SUCCESS) {
+      m_connected = true;
+    }
   } else {
-    m_connected = false;
+    options.odbc_options.dsn = dsn;
+    options.odbc_options.user = user;
+    options.odbc_options.pass = pass;
+    if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) == SWITCH_STATUS_SUCCESS) {
+      m_connected = true;
+    }
   }
 }
 
committer: David Yat Sin
comments: 
chlog: freetdm - isdn: fix for not including some bearer-cap contents on BRI

diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
index 64147b7..23fe08b 100644
--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
@@ -873,38 +873,32 @@ ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap)
 	bearCap->tranMode.pres = PRSNT_NODEF;
 	bearCap->tranMode.val = IN_TM_CIRCUIT;
 
-	if (!FTDM_SPAN_IS_BRI(ftdmchan->span)) {
-		/* Trillium stack rejests lyr1Ident on BRI, but Netbricks always sends it.
-		Check with Trillium if this ever causes calls to fail in the field */
+	bearCap->usrInfoLyr1Prot.pres = PRSNT_NODEF;
+	bearCap->usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1);
 
-		/* PRI only params */
-		bearCap->usrInfoLyr1Prot.pres = PRSNT_NODEF;
-		bearCap->usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1);
-
-		switch (signal_data->switchtype) {
-			case SNGISDN_SWITCH_NI2:
-			case SNGISDN_SWITCH_4ESS:
-			case SNGISDN_SWITCH_5ESS:
-			case SNGISDN_SWITCH_DMS100:
-			case SNGISDN_SWITCH_INSNET:
-				if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) {
-					ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to u-law\n");
-					bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ULAW;
-				}
-				break;
-			case SNGISDN_SWITCH_EUROISDN:
-			case SNGISDN_SWITCH_QSIG:
-				if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) {
-					ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to a-law\n");
-					bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ALAW;
-				}
-				break;
-		}
-
-		
-		bearCap->lyr1Ident.pres = PRSNT_NODEF;
-		bearCap->lyr1Ident.val = IN_L1_IDENT;
+	switch (signal_data->switchtype) {
+		case SNGISDN_SWITCH_NI2:
+		case SNGISDN_SWITCH_4ESS:
+		case SNGISDN_SWITCH_5ESS:
+		case SNGISDN_SWITCH_DMS100:
+		case SNGISDN_SWITCH_INSNET:
+			if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) {
+				ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to u-law\n");
+				bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ULAW;
+			}
+			break;
+		case SNGISDN_SWITCH_EUROISDN:
+		case SNGISDN_SWITCH_QSIG:
+			if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) {
+				ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to a-law\n");
+				bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ALAW;
+			}
+			break;
 	}
+
+	bearCap->lyr1Ident.pres = PRSNT_NODEF;
+	bearCap->lyr1Ident.val = IN_L1_IDENT;
+	
 	return FTDM_SUCCESS;
 }
 
committer: Anthony Minessale
comments: 
FS-2771

diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c
index 472f2d9..12b3193 100644
--- a/src/mod/applications/mod_conference/mod_conference.c
+++ b/src/mod/applications/mod_conference/mod_conference.c
@@ -152,7 +152,8 @@ typedef enum {
 	CFLAG_BRIDGE_TO = (1 << 6),
 	CFLAG_WAIT_MOD = (1 << 7),
 	CFLAG_VID_FLOOR = (1 << 8),
-	CFLAG_WASTE_BANDWIDTH = (1 << 9)
+	CFLAG_WASTE_BANDWIDTH = (1 << 9),
+	CFLAG_OUTCALL = (1 << 10)
 } conf_flag_t;
 
 typedef enum {
@@ -288,6 +289,8 @@ typedef struct conference_obj {
 	uint32_t avg_tally;
 	switch_time_t run_time;
 	char *uuid_str;
+	uint32_t originating;
+	switch_call_cause_t cancel_cause;
 } conference_obj_t;
 
 /* Relationship with another member */
@@ -395,11 +398,16 @@ SWITCH_STANDARD_API(conf_api_main);
 static switch_status_t conference_outcall(conference_obj_t *conference,
 										  char *conference_name,
 										  switch_core_session_t *session,
-										  char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause);
+										  char *bridgeto, uint32_t timeout, 
+										  char *flags, 
+										  char *cid_name, 
+										  char *cid_num, 
+										  switch_call_cause_t *cause,
+										  switch_call_cause_t *cancel_cause);
 static switch_status_t conference_outcall_bg(conference_obj_t *conference,
 											 char *conference_name,
 											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
-											 const char *cid_num, const char *call_uuid);
+											 const char *cid_num, const char *call_uuid, switch_call_cause_t *cancel_cause);
 SWITCH_STANDARD_APP(conference_function);
 static void launch_conference_thread(conference_obj_t *conference);
 static void launch_conference_video_thread(conference_obj_t *conference);
@@ -1381,6 +1389,14 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
 	/* Rinse ... Repeat */
   end:
 
+	if (switch_test_flag(conference, CFLAG_OUTCALL)) {
+		conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Ending pending outcall channels for Conference: '%s'\n", conference->name);
+		while(conference->originating) {
+			switch_yield(200000);
+		}
+	}
+
 	if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name);
@@ -2404,6 +2420,8 @@ static void conference_loop_output(conference_member_t *member)
 
 			switch_channel_set_private(channel, "_conference_autocall_list_", NULL);
 
+			switch_set_flag(member->conference, CFLAG_OUTCALL);
+
 			if (toval) {
 				to = atoi(toval);
 				if (to < 10 || to > 500) {
@@ -2422,7 +2440,8 @@ static void conference_loop_output(conference_member_t *member)
 				for (x = 0; x < argc; x++) {
 					char *dial_str = switch_mprintf("%s%s", switch_str_nil(prefix), argv[x]);
 					switch_assert(dial_str);
-					conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL);
+					conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL, 
+										  &member->conference->cancel_cause);
 					switch_safe_free(dial_str);
 				}
 				switch_safe_free(cpstr);
@@ -4244,9 +4263,9 @@ static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_st
 	}
 
 	if (conference) {
-		conference_outcall(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], &cause);
+		conference_outcall(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], &cause, NULL);
 	} else {
-		conference_outcall(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], &cause);
+		conference_outcall(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], &cause, NULL);
 	}
 	stream->write_function(stream, "Call Requested: result: [%s]\n", switch_channel_cause2str(cause));
 
@@ -4269,9 +4288,9 @@ static switch_status_t conf_api_sub_bgdial(conference_obj_t *conference, switch_
 	switch_uuid_format(uuid_str, &uuid);
 
 	if (conference) {
-		conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str);
+		conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str, NULL);
 	} else {
-		conference_outcall_bg(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str);
+		conference_outcall_bg(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str, NULL);
 	}
 
 	stream->write_function(stream, "OK Job-UUID: %s\n", uuid_str);
@@ -4785,7 +4804,11 @@ SWITCH_STANDARD_API(conf_api_main)
 static switch_status_t conference_outcall(conference_obj_t *conference,
 										  char *conference_name,
 										  switch_core_session_t *session,
-										  char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause)
+										  char *bridgeto, uint32_t timeout, 
+										  char *flags, char *cid_name, 
+										  char *cid_num, 
+										  switch_call_cause_t *cause,
+										  switch_call_cause_t *cancel_cause)
 {
 	switch_core_session_t *peer_session = NULL;
 	switch_channel_t *peer_channel;
@@ -4831,8 +4854,15 @@ static switch_status_t conference_outcall(conference_obj_t *conference,
 
 	/* establish an outbound call leg */
 
-	if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, NULL) !=
-		SWITCH_STATUS_SUCCESS) {
+	switch_mutex_lock(conference->mutex);
+	conference->originating++;
+	switch_mutex_unlock(conference->mutex);
+	status = switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, cancel_cause);
+	switch_mutex_lock(conference->mutex);
+	conference->originating--;
+	switch_mutex_unlock(conference->mutex);
+
+	if (status != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
 						  switch_channel_cause2str(*cause));
 		if (caller_channel) {
@@ -4909,6 +4939,7 @@ struct bg_call {
 	char *cid_num;
 	char *conference_name;
 	char *uuid;
+	switch_call_cause_t *cancel_cause;
 	switch_memory_pool_t *pool;
 };
 
@@ -4921,7 +4952,7 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread,
 		switch_event_t *event;
 
 		conference_outcall(call->conference, call->conference_name,
-						   call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause);
+						   call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause, call->cancel_cause);
 
 		if (call->conference && test_eflag(call->conference, EFLAG_BGDIAL_RESULT) &&
 			switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
@@ -4949,7 +4980,7 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread,
 static switch_status_t conference_outcall_bg(conference_obj_t *conference,
 											 char *conference_name,
 											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
-											 const char *cid_num, const char *call_uuid)
+											 const char *cid_num, const char *call_uuid, switch_call_cause_t *cancel_cause)
 {
 	struct bg_call *call = NULL;
 	switch_thread_t *thread;
@@ -4963,6 +4994,7 @@ static switch_status_t conference_outcall_bg(conference_obj_t *conference,
 	call->conference = conference;
 	call->session = session;
 	call->timeout = timeout;
+	call->cancel_cause = cancel_cause;
 
 	if (conference) {
 		pool = conference->pool;
@@ -5717,7 +5749,7 @@ SWITCH_STANDARD_APP(conference_function)
 	/* if we're using "bridge:" make an outbound call and bridge it in */
 	if (!zstr(bridgeto) && strcasecmp(bridgeto, "none")) {
 		switch_call_cause_t cause;
-		if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, &cause) != SWITCH_STATUS_SUCCESS) {
+		if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, &cause, NULL) != SWITCH_STATUS_SUCCESS) {
 			goto done;
 		}
 	} else {
committer: Daniel Swarbrick
comments: 
update mod_sofia management interface OID

diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c
index eb5e2ad..6c91ce1 100644
--- a/src/mod/endpoints/mod_sofia/mod_sofia.c
+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c
@@ -4850,7 +4850,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
 	sofia_endpoint_interface->state_handler = &sofia_event_handlers;
 
 	management_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_MANAGEMENT_INTERFACE);
-	management_interface->relative_oid = "1";
+	management_interface->relative_oid = "1001";
 	management_interface->management_function = sofia_manage;
 
 	SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>");
committer: Anthony Minessale
comments: 
revert change from 2800ea199d6c233fe0aeee91de3be33dfee19607 and add disconnect packet on listener kill

diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
index 344b0ee..f3a2c92 100644
--- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
+++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
@@ -32,7 +32,7 @@
 #include <switch.h>
 #define CMD_BUFLEN 1024 * 1000
 #define MAX_QUEUE_LEN 25000
-#define MAX_MISSED 2000
+#define MAX_MISSED 500
 SWITCH_MODULE_LOAD_FUNCTION(mod_event_socket_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime);
@@ -143,7 +143,7 @@ static const char *format2str(event_format_t format)
 }
 
 static void remove_listener(listener_t *listener);
-static void kill_listener(listener_t *l);
+static void kill_listener(listener_t *l, const char *message);
 static void kill_all_listeners(void);
 
 static uint32_t next_id(void)
@@ -170,7 +170,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l
 		if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) {
 			switch_log_node_t *dnode = switch_log_node_dup(node);
 
-			if (switch_queue_push(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) {
+			if (switch_queue_trypush(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) {
 				if (l->lost_logs) {
 					int ll = l->lost_logs;
 					switch_event_t *event;
@@ -184,7 +184,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l
 			} else {
 				switch_log_node_free(&dnode);
 				if (++l->lost_logs > MAX_MISSED) {
-					kill_listener(l);
+					kill_listener(l, "Disconnected due to log queue failure.\n");
 				}
 			}
 		}
@@ -366,7 +366,7 @@ static void event_handler(switch_event_t *event)
 
 		if (send) {
 			if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
-				if (switch_queue_push(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) {
+				if (switch_queue_trypush(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) {
 					if (l->lost_events) {
 						int le = l->lost_events;
 						l->lost_events = 0;
@@ -379,7 +379,7 @@ static void event_handler(switch_event_t *event)
 					}
 				} else {
 					if (++l->lost_events > MAX_MISSED) {
-						kill_listener(l);
+						kill_listener(l, "Disconnected due to event queue failure.\n");
 					}
 					switch_event_destroy(&clone);
 				}
@@ -579,8 +579,41 @@ static void remove_listener(listener_t *listener)
 	switch_mutex_unlock(globals.listener_mutex);
 }
 
-static void kill_listener(listener_t *l)
+static void send_disconnect(listener_t *listener, const char *message)
 {
+	
+	char disco_buf[512] = "";
+	switch_size_t len, mlen;
+
+	if (zstr(message)) {
+		message = "Disconnected.\n";
+	}
+
+	mlen = strlen(message);
+	
+	if (listener->session) {
+		switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
+						"Controlled-Session-UUID: %s\n"
+						"Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), mlen);
+	} else {
+		switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen);
+	}
+	
+	len = strlen(disco_buf);
+	switch_socket_send(listener->sock, disco_buf, &len);
+	if (len > 0) {
+		len = mlen;
+		switch_socket_send(listener->sock, message, &len);
+	}
+}
+
+static void kill_listener(listener_t *l, const char *message)
+{
+
+	if (message) {
+		send_disconnect(l, message);
+	}
+
 	switch_clear_flag(l, LFLAG_RUNNING);
 	if (l->sock) {
 		switch_socket_shutdown(l->sock, SWITCH_SHUTDOWN_READWRITE);
@@ -595,7 +628,7 @@ static void kill_all_listeners(void)
 
 	switch_mutex_lock(globals.listener_mutex);
 	for (l = listen_list.listeners; l; l = l->next) {
-		kill_listener(l);
+		kill_listener(l, "The system is being shut down.\n");
 	}
 	switch_mutex_unlock(globals.listener_mutex);
 }
@@ -1233,7 +1266,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
 				if (switch_channel_get_state(chan) < CS_HANGUP && switch_channel_test_flag(chan, CF_DIVERT_EVENTS)) {
 					switch_event_t *e = NULL;
 					while (switch_core_session_dequeue_event(listener->session, &e, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
-						if (switch_queue_push(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) {
+						if (switch_queue_trypush(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) {
 							switch_core_session_queue_event(listener->session, &e);
 							break;
 						}
@@ -2540,22 +2573,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
 	}
 
 	if (listener->sock) {
-		char disco_buf[512] = "";
-		const char message[] = "Disconnected, goodbye.\nSee you at ClueCon! http://www.cluecon.com/\n";
-		int mlen = strlen(message);
-
-		if (listener->session) {
-			switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
-							"Controlled-Session-UUID: %s\n"
-							"Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), mlen);
-		} else {
-			switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen);
-		}
-
-		len = strlen(disco_buf);
-		switch_socket_send(listener->sock, disco_buf, &len);
-		len = mlen;
-		switch_socket_send(listener->sock, message, &len);
+		send_disconnect(listener, "Disconnected, goodbye.\nSee you at ClueCon! http://www.cluecon.com/\n");
 		close_socket(&listener->sock);
 	}
 
committer: Daniel Swarbrick
comments: 
whoops, tab craziness

diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h
index 72dbeeb..3315378 100644
--- a/src/mod/event_handlers/mod_snmp/subagent.h
+++ b/src/mod/event_handlers/mod_snmp/subagent.h
@@ -2,15 +2,15 @@
 #define subagent_H
 
 /* .1.3.6.1.4.1.27880.1.1 */
-#define ID_VERSION_STR				1
-#define ID_UUID						2
+#define ID_VERSION_STR			1
+#define ID_UUID				2
 
 /* .1.3.6.1.4.1.27880.1.2 */
-#define SS_UPTIME					1
+#define SS_UPTIME			1
 #define SS_SESSIONS_SINCE_STARTUP	2
-#define SS_CURRENT_SESSIONS			3
-#define SS_MAX_SESSIONS				4
-#define SS_CURRENT_CALLS			5
+#define SS_CURRENT_SESSIONS		3
+#define SS_MAX_SESSIONS			4
+#define SS_CURRENT_CALLS		5
 #define SS_SESSIONS_PER_SECOND		6
 #define SS_MAX_SESSIONS_PER_SECOND	7
 
committer: Daniel Swarbrick
comments: 
tidy up subagent and #defines

diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c
index 79ccd16..0310637 100644
--- a/src/mod/event_handlers/mod_snmp/mod_snmp.c
+++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c
@@ -101,8 +101,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime)
 {
 	if (!globals.shutdown) {
-		/* Block on select() */
 		switch_mutex_lock(globals.mutex);
+		/* Block on select() */
 		agent_check_and_process(1);
 		switch_mutex_unlock(globals.mutex);
 	}
diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c
index ad36624..2da9ebe 100644
--- a/src/mod/event_handlers/mod_snmp/subagent.c
+++ b/src/mod/event_handlers/mod_snmp/subagent.c
@@ -37,31 +37,12 @@
 #include "subagent.h"
 
 
-static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 };
-static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 };
-
-/* identity sub-IDs - these must match MIB */
-enum {
-	versionString_oid = 1,
-	uuid_oid
-};
-
-
-/* systemStats sub-IDs - these must match MIB */
-enum {
-	uptime_oid = 1,
-	sessionsSinceStartup_oid,
-	currentSessions_oid,
-	maxSessions_oid,
-	currentCalls_oid,
-	sessionsPerSecond_oid,
-	maxSessionsPerSecond_oid
-};
-
-
 void init_subagent(void)
 {
-	DEBUGMSGTL(("init_nstAgentSubagentObject", "Initializing\n"));
+	static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 };
+	static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 };
+
+	DEBUGMSGTL(("init_subagent", "Initializing\n"));
 
 	netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2);
 	netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 7);
@@ -70,28 +51,26 @@ void init_subagent(void)
 
 int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
 {
-	static char const version[] = SWITCH_VERSION_FULL;
-	char uuid[40] = "";
 	netsnmp_request_info *request = NULL;
 	oid subid;
+	static char const version[] = SWITCH_VERSION_FULL;
+	char uuid[40] = "";
 
 	switch(reqinfo->mode) {
 	case MODE_GET:
-		for (request = requests; request; request = request->next) {
-			subid = request->requestvb->name[reginfo->rootoid_len - 2];
-
-			switch (subid) {
-				case versionString_oid:
-					snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version));
-					break;
-				case uuid_oid:
-					strncpy(uuid, switch_core_get_uuid(), sizeof(uuid));
-					snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid));
-					break;
-				default:
-					snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
-					netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
-			}
+		subid = requests->requestvb->name[reginfo->rootoid_len - 2];
+
+		switch (subid) {
+		case ID_VERSION_STR:
+			snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version));
+			break;
+		case ID_UUID:
+			strncpy(uuid, switch_core_get_uuid(), sizeof(uuid));
+			snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid));
+			break;
+		default:
+			snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
+			netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
 		}
 		break;
 
@@ -114,47 +93,45 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio
 
 	switch(reqinfo->mode) {
 	case MODE_GET:
-		for (request = requests; request; request = request->next) {
-			subid = request->requestvb->name[reginfo->rootoid_len - 2];
-
-			switch (subid) {
-				case uptime_oid:
-					uptime = switch_core_uptime() / 10000;
-					snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime));
-					break;
-				case sessionsSinceStartup_oid:
-					int_val = switch_core_session_id() - 1;
-					snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val));
-					break;
-				case currentSessions_oid:
-					int_val = switch_core_session_count();
-					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-					break;
-				case maxSessions_oid:
-					switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);;
-					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-					break;
-				case currentCalls_oid:
-					/*
-					 * This is zero for now, since there is no convenient way to get total call
-					 * count (not to be confused with session count), without touching the
-					 * database.
-					 */
-					int_val = 0;
-					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-					break;
-				case sessionsPerSecond_oid:
-					switch_core_session_ctl(SCSC_LAST_SPS, &int_val);
-					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-					break;
-				case maxSessionsPerSecond_oid:
-					switch_core_session_ctl(SCSC_SPS, &int_val);
-					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-					break;
-				default:
-					snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
-					netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
-			}
+		subid = requests->requestvb->name[reginfo->rootoid_len - 2];
+
+		switch (subid) {
+		case SS_UPTIME:
+			uptime = switch_core_uptime() / 10000;
+			snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime));
+			break;
+		case SS_SESSIONS_SINCE_STARTUP:
+			int_val = switch_core_session_id() - 1;
+			snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val));
+			break;
+		case SS_CURRENT_SESSIONS:
+			int_val = switch_core_session_count();
+			snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+			break;
+		case SS_MAX_SESSIONS:
+			switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);;
+			snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+			break;
+		case SS_CURRENT_CALLS:
+			/*
+			 * This is zero for now, since there is no convenient way to get total call
+			 * count (not to be confused with session count), without touching the
+			 * database.
+			 */
+			int_val = 0;
+			snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+			break;
+		case SS_SESSIONS_PER_SECOND:
+			switch_core_session_ctl(SCSC_LAST_SPS, &int_val);
+			snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+			break;
+		case SS_MAX_SESSIONS_PER_SECOND:
+			switch_core_session_ctl(SCSC_SPS, &int_val);
+			snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+			break;
+		default:
+			snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
+			netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
 		}
 		break;
 
diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h
index 8a57d8a..72dbeeb 100644
--- a/src/mod/event_handlers/mod_snmp/subagent.h
+++ b/src/mod/event_handlers/mod_snmp/subagent.h
@@ -1,6 +1,20 @@
 #ifndef subagent_H
 #define subagent_H
 
+/* .1.3.6.1.4.1.27880.1.1 */
+#define ID_VERSION_STR				1
+#define ID_UUID						2
+
+/* .1.3.6.1.4.1.27880.1.2 */
+#define SS_UPTIME					1
+#define SS_SESSIONS_SINCE_STARTUP	2
+#define SS_CURRENT_SESSIONS			3
+#define SS_MAX_SESSIONS				4
+#define SS_CURRENT_CALLS			5
+#define SS_SESSIONS_PER_SECOND		6
+#define SS_MAX_SESSIONS_PER_SECOND	7
+
+
 void init_subagent(void);
 Netsnmp_Node_Handler handle_identity;
 Netsnmp_Node_Handler handle_systemStats;
committer: Daniel Swarbrick
comments: 
wrap potentially non-threadsafe snmp operations in mutex; support snmpwalk in subagent

diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c
index 36a133c..79ccd16 100644
--- a/src/mod/event_handlers/mod_snmp/mod_snmp.c
+++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c
@@ -38,6 +38,7 @@
 
 static struct {
 	switch_memory_pool_t *pool;
+	switch_mutex_t *mutex;
 	int shutdown;
 } globals;
 
@@ -55,27 +56,13 @@ static int snmp_callback_log(int major, int minor, void *serverarg, void *client
 }
 
 
-static switch_state_handler_table_t state_handlers = {
-	/*.on_init */ NULL,
-	/*.on_routing */ NULL,
-	/*.on_execute */ NULL,
-	/*.on_hangup */ NULL,
-	/*.on_exchange_media */ NULL,
-	/*.on_soft_execute */ NULL,
-	/*.on_consume_media */ NULL,
-	/*.on_hibernate */ NULL,
-	/*.on_reset */ NULL,
-	/*.on_park */ NULL,
-	/*.on_reporting */ NULL
-};
-
-
 static switch_status_t load_config(switch_memory_pool_t *pool)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	memset(&globals, 0, sizeof(globals));
 	globals.pool = pool;
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
 
 	return status;
 }
@@ -87,7 +74,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)
 
 	load_config(pool);
 
-	switch_core_add_state_handler(&state_handlers);
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	/* Register callback function so we get Net-SNMP logging handled by FreeSWITCH */
@@ -114,9 +100,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)
 
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime)
 {
-	while (!globals.shutdown) {
+	if (!globals.shutdown) {
 		/* Block on select() */
+		switch_mutex_lock(globals.mutex);
 		agent_check_and_process(1);
+		switch_mutex_unlock(globals.mutex);
 	}
 
 	return SWITCH_STATUS_SUCCESS;
@@ -126,9 +114,12 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime)
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_snmp_shutdown)
 {
 	globals.shutdown = 1;
-	switch_core_remove_state_handler(&state_handlers);
 
+	switch_mutex_lock(globals.mutex);
 	snmp_shutdown("mod_snmp");
+	switch_mutex_unlock(globals.mutex);
+
+	switch_mutex_destroy(globals.mutex);
 
 	return SWITCH_STATUS_SUCCESS;
 }
diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c
index 8a9f2da..ad36624 100644
--- a/src/mod/event_handlers/mod_snmp/subagent.c
+++ b/src/mod/event_handlers/mod_snmp/subagent.c
@@ -63,8 +63,8 @@ void init_subagent(void)
 {
 	DEBUGMSGTL(("init_nstAgentSubagentObject", "Initializing\n"));
 
-	netsnmp_register_handler(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY));
-	netsnmp_register_handler(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY));
+	netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2);
+	netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 7);
 }
 
 
@@ -76,33 +76,29 @@ int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *
 	oid subid;
 
 	switch(reqinfo->mode) {
-		case MODE_GET:
-			for (request = requests; request; request = request->next) {
-				subid = request->requestvb->name[OID_LENGTH(systemStats_oid)];
-
-				switch (subid) {
-					case versionString_oid:
-						snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version));
-						break;
-					case uuid_oid:
-						strncpy(uuid, switch_core_get_uuid(), sizeof(uuid));
-						snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid));
-						break;
-					default:
-						snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
-						netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
-				}
+	case MODE_GET:
+		for (request = requests; request; request = request->next) {
+			subid = request->requestvb->name[reginfo->rootoid_len - 2];
+
+			switch (subid) {
+				case versionString_oid:
+					snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version));
+					break;
+				case uuid_oid:
+					strncpy(uuid, switch_core_get_uuid(), sizeof(uuid));
+					snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid));
+					break;
+				default:
+					snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
+					netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
 			}
-			break;
+		}
+		break;
 
-		case MODE_GETNEXT:
-			snmp_log(LOG_ERR, "MODE_GETNEXT not supported (yet)\n");
-			break;
-
-		default:
-			/* we should never get here, so this is a really bad error */
-			snmp_log(LOG_ERR, "Unknown mode (%d) in handle_versionString\n", reqinfo->mode );
-			return SNMP_ERR_GENERR;
+	default:
+		/* we should never get here, so this is a really bad error */
+		snmp_log(LOG_ERR, "Unknown mode (%d) in handle_identity\n", reqinfo->mode );
+		return SNMP_ERR_GENERR;
 	}
 
 	return SNMP_ERR_NOERROR;
@@ -117,59 +113,55 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio
 	uint32_t int_val;
 
 	switch(reqinfo->mode) {
-		case MODE_GET:
-			for (request = requests; request; request = request->next) {
-				subid = request->requestvb->name[OID_LENGTH(systemStats_oid)];
-
-				switch (subid) {
-					case uptime_oid:
-						uptime = switch_core_uptime() / 10000;
-						snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime));
-						break;
-					case sessionsSinceStartup_oid:
-						int_val = switch_core_session_id() - 1;
-						snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val));
-						break;
-					case currentSessions_oid:
-						int_val = switch_core_session_count();
-						snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-						break;
-					case maxSessions_oid:
-						switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);;
-						snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-						break;
-					case currentCalls_oid:
-						/*
-						 * This is zero for now, since there is no convenient way to get total call
-						 * count (not to be confused with session count), without touching the
-						 * database.
-						 */
-						int_val = 0;
-						snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-						break;
-					case sessionsPerSecond_oid:
-						switch_core_session_ctl(SCSC_LAST_SPS, &int_val);
-						snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-						break;
-					case maxSessionsPerSecond_oid:
-						switch_core_session_ctl(SCSC_SPS, &int_val);
-						snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
-						break;
-					default:
-						snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
-						netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
-				}
+	case MODE_GET:
+		for (request = requests; request; request = request->next) {
+			subid = request->requestvb->name[reginfo->rootoid_len - 2];
+
+			switch (subid) {
+				case uptime_oid:
+					uptime = switch_core_uptime() / 10000;
+					snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime));
+					break;
+				case sessionsSinceStartup_oid:
+					int_val = switch_core_session_id() - 1;
+					snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val));
+					break;
+				case currentSessions_oid:
+					int_val = switch_core_session_count();
+					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+					break;
+				case maxSessions_oid:
+					switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);;
+					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+					break;
+				case currentCalls_oid:
+					/*
+					 * This is zero for now, since there is no convenient way to get total call
+					 * count (not to be confused with session count), without touching the
+					 * database.
+					 */
+					int_val = 0;
+					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+					break;
+				case sessionsPerSecond_oid:
+					switch_core_session_ctl(SCSC_LAST_SPS, &int_val);
+					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+					break;
+				case maxSessionsPerSecond_oid:
+					switch_core_session_ctl(SCSC_SPS, &int_val);
+					snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
+					break;
+				default:
+					snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
+					netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
 			}
-			break;
-
-		case MODE_GETNEXT:
-			snmp_log(LOG_ERR, "MODE_GETNEXT not supported (yet)\n");
-			break;
+		}
+		break;
 
-		default:
-			/* we should never get here, so this is a really bad error */
-			snmp_log(LOG_ERR, "Unknown mode (%d) in handle_systemStats\n", reqinfo->mode);
-			return SNMP_ERR_GENERR;
+	default:
+		/* we should never get here, so this is a really bad error */
+		snmp_log(LOG_ERR, "Unknown mode (%d) in handle_systemStats\n", reqinfo->mode);
+		return SNMP_ERR_GENERR;
 	}
 
 	return SNMP_ERR_NOERROR;
committer: Anthony Minessale
comments: 
use switch_queue_trypop_timeout instead of a timer in mod_loopback to improve audio quality when not using bowout features

diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c
index f875f6b..aa57668 100644
--- a/src/mod/endpoints/mod_loopback/mod_loopback.c
+++ b/src/mod/endpoints/mod_loopback/mod_loopback.c
@@ -77,11 +77,11 @@ struct private_object {
 
 	switch_frame_t cng_frame;
 	unsigned char cng_databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
-	switch_timer_t timer;
 	switch_caller_profile_t *caller_profile;
 	int32_t bowout_frame_count;
 	char *other_uuid;
 	switch_queue_t *frame_queue;
+	switch_codec_implementation_t read_impl;
 };
 
 typedef struct private_object private_t;
@@ -111,7 +111,6 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
 	int interval = 20;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	const switch_codec_implementation_t *read_impl;
 
 	if (codec) {
 		iananame = codec->implementation->iananame;
@@ -166,15 +165,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
 	switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
 	switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
 
-	if (tech_pvt->flag_mutex) {
-		switch_core_timer_destroy(&tech_pvt->timer);
-	}
-
-	read_impl = tech_pvt->read_codec.implementation;
-
-	switch_core_timer_init(&tech_pvt->timer, "soft",
-						   read_impl->microseconds_per_packet / 1000, read_impl->samples_per_packet * 4, switch_core_session_get_pool(session));
-
+	tech_pvt->read_impl = *tech_pvt->read_codec.implementation;
 
 	if (!tech_pvt->flag_mutex) {
 		switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
@@ -376,7 +367,6 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
 	tech_pvt = switch_core_session_get_private(session);
 
 	if (tech_pvt) {
-		switch_core_timer_destroy(&tech_pvt->timer);
 
 		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
 			switch_core_codec_destroy(&tech_pvt->read_codec);
@@ -568,12 +558,10 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
 		goto end;
 	}
 
-	switch_core_timer_next(&tech_pvt->timer);
-
 	mutex = tech_pvt->mutex;
-	switch_mutex_lock(mutex);
 
-	if (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+
+	if (switch_queue_pop_timeout(tech_pvt->frame_queue, &pop, tech_pvt->read_impl.microseconds_per_packet) == SWITCH_STATUS_SUCCESS && pop) {
 		if (tech_pvt->write_frame) {
 			switch_frame_free(&tech_pvt->write_frame);
 		}
@@ -585,6 +573,8 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
 		switch_set_flag(tech_pvt, TFLAG_CNG);
 	}
 
+	switch_mutex_lock(mutex);
+
 	if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
 		unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 		uint32_t flag = 0;
@@ -775,8 +765,6 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
 				switch_frame_free(&frame);
 			}
 
-			switch_core_timer_sync(&tech_pvt->timer);
-
 		}
 		break;
 	default:
committer: Anthony Minessale
comments: 
update syntax

diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c
index 1c12e1c..7771b09 100644
--- a/src/mod/applications/mod_commands/mod_commands.c
+++ b/src/mod/applications/mod_commands/mod_commands.c
@@ -2372,7 +2372,7 @@ SWITCH_STANDARD_API(uuid_media_function)
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define BROADCAST_SYNTAX "<uuid> <path> [aleg|bleg|both]"
+#define BROADCAST_SYNTAX "<uuid> <path> [aleg|bleg|holdb|both]"
 SWITCH_STANDARD_API(uuid_broadcast_function)
 {
 	char *mycmd = NULL, *argv[4] = { 0 };
committer: Anthony Minessale
comments: 
add moh by default to uuid_broadcast when only broadcasting to A leg use aleg arg to disable this

diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c
index 15ac8ec..1c12e1c 100644
--- a/src/mod/applications/mod_commands/mod_commands.c
+++ b/src/mod/applications/mod_commands/mod_commands.c
@@ -2389,15 +2389,26 @@ SWITCH_STANDARD_API(uuid_broadcast_function)
 		switch_media_flag_t flags = SMF_NONE;
 
 		if (argv[2]) {
-			if (!strcasecmp(argv[2], "both")) {
+			if (switch_stristr("both", (argv[2]))) {
 				flags |= (SMF_ECHO_ALEG | SMF_ECHO_BLEG);
-			} else if (!strcasecmp(argv[2], "aleg")) {
+			}
+
+			if (switch_stristr("aleg", argv[2])) {
 				flags |= SMF_ECHO_ALEG;
-			} else if (!strcasecmp(argv[2], "bleg")) {
+			} 
+
+			if (switch_stristr("bleg", argv[2])) {
+				flags &= ~SMF_HOLD_BLEG;
 				flags |= SMF_ECHO_BLEG;
 			}
+
+			if (switch_stristr("holdb", argv[2])) {
+				flags &= ~SMF_ECHO_BLEG;
+				flags |= SMF_HOLD_BLEG;
+			}
+
 		} else {
-			flags |= SMF_ECHO_ALEG;
+			flags = SMF_ECHO_ALEG | SMF_HOLD_BLEG;
 		}
 
 		status = switch_ivr_broadcast(argv[0], argv[1], flags);
committer: cypromis
comments: 
not sure the stuff is needed in the core iksemel. this will take some more teting via hudson and some more comits, but hey, it does not have an impact on anythingbut solaris and derivates

diff --git a/libs/iksemel/src/Makefile.am b/libs/iksemel/src/Makefile.am
index 10236f6..9d3da69 100644
--- a/libs/iksemel/src/Makefile.am
+++ b/libs/iksemel/src/Makefile.am
@@ -25,5 +25,5 @@ libiksemel_la_SOURCES = \
 	base64.c
 
 libiksemel_la_LDFLAGS = -version-info 4:0:1 -no-undefined
-libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS)  @SUNCFLAGS@
-libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS)  @SUNCFLAGS@
+libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS)  
+libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS)  
committer: cypromis
comments: 
more sun fixes to libiksemel.

diff --git a/libs/iksemel/configure.ac b/libs/iksemel/configure.ac
index e00af1f..49d8621 100644
--- a/libs/iksemel/configure.ac
+++ b/libs/iksemel/configure.ac
@@ -83,9 +83,13 @@ AC_ARG_ENABLE(64,
 
 if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
     if test "${enable_64}" = "yes"; then
-        CFLAGS="$CFLAGS -m64 -lgpg-error"
-        CXXFLAGS="$CXXFLAGS -m64 -lgpg-error"
-	SUNFLAGS="-lgpg.error"
+        CFLAGS="$CFLAGS -xc99=all -mt -m64 -lgpg-error"
+        CXXFLAGS="$CXXFLAGS -xc99=all -mt -m64 -lgpg-error"
+	SUNFLAGS="-xc99=all -mt -m64 -lgpg-error"
+    else 
+	CFLAGS="$CFLAGS -xc99=all -mt -lgpg-error"
+	CXXFLAGS="$CXXFLAGS -xc99=all -mt -lgpg-error"
+	SUNFLAGS="-xc99=all -mt -lgpg-error"
     fi
 fi
 
diff --git a/libs/iksemel/src/Makefile.am b/libs/iksemel/src/Makefile.am
index 20ca263..10236f6 100644
--- a/libs/iksemel/src/Makefile.am
+++ b/libs/iksemel/src/Makefile.am
@@ -25,5 +25,5 @@ libiksemel_la_SOURCES = \
 	base64.c
 
 libiksemel_la_LDFLAGS = -version-info 4:0:1 -no-undefined
-libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS)
-libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS)
+libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS)  @SUNCFLAGS@
+libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS)  @SUNCFLAGS@
committer: Jeff Lenk
comments: 
revert till right solution found

diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs
index 1de2ec2..2f072aa 100644
--- a/w32/Setup/Product.wxs
+++ b/w32/Setup/Product.wxs
@@ -57,9 +57,6 @@
 							 WorkingDirectory="INSTALLLOCATION"/>
 				<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
 				<RegistryValue Root="HKCU" Key="Software\FreeSWITCH\FreeSWITCH" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
-        <CreateFolder Directory="INSTALLLOCATION">
-          <Permission User="Authenticated Users" GenericAll="yes" />
-        </CreateFolder>
 			</Component>
 			<Component Id="FSCliShortcut" Guid="D209546C-C728-4d8f-BDB2-29AED8824282">
 				<Shortcut Id="FSCliStartMenuShortcut"
@@ -68,9 +65,6 @@
 							 Target="[INSTALLLOCATION]fs_cli.exe"
 							 WorkingDirectory="INSTALLLOCATION"/>
 				<RegistryValue Root="HKCU" Key="Software\FreeSWITCH\FS_CLI" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
-        <CreateFolder Directory="INSTALLLOCATION">
-          <Permission User="Authenticated Users" GenericAll="yes" />
-        </CreateFolder>
 			</Component>
 		</DirectoryRef>
 
committer: cypromis
comments: 
explicitly add gpg-error if sun comiler, maybe that solves it finaly

diff --git a/libs/iksemel/configure.ac b/libs/iksemel/configure.ac
index 7761eb0..e00af1f 100644
--- a/libs/iksemel/configure.ac
+++ b/libs/iksemel/configure.ac
@@ -85,9 +85,12 @@ if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
     if test "${enable_64}" = "yes"; then
         CFLAGS="$CFLAGS -m64 -lgpg-error"
         CXXFLAGS="$CXXFLAGS -m64 -lgpg-error"
+	SUNFLAGS="-lgpg.error"
     fi
 fi
 
+AC_SUBST(SUNCFLAGS)
+
 dnl Generating makefiles
 AC_CONFIG_FILES([
 Makefile
diff --git a/libs/iksemel/tools/Makefile.am b/libs/iksemel/tools/Makefile.am
index ab81e66..b7d80e9 100644
--- a/libs/iksemel/tools/Makefile.am
+++ b/libs/iksemel/tools/Makefile.am
@@ -8,11 +8,11 @@ bin_PROGRAMS = ikslint iksroster iksperf
 
 noinst_HEADERS = perf.h
 
-ikslint_LDADD = $(top_builddir)/src/libiksemel.la
+ikslint_LDADD = $(top_builddir)/src/libiksemel.la @SUNCFLAGS@
 ikslint_SOURCES = ikslint.c hash.c
 
-iksroster_LDADD = $(top_builddir)/src/libiksemel.la
+iksroster_LDADD = $(top_builddir)/src/libiksemel.la @SUNCFLAGS@
 iksroster_SOURCES = iksroster.c
 
-iksperf_LDADD = $(top_builddir)/src/libiksemel.la
+iksperf_LDADD = $(top_builddir)/src/libiksemel.la @SUNCFLAGS@
 iksperf_SOURCES = iksperf.c perf.c
committer: cypromis
comments: 
gpg-error is needed on c flags as well on solaris

diff --git a/libs/iksemel/configure.ac b/libs/iksemel/configure.ac
index 1b8af13..7761eb0 100644
--- a/libs/iksemel/configure.ac
+++ b/libs/iksemel/configure.ac
@@ -83,7 +83,7 @@ AC_ARG_ENABLE(64,
 
 if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
     if test "${enable_64}" = "yes"; then
-        CFLAGS="$CFLAGS -m64"
+        CFLAGS="$CFLAGS -m64 -lgpg-error"
         CXXFLAGS="$CXXFLAGS -m64 -lgpg-error"
     fi
 fi
committer: Daniel Swarbrick
comments: 
make mod_snmp module unload more failsafe

diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c
index 040e82b..36a133c 100644
--- a/src/mod/event_handlers/mod_snmp/mod_snmp.c
+++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c
@@ -98,6 +98,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)
 	netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
 
 	init_agent("mod_snmp");
+
+	/*
+	 * Override master/subagent ping interval to 5s, to ensure that
+	 * agent_check_and_process() never blocks for longer than that.
+	 */
+	netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 5);
+
 	init_subagent();  
 	init_snmp("mod_snmp");
 
@@ -107,8 +114,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)
 
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime)
 {
-	/* block on select() */
-	agent_check_and_process(1);
+	while (!globals.shutdown) {
+		/* Block on select() */
+		agent_check_and_process(1);
+	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
committer: Mathieu Rene
comments: 
don't hold loadable_modules.mutex while a module shutdown function is run, so that we do not prevent new channels from being created.

diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c
index 03858ac..d6796c8 100644
--- a/src/switch_loadable_module.c
+++ b/src/switch_loadable_module.c
@@ -1047,20 +1047,24 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir,
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Module is not unloadable.\n");
 			*err = "Module is not unloadable";
 			status = SWITCH_STATUS_NOUNLOAD;
-			goto end;
+			goto unlock;
 		} else {
-			if ((status = do_shutdown(module, SWITCH_TRUE, SWITCH_TRUE, !force, err) != SWITCH_STATUS_SUCCESS)) {
-				goto end;
+			/* Prevent anything from using the module while it's shutting down */
+			switch_core_hash_delete(loadable_modules.module_hash, fname);
+			switch_mutex_unlock(loadable_modules.mutex);
+			if ((status = do_shutdown(module, SWITCH_TRUE, SWITCH_TRUE, !force, err)) != SWITCH_STATUS_SUCCESS) {
+				/* Something went wrong in the module's shutdown function, add it again */
+				switch_core_hash_insert_locked(loadable_modules.module_hash, fname, module, loadable_modules.mutex);
 			}
+			goto end;
 		}
-		switch_core_hash_delete(loadable_modules.module_hash, fname);
 	} else {
 		*err = "No such module!";
 		status = SWITCH_STATUS_FALSE;
 	}
-  end:
+unlock:
 	switch_mutex_unlock(loadable_modules.mutex);
-
+  end:
 	if (force) {
 		switch_yield(1000000);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PHEW!\n");
committer: Jeff Lenk
comments: 
FS-3000 revert previous - flush digits after pin error

diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c
index e6a47bf..472f2d9 100644
--- a/src/mod/applications/mod_conference/mod_conference.c
+++ b/src/mod/applications/mod_conference/mod_conference.c
@@ -5597,7 +5597,6 @@ SWITCH_STANDARD_APP(conference_function)
 			char pin_buf[80] = "";
 			int pin_retries = 3;	/* XXX - this should be configurable - i'm too lazy to do it right now... */
 			int pin_valid = 0;
-			int be_friendly = 0;
 			switch_status_t status = SWITCH_STATUS_SUCCESS;
 			char *supplied_pin_value;
 
@@ -5632,23 +5631,19 @@ SWITCH_STANDARD_APP(conference_function)
 				switch_status_t pstatus = SWITCH_STATUS_FALSE;
 
 				/* be friendly */
-				if (!be_friendly) {
-					if (conference->pin_sound) {
-						pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
-					} else if (conference->tts_engine && conference->tts_voice) {
-						pstatus =
-							switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL);
-					} else {
-						pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL);
-					}
-
-					if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) {
-						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call");
-						switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-					}
+				if (conference->pin_sound) {
+					pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
+				} else if (conference->tts_engine && conference->tts_voice) {
+					pstatus =
+						switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL);
+				} else {
+					pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL);
 				}
 
-				be_friendly = 1;
+				if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) {
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call");
+					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+				}
 
 				/* wait for them if neccessary */
 				if (strlen(pin_buf) < strlen(dpin)) {
@@ -5665,12 +5660,14 @@ SWITCH_STANDARD_APP(conference_function)
 
 				pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, dpin) == 0);
 				if (!pin_valid) {
+					/* zero the collected pin */
+					memset(pin_buf, 0, sizeof(pin_buf));
+
 					/* more friendliness */
 					if (conference->bad_pin_sound) {
-						conference_local_play_file(conference, session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
+						conference_local_play_file(conference, session, conference->bad_pin_sound, 20, NULL, 0);
 					}
-					/* zero the collected pin */
-					memset(pin_buf, 0, sizeof(pin_buf));
+					switch_channel_flush_dtmf(channel);
 				}
 				pin_retries--;
 			}
committer: Anthony Minessale
comments: 
fix unreachable condition with a null args to make any key stop playback/record etc without dequing and remove hard-coded flush digits in play_and_get_digits be sure to flush it yourself before using

diff --git a/src/switch_ivr.c b/src/switch_ivr.c
index 496c29b..a40da1b 100644
--- a/src/switch_ivr.c
+++ b/src/switch_ivr.c
@@ -224,7 +224,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
 		switch_ivr_parse_all_events(session);
 
 
-		if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) {
+		if (args) {
 			switch_dtmf_t dtmf;
 
 			/*
diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c
index 4e9e7b9..dc263e9 100644
--- a/src/switch_ivr_play_say.c
+++ b/src/switch_ivr_play_say.c
@@ -634,7 +634,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
 			break;
 		}
 
-		if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) {
+		if (args) {
 			/*
 			   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
 			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
@@ -862,7 +862,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
 
 		switch_ivr_parse_all_events(session);
 
-		if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) {
+		if (args) {
 			/*
 			   dtmf handler function you can hook up to be executed when a digit is dialed during gentones 
 			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
@@ -1314,7 +1314,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
 
 			switch_ivr_parse_all_events(session);
 
-			if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) {
+			if (args) {
 				/*
 				   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
 				   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
@@ -1875,7 +1875,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
 		switch_status_t status;
 
 		memset(digit_buffer, 0, digit_buffer_length);
-		switch_channel_flush_dtmf(channel);
+
 		status = switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name,
 								 digit_buffer, digit_buffer_length, timeout, valid_terminators, digit_timeout);
 		if (status == SWITCH_STATUS_TIMEOUT && strlen(digit_buffer) >= min_digits) {
@@ -2037,7 +2037,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
 			switch_event_destroy(&event);
 		}
 
-		if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) {
+		if (args) {
 			/* dtmf handler function you can hook up to be executed when a digit is dialed during playback 
 			 * if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
 			 */
========================================================================

Summary of changes:
 .../ftmod_sangoma_isdn_support.c                   |   54 +++----
 libs/iksemel/configure.ac                          |   11 +-
 libs/iksemel/src/Makefile.am                       |    4 +-
 libs/iksemel/tools/Makefile.am                     |    6 +-
 scripts/perl/dhcp-inform.pl                        |    9 +-
 src/mod/applications/mod_commands/mod_commands.c   |   21 ++-
 .../applications/mod_conference/mod_conference.c   |   95 +++++++----
 src/mod/endpoints/mod_loopback/mod_loopback.c      |   24 +--
 src/mod/endpoints/mod_sofia/mod_sofia.c            |    2 +-
 src/mod/endpoints/mod_sofia/sofia.c                |   12 ++
 .../mod_event_socket/mod_event_socket.c            |   68 +++++---
 src/mod/event_handlers/mod_snmp/mod_snmp.c         |   38 ++--
 src/mod/event_handlers/mod_snmp/subagent.c         |  171 ++++++++-----------
 src/mod/event_handlers/mod_snmp/subagent.h         |   14 ++
 src/mod/languages/mod_lua/freeswitch.i             |    1 +
 src/mod/languages/mod_lua/freeswitch_lua.cpp       |   32 +++-
 src/mod/languages/mod_lua/freeswitch_lua.h         |    1 +
 src/mod/languages/mod_lua/mod_lua_wrap.cpp         |  179 ++++++++++++++++++++
 src/switch_channel.c                               |    4 +-
 src/switch_ivr.c                                   |    2 +-
 src/switch_ivr_async.c                             |    1 +
 src/switch_ivr_play_say.c                          |   10 +-
 src/switch_loadable_module.c                       |   16 +-
 w32/Setup/Product.wxs                              |    6 -
 24 files changed, 507 insertions(+), 274 deletions(-)

this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630 --
FreeSWITCH Source