1 /*****************************************************************************\
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** elektronische fernmelder identifikation **
10 \*****************************************************************************/
14 #include <sys/types.h>
24 EFI_STATE_BENUTZERDEFINIERTE,
25 EFI_STATE_UNTERDRUECKTE,
26 EFI_STATE_RUFNUMMER_LAUTET,
28 EFI_STATE_ICH_WIEDERHOLE,
32 void EndpointAppPBX::action_init_efi(void)
34 // int language = e_ext.vbox_language;
35 // struct route_param *rparam;
36 struct lcr_msg *message;
37 struct port_list *portlist = ea_endpoint->ep_portlist;
40 if (e_callerinfo.id[0] == '\0')
42 /* facility rejected */
43 message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT);
44 message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
45 message->param.disconnectinfo.cause = CAUSE_FACILITYREJECTED;
47 logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
48 new_state(EPOINT_STATE_OUT_DISCONNECT);
49 set_tone(portlist,"cause_22");
54 new_state(EPOINT_STATE_CONNECT);
56 /* initialize the vbox */
57 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) initializing efi\n", ea_endpoint->ep_serial);
59 e_efi_state = EFI_STATE_HELLO;
60 set_tone_efi("hello");
66 * the audio file has ended
67 * this is called by Endpoint::message_port(), whenever an audio of has been received
69 void EndpointAppPBX::efi_message_eof(void)
72 char digit[] = "number_00";
73 // struct lcr_msg *message;
74 // struct port_list *portlist = ea_endpoint->ep_portlist;
76 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s end of file during state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
81 e_efi_state = EFI_STATE_DIE;
85 if (e_callerinfo.screen==INFO_SCREEN_USER)
87 e_efi_state = EFI_STATE_BENUTZERDEFINIERTE;
88 set_tone_efi("benutzerdefinierte");
92 case EFI_STATE_BENUTZERDEFINIERTE:
93 if (e_callerinfo.present==INFO_PRESENT_RESTRICTED)
95 e_efi_state = EFI_STATE_UNTERDRUECKTE;
96 set_tone_efi("unterdrueckte");
100 case EFI_STATE_UNTERDRUECKTE:
101 e_efi_state = EFI_STATE_RUFNUMMER_LAUTET;
102 set_tone_efi("rufnummer_lautet");
105 case EFI_STATE_RUFNUMMER_LAUTET:
106 e_efi_state = EFI_STATE_DIGIT;
109 case EFI_STATE_DIGIT:
110 digit[8] = numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype)[e_efi_digit];
117 // e_efi_state = EFI_STATE_STOP;
118 e_efi_state = EFI_STATE_ICH_WIEDERHOLE;
119 // message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT);
120 // message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
121 // message->param.disconnectinfo.cause = CAUSE_NORMAL;
122 // message_put(message);
123 // logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
124 // new_state(EPOINT_STATE_OUT_DISCONNECT);
125 // set_tone(portlist,"cause_10");
126 set_tone_efi("ich_wiederhole");
130 case EFI_STATE_ICH_WIEDERHOLE:
131 e_efi_state = EFI_STATE_DIE;
139 PERROR("efi_message_eof(ep%d): terminal %s unknown state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
146 * set the given vbox-tone with full path (without appending)
147 * the tone is played and after eof, a message is received
149 void EndpointAppPBX::set_tone_efi(char *tone)
151 struct lcr_msg *message;
156 if (!ea_endpoint->ep_portlist)
158 PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
160 message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_TONE);
161 SCPY(message->param.tone.dir, (char *)"tones_efi");
162 SCPY(message->param.tone.name, tone);
163 message_put(message);
165 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set tone '%s'\n", ea_endpoint->ep_serial, e_ext.number, tone);