if (e_ext.rights < 1)
{
printlog("%3d action INTERN access to internal phones are denied for this caller.\n", ea_endpoint->ep_serial);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): internal call from terminal %s denied.\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): internal call from terminal %s denied.\n", ea_endpoint->ep_serial, e_ext.number);
new_state(EPOINT_STATE_OUT_DISCONNECT);
message_disconnect_port(portlist, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, "");
set_tone(portlist, "cause_81");
if (strchr(e_extdialing, '#'))
{
e_extdialing[0] = '\0';
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): '#' detected: terminal '%s' selected caller id '%s' and continues dialing: '%s'\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, e_extdialing);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): '#' detected: terminal '%s' selected caller id '%s' and continues dialing: '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, e_extdialing);
}
/* eliminate digits before '*', which is a delete digit
*/
}
UCPY(p, p+1); /* remove '*' */
}
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s deleted digits and got new string: %s\n", ea_endpoint->ep_serial, e_terminal, e_extdialing);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s deleted digits and got new string: %s\n", ea_endpoint->ep_serial, e_ext.number, e_extdialing);
}
}
if (e_ext.rights < 2)
{
printlog("%3d action EXTERN calls are denied for this caller.\n", ea_endpoint->ep_serial);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): external call from terminal denied: %s\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): external call from terminal denied: %s\n", ea_endpoint->ep_serial, e_ext.number);
release(RELEASE_CALL, LOCATION_PRIVATE_LOCAL, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, 0);
set_tone(portlist, "cause_82");
denied:
if (e_ext.rights < 3)
{
printlog("%3d action EXTERN national calls are denied for this caller.\n", ea_endpoint->ep_serial);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): national call from terminal %s denied.\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): national call from terminal %s denied.\n", ea_endpoint->ep_serial, e_ext.number);
release(RELEASE_CALL, LOCATION_PRIVATE_LOCAL, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, 0);
set_tone(portlist, "cause_83");
goto denied;
if (e_ext.rights < 4)
{
printlog("%3d action EXTERN international calls are denied for this caller.\n", ea_endpoint->ep_serial);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): international call from terminal %s denied.\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): international call from terminal %s denied.\n", ea_endpoint->ep_serial, e_ext.number);
release(RELEASE_CALL, LOCATION_PRIVATE_LOCAL, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, 0);
set_tone(portlist, "cause_84");
goto denied;
return;
}
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s dialing extension: %s\n", ea_endpoint->ep_serial, e_terminal, rparam->string_value);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s dialing extension: %s\n", ea_endpoint->ep_serial, e_ext.number, rparam->string_value);
/* check if internal calls are denied */
if (e_ext.rights < 1)
{
printlog("%3d action VBOX-RECORD calls are denied for this caller.\n", ea_endpoint->ep_serial);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): internal call from terminal %s denied.\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): internal call from terminal %s denied.\n", ea_endpoint->ep_serial, e_ext.number);
new_state(EPOINT_STATE_OUT_DISCONNECT);
message_disconnect_port(portlist, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, "");
set_tone(portlist, "cause_81");
}
ea_endpoint->ep_call_id = call->c_serial;
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s dialing room: %d\n", ea_endpoint->ep_serial, e_terminal, partyline);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s dialing room: %d\n", ea_endpoint->ep_serial, e_ext.number, partyline);
set_tone(portlist, "proceeding");
message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_PROCEEDING);
printlog("%3d action CALL to '%s' hangs up.\n", ea_endpoint->ep_serial, e_dialinginfo.number);
/* check */
- if (e_terminal[0] == '\0')
+ if (e_ext.number[0] == '\0')
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because caller is unknown (not internal).\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because caller is unknown (not internal).\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
return;
}
- if (!(read_extension(&e_ext, e_terminal)))
+ if (!(read_extension(&e_ext, e_ext.number)))
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because cannot read settings.\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because cannot read settings.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
return;
}
if (e_dialinginfo.number[0] == '\0')
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number because nothing was dialed.\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number because nothing was dialed.\n", ea_endpoint->ep_serial, e_ext.number);
return;
}
if (!strcmp(e_dialinginfo.number, e_ext.last_out[0]))
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
return;
}
/* insert */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last number '%s'.\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last number '%s'.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
i = MAX_REMEMBER-1;
while(i)
{
SCPY(e_ext.last_out[0], e_dialinginfo.number);
/* write extension */
- write_extension(&e_ext, e_terminal);
+ write_extension(&e_ext, e_ext.number);
}
}
/* we changed our extension */
- SCPY(e_terminal, extension);
+ SCPY(e_ext.number, extension);
new_state(EPOINT_STATE_CONNECT);
e_dtmf = 1;
e_connectedmode = 1;
if (!(rparam = routeparam(e_action, PARAM_NOPASSWORD)))
{
/* make call state to enter password */
- printlog("%3d action LOGIN to extension %s, ask for password.\n", ea_endpoint->ep_serial, e_terminal);
+ printlog("%3d action LOGIN to extension %s, ask for password.\n", ea_endpoint->ep_serial, e_ext.number);
new_state(EPOINT_STATE_IN_OVERLAP);
e_ruleset = NULL;
e_rule = NULL;
}
/* caller id complete, dialing with new caller id */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing callerid '%s' for all following calls.\n", ea_endpoint->ep_serial, e_terminal, callerid);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing callerid '%s' for all following calls.\n", ea_endpoint->ep_serial, e_ext.number, callerid);
/* write new parameters */
- if (read_extension(&e_ext, e_terminal))
+ if (read_extension(&e_ext, e_ext.number))
{
if (callerid[0] == '\0')
{
if (!next) e_ext.id_next_call_type = -1;
PDEBUG(DEBUG_EPOINT, "EPOINT(%d): nationalized callerid: '%s' type=%d\n", ea_endpoint->ep_serial, (!next)?e_ext.callerid:e_ext.id_next_call, (!next)?e_ext.callerid_type:e_ext.id_next_call_type);
}
- write_extension(&e_ext, e_terminal);
+ write_extension(&e_ext, e_ext.number);
}
/* function activated */
dest = e_extdialing;
}
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing forwarding to '%s'.\n", ea_endpoint->ep_serial, e_terminal, dest);
- if (read_extension(&e_ext, e_terminal))
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing forwarding to '%s'.\n", ea_endpoint->ep_serial, e_ext.number, dest);
+ if (read_extension(&e_ext, e_ext.number))
{
switch(diversion)
{
SCPY(e_ext.cfp, dest);
break;
}
- write_extension(&e_ext, e_terminal);
+ write_extension(&e_ext, e_ext.number);
}
/* function (de)activated */
message_disconnect_port(portlist, CAUSE_NORMAL, LOCATION_PRIVATE_LOCAL, "");
SPRINT(message->param.notifyinfo.display, "(%d) %s vbox", e_select+1, last+5);
else
SPRINT(message->param.notifyinfo.display, "(%d) %s", e_select+1, (last[0])?last:"- empty -");
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s sending display:%s\n", ea_endpoint->ep_serial, e_terminal, message->param.notifyinfo.display);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s sending display:%s\n", ea_endpoint->ep_serial, e_ext.number, message->param.notifyinfo.display);
message_put(message);
logmessage(message);
}
/* send connect to avoid overlap timeout */
// new_state(EPOINT_STATE_CONNECT); connect may prevent further dialing
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1;
memset(&e_connectinfo, 0, sizeof(e_connectinfo));
message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
portlist = ea_endpoint->ep_portlist;
/* abbrev dialing is only possible if we have a caller defined */
- if (!e_terminal[0])
+ if (!e_ext.number[0])
{
printlog("%3d action ABBREVIATION only possible for internal callers.\n", ea_endpoint->ep_serial);
new_state(EPOINT_STATE_OUT_DISCONNECT);
abbrev = e_extdialing;
phone = NULL;
name = NULL;
- result = parse_phonebook(e_terminal, &abbrev, &phone, &name);
+ result = parse_phonebook(e_ext.number, &abbrev, &phone, &name);
if (result == 0)
{
printlog("%3d action ABBREVIATION '%s' not found.\n", ea_endpoint->ep_serial, abbrev);
case '3':
printlog("%3d action TESTMODE executing 'echo connect' test.\n", ea_endpoint->ep_serial);
new_state(EPOINT_STATE_CONNECT);
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1;
set_tone(portlist, NULL);
memset(&e_connectinfo, 0, sizeof(e_connectinfo));
case '4':
printlog("%3d action TESTMODE executing 'tone connect' test.\n", ea_endpoint->ep_serial);
new_state(EPOINT_STATE_CONNECT);
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1;
memset(&e_connectinfo, 0, sizeof(e_connectinfo));
message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
case '5':
printlog("%3d action TESTMODE executing 'hold music' test.\n", ea_endpoint->ep_serial);
new_state(EPOINT_STATE_CONNECT);
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1;
memset(&e_connectinfo, 0, sizeof(e_connectinfo));
message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
cause = 0;
printlog("%3d action TESTMODE executing 'announcement' test with cause %d.\n", ea_endpoint->ep_serial, cause);
new_state(EPOINT_STATE_CONNECT);
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1;
SPRINT(causestr,"cause_%02x",cause);
memset(&e_connectinfo, 0, sizeof(e_connectinfo));
case '9': /* text callerid test */
printlog("%3d action TESTMODE executing 'caller id' test.\n", ea_endpoint->ep_serial);
new_state(EPOINT_STATE_CONNECT);
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1;
memset(&e_connectinfo, 0, sizeof(e_connectinfo));
SCPY(e_connectinfo.id, "12345678");
goto disconnect;
}
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1;
set_tone(ea_endpoint->ep_portlist, rparam->string_value);
/* display dialing */
message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_NOTIFY);
SPRINT(message->param.notifyinfo.display, ">%s", e_extdialing);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s displaying interpreted dialing '%s' internal values: %f %f\n", ea_endpoint->ep_serial, e_terminal, e_extdialing, value1, value2);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s displaying interpreted dialing '%s' internal values: %f %f\n", ea_endpoint->ep_serial, e_ext.number, e_extdialing, value1, value2);
message_put(message);
logmessage(message);
//SCAT(dialing, e_dialinginfo.number);
SCPY(e_dialinginfo.number, dialing);
e_extdialing = e_dialinginfo.number+strlen(numbering->prefix);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' dialing: %s\n", ea_endpoint->ep_serial, e_terminal, numb_actions[numbering->action], e_dialinginfo.number);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' dialing: %s\n", ea_endpoint->ep_serial, e_ext.number, numb_actions[numbering->action], e_dialinginfo.number);
nesting?:
process_dialing();
return;
/* send display message to port */
message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_NOTIFY);
SPRINT(message->param.notifyinfo.display, ">%s %s%s%s", numbering->prefix, numb_actions[numbering->action], (numbering->param[0])?" ":"", numbering->param);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' sending display:%s\n", ea_endpoint->ep_serial, e_terminal, numb_actions[numbering->action], message->param.notifyinfo.display);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' sending display:%s\n", ea_endpoint->ep_serial, e_ext.number, numb_actions[numbering->action], message->param.notifyinfo.display);
message_put(message);
logmessage(message);
#endif
if (command[0] == '\0')
{
printlog("%3d action EXECUTE no 'execute' parameter given at routing.conf.\n", ea_endpoint->ep_serial);
- PERROR("EPOINT(%d): terminal %s: NO PARAMETER GIVEN for 'execute' action. see routing.conf\n", ea_endpoint->ep_serial, e_terminal);
+ PERROR("EPOINT(%d): terminal %s: NO PARAMETER GIVEN for 'execute' action. see routing.conf\n", ea_endpoint->ep_serial, e_ext.number);
return;
}
printlog("%3d action EXECUTE command='%s'\n", ea_endpoint->ep_serial, command);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: executing '%s'.\n", ea_endpoint->ep_serial, e_terminal, command);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: executing '%s'.\n", ea_endpoint->ep_serial, e_ext.number, command);
argv[0] = command;
while(strchr(argv[0], '/'))
if (file[0] == '\0')
{
printlog("%3d action FILE no filename given.\n", ea_endpoint->ep_serial);
- PERROR("EPOINT(%d): terminal %s: NO FILENAME GIVEN for 'file' action. see routing.conf\n", ea_endpoint->ep_serial, e_terminal);
+ PERROR("EPOINT(%d): terminal %s: NO FILENAME GIVEN for 'file' action. see routing.conf\n", ea_endpoint->ep_serial, e_ext.number);
return;
}
if (!(fp = fopen(file, mode)))
{
printlog("%3d action FILE file '%s' cannot be opened. (errno = %d)\n", ea_endpoint->ep_serial, file, errno);
- PERROR("EPOINT(%d): terminal %s: given file '%s' cannot be opened. see routing.conf\n", ea_endpoint->ep_serial, e_terminal, file);
+ PERROR("EPOINT(%d): terminal %s: given file '%s' cannot be opened. see routing.conf\n", ea_endpoint->ep_serial, e_ext.number, file);
return;
}
printlog("%3d action FILE file='%s' content='%s'\n", ea_endpoint->ep_serial, file, content);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: writing file '%s' with content '%s'.\n", ea_endpoint->ep_serial, e_terminal, file, content);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: writing file '%s' with content '%s'.\n", ea_endpoint->ep_serial, e_ext.number, file, content);
fprintf(fp, "%s\n", content);
fclose(fp);
}
if (e_action)
if (e_action->index == ACTION_PASSWORD_WRITE)
{
- append_callbackauth(e_terminal, &e_callbackinfo);
+ append_callbackauth(e_ext.number, &e_callbackinfo);
printlog("%3d action PASSWORD WRITE password written\n", ea_endpoint->ep_serial);
}
if (!portlist)
{
portlist_error:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): note: dialing call requires exactly one port object to process dialing. this case could happen due to a parked call. we end dialing here.\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): note: dialing call requires exactly one port object to process dialing. this case could happen due to a parked call. we end dialing here.\n", ea_endpoint->ep_serial, e_ext.number);
e_action_timeout = 0;
e_match_timeout = 0;
return;
if (e_match_timeout && now_d>=e_match_timeout)
{
/* return timeout rule */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', timeout in ruleset '%s'\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number, e_ruleset->name);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', timeout in ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number, e_ruleset->name);
e_match_timeout = 0;
e_action = e_match_to_action;
e_extdialing = e_match_to_extdialing;
{
//PDEBUG(~0, "HANG-BUG-DEBUGGING: before routing\n");
/* check for matching rule */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', checking matching rule of ruleset '%s'\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number, e_ruleset->name);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', checking matching rule of ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number, e_ruleset->name);
if (e_ruleset)
{
e_action = route(e_ruleset);
}
if (!e_action)
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): no rule within the current ruleset matches yet.\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): no rule within the current ruleset matches yet.\n", ea_endpoint->ep_serial, e_ext.number);
goto display;
}
if (action_defs[e_action->index].init_func)
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a init function, so we call it...\n", ea_endpoint->ep_serial, e_terminal, action_defs[e_action->index].name);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a init function, so we call it...\n", ea_endpoint->ep_serial, e_ext.number, action_defs[e_action->index].name);
(this->*(action_defs[e_action->index].init_func))();
}
if (e_state!=EPOINT_STATE_IN_SETUP
}
/* show what we are doing */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' action: %s (dialing '%s')\n", ea_endpoint->ep_serial, e_terminal, action_defs[e_action->index].name, e_extdialing);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' action: %s (dialing '%s')\n", ea_endpoint->ep_serial, e_ext.number, action_defs[e_action->index].name, e_extdialing);
/* go to action's dialing function */
if (action_defs[e_action->index].dialing_func)
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a dialing function, so we call it...\n", ea_endpoint->ep_serial, e_terminal, action_defs[e_action->index].name);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a dialing function, so we call it...\n", ea_endpoint->ep_serial, e_ext.number, action_defs[e_action->index].name);
(this->*(action_defs[e_action->index].dialing_func))();
}
SPRINT(message->param.notifyinfo.display, "%s%s%s", action_defs[e_action->index].name, (e_extdialing[0])?" ":"", e_extdialing);
}
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s displaying interpreted dialing '%s'\n", ea_endpoint->ep_serial, e_terminal, message->param.notifyinfo.display);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s displaying interpreted dialing '%s'\n", ea_endpoint->ep_serial, e_ext.number, message->param.notifyinfo.display);
message_put(message);
logmessage(message);
}
char callertext[256], dialingtext[256];
int writeext = 0, i;
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s'\n", ea_endpoint->ep_serial, e_terminal);
- if (e_terminal[0])
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s'\n", ea_endpoint->ep_serial, e_ext.number);
+ if (e_ext.number[0])
{
- if (read_extension(&e_ext, e_terminal))
+ if (read_extension(&e_ext, e_ext.number))
writeext = 0x10;
if (!e_start)
} else
if (!e_stop)
time(&e_stop);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): writing connect from %s to %s into logfile of %s\n", ea_endpoint->ep_serial, e_callerinfo.id, e_dialinginfo.number, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): writing connect from %s to %s into logfile of %s\n", ea_endpoint->ep_serial, e_callerinfo.id, e_dialinginfo.number, e_ext.number);
switch(e_dialinginfo.itype)
{
case INFO_ITYPE_CHAN:
UNPRINT(strchr(callertext,'\0'), sizeof(callertext)-1+strlen(callertext), " (intern %s)", e_callerinfo.intern);
if (e_callerinfo.voip[0]) /* add voip if present */
UNPRINT(strchr(callertext,'\0'), sizeof(callertext)-1+strlen(callertext), " (voip %s)", e_callerinfo.voip);
- write_log(e_terminal, callertext, dialingtext, e_start, e_stop, 0, cause, location);
+ write_log(e_ext.number, callertext, dialingtext, e_start, e_stop, 0, cause, location);
/* store last received call for reply-list */
if (e_callerinfo.id[0] || e_callerinfo.intern[0])
}
SCPY(e_ext.last_in[0], callertext);
writeext |= 1; /* store extension later */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last received caller id '%s'.\n", ea_endpoint->ep_serial, e_terminal, e_ext.last_in[0]);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last received caller id '%s'.\n", ea_endpoint->ep_serial, e_ext.number, e_ext.last_in[0]);
} else
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last received id '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_terminal, callertext);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last received id '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_ext.number, callertext);
}
}
/* write extension if needed */
if (writeext == 0x11)
- write_extension(&e_ext, e_terminal);
+ write_extension(&e_ext, e_ext.number);
if (e_action)
{
if (action_defs[e_action->index].hangup_func)
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a hangup function, so we call it...\n", ea_endpoint->ep_serial, e_terminal, action_defs[e_action->index].name);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a hangup function, so we call it...\n", ea_endpoint->ep_serial, e_ext.number, action_defs[e_action->index].name);
(this->*(action_defs[e_action->index].hangup_func))();
}
}
struct message *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)
{
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);
}
}
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);
}
struct port_list *portlist = ea_endpoint->ep_portlist;
/* get extension */
- SCPY(e_vbox, e_terminal);
+ SCPY(e_vbox, e_ext.number);
if ((rparam = routeparam(e_action, PARAM_EXTENSION)))
SCPY(e_vbox, rparam->string_value);
if (e_vbox[0] == '\0')
/* connect, but still accept more digits */
new_state(EPOINT_STATE_IN_OVERLAP);
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1;
message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
message_put(message);
if (port)
{
port->close_record(6000); /* append beep */
- port->open_record(CODEC_MONO, 1, 5000, e_terminal, 0, "", 0); /* record announcement, skip the first 5000 samples */
+ port->open_record(CODEC_MONO, 1, 5000, e_ext.number, 0, "", 0); /* record announcement, skip the first 5000 samples */
}
e_vbox_state = VBOX_STATE_RECORD_RECORD;
if (e_ext.vbox_language)
e_vbox_display_refresh = 0;
message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_NOTIFY);
SPRINT(message->param.notifyinfo.display, e_vbox_display, counter);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s pending display:%s\n", ea_endpoint->ep_serial, e_terminal, message->param.notifyinfo.display);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s pending display:%s\n", ea_endpoint->ep_serial, e_ext.number, message->param.notifyinfo.display);
message_put(message);
logmessage(message);
}
char buffer[32];
int language = e_ext.vbox_language;
- 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_vbox_state)
{
break;
default:
- PERROR("vbox_message_eof(ep%d): terminal %s unknown state: %d\n", ea_endpoint->ep_serial, e_terminal, e_vbox_state);
+ PERROR("vbox_message_eof(ep%d): terminal %s unknown state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
}
}
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);
}
message->param.play.offset = offset;
message_put(message);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set play '%s'\n", ea_endpoint->ep_serial, e_terminal, filename);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set play '%s'\n", ea_endpoint->ep_serial, e_ext.number, filename);
}
message->param.speed = speed;
message_put(message);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set speed '%d'\n", ea_endpoint->ep_serial, e_terminal, speed);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s set speed '%d'\n", ea_endpoint->ep_serial, e_ext.number, speed);
}
response->am[num].u.e.state = ADMIN_STATE_IDLE;
}
/* terminal */
- SCPY(response->am[num].u.e.terminal, apppbx->e_terminal);
+ SCPY(response->am[num].u.e.terminal, apppbx->e_ext.number);
/* callerid */
SCPY(response->am[num].u.e.callerid, apppbx->e_callerinfo.id);
/* dialing */
e_ext.rights = 4; /* international */
e_ext.rxvol = e_ext.txvol = 256;
e_state = EPOINT_STATE_IDLE;
- e_terminal[0] = '\0';
- e_terminal_interface[0] = '\0';
+ e_ext.number[0] = '\0';
+ e_extension_interface[0] = '\0';
memset(&e_callerinfo, 0, sizeof(struct caller_info));
memset(&e_dialinginfo, 0, sizeof(struct dialing_info));
memset(&e_connectinfo, 0, sizeof(struct connect_info));
memcpy(&e_callbackinfo, &e_callerinfo, sizeof(e_callbackinfo));
memset(&e_dialinginfo, 0, sizeof(e_dialinginfo));
/* create dialing by callerinfo */
- if (e_terminal[0] && e_terminal_interface[0])
+ if (e_ext.number[0] && e_extension_interface[0])
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) preparing callback to internal: %s interface %s\n", ea_endpoint->ep_serial, e_terminal, e_terminal_interface);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) preparing callback to internal: %s interface %s\n", ea_endpoint->ep_serial, e_ext.number, e_extension_interface);
/* create callback to the current terminal */
- SCPY(e_dialinginfo.number, e_terminal);
- SCPY(e_dialinginfo.interfaces, e_terminal_interface);
+ SCPY(e_dialinginfo.number, e_ext.number);
+ SCPY(e_dialinginfo.interfaces, e_extension_interface);
e_dialinginfo.itype = INFO_ITYPE_ISDN_EXTENSION;
e_dialinginfo.ntype = INFO_NTYPE_UNKNOWN;
} else
{
/* we must be in a call, in order to send messages to the call */
- if (e_terminal[0] == '\0')
+ if (e_ext.number[0] == '\0')
{
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) IGNORING keypad received not from extension.\n", ea_endpoint->ep_serial);
return;
while(atemp)
{
if (atemp != this)
- if (!strcmp(atemp->e_terminal, e_terminal))
+ if (!strcmp(atemp->e_ext.number, e_ext.number))
break;
atemp = atemp->next;
}
{
if (checkapp != this) /* any other endpoint except our own */
{
- if (!strcmp(checkapp->e_terminal, e_terminal))
+ if (!strcmp(checkapp->e_ext.number, e_ext.number))
{
/* present to forwarded party */
if (e_ext.anon_ignore && e_callerinfo.id[0])
memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
memcpy(&message->param.setup.callerinfo, &e_callerinfo, sizeof(struct caller_info));
memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
-//terminal SCPY(message->param.setup.from_terminal, e_terminal);
+//terminal SCPY(message->param.setup.from_terminal, e_ext.number);
//terminal if (e_dialinginfo.number)
//terminal SCPY(message->param.setup.to_terminal, e_dialinginfo.number);
/* handle restricted caller ids */
{
/* only if vbox should be dialed, and terminal is given */
earlyb = 0;
- if (!strcmp(p, "vbox") && e_terminal[0])
+ if (!strcmp(p, "vbox") && e_ext.number[0])
{
/* go to the end of p */
p += strlen(p);
break;
}
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) allocated port %s\n", ea_endpoint->ep_serial, port->p_name);
- UCPY(cfp, e_terminal); /* cfp or any other direct forward/vbox */
+ UCPY(cfp, e_ext.number); /* cfp or any other direct forward/vbox */
} else
{
cfp[0] = '\0';
if (e_ext.clip==CLIP_HIDE && port->p_type!=PORT_TYPE_VBOX_OUT)
{
SCPY(message->param.setup.callerinfo.id, e_ext.callerid);
- SCPY(message->param.setup.callerinfo.intern, e_terminal);
+ SCPY(message->param.setup.callerinfo.intern, e_ext.number);
message->param.setup.callerinfo.ntype = e_ext.callerid_type;
message->param.setup.callerinfo.present = e_ext.callerid_present;
}
memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
-//terminal SCPY(message->param.setup.from_terminal, e_terminal);
+//terminal SCPY(message->param.setup.from_terminal, e_ext.number);
//terminal if (e_dialinginfo.number)
//terminal SCPY(message->param.setup.to_terminal, e_dialinginfo.number);
/* handle restricted caller ids */
memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
memcpy(&message->param.setup.callerinfo, &e_callerinfo, sizeof(struct caller_info));
memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
-//terminal SCPY(message->param.setup.from_terminal, e_terminal);
+//terminal SCPY(message->param.setup.from_terminal, e_ext.number);
//terminal if (e_dialinginfo.number)
//terminal SCPY(message->param.setup.to_terminal, e_dialinginfo.number);
/* handle restricted caller ids */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call is extension\n", ea_endpoint->ep_serial);
/* port makes call from extension */
SCPY(e_callerinfo.intern, e_callerinfo.id);
- SCPY(e_terminal, e_callerinfo.intern);
- SCPY(e_terminal_interface, e_callerinfo.interface);
+ SCPY(e_ext.number, e_callerinfo.intern);
+ SCPY(e_extension_interface, e_callerinfo.interface);
} else
{
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call is external or voip\n", ea_endpoint->ep_serial);
if (e_callerinfo.itype == INFO_ITYPE_INTERN)
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call from extension '%s'\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call from extension '%s'\n", ea_endpoint->ep_serial, e_ext.number);
/* get extension's info about caller */
- if (!read_extension(&e_ext, e_terminal))
+ if (!read_extension(&e_ext, e_ext.number))
{
/* extension doesn't exist */
printlog("%3d endpoint EXTENSION '%s' doesn't exist, please check or create.\n", ea_endpoint->ep_serial, e_callerinfo.id);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) rejecting call from not existing extension: '%s'\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) rejecting call from not existing extension: '%s'\n", ea_endpoint->ep_serial, e_ext.number);
message_disconnect_port(portlist, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, "");
new_state(EPOINT_STATE_OUT_DISCONNECT);
set_tone(portlist, "cause_80"); /* pbx cause: extension not authorized */
- e_terminal[0] = '\0'; /* no terminal */
+ e_ext.number[0] = '\0'; /* no terminal */
return;
}
writeext = 0;
/* extension is written */
if (writeext)
- write_extension(&e_ext, e_terminal);
+ write_extension(&e_ext, e_ext.number);
/* set volume of rx and tx */
if (param->setup.callerinfo.itype == INFO_ITYPE_INTERN)
if (e_ext.record!=CODEC_OFF && (e_capainfo.bearer_capa==INFO_BC_SPEECH || e_capainfo.bearer_capa==INFO_BC_AUDIO))
{
/* check if we are a terminal */
- if (e_terminal[0] == '\0')
+ if (e_ext.number[0] == '\0')
PERROR("Port(%d) cannot record because we are not a terminal\n", ea_endpoint->ep_serial);
else
{
port = find_port_id(portlist->port_id);
if (port)
- port->open_record(e_ext.record, 0, 0, e_terminal, e_ext.anon_ignore, "", 0);
+ port->open_record(e_ext.record, 0, 0, e_ext.number, e_ext.anon_ignore, "", 0);
}
}
} else
{
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call from external port\n", ea_endpoint->ep_serial);
/* no terminal identification */
- e_terminal[0] = '\0';
- e_terminal_interface[0] = '\0';
+ e_ext.number[0] = '\0';
+ e_extension_interface[0] = '\0';
memset(&e_ext, 0, sizeof(e_ext));
e_ext.rights = 4; /* right to dial internat */
}
set_tone(portlist, "dialing");
} else
{
- if (e_terminal[0])
+ if (e_ext.number[0])
set_tone(portlist, "dialpbx");
else
set_tone(portlist, "dialtone");
/* turn off dtmf detection, in case dtmf is sent with keypad information */
if (e_dtmf)
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) received dialing information, so dtmf is now disabled, to prevent double detection by keypad+dtmf.\n", ea_endpoint->ep_serial, param->information.number, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) received dialing information, so dtmf is now disabled, to prevent double detection by keypad+dtmf.\n", ea_endpoint->ep_serial, param->information.number, e_ext.number, e_callerinfo.id);
e_dtmf = 0;
}
SCPY(e_connectinfo.name, e_ext.name);
/* add internal id to colp */
- SCPY(e_connectinfo.intern, e_terminal);
+ SCPY(e_connectinfo.intern, e_ext.number);
/* we store the connected port number */
- SCPY(e_terminal_interface, e_connectinfo.interfaces);
+ SCPY(e_extension_interface, e_connectinfo.interfaces);
/* for internal and am calls, we get the extension's id */
if (portlist->port_type==PORT_TYPE_VBOX_OUT || e_ext.colp==COLP_HIDE)
{
SCPY(e_connectinfo.id, e_ext.callerid);
- SCPY(e_connectinfo.intern, e_terminal);
+ SCPY(e_connectinfo.intern, e_ext.number);
e_connectinfo.itype = INFO_ITYPE_INTERN;
e_connectinfo.ntype = e_ext.callerid_type;
e_connectinfo.present = e_ext.callerid_present;
}
e_cfnr_call = e_cfnr_release = 0;
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1; /* allow dtmf */
// if (call_countrelations(ea_endpoint->ep_call_id) == 2)
{
{
/* callback */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) we have a callback, so we create a call with cbcaller: \"%s\".\n", ea_endpoint->ep_serial, e_cbcaller);
- SCPY(e_terminal, e_cbcaller);
+ SCPY(e_ext.number, e_cbcaller);
new_state(EPOINT_STATE_IN_OVERLAP);
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) callback from extension '%s'\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) callback from extension '%s'\n", ea_endpoint->ep_serial, e_ext.number);
/* get extension's info about terminal */
- if (!read_extension(&e_ext, e_terminal))
+ if (!read_extension(&e_ext, e_ext.number))
{
/* extension doesn't exist */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) rejecting callback from not existing extension: '%s'\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) rejecting callback from not existing extension: '%s'\n", ea_endpoint->ep_serial, e_ext.number);
message_disconnect_port(portlist, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, "");
new_state(EPOINT_STATE_OUT_DISCONNECT);
set_tone(portlist, "cause_80"); /* pbx cause: extension not authorized */
/* use caller id (or if exist: id_next_call) for this call */
e_callerinfo.screen = INFO_SCREEN_NETWORK;
- SCPY(e_callerinfo.intern, e_terminal);
+ SCPY(e_callerinfo.intern, e_ext.number);
if (e_ext.id_next_call_present >= 0)
{
SCPY(e_callerinfo.id, e_ext.id_next_call);
e_callerinfo.ntype = e_ext.id_next_call_type;
e_ext.id_next_call_present = -1;
/* extension is written */
- write_extension(&e_ext, e_terminal);
+ write_extension(&e_ext, e_ext.number);
} else
{
SCPY(e_callerinfo.id, e_ext.callerid);
e_dtmf = 1;
/* check if caller id is NOT authenticated */
- if (!parse_callbackauth(e_terminal, &e_callbackinfo))
+ if (!parse_callbackauth(e_ext.number, &e_callbackinfo))
{
/* make call state to enter password */
new_state(EPOINT_STATE_IN_OVERLAP);
}
/* start recording if enabled, not when answering machine answers */
- if (param->connectinfo.itype!=INFO_ITYPE_VBOX && e_terminal[0] && e_ext.record!=CODEC_OFF && (e_capainfo.bearer_capa==INFO_BC_SPEECH || e_capainfo.bearer_capa==INFO_BC_AUDIO))
+ if (param->connectinfo.itype!=INFO_ITYPE_VBOX && e_ext.number[0] && e_ext.record!=CODEC_OFF && (e_capainfo.bearer_capa==INFO_BC_SPEECH || e_capainfo.bearer_capa==INFO_BC_AUDIO))
{
/* check if we are a terminal */
- if (e_terminal[0] == '\0')
+ if (e_ext.number[0] == '\0')
PERROR("Port(%d) cannot record because we are not a terminal\n", ea_endpoint->ep_serial);
else
{
port = find_port_id(portlist->port_id);
if (port)
- port->open_record(e_ext.record, 0, 0, e_terminal, e_ext.anon_ignore, "", 0);
+ port->open_record(e_ext.record, 0, 0, e_ext.number, e_ext.anon_ignore, "", 0);
}
}
}
return;
}
-// PDEBUG(DEBUG_EPOINT, "received message %d (terminal %s, caller id %s)\n", message, e_terminal, e_callerinfo.id);
+// PDEBUG(DEBUG_EPOINT, "received message %d (terminal %s, caller id %s)\n", message, e_ext.number, e_callerinfo.id);
switch(message_type)
{
case MESSAGE_DATA: /* data from port */
/* PORT sends INFORMATION message */
case MESSAGE_INFORMATION: /* additional digits received */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call dialing more=%s (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->information.number, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming call dialing more=%s (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->information.number, e_ext.number, e_callerinfo.id);
port_information(portlist, message_type, param);
break;
/* PORT sends FACILITY message */
case MESSAGE_FACILITY:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming facility (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) incoming facility (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
port_facility(portlist, message_type, param);
break;
/* PORT sends DTMF message */
case MESSAGE_DTMF: /* dtmf digits received */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) dtmf digit=%c (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->dtmf, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) dtmf digit=%c (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->dtmf, e_ext.number, e_callerinfo.id);
port_dtmf(portlist, message_type, param);
break;
/* PORT sends MORE message */
case MESSAGE_OVERLAP:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) outgoing call is accepted [overlap dialing] (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) outgoing call is accepted [overlap dialing] (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if (e_state != EPOINT_STATE_OUT_SETUP)
{
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) ignored because we are not in setup state (for port_list: another portlist might have changed the state already).\n", ea_endpoint->ep_serial);
/* PORT sends PROCEEDING message */
case MESSAGE_PROCEEDING: /* port is proceeding */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) outgoing call is proceeding (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) outgoing call is proceeding (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if (e_state!=EPOINT_STATE_OUT_SETUP
&& e_state!=EPOINT_STATE_OUT_OVERLAP)
{
/* PORT sends ALERTING message */
case MESSAGE_ALERTING:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) outgoing call is ringing (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) outgoing call is ringing (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if (e_state!=EPOINT_STATE_OUT_SETUP
&& e_state!=EPOINT_STATE_OUT_OVERLAP
&& e_state!=EPOINT_STATE_OUT_PROCEEDING)
/* PORT sends CONNECT message */
case MESSAGE_CONNECT:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) outgoing call connected to %s (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_connectinfo.id, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) outgoing call connected to %s (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, e_connectinfo.id, e_ext.number, e_callerinfo.id);
if (e_state!=EPOINT_STATE_OUT_SETUP
&& e_state!=EPOINT_STATE_OUT_OVERLAP
&& e_state!=EPOINT_STATE_OUT_PROCEEDING
/* PORT sends DISCONNECT message */
case MESSAGE_DISCONNECT: /* port is disconnected */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call disconnect with cause=%d location=%d (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->disconnectinfo.cause, param->disconnectinfo.location, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) call disconnect with cause=%d location=%d (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->disconnectinfo.cause, param->disconnectinfo.location, e_ext.number, e_callerinfo.id);
port_disconnect_release(portlist, message_type, param);
break;
/* PORT sends a RELEASE message */
case MESSAGE_RELEASE: /* port releases */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) release with cause=%d location=%d (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->disconnectinfo.cause, param->disconnectinfo.location, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) release with cause=%d location=%d (terminal '%s', caller id '%s')\n", ea_endpoint->ep_serial, param->disconnectinfo.cause, param->disconnectinfo.location, e_ext.number, e_callerinfo.id);
/* portlist is release at port_disconnect_release, thanx Paul */
port_disconnect_release(portlist, message_type, param);
break;
/* PORT sends a TIMEOUT message */
case MESSAGE_TIMEOUT:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received timeout (state=%d).\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, param->state);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received timeout (state=%d).\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->state);
port_timeout(portlist, message_type, param);
break; /* release */
/* PORT sends a NOTIFY message */
case MESSAGE_NOTIFY:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received notify.\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received notify.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
port_notify(portlist, message_type, param);
break;
/* PORT sends a SUSPEND message */
case MESSAGE_SUSPEND:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received suspend.\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received suspend.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
port_suspend(portlist, message_type, param);
break; /* suspend */
/* PORT sends a RESUME message */
case MESSAGE_RESUME:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received resume.\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received resume.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
port_resume(portlist, message_type, param);
break;
default:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: %d\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, message);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: %d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message);
}
/* Note: this endpoint may be destroyed, so we MUST return */
break;
default:
- PERROR("EPOINT(%d) epoint with terminal '%s' (caller id '%s') unknown crypt message: '%d'\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, param->crypt.type);
+ PERROR("EPOINT(%d) epoint with terminal '%s' (caller id '%s') unknown crypt message: '%d'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->crypt.type);
}
}
set_tone(portlist, "dialtone");
return;
}
- if (e_terminal[0])
+ if (e_ext.number[0])
set_tone(portlist, "dialpbx");
else
set_tone(portlist, "dialtone");
set_tone(portlist, "ringing");
return;
}
- if (e_terminal[0])
+ if (e_ext.number[0])
set_tone(portlist, "ringpbx");
else
set_tone(portlist, "ringing");
new_state(EPOINT_STATE_CONNECT);
// UCPY(e_call_tone, "");
- if (e_terminal[0])
+ if (e_ext.number[0])
e_dtmf = 1; /* allow dtmf */
e_powerdialing = 0;
memcpy(&e_connectinfo, ¶m->connectinfo, sizeof(e_callerinfo));
memcpy(&message->param.connnectinfo, e_connectinfo);
/* screen clip if prefix is required */
- if (e_terminal[0] && message->param.connectinfo.id[0] && e_ext.clip_prefix[0])
+ if (e_ext.number[0] && message->param.connectinfo.id[0] && e_ext.clip_prefix[0])
{
SCPY(message->param.connectinfo.id, e_ext.clip_prefix);
SCAT(message->param.connectinfo.id, numberrize_callerinfo(e_connectinfo.id,e_connectinfo.ntype));
}
/* use internal caller id */
- if (e_terminal[0] && e_connectinfo.intern[0] && (message->param.connectinfo.present!=INFO_PRESENT_RESTRICTED || e_ext.anon_ignore))
+ if (e_ext.number[0] && e_connectinfo.intern[0] && (message->param.connectinfo.present!=INFO_PRESENT_RESTRICTED || e_ext.anon_ignore))
{
SCPY(message->param.connectinfo.id, e_connectinfo.intern);
message->param.connectinfo.ntype = INFO_NTYPE_UNKNOWN;
e_call_pattern = 0;
}
set_tone(ea_endpoint->ep_portlist, "redial");
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') redialing in %d seconds\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, (int)e_powerdelay);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') redialing in %d seconds\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, (int)e_powerdelay);
/* send proceeding when powerdialing and still setup (avoid dialing timeout) */
if (e_state==EPOINT_STATE_IN_OVERLAP)
{
}
/* if an internal extension is dialed, copy that number */
if (param->setup.dialinginfo.itype==INFO_ITYPE_INTERN || param->setup.dialinginfo.itype==INFO_ITYPE_VBOX)
- SCPY(e_terminal, param->setup.dialinginfo.number);
+ SCPY(e_ext.number, param->setup.dialinginfo.number);
/* if an internal extension is dialed, get extension's info about caller */
- if (e_terminal[0])
+ if (e_ext.number[0])
{
- if (!read_extension(&e_ext, e_terminal))
+ if (!read_extension(&e_ext, e_ext.number))
{
- e_terminal[0] = '\0';
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) the called terminal='%s' is not found in directory tree!\n", ea_endpoint->ep_serial, e_terminal);
+ e_ext.number[0] = '\0';
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) the called terminal='%s' is not found in directory tree!\n", ea_endpoint->ep_serial, e_ext.number);
}
}
/* process (voice over) data calls */
if (e_ext.datacall && e_capainfo.bearer_capa!=INFO_BC_SPEECH && e_capainfo.bearer_capa!=INFO_BC_AUDIO)
{
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) handling data call as audio call: '%s'\n", ea_endpoint->ep_serial, e_terminal);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) handling data call as audio call: '%s'\n", ea_endpoint->ep_serial, e_ext.number);
memset(&e_capainfo, 0, sizeof(e_capainfo));
e_capainfo.bearer_capa = INFO_BC_AUDIO;
e_capainfo.bearer_mode = INFO_BMODE_CIRCUIT;
}
}
-// PDEBUG(DEBUG_EPOINT, "EPOINT(%d) received message %d for active call (terminal %s, caller id %s state=%d)\n", ea_endpoint->ep_serial, message, e_terminal, e_callerinfo.id, e_state);
+// PDEBUG(DEBUG_EPOINT, "EPOINT(%d) received message %d for active call (terminal %s, caller id %s state=%d)\n", ea_endpoint->ep_serial, message, e_ext.number, e_callerinfo.id, e_state);
switch(message_type)
{
/* CALL SENDS CRYPT message */
case MESSAGE_CRYPT:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received crypt message: '%d'\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, param->crypt.type);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received crypt message: '%d'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->crypt.type);
call_crypt(portlist, message_type, param);
break;
/* CALL sends INFORMATION message */
case MESSAGE_INFORMATION:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received more digits: '%s'\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, param->information.number);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received more digits: '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->information.number);
call_information(portlist, message_type, param);
break;
/* CALL sends FACILITY message */
case MESSAGE_FACILITY:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received facility\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received facility\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
call_facility(portlist, message_type, param);
break;
/* CALL sends OVERLAP message */
case MESSAGE_OVERLAP:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received 'more info available'\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received 'more info available'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if (e_state!=EPOINT_STATE_IN_SETUP
&& e_state!=EPOINT_STATE_IN_OVERLAP)
{
/* CALL sends PROCEEDING message */
case MESSAGE_PROCEEDING:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s (caller id '%s') received proceeding\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s (caller id '%s') received proceeding\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if(e_state!=EPOINT_STATE_IN_OVERLAP)
{
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) ignored because we are not in setup state.\n", ea_endpoint->ep_serial);
/* CALL sends ALERTING message */
case MESSAGE_ALERTING:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received alerting\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received alerting\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if (e_state!=EPOINT_STATE_IN_OVERLAP
&& e_state!=EPOINT_STATE_IN_PROCEEDING)
{
/* CALL sends CONNECT message */
case MESSAGE_CONNECT:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received connect\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received connect\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if (e_state!=EPOINT_STATE_IN_OVERLAP
&& e_state!=EPOINT_STATE_IN_PROCEEDING
&& e_state!=EPOINT_STATE_IN_ALERTING)
/* CALL sends DISCONNECT/RELEASE message */
case MESSAGE_DISCONNECT: /* call disconnect */
case MESSAGE_RELEASE: /* call releases */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received %s with cause %d location %d\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, (message_type==MESSAGE_DISCONNECT)?"disconnect":"release", param->disconnectinfo.cause, param->disconnectinfo.location);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received %s with cause %d location %d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, (message_type==MESSAGE_DISCONNECT)?"disconnect":"release", param->disconnectinfo.cause, param->disconnectinfo.location);
call_disconnect_release(portlist, message_type, param);
break;
/* CALL sends special mISDNSIGNAL message */
case MESSAGE_mISDNSIGNAL: /* isdn message to port */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received mISDNsignal message.\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received mISDNsignal message.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
call_mISDNsignal(portlist, message_type, param);
break;
/* CALL has pattern available */
case MESSAGE_PATTERN: /* indicating pattern available */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received pattern availability.\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received pattern availability.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if (!e_call_pattern)
{
PDEBUG(DEBUG_EPOINT, "-> pattern becomes available\n");
/* CALL has no pattern available */
case MESSAGE_NOPATTERN: /* indicating no pattern available */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received pattern NOT available.\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received pattern NOT available.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
if (e_call_pattern)
{
PDEBUG(DEBUG_EPOINT, "-> pattern becomes unavailable\n");
#if 0
/* CALL (dunno at the moment) */
case MESSAGE_REMOTE_AUDIO:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received audio remote request.\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received audio remote request.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_CHANNEL);
message->param.channel = param->channel;
message_put(message);
/* CALL sends a notify message */
case MESSAGE_NOTIFY:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received notify.\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received notify.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
call_notify(portlist, message_type, param);
break;
default:
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: #%d\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, message);
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: #%d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message);
}
}
{
if (port->p_type == PORT_TYPE_VBOX_OUT)
{
- if (match_list(extensions, eapp->e_terminal))
+ if (match_list(extensions, eapp->e_ext.number))
{
found = eapp;
vbox = 1;
}
if ((port->p_type==PORT_TYPE_DSS1_NT_OUT || port->p_type==PORT_TYPE_DSS1_TE_OUT)
&& port->p_state==PORT_STATE_OUT_ALERTING)
- if (match_list(extensions, eapp->e_terminal))
+ if (match_list(extensions, eapp->e_ext.number))
{
found = eapp;
}
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) cannot join: we have no port.\n", ea_endpoint->ep_serial);
return;
}
- if (!e_terminal[0])
+ if (!e_ext.number[0])
{
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) cannot join: we are not internal extension.\n", ea_endpoint->ep_serial);
return;
other_eapp = other_eapp->next;
continue;
}
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) comparing other endpoint candiate: (ep%d) terminal='%s' port=%s call=%d.\n", ea_endpoint->ep_serial, other_eapp->ea_endpoint->ep_serial, other_eapp->e_terminal, (other_eapp->ea_endpoint->ep_portlist)?"YES":"NO", other_eapp->ea_endpoint->ep_call_id);
- if (other_eapp->e_terminal[0] /* has terminal */
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) comparing other endpoint candiate: (ep%d) terminal='%s' port=%s call=%d.\n", ea_endpoint->ep_serial, other_eapp->ea_endpoint->ep_serial, other_eapp->e_ext.number, (other_eapp->ea_endpoint->ep_portlist)?"YES":"NO", other_eapp->ea_endpoint->ep_call_id);
+ if (other_eapp->e_ext.number[0] /* has terminal */
&& other_eapp->ea_endpoint->ep_portlist /* has port */
&& other_eapp->ea_endpoint->ep_call_id) /* has call */
{
*errstr = "No Call";
return(1);
}
- if (!e_terminal[0])
+ if (!e_ext.number[0])
{
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) error: we are not internal extension.\n", ea_endpoint->ep_serial);
*errstr = "No Call";
/* states */
int e_state; /* state of endpoint */
- char e_terminal_interface[32];/* current internal isdn interface (usefull for callback to internal phone) */
+ char e_extension_interface[32];/* current internal isdn interface (usefull for callback to internal phone) */
struct caller_info e_callerinfo; /* information about the caller */
struct dialing_info e_dialinginfo; /* information about dialing */
struct connect_info e_connectinfo; /* information about connected line */
/* check the key for the call */
if (port->p_type==PORT_TYPE_DSS1_TE_OUT || port->p_type==PORT_TYPE_DSS1_NT_OUT || port->p_type==PORT_TYPE_SIP_OUT)
- ret = parse_secrets((char *)e_terminal, (char *)port->p_dialinginfo.number, &auth_pointer, &crypt_pointer, &key_pointer);
+ ret = parse_secrets((char *)e_ext.number, (char *)port->p_dialinginfo.number, &auth_pointer, &crypt_pointer, &key_pointer);
else
{
if (!port->p_callerinfo.id[0])
errstr = "No Remote ID";
goto reject;
}
- ret = parse_secrets((char *)e_terminal, (char *)numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype), &auth_pointer, &crypt_pointer, &key_pointer);
+ ret = parse_secrets((char *)e_ext.number, (char *)numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype), &auth_pointer, &crypt_pointer, &key_pointer);
}
if (!ret)
{
*
* reads extension from given extension number and fills structure
*/
-int read_extension(struct extension *ext, char *number)
+int read_extension(struct extension *ext, char *num)
{
FILE *fp=NULL;
+ char number[32];
char filename[256];
char *p;
char option[32];
char buffer[1024];
int last_in_count = 0, last_out_count = 0;
+ /* save number, so &ext and ext.number can be given as parameters - without overwriting itself */
+ SCPY(number, num);
+
if (number[0] == '\0')
return(0);
/* default values */
memset(ext, 0, sizeof(struct extension));
+ SCPY(ext->number, number);
ext->rights = 4; /* international */
ext->tout_setup = 120;
ext->tout_dialing = 120;
/* reset dsp features */
if (mISDNport->b_port[i])
{
- if (mISDNport->b_port[i]->p_m_delay)
+ if (mISDNport->b_port[i]->p_m_txdata)
{
PDEBUG(DEBUG_BCHANNEL, "during deactivation, we reset txdata from txdata=%d.\n", mISDNport->b_port[i]->p_m_txdata);
ph_control(mISDNport->b_addr[i], CMX_TXDATA_OFF, 0);
if ((ret = Port::handler()))
return(ret);
+ inbuffer = (p_fromup_buffer_writep - p_fromup_buffer_readp) & FROMUP_BUFFER_MASK
/* send tone data to isdn device only if we have data */
- if (p_tone_fh>=0 || p_tone_fetched || p_m_crypt_msg_loops)
+ if (p_tone_fh>=0 || p_tone_fetched || p_m_crypt_msg_loops || inbuffer)
{
/* calculate how much to transmit */
if (!p_last_tv.sec)
}
if (elapsed >= ISDN_TRANSMIT)
{
- unsigned char buf[mISDN_HEADER_LEN+(ISDN_PRELOAD<<3)];
+ unsigned char buf[mISDN_HEADER_LEN+(ISDN_PRELOAD<<3)], *p = buf;
iframe_t *frm = (iframe_t *)buf;
- length = read_audio(buffer, elapsed);
p_last_tv_sec = now_tv.sec;
p_last_tv_msec = now_tv.usec/1000;
+ /* read tones */
+ length = read_audio(buffer, elapsed);
+
+ /*
+ * get data from up
+ * the fromup_buffer data is written to the beginning of the buffer
+ * the part that is filles with tones (length) is skipped, so tones have priority
+ * the length value is increased by the number of data copied from fromup_buffer
+ */
+ if (inbuffer)
+ {
+ /* inbuffer might be less than we skip due to audio */
+ if (inbuffer <= length)
+ {
+ /* clear buffer */
+ p_fromup_buffer_readp = p_fromup_buffer_writep;
+ inbuffer = 0;
+ } else
+ {
+ /* skip what we already have with tones */
+ p_fromup_buffer_readp = (p_fromup_buffer_readp + length) & FROMUP_BUFFER_MASK;
+ inbuffer -= length;
+ }
+ /* if we have more in buffer, than we send this time */
+ if (inbuffer > (elapsed-length))
+ inbuffer = elapsed - length;
+ /* set length to what we actually have */
+ length = length + inbuffer;
+ /* now fill up with fromup_buffer */
+ while (inbuffer)
+ {
+ *p++ = p_fromup_buffer[p_fromup_buffer_readp];
+ p_fromup_buffer_readp = (p_fromup_buffer_readp + 1) & FROMUP_BUFFER_MASK;
+ inbuffer--;
+ }
+ }
+
+ /* overwrite buffer with crypto stuff */
if (p_m_crypt_msg_loops)
{
/* send pending message */
int tosend;
+
+ /* we need full length */
+ length = elapsed;
check!!
tosend = p_m_crypt_msg_len - p_m_crypt_msg_current;
if (tosend > length)
tosend = length;
- memcpy(p, p_m_crypt_msg+p_m_crypt_msg_current, tosend);
+ memcpy(buffer, p_m_crypt_msg+p_m_crypt_msg_current, tosend);
p_m_crypt_msg_current += tosend;
if (p_m_crypt_msg_current == p_m_crypt_msg_len)
{
}
} else
{
- p_last_tv.sec = p_last_tv.msec = 0; /* flag that we don't transmit data */
if (!cwp_debug_nothingtosend)
{
p_debug_nothingtosend = 1;
if (frm->prim == (PH_CONTROL | INDICATION))
{
+ if (frm->len < 4)
+ {
+ PERROR("SHORT READ OF PH_CONTROL INDICATION\n");
+ return;
+ }
cont = *((unsigned long *)&frm->data.p);
// PDEBUG(DEBUG_PORT, "PmISDN(%s) received a PH_CONTROL INDICATION 0x%x\n", p_name, cont);
if ((cont&(~DTMF_TONE_MASK)) == DTMF_TONE_VAL)
{
message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_DTMF);
message->param.dtmf = cont & DTMF_TONE_MASK;
- PDEBUG(DEBUG_PORT, "PmISDN(%s) PH_CONTROL DTMF digit '%c'\n", p_name, message->param.dtmf);
+ PDEBUG(DEBUG_PORT, "PmISDN(%s) PH_CONTROL INDICATION DTMF digit '%c'\n", p_name, message->param.dtmf);
message_put(message);
+ return;
}
switch(cont)
{
case BF_REJECT:
message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_CRYPT);
message->param.crypt.type = CC_ERROR_IND;
- PDEBUG(DEBUG_PORT, "PmISDN(%s) PH_CONTROL reject of blowfish.\n", p_name);
+ PDEBUG(DEBUG_PORT, "PmISDN(%s) PH_CONTROL INDICATION reject of blowfish.\n", p_name);
message_put(message);
break;
case BF_ACCEPT:
message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_CRYPT);
message->param.crypt.type = CC_ACTBF_CONF;
- PDEBUG(DEBUG_PORT, "PmISDN(%s) PH_CONTROL accept of blowfish.\n", p_name);
+ PDEBUG(DEBUG_PORT, "PmISDN(%s) PH_CONTROL INDICATION accept of blowfish.\n", p_name);
message_put(message);
break;
+
+ case CMX_TX_DATA:
+ if (!p_m_txdatad)
+ {
+ /* if rx is off, it may happen that fifos send us pending informations, we just ignore them */
+ PDEBUG(DEBUG_BCHANNEL, "PmISDN(%s) ignoring rx data, because 'txdata' is turned off\n", p_name);
+ return;
+ }
+ if (p_record)
+ record(&(cont+1), frm->len - 4, 1); // from up
+ break;
+
+ default:
+ PDEBUG(DEBUG_PORT, "PmISDN(%s) PH_CONTROL INDICATION unknown 0x%x.\n", p_name, cont);
}
return;
+ }
+ if (frm->prim != (PH_DATA | INDICATION))
+ {
+ PERROR("Bchannel received unknown primitve: 0x%x\n", frm->prim);
+ return;
}
/* calls will not process any audio data unless
return;
}
+ /* record data */
+ if (p_record)
+ record((unsigned char *)&frm->data.p, frm->len, 0); // from down
+
/* randomize and listen to crypt message if enabled */
if (p_m_crypt_listen)
{
i = 0;
while(i < mISDNport->b_num)
{
- if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
+ isdnport=mISDNport->b_port[i];
+ /* call bridges in user space OR crypto OR recording */
+ if (isdnport->p_m_calldata || isdnport->p_m_crypt_msg_loops || isdnport->p_m_crypt_listen || isdnport->p_record)
{
- isdnport=mISDNport->b_port[i];
- if (isdnport->p_m_calldata || isdnport->p_m_crypt_msg_loops || isdnport->p_m_crypt_listen || isdnport->p_record)
+ /* rx IS required */
+ if (isdnport->p_m_rxoff)
{
- /* rx IS required */
- if (isdnport->p_m_rxoff)
- {
- /* turn on RX */
- isdnport->p_m_rxoff = 0;
- PDEBUG(DEBUG_BCHANNEL, "%s: receive data is required, so we turn them on\n");
+ /* turn on RX */
+ isdnport->p_m_rxoff = 0;
+ PDEBUG(DEBUG_BCHANNEL, "%s: receive data is required, so we turn them on\n");
+ if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
ph_control(isdnport->p_m_b_addr, CMX_RECEIVE_ON, 0);
- return(1);
- }
- } else
+ return(1);
+ }
+ } else
+ {
+ /* rx NOT required */
+ if (!isdnport->p_m_rxoff)
{
- /* rx NOT required */
- if (!isdnport->p_m_rxoff)
- {
- /* turn off RX */
- isdnport->p_m_rxoff = 1;
- PDEBUG(DEBUG_BCHANNEL, "%s: receive data is not required, so we turn them off\n");
+ /* turn off RX */
+ isdnport->p_m_rxoff = 1;
+ PDEBUG(DEBUG_BCHANNEL, "%s: receive data is not required, so we turn them off\n");
+ if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
ph_control(isdnport->p_m_b_addr, CMX_RECEIVE_OFF, 0);
- return(1);
- }
+ return(1);
}
}
+ /* recordin */
+ if (isdnport->p_record)
+ {
+ /* txdata IS required */
+ if (!isdnport->p_m_txdata)
+ {
+ /* turn on RX */
+ isdnport->p_m_txdata = 1;
+ PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is required, so we turn them on\n");
+ if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
+ ph_control(isdnport->p_m_b_addr, CMX_TXDATA_ON, 0);
+ return(1);
+ }
+ } else
+ {
+ /* txdata NOT required */
+ if (isdnport->p_m_txdata)
+ {
+ /* turn off RX */
+ isdnport->p_m_txdata = 0;
+ PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is not required, so we turn them off\n");
+ if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
+ ph_control(isdnport->p_m_b_addr, CMX_TXDATA_OFF, 0);
+ return(1);
+ }
i++;
}
#if 0
struct param_data {
unsigned char data[512]; /* audio/hdlc data */
int len; /* audio/hdlc data */
- unsigned long port_id; /* to identify the source of this data */
- int port_type; /* type of the source's port */
+// unsigned long port_id; /* to identify the source of this data */
+// int port_type; /* type of the source's port */
};
struct param_play {
set_tone(param->tone.dir,param->tone.name);
return(1);
- case MESSAGE_DATA:
-//printf("port=%s, epoint=%d\n",p_cardname, epoint->e_serial);
- mixer(param);
+ case MESSAGE_DATA: /* tx-data from upper layer */
+ fromup(param->data.data, param->data.len);
return(1);
case MESSAGE_VBOX_TONE: /* play tone of answering machine */
* written before close, because we do not know the size yet)
* type=1 record annoucement, type=0 record audio stream, type=2 record vbox
*/
-int Port::open_record(int type, int vbox, int skip, char *terminal, int anon_ignore, char *vbox_email, int vbox_email_file)
+int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ignore, char *vbox_email, int vbox_email_file)
{
/* RIFFxxxxWAVEfmt xxxx(fmt-size)dataxxxx... */
char dummyheader[8+4+8+sizeof(fmt)+8];
char filename[256];
- if (!terminal)
+ if (!extension)
{
- PERROR("Port(%d) not a terminal\n", p_serial);
+ PERROR("Port(%d) not an extension\n", p_serial);
return(0);
}
- SCPY(p_record_extension, terminal);
+ SCPY(p_record_extension, extension);
p_record_anon_ignore = anon_ignore;
SCPY(p_record_vbox_email, vbox_email);
p_record_vbox_email_file = vbox_email_file;
else
SPRINT(filename, "%s_%s-%s.isdn", p_record_filename, callerid, number);
break;
-
- default:
- if (p_record_vbox == 1)
- SPRINT(filename, "%s.unknown", p_record_filename);
- else
- SPRINT(filename, "%s_%s-%s.unknown", p_record_filename, callerid, number);
}
fclose(p_record);
}
+/*
+ * recording function
+ * Records all data from down and from up into one single stream.
+ * Both streams may have gaps or jitter.
+ * A Jitter buffer for both streams is used to compensate jitter.
+ *
+ * If one stream (dir) received packets, they are stored to a
+ * buffer to wait for the other stream (dir), so both streams can
+ * be combined. If the buffer is full, it's read pointer is written
+ * without mixing stream.
+ * A flag is used to indicate what stream is currently in buffer.
+ *
+ * NOTE: First stereo sample (odd) is from down, second is from up.
+ */
+alle buffer initialisieren
+record nur aufrufen, wenn recorded wird.
+restlicher buffer wegschreiben beim schliessen
+void Port::record(char *data, int length, int dir_fromup)
+{
+ unsigned char write_buffer[1024], *d;
+ signed short *s;
+ int r, w;
+ signed long sample;
+
+ /* no recording */
+ if (!p_record || !length)
+ return;
+
+ free = ((p_record_buffer_readp - p_record_buffer_writep - 1) & RECORD_BUFFER_MASK);
+
+ /* the buffer stores the same data stream */
+ if (dir_fromup == p_record_buffer_dir)
+ {
+ same_again:
+
+ /* first write what we can to the buffer */
+ while(free && length)
+ {
+ p_record_buffer[p_record_buffer_writep] = audio_law_to_s32(*data++);
+ p_record_buffer_writep = (p_record_buffer_writep + 1) & RECORD_BUFFER_MASK;
+ free--;
+ length--;
+ }
+ /* all written, so we return */
+ if (!length)
+ return;
+ /* still data left, buffer is full, so we need to write to file */
+ switch(p_record_type)
+ {
+ case CODEC_MONO:
+ s = (signed short *)write_buffer;
+ i = 0;
+ while(i < 256)
+ {
+ *s++ = p_record_buffer[p_record_buffer_readp];
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ i++;
+ }
+ fwrite(write_buffer, 512, 1, p_record);
+ break;
+
+ case CODEC_STEREO:
+ s = (signed short *)write_buffer;
+ if (p_record_buffer_dir)
+ {
+ i = 0;
+ while(i < 256)
+ {
+ *s++ = 0; /* nothing from down */
+ *s++ = p_record_buffer[p_record_buffer_readp];
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ i++;
+ }
+ } else
+ {
+ i = 0;
+ while(i < 256)
+ {
+ *s++ = p_record_buffer[p_record_buffer_readp];
+ *s++ = 0; /* nothing from up */
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ i++;
+ }
+ }
+ fwrite(write_buffer, 1024, 1, p_record);
+ break;
+
+ case CODEC_8BIT:
+ d = write_buffer;
+ i = 0;
+ while(i < 256)
+ {
+ *d++ = (p_record_buffer[p_record_buffer_readp]+0x8000) >> 8;
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ i++;
+ }
+ fwrite(write_buffer, 512, 1, p_record);
+ break;
+
+ case CODEC_LAW:
+ d = write_buffer;
+ i = 0;
+ while(i < 256)
+ {
+ *d++ = audio_s16_to_law[p_record_buffer[p_record_buffer_readp] & 0xffff];
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ i++;
+ }
+ fwrite(write_buffer, 256, 1, p_record);
+ break;
+ }
+ /* because we still have data, we write again */
+ free += sizeof(write_buffer);
+ goto same_again;
+ }
+
+ /* the buffer store the other stream */
+ different_again:
+
+ /* if buffer empty, change it */
+ if (p_record_buffer_readp == p_record_buffer_writep)
+ {
+ p_record_buffer_dir = dir_fromup;
+ goto same_again;
+ }
+ /* how much data can we mix ? */
+ ii = (p_record_buffer_writep - p_record_buffer_readp) & RECORD_BUFFER_MASK;
+ if (length < ii)
+ ii = length;
+ /* write data mixed with the buffer */
+ switch(p_record_type)
+ {
+ case CODEC_MONO:
+ s = (signed short *)write_buffer;
+ i = 0;
+ while(i < ii)
+ {
+ sample = p_record_buffer[p_record_buffer_readp]
+ + audio_law_to_s32(*data++);
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ if (sample < 32767)
+ sample = -32767;
+ if (sample > 32768)
+ sample = 32768;
+ *s++ = sample;
+ i++;
+ }
+ fwrite(write_buffer, ii<<1, 1, p_record);
+ break;
+
+ case CODEC_STEREO:
+ s = (signed short *)write_buffer;
+ if (p_record_buffer_dir)
+ {
+ i = 0;
+ while(i < ii)
+ {
+ *s++ = audio_law_to_s32(*data++);
+ *s++ = p_record_buffer[p_record_buffer_readp];
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ i++;
+ }
+ } else
+ {
+ i = 0;
+ while(i < ii)
+ {
+ *s++ = p_record_buffer[p_record_buffer_readp];
+ *s++ = audio_law_to_s32(*data++);
+ i++;
+ }
+ }
+ fwrite(write_buffer, ii<<2, 1, p_record);
+ break;
+
+ case CODEC_8BIT:
+ d = write_buffer;
+ i = 0;
+ while(i < ii)
+ {
+ sample = p_record_buffer[p_record_buffer_readp]
+ + audio_law_to_s32(*data++);
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ if (sample < 32767)
+ sample = -32767;
+ if (sample > 32768)
+ sample = 32768;
+ *d++ = (sample+0x8000) >> 8;
+ i++;
+ }
+ fwrite(write_buffer, ii, 1, p_record);
+ break;
+
+ case CODEC_LAW:
+ d = write_buffer;
+ i = 0;
+ while(i < ii)
+ {
+ sample = p_record_buffer[p_record_buffer_readp]
+ + audio_law_to_s32(*data++);
+ p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK;
+ if (sample < 32767)
+ sample = -32767;
+ if (sample > 32768)
+ sample = 32768;
+ *d++ = audio_s16_to_law[sample & 0xffff];
+ i++;
+ }
+ fwrite(write_buffer, ii, 1, p_record);
+ break;
+ }
+ length -= ii;
+ /* data, but buffer empty */
+ if (length)
+ {
+ p_record_buffer_dir = dir_fromup;
+ goto same_again;
+ }
+ /* no data (maybe buffer) */
+ return;
+
+}
+
+
+/*
+ * enque data from upper buffer
+ */
+iniialisieren der werte
+void Port::txfromup(unsigned char *data, int length)
+{
+
+ /* no recording */
+ if (!length)
+ return;
+
+ /* get free samples in buffer */
+ free = ((p_fromup_buffer_readp - p_fromup_buffer_writep - 1) & FROMUP_BUFFER_MASK);
+ if (free < length)
+ {
+ PDEBUG(DEBUG_PORT, "Port(%d): fromup_buffer overflows, this shall not happen under normal conditions\n", p_serial);
+ return;
+ }
+
+ /* write data to buffer and return */
+ while(length)
+ {
+ p_fromup_buffer[p_fromup_buffer_writep] = *data++;
+ p_fromup_buffer_writep = (p_fromup_buffer_writep + 1) & FROMUP_BUFFER_MASK;
+ length--;
+ }
+ return; // must return, because length is 0
+}
switch(cond->match)
{
case MATCH_EXTERN:
- if (!e_terminal[0])
+ if (!e_ext.number[0])
istrue = 1;
break;
case MATCH_INTERN:
- if (e_terminal[0])
+ if (e_ext.number[0])
istrue = 1;
break;
-
define and change dsp conference ids
make asterisk call implementation
new interface.conf (add remove ports by admin)
-reduce mixer
-
-call recording
-
call to multiple endpoints (extensions)
trace with layers and filters
display message during nothing/play
-
+Port -> Channel
+Call -> Link
/* start recording, if not already */
if (p_vbox_mode == VBOX_MODE_NORMAL)
{
- /* send recording start message */
- message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_VBOX_RECORD);
- message_put(message);
+ /* recording start */
+ open_record(p_vbox_ext.vbox_codec, 2, 0, p_vbox_ext.number, p_vbox_ext.anon_ignore, p_vbox_ext.vbox_email, p_vbox_ext.vbox_email_file);
} else // else!!
if (p_vbox_mode == VBOX_MODE_ANNOUNCEMENT)
{
}
} else
{
+ if (p_record)
+ record(buffer, tosend, 0); // from down
message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_DATA);
message->param.data.port_type = p_type;
message->param.data.port_id = p_serial;
new_state(PORT_STATE_IN_ALERTING);
}
- /* start recording during announcement */
- /* start parallel recording if desired */
- p_vbox_mode = p_vbox_ext.vbox_mode;
- p_vbox_record_limit = p_vbox_ext.vbox_time;
/* play the announcement */
if ((p_vbox_announce_fh = open_tone(filename, &p_vbox_announce_codec, &p_vbox_announce_size, &p_vbox_announce_left)) >= 0)
{
fhuse++;
}
+ /* start recording if desired */
+ p_vbox_mode = p_vbox_ext.vbox_mode;
+ p_vbox_record_limit = p_vbox_ext.vbox_time;
if (!p_vbox_announce_fh || p_vbox_mode==VBOX_MODE_PARALLEL)
{
PDEBUG(DEBUG_VBOX, "PORT(%s) parallel mode OR no announcement found at: '%s' so we start recording now.\n", p_name, filename);