1 /*****************************************************************************\
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** elektronische fernmelder identifikation **
10 \*****************************************************************************/
17 EFI_STATE_BENUTZERDEFINIERTE,
18 EFI_STATE_UNTERDRUECKTE,
19 EFI_STATE_RUFNUMMER_LAUTET,
21 EFI_STATE_ICH_WIEDERHOLE,
25 void EndpointAppPBX::action_init_efi(void)
27 // int language = e_ext.vbox_language;
28 // struct route_param *rparam;
29 struct lcr_msg *message;
30 struct port_list *portlist = ea_endpoint->ep_portlist;
33 if (e_callerinfo.id[0] == '\0') {
34 /* facility rejected */
35 message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT);
36 message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
37 message->param.disconnectinfo.cause = CAUSE_FACILITYREJECTED;
39 logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
40 new_state(EPOINT_STATE_OUT_DISCONNECT);
41 set_tone(portlist,"cause_22");
46 new_state(EPOINT_STATE_CONNECT);
48 /* initialize the vbox */
49 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) initializing efi\n", ea_endpoint->ep_serial);
51 e_efi_state = EFI_STATE_HELLO;
52 set_tone_efi("hello");
58 * the audio file has ended
59 * this is called by Endpoint::message_port(), whenever an audio of has been received
61 void EndpointAppPBX::efi_message_eof(void)
64 char digit[] = "number_00";
65 // struct lcr_msg *message;
66 // struct port_list *portlist = ea_endpoint->ep_portlist;
68 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s end of file during state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
72 e_efi_state = EFI_STATE_DIE;
76 if (e_callerinfo.screen==INFO_SCREEN_USER) {
77 e_efi_state = EFI_STATE_BENUTZERDEFINIERTE;
78 set_tone_efi("benutzerdefinierte");
82 case EFI_STATE_BENUTZERDEFINIERTE:
83 if (e_callerinfo.present==INFO_PRESENT_RESTRICTED) {
84 e_efi_state = EFI_STATE_UNTERDRUECKTE;
85 set_tone_efi("unterdrueckte");
89 case EFI_STATE_UNTERDRUECKTE:
90 e_efi_state = EFI_STATE_RUFNUMMER_LAUTET;
91 set_tone_efi("rufnummer_lautet");
94 case EFI_STATE_RUFNUMMER_LAUTET:
95 e_efi_state = EFI_STATE_DIGIT;
99 digit[8] = numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype, options.national, options.international)[e_efi_digit];
104 // e_efi_state = EFI_STATE_STOP;
105 e_efi_state = EFI_STATE_ICH_WIEDERHOLE;
106 // message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT);
107 // message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
108 // message->param.disconnectinfo.cause = CAUSE_NORMAL;
109 // message_put(message);
110 // logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
111 // new_state(EPOINT_STATE_OUT_DISCONNECT);
112 // set_tone(portlist,"cause_10");
113 set_tone_efi("ich_wiederhole");
117 case EFI_STATE_ICH_WIEDERHOLE:
118 e_efi_state = EFI_STATE_DIE;
126 PERROR("efi_message_eof(ep%d): terminal %s unknown state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
133 * set the given vbox-tone with full path (without appending)
134 * the tone is played and after eof, a message is received
136 void EndpointAppPBX::set_tone_efi(const char *tone)
138 struct lcr_msg *message;
143 if (!ea_endpoint->ep_portlist) {
144 PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
146 message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_TONE);
147 SCPY(message->param.tone.dir, (char *)"tones_efi");
148 SCPY(message->param.tone.name, tone);
149 message_put(message);
151 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set tone '%s'\n", ea_endpoint->ep_serial, e_ext.number, tone);