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

hangup handler should run in cs_reporting

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15375 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 7755f638
...@@ -162,7 +162,7 @@ namespace FreeSWITCH.Native ...@@ -162,7 +162,7 @@ namespace FreeSWITCH.Native
switch_state_handler_table originate_table; switch_state_handler_table originate_table;
GCHandle originate_keepalive_handle; // Make sure the B Leg is not collected and disposed until we run ondestroy GCHandle originate_keepalive_handle; // Make sure the B Leg is not collected and disposed until we run ondestroy
switch_status_t originate_onhangup_method(IntPtr channelPtr) { switch_status_t originate_ondestroy_method(IntPtr channelPtr) {
// CS_DESTROY lets the bleg be collected // CS_DESTROY lets the bleg be collected
// and frees originate_table memory // and frees originate_table memory
// Note that this (bleg ManagedSession) is invalid // Note that this (bleg ManagedSession) is invalid
...@@ -179,19 +179,19 @@ namespace FreeSWITCH.Native ...@@ -179,19 +179,19 @@ namespace FreeSWITCH.Native
/// <summary> /// <summary>
/// Performs originate. Returns ManagedSession on success, null on failure. /// Performs originate. Returns ManagedSession on success, null on failure.
/// onHangup is called as a state handler, after the channel is truly hungup. /// onHangup is called as a state handler, after the channel is truly hungup (CS_REPORTING).
/// </summary> /// </summary>
public static ManagedSession OriginateHandleHangup(CoreSession aLegSession, string destination, TimeSpan timeout, Action<ManagedSession> onHangup) { public static ManagedSession OriginateHandleHangup(CoreSession aLegSession, string destination, TimeSpan timeout, Action<ManagedSession> onHangup) {
var bleg = new ManagedSession(); var bleg = new ManagedSession();
bleg.originate_ondestroy_delegate = bleg.originate_onhangup_method; bleg.originate_ondestroy_delegate = bleg.originate_ondestroy_method;
bleg.originate_onhangup_delegate = CreateStateHandlerDelegate(sess_b => { bleg.originate_onhangup_delegate = CreateStateHandlerDelegate(sess_b => {
if (onHangup != null) { if (onHangup != null) {
onHangup(sess_b); onHangup(sess_b);
} }
}); });
bleg.originate_table = new switch_state_handler_table(); bleg.originate_table = new switch_state_handler_table();
bleg.originate_table.on_hangup = WrapStateHandlerDelegate(bleg.originate_onhangup_delegate); bleg.originate_table.on_reporting = WrapStateHandlerDelegate(bleg.originate_onhangup_delegate);
bleg.originate_table.on_destroy = WrapStateHandlerDelegate(bleg.originate_ondestroy_delegate); bleg.originate_table.on_destroy = WrapStateHandlerDelegate(bleg.originate_ondestroy_delegate);
bleg.originate_table.flags = (int)switch_state_handler_flag_t.SSH_FLAG_STICKY; bleg.originate_table.flags = (int)switch_state_handler_flag_t.SSH_FLAG_STICKY;
var res = 0 == bleg.originate(aLegSession, destination, (int)timeout.TotalSeconds, bleg.originate_table); var res = 0 == bleg.originate(aLegSession, destination, (int)timeout.TotalSeconds, bleg.originate_table);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论