Project "FreeSWITCH user-contributed scripts, etc" received a push.

branch: master updated

  discards  9ff716208ae05c3e9cb55d639243371e8553bb17 (commit)
  discards  a4349bbeba56858b0c17f8b69ed69ecebba0bc58 (commit)
  discards  d93d8a0e353b8a112167961178bffda485356ee7 (commit)
  discards  f192c27939941db18bdf2c543a9e14b21ae16fd0 (commit)
       via: 319c6bf92e7368d4ce0c7bfdd2efb569368579f2 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (9ff716208ae05c3e9cb55d639243371e8553bb17)
            \
             N -- N -- N (319c6bf92e7368d4ce0c7bfdd2efb569368579f2)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.


= COMMIT LOG ===========================================================
committer: Mitch Capper
comments: 
Fixed TLS / secure params and support secure media outbound dialing. Added checks to make sure certs are where they need to be for TLS to work properly.

diff --git a/mitchcapper/FSClient/Account.cs b/mitchcapper/FSClient/Account.cs
index 59f0197..5d86035 100644
--- a/mitchcapper/FSClient/Account.cs
+++ b/mitchcapper/FSClient/Account.cs
@@ -2,6 +2,7 @@
 using System;
 using System.Collections.ObjectModel;
 using System.Linq;
+using System.Windows;
 using System.Xml;
 using FreeSWITCH.Native;
 using System.Xml.Serialization;
@@ -49,15 +50,17 @@ namespace FSClient {
 									new	Field(Field.FIELD_TYPE.String, "SIP URL for Checking Voicemail","sip_check_voicemail_url","","",""),
 									new	Field(Field.FIELD_TYPE.String, "SIP URL for Sending to Voicemail","sip_send_voicemail_url","","",""),
 									new Field(Field.FIELD_TYPE.Bool,"Register","register","register","true",""),
+									new Field(Field.FIELD_TYPE.Combo,"Register Transport","register-transport","register-transport","udp","", "udp","tcp","sctp","tls"),
+									new Field(Field.FIELD_TYPE.Bool,"SIP Secure Media","sip_secure_media","sip_secure_media","false",""),
+
 									new Field(Field.FIELD_TYPE.String,"Proxy","proxy","proxy","","Advanced"),
+									new Field(Field.FIELD_TYPE.Int,"Ping Seconds","ping","ping","30","Advanced"),
 									new Field(Field.FIELD_TYPE.String,"Outbound Proxy","outbound-proxy","outbound-proxy","","Advanced"),
 									new Field(Field.FIELD_TYPE.String,"Register Proxy","register-proxy","register-proxy","","Advanced"),
-									
 									new Field(Field.FIELD_TYPE.Int,"Expire Seconds","expire-seconds","expire-seconds","3600","Advanced"),
 									new Field(Field.FIELD_TYPE.Int,"Retry Seconds","retry-seconds","retry-seconds","30","Advanced"),
-									new Field(Field.FIELD_TYPE.Int,"Ping Seconds","ping","ping","30","Advanced"),
-									new Field(Field.FIELD_TYPE.Combo,"Register Transport","register-transport","register-transport","udp","Advanced", "udp","tcp","sctp","tls"),
-									new Field(Field.FIELD_TYPE.Bool,"SIP Secure Media","sip_secure_media","sip_secure_media","false","")
+									new Field(Field.FIELD_TYPE.String,"Contact Params","contact-params","contact-params","","Advanced")
+
 								  };
 		#region Static Methods
 
@@ -131,10 +134,10 @@ namespace FSClient {
 			ReloadSofia();
 		}
 
-		public static void create_gateway_nodes(XmlNode gateways_node) {
+		public static void create_gateway_nodes(XmlNode gateways_node, bool tls_enabled) {
 			foreach (Account account in accounts) {
 				if (account.enabled)
-					account.create_gateway_node(gateways_node);
+					account.create_gateway_node(gateways_node,tls_enabled);
 			}
 		}
 		public static void HandleGatewayEvent(FSEvent evt) {
@@ -197,7 +200,8 @@ namespace FSClient {
 		public void CreateCall(String number) {
 			if (!enabled)
 				return;
-			PortAudio.Call("sofia/gateway/" + gateway_id + "/" + number);
+			String sec_media = secure_media ? "{sip_secure_media=true}" : "";
+			PortAudio.Call(sec_media + "sofia/gateway/" + gateway_id + "/" + number);
 		}
 		private void KillGateway() {
 			if (!String.IsNullOrEmpty(old_gateway_id))
@@ -269,6 +273,16 @@ namespace FSClient {
 		}
 		private bool _enabled;
 
+		public bool secure_media {
+			get { return _secure_media; }
+			private set {
+				if (value == _secure_media)
+					return;
+				_secure_media = value;
+				RaisePropertyChanged("secure_media");
+			}
+		}
+		private bool _secure_media;
 
 		public string name {
 			get { return _name.value; }
@@ -317,13 +331,22 @@ namespace FSClient {
 				Broker.get_instance().reload_sofia(Sofia.RELOAD_CONFIG_MODE.SOFT);
 
 		}
-		private void create_gateway_node(XmlNode gateways_node) {
+		private void create_gateway_node(XmlNode gateways_node, bool tls_enabled) {
 			XmlNode node = XmlUtils.AddNodeNode(gateways_node, "gateway");
 			XmlUtils.AddNodeAttrib(node, "name", gateway_id);
 			old_gateway_id = gateway_id;
 			foreach (FieldValue value in values) {
-				if (!String.IsNullOrEmpty(value.field.xml_name))
+				if (!String.IsNullOrEmpty(value.field.xml_name)){
+					if (value.field.name == "register-transport" && value.value == "tls" && ! tls_enabled){
+						MessageBox.Show("Warning the register-transport for account: " + name + " is set to tls, however you have tls disabled in your sofia settings this account will be disabled for now");
+						gateways_node.RemoveChild(node);
+						enabled = false;
+						return;
+					}
+					if (value.field.name == "sip_secure_media")
+						secure_media = value.value == "true";
 					Utils.add_xml_param(node, value.field.xml_name, value.value);
+				}
 			}
 			//Was preventing gateway ID from being passed to create_channel so removed (needed for incoming calls)
 			//FieldValue user = FieldValue.GetByName(values, "username");
diff --git a/mitchcapper/FSClient/Sofia.cs b/mitchcapper/FSClient/Sofia.cs
index b3f3b3d..4051172 100644
--- a/mitchcapper/FSClient/Sofia.cs
+++ b/mitchcapper/FSClient/Sofia.cs
@@ -46,11 +46,13 @@ namespace FSClient {
 
 											/*Security*/
 											new Field(Field.FIELD_TYPE.Bool,"TLS","tls","tls","false","Security"),
-											new Field(Field.FIELD_TYPE.Combo,"TLS Version","tls-version","tls-version","tlsv1","Security","tlsv1","sslv23"),
+											new Field(Field.FIELD_TYPE.Combo,"TLS Verify Policy","tls-verify-policy","tls-verify-policy","subjects_out","Security",new Field.FieldOption{display_value="None", value=""},new Field.FieldOption{display_value="Outbound Certificates", value="out"},new Field.FieldOption{display_value="Outbound Certs & Hostnames", value="subjects_out"}),
+											new Field(Field.FIELD_TYPE.Combo,"TLS Version","tls-version","tls-version","sslv23","Security","sslv23","tlsv1"),
 											new Field(Field.FIELD_TYPE.String,"TLS Bind Params","tls-bind-params","tls-bind-params","transport=tls","Security"),
 											new Field(Field.FIELD_TYPE.Int,"TLS SIP Port","tls-sip-port","tls-sip-port","12347","Security"),
-											new Field(Field.FIELD_TYPE.Bool,"Auth All Packets","auth-all-packets","auth-all-packets","false","Security"),
-											new Field(Field.FIELD_TYPE.Bool,"Auth Calls","auth-calls","auth-calls","false","Security"),
+											new Field(Field.FIELD_TYPE.String,"TLS Certificate Directory","tls-cert-dir","tls-cert-dir","conf/ssl","Security"),
+											new Field(Field.FIELD_TYPE.Int,"TLS Max Verify Depth","tls-verify-depth","tls-verify-depth","2","Security"),
+											new Field(Field.FIELD_TYPE.Bool,"TLS No Certificate Date Validation","tls-no-verify-date","tls-no-verify-date","false","Security"),
 
 											/*Advanced*/
 											new Field(Field.FIELD_TYPE.String,"Challenge Realm","challenge-realm","challenge-realm","auto_from","Advanced"),
@@ -66,7 +68,7 @@ namespace FSClient {
 											new Field(Field.FIELD_TYPE.Int,"RTP Hold Timeout Seconds","rtp-hold-timeout-sec","rtp-hold-timeout-sec","1800","Advanced"),
 											new Field(Field.FIELD_TYPE.Int,"RTP Tiemout Seconds","rtp-timeout-sec","rtp-timeout-sec","300","Advanced"),
 											new Field(Field.FIELD_TYPE.String,"RTP Timer Name","rtp-timer-name","rtp-timer-name","soft","Advanced"),
-											
+
 
 
 									   };
@@ -80,18 +82,35 @@ namespace FSClient {
 			XmlNode profile = XmlUtils.AddNodeNode(profiles, "profile");
 			XmlUtils.AddNodeAttrib(profile, "name", "softphone");
 			XmlNode gateways = XmlUtils.AddNodeNode(profile, "gateways");
-			Account.create_gateway_nodes(gateways);
+			Account.create_gateway_nodes(gateways,FieldValue.GetByName(values, "tls").value == "true");
 			XmlNode settings = XmlUtils.AddNodeNode(profile, "settings");
 
 			Utils.add_xml_param(settings, "context", "public");
 			Utils.add_xml_param(settings, "dialplan", "xml");
 			Utils.add_xml_param(settings, "disable-register", "true");
 			foreach (FieldValue value in values) {
-				if (!String.IsNullOrEmpty(value.field.xml_name))
-					Utils.add_xml_param(settings, value.field.xml_name, value.value);
+				if (!String.IsNullOrEmpty(value.field.xml_name)){
+					String param_value = value.value;
+					if (value.field.name == "tls" && value.value == "true") {//lets make sure that we have a cafile.pem
+						
+						String base_dir = FieldValue.GetByName(values, "tls-cert-dir").value;
+						if (String.IsNullOrWhiteSpace(base_dir))
+							base_dir = "conf/ssl";
+								//this is what freeswitch uses by default if its empty, if this changes this code needs to be updated
+						base_dir = base_dir.Replace('/', '\\'); //windows file path
+						if (base_dir[base_dir.Length - 1] != '\\')
+							base_dir += '\\';
+						if (!System.IO.File.Exists(base_dir + "cafile.pem")){
+							MessageBox.Show("Your sofia settings have TLS enabled however you do not have a cafile.pem in your cert folder, this will most likely cause the entire softphone profile not to load so I am disabling TLS in the profile for now");
+							param_value = "false";
+						}
+
+					}
+					Utils.add_xml_param(settings, value.field.xml_name, param_value);
+				}
 			}
 
-
+			DelayedFunction.DelayedCall("SofiaProfileCheck", sofia_profile_check, 1200);
 		}
 
 		public enum RELOAD_CONFIG_MODE {
@@ -106,11 +125,9 @@ namespace FSClient {
 					break;
 				case RELOAD_CONFIG_MODE.HARD:
 					Utils.api_exec("sofia", "profile softphone restart reloadxml");
-					DelayedFunction.DelayedCall("SofiaProfileCheck", sofia_profile_check, 100);
 					break;
 				case RELOAD_CONFIG_MODE.MODULE:
 					Utils.api_exec("reload", "mod_sofia");
-					DelayedFunction.DelayedCall("SofiaProfileCheck", sofia_profile_check, 500);
 					break;
 			}
 		}
========================================================================

Summary of changes:
 hunmonk/jester/conf.lua                    |    1 -
 hunmonk/jester/modules/record/help.lua     |    4 +-
 hunmonk/jester/modules/service/conf.lua    |    5 --
 hunmonk/jester/modules/service/help.lua    |   39 ------------
 hunmonk/jester/modules/service/service.lua |   91 ----------------------------
 mitchcapper/FSClient/Account.cs            |   41 ++++++++++---
 mitchcapper/FSClient/Sofia.cs              |   37 ++++++++---
 7 files changed, 61 insertions(+), 157 deletions(-)
 delete mode 100644 hunmonk/jester/modules/service/conf.lua
 delete mode 100644 hunmonk/jester/modules/service/help.lua
 delete mode 100644 hunmonk/jester/modules/service/service.lua

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 user-contributed scripts, etc