提交 21b83483 authored 作者: João Mesquita's avatar João Mesquita

We are able to see the board events already. We see the call getting to the far…

We are able to see the board events already. We see the call getting to the far end! But... still no audio treatment.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/scripts/contrib@13772 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 cdf1802b
...@@ -130,6 +130,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int ...@@ -130,6 +130,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
/* My function prototypes */ /* My function prototypes */
static void printBoardsInfo(switch_stream_handle_t*); static void printBoardsInfo(switch_stream_handle_t*);
static const char* linkStatus(unsigned int device, unsigned int link); static const char* linkStatus(unsigned int device, unsigned int link);
static int32 Kstdcall EventCallBack(int32 obj, K3L_EVENT * e);
...@@ -661,13 +662,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load) ...@@ -661,13 +662,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting K3L...\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting K3L...\n");
try { try {
k3l->start(); k3l->start();
} catch (...) { } catch (K3LAPI::start_failed & e) {
/* TODO: Catch the proper error and display it. */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "K3L not started. Reason:%s.\n", e.msg.c_str());
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "K3L not started.");
return SWITCH_STATUS_TERM; return SWITCH_STATUS_TERM;
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "K3L started.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "K3L started.\n");
k3lRegisterEventHandler( EventCallBack );
/* Add all the specific API functions */ /* Add all the specific API functions */
SWITCH_ADD_API(api_interface, "khomp", "Khomp Menu", khomp, KHOMP_SYNTAX); SWITCH_ADD_API(api_interface, "khomp", "Khomp Menu", khomp, KHOMP_SYNTAX);
...@@ -930,6 +932,27 @@ static void printBoardsInfo(switch_stream_handle_t* stream) { ...@@ -930,6 +932,27 @@ static void printBoardsInfo(switch_stream_handle_t* stream) {
/* End of helper functions */ /* End of helper functions */
static int32 Kstdcall EventCallBack(int32 obj, K3L_EVENT * e)
{
/* TODO: We should hash things to make it statful */
switch(e->Code)
{
case EV_NEW_CALL:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New call on %u to %s.\n", obj, k3l->get_param(e, "dest_addr").c_str());
break;
case EV_DISCONNECT:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Called party dropped the call on: %u. Releasing channel.\n", obj);
k3l->command(e->DeviceId, obj, CM_DISCONNECT, NULL);
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New Event has just arrived on %u with untreated code: %x\n", obj, e->Code);
break;
}
return ksSuccess;
}
/* For Emacs: /* For Emacs:
* Local Variables: * Local Variables:
* mode:c * mode:c
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论