提交 f22a237b authored 作者: Michael Giagnocavo's avatar Michael Giagnocavo

Start adding some strongly-typed accessors to common channel vars

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14774 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 2a3be1dc
......@@ -48,6 +48,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="ChannelVariables.cs" />
<Compile Include="ManagedSession.cs" />
<Compile Include="Loader.cs" />
<Compile Include="Extensions.cs" />
......
......@@ -52,6 +52,9 @@ namespace FreeSWITCH.Native
/// <summary>Initializes the native ManagedSession. Must be called after Originate.</summary>
public void Initialize()
{
if (allocated == 0) {
Log.WriteLine(LogLevel.Critical, "Cannot initialize a ManagedSession until it is allocated (originated successfully).");
}
// P/Invoke generated function pointers stick around until the delegate is collected
// By sticking the delegates in fields, their lifetime won't be less than the session
// So we don't need to worry about GCHandles and all that....
......@@ -59,6 +62,7 @@ namespace FreeSWITCH.Native
this._inputCallbackRef = inputCallback;
this._hangupCallbackRef = hangupCallback;
InitManagedSession(ManagedSession.getCPtr(this).Handle, this._inputCallbackRef, this._hangupCallbackRef);
this._variables = new ChannelVariables(this);
}
DtmfCallback _inputCallbackRef;
CdeclAction _hangupCallbackRef;
......@@ -122,15 +126,9 @@ namespace FreeSWITCH.Native
get { return this.Ready(); }
}
Guid _uuid;
bool _uuidSet;
public Guid Uuid {
get {
if (!_uuidSet) {
_uuid = new Guid(this.GetUuid());
_uuidSet = true;
}
return _uuid;
return new Guid(this.GetUuid());
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论