1 /*****************************************************************************\
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** elektronische fernmelder identifikation **
10 \*****************************************************************************/
14 #include <sys/types.h>
23 EFI_STATE_BENUTZERDEFINIERTE,
24 EFI_STATE_UNTERDRUECKTE,
25 EFI_STATE_RUFNUMMER_LAUTET,
27 EFI_STATE_ICH_WIEDERHOLE,
31 void EndpointAppPBX::action_init_efi(void)
33 // int language = e_ext.vbox_language;
34 // struct route_param *rparam;
35 struct message *message;
36 struct port_list *portlist = ea_endpoint->ep_portlist;
39 if (e_callerinfo.id[0] == '\0')
41 /* facility rejected */
42 message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT);
43 message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
44 message->param.disconnectinfo.cause = CAUSE_FACILITYREJECTED;
46 logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
47 new_state(EPOINT_STATE_OUT_DISCONNECT);
48 set_tone(portlist,"cause_22");
53 new_state(EPOINT_STATE_CONNECT);
55 /* initialize the vbox */
56 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) initializing efi\n", ea_endpoint->ep_serial);
58 e_efi_state = EFI_STATE_DIE;
65 * the audio file has ended
66 * this is called by Endpoint::message_port(), whenever an audio of has been received
68 void EndpointAppPBX::efi_message_eof(void)
71 char digit[] = "number_00";
72 struct message *message;
73 struct port_list *portlist = ea_endpoint->ep_portlist;
75 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s end of file during state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
80 if (e_callerinfo.screen==INFO_SCREEN_USER)
82 e_efi_state = EFI_STATE_BENUTZERDEFINIERTE;
83 set_tone_efi("benutzerdefinierte");
87 case EFI_STATE_BENUTZERDEFINIERTE:
88 if (e_callerinfo.present==INFO_PRESENT_RESTRICTED)
90 e_efi_state = EFI_STATE_UNTERDRUECKTE;
91 set_tone_efi("unterdrueckte");
95 case EFI_STATE_UNTERDRUECKTE:
96 e_efi_state = EFI_STATE_RUFNUMMER_LAUTET;
97 set_tone_efi("rufnummer_lautet");
100 case EFI_STATE_RUFNUMMER_LAUTET:
101 e_efi_state = EFI_STATE_DIGIT;
104 case EFI_STATE_DIGIT:
105 digit[8] = numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype)[e_efi_digit];
112 e_efi_state = EFI_STATE_STOP; //EFI_STATE_ICH_WIEDERHOLE;
113 message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_DISCONNECT);
114 message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
115 message->param.disconnectinfo.cause = CAUSE_NORMAL;
116 message_put(message);
117 logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
118 new_state(EPOINT_STATE_OUT_DISCONNECT);
119 set_tone(portlist,"cause_10");
120 // set_tone_efi("ich_wiederhole");
124 case EFI_STATE_ICH_WIEDERHOLE:
125 e_efi_state = EFI_STATE_DIE;
133 PERROR("efi_message_eof(ep%d): terminal %s unknown state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
140 * set the given vbox-tone with full path (without appending)
141 * the tone is played and after eof, a message is received
143 void EndpointAppPBX::set_tone_efi(char *tone)
145 struct message *message;
150 if (!ea_endpoint->ep_portlist)
152 PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
154 message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_TONE);
155 SCPY(message->param.tone.dir, (char *)"tones_efi");
156 SCPY(message->param.tone.name, tone);
157 message_put(message);
159 PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set tone '%s'\n", ea_endpoint->ep_serial, e_ext.number, tone);