Skinny: Handle backspace

This commit is contained in:
Mathieu Parent 2010-04-15 10:54:01 +02:00
parent 7074b07603
commit e44d79192f
4 changed files with 28 additions and 2 deletions

View File

@ -606,6 +606,7 @@ switch_status_t skinny_session_process_dest(switch_core_session_t *session, list
if (!dest) {
if (backspace) { /* backspace */
*tech_pvt->caller_profile->destination_number++ = '\0';
send_back_space_request(listener, line_instance, tech_pvt->call_id);
}
if (append_dest != '\0' && !backspace) {/* append digit */
tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool,
@ -615,7 +616,6 @@ switch_status_t skinny_session_process_dest(switch_core_session_t *session, list
send_start_tone(listener, SKINNY_TONE_DIALTONE, 0, line_instance, tech_pvt->call_id);
if(backspace) {
send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_OFF_HOOK, 0xffff);
/* TODO: How to clear the screen? */
}
} else if (strlen(tech_pvt->caller_profile->destination_number) == 1) {/* first digit */
send_stop_tone(listener, line_instance, tech_pvt->call_id);
@ -1476,6 +1476,20 @@ switch_status_t send_activate_call_plane(listener_t *listener,
return skinny_send_reply(listener, message);
}
switch_status_t send_back_space_request(listener_t *listener,
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.back_space_req));
message->type = BACK_SPACE_REQ_MESSAGE;
message->length = 4 + sizeof(message->data.back_space_req);
message->data.back_space_req.line_instance = line_instance;
message->data.back_space_req.call_id = call_id;
return skinny_send_reply(listener, message);
}
switch_status_t send_dialed_number(listener_t *listener,
char called_party[24],
uint32_t line_instance,

View File

@ -457,6 +457,13 @@ struct unregister_ack_message {
uint32_t unregister_status;
};
/* BackSpaceReqMessage */
#define BACK_SPACE_REQ_MESSAGE 0x0119
struct back_space_req_message {
uint32_t line_instance;
uint32_t call_id;
};
/* DialedNumberMessage */
#define DIALED_NUMBER_MESSAGE 0x011D
struct dialed_number_message {
@ -540,6 +547,7 @@ union skinny_data {
struct clear_prompt_status_message clear_prompt_status;
struct activate_call_plane_message activate_call_plane;
struct unregister_ack_message unregister_ack;
struct back_space_req_message back_space_req;
struct dialed_number_message dialed_number;
struct feature_stat_res_message feature_res;
struct display_pri_notify_message display_pri_notify;
@ -748,6 +756,9 @@ switch_status_t send_clear_prompt_status(listener_t *listener,
uint32_t call_id);
switch_status_t send_activate_call_plane(listener_t *listener,
uint32_t line_instance);
switch_status_t send_back_space_request(listener_t *listener,
uint32_t line_instance,
uint32_t call_id);
switch_status_t send_dialed_number(listener_t *listener,
char called_party[24],
uint32_t line_instance,

View File

@ -86,6 +86,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
{"ClearPromptStatusMessage", CLEAR_PROMPT_STATUS_MESSAGE},
{"ActivateCallPlaneMessage", ACTIVATE_CALL_PLANE_MESSAGE},
{"UnregisterAckMessage", UNREGISTER_ACK_MESSAGE},
{"BackSpaceReqMessage", BACK_SPACE_REQ_MESSAGE},
{"DialedNumberMessage", DIALED_NUMBER_MESSAGE},
{"FeatureResMessage", FEATURE_STAT_RES_MESSAGE},
{"DisplayPriNotifyMessage", DISPLAY_PRI_NOTIFY_MESSAGE},

View File

@ -84,7 +84,7 @@ uint32_t func(const char *str)\
}
struct skinny_table SKINNY_MESSAGE_TYPES[56];
struct skinny_table SKINNY_MESSAGE_TYPES[57];
const char *skinny_message_type2str(uint32_t id);
uint32_t skinny_str2message_type(const char *str);
#define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES)