/// Callback for a client request for ParcelVoiceInfo
public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
UUID agentID, Caps caps)
{
m_log.Info("[MurmurVoice]: Calling ParcelVoiceInfoRequest...");
try
{
ScenePresence avatar = scene.GetScenePresence(agentID);
LLSDParcelVoiceInfoResponse parcelVoiceInfo;
string channel_uri = String.Empty;
if (null == scene.LandChannel)
throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available",
scene.RegionInfo.RegionName, avatar.Name));
// get channel_uri: check first whether estate
// settings allow voice, then whether parcel allows
// voice, if all do retrieve or obtain the parcel
// voice channel
LandData land = scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
m_log.DebugFormat("[MurmurVoice]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}",
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatar.Name, request, path, param);
if ( ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) > 0) && scene.RegionInfo.EstateSettings.AllowVoice )
{
Agent agent = m_manager.Agent.GetOrCreate(agentID);
string RegionName = scene.RegionInfo.RegionName;
if(m_RegionParents.ContainsKey(RegionName))
{
int RParent = m_RegionParents[RegionName];
agent.channel = m_manager.Channel.GetOrCreate(ChannelName(scene, land),RParent);
// Host/port pair for voice server
channel_uri = String.Format("{0}:{1}", m_murmurd_exthost, m_murmurd_port);
m_log.InfoFormat("[MurmurVoice]: {0}", channel_uri);
m_callback.AddUserToChan(agent);
}
else
m_log.DebugFormat("[MurmurVoice]: Region Parent channel not found: {0}",RegionName);
} else {
m_log.DebugFormat("[MurmurVoice]: Voice not enabled.");
}
Hashtable creds = new Hashtable();
creds["channel_uri"] = channel_uri;
parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds);
string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
m_log.InfoFormat("[MurmurVoice]: Parcel: {0}", r);
return r;
}
catch (Exception e)
{
m_log.ErrorFormat("[MurmurVoice]: Exception: " + e.ToString());
return "<llsd><undef /></llsd>";
}
}