aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs192
1 files changed, 95 insertions, 97 deletions
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");