aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice
diff options
context:
space:
mode:
authorJeff Ames2009-07-23 15:32:11 +0000
committerJeff Ames2009-07-23 15:32:11 +0000
commita133e83f3ab38ad7abf0b3c591421d3eac418c0c (patch)
tree0c0de3d37510a54d8668402d310fc0cf7e8c255d /OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice
parentMinor: rename libsl to libomv in Contributors.txt. (diff)
downloadopensim-SC_OLD-a133e83f3ab38ad7abf0b3c591421d3eac418c0c.zip
opensim-SC_OLD-a133e83f3ab38ad7abf0b3c591421d3eac418c0c.tar.gz
opensim-SC_OLD-a133e83f3ab38ad7abf0b3c591421d3eac418c0c.tar.bz2
opensim-SC_OLD-a133e83f3ab38ad7abf0b3c591421d3eac418c0c.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs78
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs192
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs4
3 files changed, 136 insertions, 138 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
index d34b6f1..bb3dca5 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
36 public class FreeSwitchDialplan 36 public class FreeSwitchDialplan
37 { 37 {
38 private static readonly ILog m_log = 38 private static readonly ILog m_log =
39 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 40
41 41
42 public Hashtable HandleDialplanRequest(string Context, string Realm, Hashtable request) 42 public Hashtable HandleDialplanRequest(string Context, string Realm, Hashtable request)
@@ -54,50 +54,50 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
54 response["content_type"] = "text/xml"; 54 response["content_type"] = "text/xml";
55 response["keepalive"] = false; 55 response["keepalive"] = false;
56 response["int_response_code"] = 200; 56 response["int_response_code"] = 200;
57 if ( Context != requestcontext ) 57 if (Context != requestcontext)
58 { 58 {
59 m_log.Debug("[FreeSwitchDirectory] returning empty as it's for another context"); 59 m_log.Debug("[FreeSwitchDirectory] returning empty as it's for another context");
60 response["str_response_string"] = ""; 60 response["str_response_string"] = "";
61 } else { 61 } else {
62 response["str_response_string"] = String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?> 62 response["str_response_string"] = String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
63 <document type=""freeswitch/xml""> 63 <document type=""freeswitch/xml"">
64 <section name=""dialplan""> 64 <section name=""dialplan"">
65 <context name=""{0}"">" + 65 <context name=""{0}"">" +
66 66
67/* <!-- dial via SIP uri --> 67/* <!-- dial via SIP uri -->
68 <extension name=""sip_uri""> 68 <extension name=""sip_uri"">
69 <condition field=""destination_number"" expression=""^sip:(.*)$""> 69 <condition field=""destination_number"" expression=""^sip:(.*)$"">
70 <action application=""bridge"" data=""sofia/${use_profile}/$1""/> 70 <action application=""bridge"" data=""sofia/${use_profile}/$1""/>
71 <!--<action application=""bridge"" data=""$1""/>--> 71 <!--<action application=""bridge"" data=""$1""/>-->
72 </condition> 72 </condition>
73 </extension>*/ 73 </extension>*/
74 74
75 @"<extension name=""opensim_conferences""> 75 @"<extension name=""opensim_conferences"">
76 <condition field=""destination_number"" expression=""^confctl-(.*)$""> 76 <condition field=""destination_number"" expression=""^confctl-(.*)$"">
77 <action application=""answer""/> 77 <action application=""answer""/>
78 <action application=""conference"" data=""$1-{1}@grid""/> 78 <action application=""conference"" data=""$1-{1}@grid""/>
79 </condition> 79 </condition>
80 </extension> 80 </extension>
81 81
82 <extension name=""opensim_conf""> 82 <extension name=""opensim_conf"">
83 <condition field=""destination_number"" expression=""^conf-(.*)$""> 83 <condition field=""destination_number"" expression=""^conf-(.*)$"">
84 <action application=""answer""/> 84 <action application=""answer""/>
85 <action application=""conference"" data=""$1-${domain_name}@default""/> 85 <action application=""conference"" data=""$1-${domain_name}@default""/>
86 </condition> 86 </condition>
87 </extension> 87 </extension>
88 88
89 <extension name=""avatar""> 89 <extension name=""avatar"">
90 <condition field=""destination_number"" expression=""^(x.*)$""> 90 <condition field=""destination_number"" expression=""^(x.*)$"">
91 <action application=""bridge"" data=""user/$1""/> 91 <action application=""bridge"" data=""user/$1""/>
92 </condition> 92 </condition>
93 </extension> 93 </extension>
94 94
95 </context> 95 </context>
96 </section> 96 </section>
97 </document>", Context, Realm); 97 </document>", Context, Realm);
98 } 98 }
99 99
100 return response; 100 return response;
101 } 101 }
102 } 102 }
103 103
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index af5692c..5d90a8f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -40,109 +40,108 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
40 40
41 public Hashtable HandleDirectoryRequest(string Context, string Realm, Hashtable request) 41 public Hashtable HandleDirectoryRequest(string Context, string Realm, Hashtable request)
42 { 42 {
43 Hashtable response = new Hashtable(); 43 Hashtable response = new Hashtable();
44 string domain = (string) request["domain"]; 44 string domain = (string) request["domain"];
45 if ( domain != Realm ) { 45 if (domain != Realm) {
46 response["content_type"] = "text/xml"; 46 response["content_type"] = "text/xml";
47 response["keepalive"] = false; 47 response["keepalive"] = false;
48 response["int_response_code"] = 200; 48 response["int_response_code"] = 200;
49 response["str_response_string"] = ""; 49 response["str_response_string"] = "";
50 } else { 50 } else {
51 m_log.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}",request.ToString()); 51 m_log.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}",request.ToString());
52 52
53 53 // information in the request we might be interested in
54 // information in the request we might be interested in
55 54
56 // Request 1 sip_auth for users account 55 // Request 1 sip_auth for users account
57 56
58 //Event-Calling-Function=sofia_reg_parse_auth 57 //Event-Calling-Function=sofia_reg_parse_auth
59 //Event-Calling-Line-Number=1494 58 //Event-Calling-Line-Number=1494
60 //action=sip_auth 59 //action=sip_auth
61 //sip_user_agent=Vivox-SDK-2.1.3010.6151-Mac%20(Feb-11-2009/16%3A42%3A41) 60 //sip_user_agent=Vivox-SDK-2.1.3010.6151-Mac%20(Feb-11-2009/16%3A42%3A41)
62 //sip_auth_username=xhZuXKmRpECyr2AARJYyGgg%3D%3D (==) 61 //sip_auth_username=xhZuXKmRpECyr2AARJYyGgg%3D%3D (==)
63 //sip_auth_realm=9.20.151.43 62 //sip_auth_realm=9.20.151.43
64 //sip_contact_user=xhZuXKmRpECyr2AARJYyGgg%3D%3D (==) 63 //sip_contact_user=xhZuXKmRpECyr2AARJYyGgg%3D%3D (==)
65 //sip_contact_host=192.168.0.3 // this shouldnt really be a local IP, investigate STUN servers 64 //sip_contact_host=192.168.0.3 // this shouldnt really be a local IP, investigate STUN servers
66 //sip_to_user=xhZuXKmRpECyr2AARJYyGgg%3D%3D 65 //sip_to_user=xhZuXKmRpECyr2AARJYyGgg%3D%3D
67 //sip_to_host=9.20.151.43 66 //sip_to_host=9.20.151.43
68 //sip_auth_method=REGISTER 67 //sip_auth_method=REGISTER
69 //user=xhZuXKmRpECyr2AARJYyGgg%3D%3D 68 //user=xhZuXKmRpECyr2AARJYyGgg%3D%3D
70 //domain=9.20.151.43 69 //domain=9.20.151.43
71 //ip=9.167.220.137 // this is the correct IP rather than sip_contact_host above when through a vpn or NAT setup 70 //ip=9.167.220.137 // this is the correct IP rather than sip_contact_host above when through a vpn or NAT setup
72 71
73 foreach (DictionaryEntry item in request) 72 foreach (DictionaryEntry item in request)
74 { 73 {
75 m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}", item.Key, item.Value); 74 m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}", item.Key, item.Value);
76 } 75 }
77 76
78 string eventCallingFunction = (string) request["Event-Calling-Function"]; 77 string eventCallingFunction = (string) request["Event-Calling-Function"];
79 if (eventCallingFunction == null) 78 if (eventCallingFunction == null)
80 { 79 {
81 eventCallingFunction = "sofia_reg_parse_auth"; 80 eventCallingFunction = "sofia_reg_parse_auth";
82 } 81 }
83 82
84 if (eventCallingFunction.Length == 0) 83 if (eventCallingFunction.Length == 0)
85 { 84 {
86 eventCallingFunction = "sofia_reg_parse_auth"; 85 eventCallingFunction = "sofia_reg_parse_auth";
87 } 86 }
88 87
89 if (eventCallingFunction == "sofia_reg_parse_auth") 88 if (eventCallingFunction == "sofia_reg_parse_auth")
90 { 89 {
91 string sipAuthMethod = (string)request["sip_auth_method"]; 90 string sipAuthMethod = (string)request["sip_auth_method"];
92 91
93 if (sipAuthMethod == "REGISTER") 92 if (sipAuthMethod == "REGISTER")
94 { 93 {
95 response = HandleRegister(Context, Realm, request); 94 response = HandleRegister(Context, Realm, request);
96 } 95 }
97 else if (sipAuthMethod == "INVITE") 96 else if (sipAuthMethod == "INVITE")
98 { 97 {
99 response = HandleInvite(Context, Realm, request); 98 response = HandleInvite(Context, Realm, request);
100 } 99 }
101 else 100 else
102 { 101 {
103 m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod); 102 m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
104 response["int_response_code"] = 404; 103 response["int_response_code"] = 404;
105 response["content_type"] = "text/xml"; 104 response["content_type"] = "text/xml";
106 response["str_response_string"] = ""; 105 response["str_response_string"] = "";
107 } 106 }
108 } 107 }
109 else if (eventCallingFunction == "switch_xml_locate_user") 108 else if (eventCallingFunction == "switch_xml_locate_user")
110 { 109 {
111 response = HandleLocateUser(Realm, request); 110 response = HandleLocateUser(Realm, request);
112 } 111 }
113 else if (eventCallingFunction == "user_data_function") // gets called when an avatar to avatar call is made 112 else if (eventCallingFunction == "user_data_function") // gets called when an avatar to avatar call is made
114 { 113 {
115 response = HandleLocateUser(Realm, request); 114 response = HandleLocateUser(Realm, request);
116 } 115 }
117 else if (eventCallingFunction == "user_outgoing_channel") 116 else if (eventCallingFunction == "user_outgoing_channel")
118 { 117 {
119 response = HandleRegister(Context, Realm, request); 118 response = HandleRegister(Context, Realm, request);
120 } 119 }
121 else if (eventCallingFunction == "config_sofia") // happens once on freeswitch startup 120 else if (eventCallingFunction == "config_sofia") // happens once on freeswitch startup
122 { 121 {
123 response = HandleConfigSofia(Context, Realm, request); 122 response = HandleConfigSofia(Context, Realm, request);
124 } 123 }
125 else if (eventCallingFunction == "switch_load_network_lists") 124 else if (eventCallingFunction == "switch_load_network_lists")
126 { 125 {
127 //response = HandleLoadNetworkLists(request); 126 //response = HandleLoadNetworkLists(request);
128 response["int_response_code"] = 404; 127 response["int_response_code"] = 404;
129 response["keepalive"] = false; 128 response["keepalive"] = false;
130 response["content_type"] = "text/xml"; 129 response["content_type"] = "text/xml";
131 response["str_response_string"] = ""; 130 response["str_response_string"] = "";
132 } 131 }
133 else 132 else
134 { 133 {
135 m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction); 134 m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction);
136 response["int_response_code"] = 404; 135 response["int_response_code"] = 404;
137 response["keepalive"] = false; 136 response["keepalive"] = false;
138 response["content_type"] = "text/xml"; 137 response["content_type"] = "text/xml";
139 response["str_response_string"] = ""; 138 response["str_response_string"] = "";
140 } 139 }
141 } 140 }
142 return response; 141 return response;
143 } 142 }
144 143
145 private Hashtable HandleRegister(string Context, string Realm, Hashtable request) 144 private Hashtable HandleRegister(string Context, string Realm, Hashtable request)
146 { 145 {
147 m_log.Info("[FreeSwitchDirectory] HandleRegister called"); 146 m_log.Info("[FreeSwitchDirectory] HandleRegister called");
148 147
@@ -156,7 +155,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
156 response["keepalive"] = false; 155 response["keepalive"] = false;
157 response["int_response_code"] = 200; 156 response["int_response_code"] = 200;
158 157
159 response["str_response_string"] = String.Format( 158 response["str_response_string"] = String.Format(
160 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + 159 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
161 "<document type=\"freeswitch/xml\">\r\n" + 160 "<document type=\"freeswitch/xml\">\r\n" +
162 "<section name=\"directory\" description=\"User Directory\">\r\n" + 161 "<section name=\"directory\" description=\"User Directory\">\r\n" +
@@ -225,8 +224,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
225 224
226 return response; 225 return response;
227 } 226 }
228 227
229
230 private Hashtable HandleLocateUser(String Realm, Hashtable request) 228 private Hashtable HandleLocateUser(String Realm, Hashtable request)
231 { 229 {
232 m_log.Info("[FreeSwitchDirectory] HandleLocateUser called"); 230 m_log.Info("[FreeSwitchDirectory] HandleLocateUser called");
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 3659299..de12b0a 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
95 // private static IPEndPoint m_FreeSwitchServiceIP; 95 // private static IPEndPoint m_FreeSwitchServiceIP;
96 private int m_freeSwitchServicePort; 96 private int m_freeSwitchServicePort;
97 private string m_openSimWellKnownHTTPAddress; 97 private string m_openSimWellKnownHTTPAddress;
98 private string m_freeSwitchContext; 98 private string m_freeSwitchContext;
99 99
100 private FreeSwitchDirectory m_FreeSwitchDirectory; 100 private FreeSwitchDirectory m_FreeSwitchDirectory;
101 private FreeSwitchDialplan m_FreeSwitchDialplan; 101 private FreeSwitchDialplan m_FreeSwitchDialplan;
@@ -152,7 +152,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
152 m_freeSwitchDefaultTimeout = m_config.GetInt("freeswitch_default_timeout", 5000); 152 m_freeSwitchDefaultTimeout = m_config.GetInt("freeswitch_default_timeout", 5000);
153 // m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120); 153 // m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
154 m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty); 154 m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
155 m_freeSwitchContext = m_config.GetString("freeswitch_context", "public"); 155 m_freeSwitchContext = m_config.GetString("freeswitch_context", "public");
156 156
157 if (String.IsNullOrEmpty(m_freeSwitchServerUser) || 157 if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
158 String.IsNullOrEmpty(m_freeSwitchServerPass) || 158 String.IsNullOrEmpty(m_freeSwitchServerPass) ||