X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=action_efi.cpp;h=b0f3cadaa92f96474edd6a8abc0634c53654dead;hp=ce0253f634e180d04bf633fae1745c6e21d4e931;hb=5566f74eb29be75da44e29ba72ee6f015249ce61;hpb=2ed0fee489c37a6e2d4473f6185ebbe3e746ac11 diff --git a/action_efi.cpp b/action_efi.cpp index ce0253f..b0f3cad 100644 --- a/action_efi.cpp +++ b/action_efi.cpp @@ -9,16 +9,10 @@ ** ** \*****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include #include "main.h" enum { + EFI_STATE_HELLO, EFI_STATE_DIE, EFI_STATE_BENUTZERDEFINIERTE, EFI_STATE_UNTERDRUECKTE, @@ -32,18 +26,17 @@ void EndpointAppPBX::action_init_efi(void) { // int language = e_ext.vbox_language; // struct route_param *rparam; - struct message *message; + struct lcr_msg *message; struct port_list *portlist = ea_endpoint->ep_portlist; /* if no caller id */ - if (e_callerinfo.id[0] == '\0') - { + if (e_callerinfo.id[0] == '\0') { /* facility rejected */ message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT); message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL; message->param.disconnectinfo.cause = CAUSE_FACILITYREJECTED; message_put(message); - logmessage(message); + logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT); new_state(EPOINT_STATE_OUT_DISCONNECT); set_tone(portlist,"cause_22"); return; @@ -55,8 +48,8 @@ void EndpointAppPBX::action_init_efi(void) /* initialize the vbox */ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) initializing efi\n", ea_endpoint->ep_serial); - e_efi_state = EFI_STATE_DIE; - set_tone_efi("die"); + e_efi_state = EFI_STATE_HELLO; + set_tone_efi("hello"); e_efi_digit = 0; } @@ -69,24 +62,25 @@ void EndpointAppPBX::efi_message_eof(void) { // char buffer[32]; char digit[] = "number_00"; - struct message *message; - struct port_list *portlist = ea_endpoint->ep_portlist; +// struct lcr_msg *message; +// struct port_list *portlist = ea_endpoint->ep_portlist; - PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s end of file during state: %d\n", ea_endpoint->ep_serial, e_terminal, e_vbox_state); + PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s end of file during state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state); - switch(e_efi_state) - { + switch(e_efi_state) { + case EFI_STATE_HELLO: + e_efi_state = EFI_STATE_DIE; + set_tone_efi("die"); + break; case EFI_STATE_DIE: - if (e_callerinfo.screen==INFO_SCREEN_USER) - { + if (e_callerinfo.screen==INFO_SCREEN_USER) { e_efi_state = EFI_STATE_BENUTZERDEFINIERTE; set_tone_efi("benutzerdefinierte"); break; } // fall through case EFI_STATE_BENUTZERDEFINIERTE: - if (e_callerinfo.present==INFO_PRESENT_RESTRICTED) - { + if (e_callerinfo.present==INFO_PRESENT_RESTRICTED) { e_efi_state = EFI_STATE_UNTERDRUECKTE; set_tone_efi("unterdrueckte"); break; @@ -102,22 +96,21 @@ void EndpointAppPBX::efi_message_eof(void) e_efi_digit = 0; // fall through case EFI_STATE_DIGIT: - digit[8] = numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype)[e_efi_digit]; - if (digit[8]) - { + digit[8] = numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype, options.national, options.international)[e_efi_digit]; + if (digit[8]) { set_tone_efi(digit); e_efi_digit++; - } else - { - e_efi_state = EFI_STATE_STOP; //EFI_STATE_ICH_WIEDERHOLE; - message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT); - message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL; - message->param.disconnectinfo.cause = CAUSE_NORMAL; - message_put(message); - logmessage(message); - new_state(EPOINT_STATE_OUT_DISCONNECT); - set_tone(portlist,"cause_10"); -// set_tone_efi("ich_wiederhole"); + } else { +// e_efi_state = EFI_STATE_STOP; + e_efi_state = EFI_STATE_ICH_WIEDERHOLE; +// message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT); +// message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL; +// message->param.disconnectinfo.cause = CAUSE_NORMAL; +// message_put(message); +// logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT); +// new_state(EPOINT_STATE_OUT_DISCONNECT); +// set_tone(portlist,"cause_10"); + set_tone_efi("ich_wiederhole"); } break; @@ -130,7 +123,7 @@ void EndpointAppPBX::efi_message_eof(void) break; default: - PERROR("efi_message_eof(ep%d): terminal %s unknown state: %d\n", ea_endpoint->ep_serial, e_terminal, e_vbox_state); + PERROR("efi_message_eof(ep%d): terminal %s unknown state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state); } } @@ -140,15 +133,14 @@ void EndpointAppPBX::efi_message_eof(void) * set the given vbox-tone with full path (without appending) * the tone is played and after eof, a message is received */ -void EndpointAppPBX::set_tone_efi(char *tone) +void EndpointAppPBX::set_tone_efi(const char *tone) { - struct message *message; + struct lcr_msg *message; if (tone == NULL) tone = ""; - if (!ea_endpoint->ep_portlist) - { + if (!ea_endpoint->ep_portlist) { PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial); } message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_TONE); @@ -156,6 +148,6 @@ void EndpointAppPBX::set_tone_efi(char *tone) SCPY(message->param.tone.name, tone); message_put(message); - PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set tone '%s'\n", ea_endpoint->ep_serial, e_terminal, tone); + PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set tone '%s'\n", ea_endpoint->ep_serial, e_ext.number, tone); }