提交 139291f9 authored 作者: Mathieu Parent's avatar Mathieu Parent

Skinny: Rework of buttons

- Refactorize line/speed-dial info (with getters)
- Set calling/called party when known
- Don't recreate session on existing
- Lower some debug messages (SQL, messages send/received)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16790 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 900c50fd
......@@ -183,7 +183,7 @@ void skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_mutex_t *mu
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
goto end;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SQL: %s\n", sql);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", sql);
switch_core_db_persistant_execute(db, sql, 1);
switch_core_db_close(db);
}
......@@ -213,7 +213,7 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile,
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
goto end;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SQL: %s\n", sql);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", sql);
switch_core_db_exec(db, sql, callback, pdata, &errmsg);
if (errmsg) {
......@@ -334,9 +334,11 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
tech_pvt->read_impl.microseconds_per_packet,
tech_pvt->read_impl.samples_per_packet
) != SWITCH_STATUS_SUCCESS) {
/* TODO
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
*/
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(tech_pvt->session);
assert(channel != NULL);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
}
......@@ -383,6 +385,8 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
void tech_init(private_t *tech_pvt, switch_core_session_t *session, listener_t *listener, uint32_t line)
{
struct line_stat_res_message *button = NULL;
switch_assert(tech_pvt);
switch_assert(session);
switch_assert(listener);
......@@ -396,6 +400,11 @@ void tech_init(private_t *tech_pvt, switch_core_session_t *session, listener_t *
tech_pvt->line = line;
switch_core_session_set_private(session, tech_pvt);
tech_pvt->session = session;
skinny_line_get(listener, line, &button);
tech_pvt->line_name = switch_core_strdup(listener->pool, button->name);
tech_pvt->line_shortname = switch_core_strdup(listener->pool, button->shortname);
tech_pvt->line_displayname = switch_core_strdup(listener->pool, button->displayname);
}
/*
......
......@@ -164,6 +164,9 @@ struct private_object {
uint32_t line;
uint32_t call_id;
uint32_t party_id;
char *line_name;
char *line_shortname;
char *line_displayname;
char dest[10];
/* codec */
char *iananame;
......
......@@ -669,6 +669,9 @@ switch_status_t skinny_create_session(listener_t *listener, uint32_t line, uint3
switch_status_t skinny_process_dest(listener_t *listener, uint32_t line);
switch_status_t skinny_answer(switch_core_session_t *session);
void skinny_line_get(listener_t *listener, uint32_t instance, struct line_stat_res_message **button);
void skinny_speed_dial_get(listener_t *listener, uint32_t instance, struct speed_dial_stat_res_message **button);
switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply);
#define skinny_send_reply(listener, reply) skinny_perform_send_reply(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论