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')
35 /* facility rejected */
36 message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT);
37 message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
38 message->param.disconnectinfo.cause = CAUSE_FACILITYREJECTED;
40 logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
41 new_state(EPOINT_STATE_OUT_DISCONNECT);
42 set_tone(portlist,"cause_22");
47 new_state(EPOINT_STATE_CONNECT);
49 /* initialize the vbox */
50 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) initializing efi\n", ea_endpoint->ep_serial);
52 e_efi_state = EFI_STATE_HELLO;
53 set_tone_efi("hello");
59 * the audio file has ended
60 * this is called by Endpoint::message_port(), whenever an audio of has been received
62 void EndpointAppPBX::efi_message_eof(void)
65 char digit[] = "number_00";
66 // struct lcr_msg *message;
67 // struct port_list *portlist = ea_endpoint->ep_portlist;
69 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s end of file during state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
74 e_efi_state = EFI_STATE_DIE;
78 if (e_callerinfo.screen==INFO_SCREEN_USER)
80 e_efi_state = EFI_STATE_BENUTZERDEFINIERTE;
81 set_tone_efi("benutzerdefinierte");
85 case EFI_STATE_BENUTZERDEFINIERTE:
86 if (e_callerinfo.present==INFO_PRESENT_RESTRICTED)
88 e_efi_state = EFI_STATE_UNTERDRUECKTE;
89 set_tone_efi("unterdrueckte");
93 case EFI_STATE_UNTERDRUECKTE:
94 e_efi_state = EFI_STATE_RUFNUMMER_LAUTET;
95 set_tone_efi("rufnummer_lautet");
98 case EFI_STATE_RUFNUMMER_LAUTET:
99 e_efi_state = EFI_STATE_DIGIT;
102 case EFI_STATE_DIGIT:
103 digit[8] = numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype, options.national, options.international)[e_efi_digit];
110 // e_efi_state = EFI_STATE_STOP;
111 e_efi_state = EFI_STATE_ICH_WIEDERHOLE;
112 // message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT);
113 // message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
114 // message->param.disconnectinfo.cause = CAUSE_NORMAL;
115 // message_put(message);
116 // logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
117 // new_state(EPOINT_STATE_OUT_DISCONNECT);
118 // set_tone(portlist,"cause_10");
119 set_tone_efi("ich_wiederhole");
123 case EFI_STATE_ICH_WIEDERHOLE:
124 e_efi_state = EFI_STATE_DIE;
132 PERROR("efi_message_eof(ep%d): terminal %s unknown state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
139 * set the given vbox-tone with full path (without appending)
140 * the tone is played and after eof, a message is received
142 void EndpointAppPBX::set_tone_efi(const char *tone)
144 struct lcr_msg *message;
149 if (!ea_endpoint->ep_portlist)
151 PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
153 message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_TONE);
154 SCPY(message->param.tone.dir, (char *)"tones_efi");
155 SCPY(message->param.tone.name, tone);
156 message_put(message);
158 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set tone '%s'\n", ea_endpoint->ep_serial, e_ext.number, tone);