mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +00:00
Merged revisions 145293,158010 from
https://origsvn.digium.com/svn/asterisk/branches/1.4 to make merging easier. These changes are already on trunk. ................ r145293 | rmudgett | 2008-09-30 18:55:24 -0500 (Tue, 30 Sep 2008) | 54 lines channels/chan_misdn.c channels/misdn/isdn_lib.c * Miscellaneous other fixes from trunk to make merging easier later. ........ r145200 | rmudgett | 2008-09-30 16:00:54 -0500 (Tue, 30 Sep 2008) | 7 lines * Miscellaneous formatting changes to make v1.4 and trunk more merge compatible in the mISDN area. channels/chan_misdn.c * Eliminated redundant code in cb_events() EVENT_SETUP ........ r144257 | crichter | 2008-09-24 03:42:55 -0500 (Wed, 24 Sep 2008) | 9 lines improved helptext of misdn_set_opt. ........ r142181 | rmudgett | 2008-09-09 12:30:52 -0500 (Tue, 09 Sep 2008) | 1 line Cleaned up comment ........ r138738 | rmudgett | 2008-08-18 16:07:28 -0500 (Mon, 18 Aug 2008) | 30 lines channels/chan_misdn.c * Made bearer2str() use allowed_bearers_array[] * Made use the causes.h defines instead of hardcoded numbers. * Made use Asterisk presentation indicator values if either of the mISDN presentation or screen options are negative. * Updated the misdn_set_opt application option descriptions. * Renamed the awkward Caller ID presentation misdn_set_opt application option value not_screened to restricted. Deprecated the not_screened option value. channels/misdn/isdn_lib.c * Made use the causes.h defines instead of hardcoded numbers. * Fixed some spelling errors and typos. * Added all defined facility code strings to fac2str(). channels/misdn/isdn_lib.h * Added doxygen comments to struct misdn_bchannel. channels/misdn/isdn_lib_intern.h * Added doxygen comments to struct misdn_stack. channels/misdn_config.c configs/misdn.conf.sample * Updated the mISDN presentation and screen parameter descriptions. doc/misdn.txt (doc/tex/misdn.tex) * Updated the misdn_set_opt application option descriptions. * Fixed some spelling errors and typos. ................ r158010 | rmudgett | 2008-11-19 19:46:09 -0600 (Wed, 19 Nov 2008) | 9 lines Merged revision 157977 from https://origsvn.digium.com/svn/asterisk/team/group/issue8824 ........ Fixes JIRA ABE-1726 The dial extension could be empty if you are using MISDN_KEYPAD to control ISDN provider features. ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@207286 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -586,51 +586,35 @@ static struct chan_list * get_chan_by_ast_name(char *name)
|
|||||||
|
|
||||||
|
|
||||||
struct allowed_bearers {
|
struct allowed_bearers {
|
||||||
int cap;
|
char *name; /*!< Bearer capability name string used in /etc/misdn.conf allowed_bearers */
|
||||||
int val;
|
char *display; /*!< Bearer capability displayable name */
|
||||||
char *name;
|
int cap; /*!< SETUP message bearer capability field code value */
|
||||||
int deprecated;
|
int deprecated; /*!< TRUE if this entry is deprecated. (Misspelled or bad name to use) */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct allowed_bearers allowed_bearers_array[]= {
|
/* *INDENT-OFF* */
|
||||||
{INFO_CAPABILITY_SPEECH,1,"speech"},
|
static const struct allowed_bearers allowed_bearers_array[]= {
|
||||||
{INFO_CAPABILITY_AUDIO_3_1K,2,"3_1khz"},
|
/* Name, Displayable Name Bearer Capability, Deprecated */
|
||||||
{INFO_CAPABILITY_DIGITAL_UNRESTRICTED,4,"digital_unrestricted"},
|
{ "speech", "Speech", INFO_CAPABILITY_SPEECH, 0 },
|
||||||
{INFO_CAPABILITY_DIGITAL_RESTRICTED,8,"digital_restricted"},
|
{ "3_1khz", "3.1KHz Audio", INFO_CAPABILITY_AUDIO_3_1K, 0 },
|
||||||
{INFO_CAPABILITY_DIGITAL_RESTRICTED,8,"digital_restriced", 1}, /* Allow misspelling for backwards compatibility */
|
{ "digital_unrestricted", "Unrestricted Digital", INFO_CAPABILITY_DIGITAL_UNRESTRICTED, 0 },
|
||||||
{INFO_CAPABILITY_VIDEO,16,"video"}
|
{ "digital_restricted", "Restricted Digital", INFO_CAPABILITY_DIGITAL_RESTRICTED, 0 },
|
||||||
|
{ "digital_restriced", "Restricted Digital", INFO_CAPABILITY_DIGITAL_RESTRICTED, 1 }, /* Allow misspelling for backwards compatibility */
|
||||||
|
{ "video", "Video", INFO_CAPABILITY_VIDEO, 0 }
|
||||||
};
|
};
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
static char *bearer2str(int cap) {
|
static const char *bearer2str(int cap)
|
||||||
static char *bearers[]={
|
{
|
||||||
"Speech",
|
unsigned index;
|
||||||
"Audio 3.1k",
|
|
||||||
"Unres Digital",
|
for (index = 0; index < ARRAY_LEN(allowed_bearers_array); ++index) {
|
||||||
"Res Digital",
|
if (allowed_bearers_array[index].cap == cap) {
|
||||||
"Video",
|
return allowed_bearers_array[index].display;
|
||||||
"Unknown Bearer"
|
}
|
||||||
};
|
|
||||||
|
|
||||||
switch (cap) {
|
|
||||||
case INFO_CAPABILITY_SPEECH:
|
|
||||||
return bearers[0];
|
|
||||||
break;
|
|
||||||
case INFO_CAPABILITY_AUDIO_3_1K:
|
|
||||||
return bearers[1];
|
|
||||||
break;
|
|
||||||
case INFO_CAPABILITY_DIGITAL_UNRESTRICTED:
|
|
||||||
return bearers[2];
|
|
||||||
break;
|
|
||||||
case INFO_CAPABILITY_DIGITAL_RESTRICTED:
|
|
||||||
return bearers[3];
|
|
||||||
break;
|
|
||||||
case INFO_CAPABILITY_VIDEO:
|
|
||||||
return bearers[4];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return bearers[5];
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "Unknown Bearer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -898,7 +882,7 @@ static int misdn_overlap_dial_task (const void *data)
|
|||||||
} else {
|
} else {
|
||||||
misdn_overlap_dial_task_disconnect:
|
misdn_overlap_dial_task_disconnect:
|
||||||
hanguptone_indicate(ch);
|
hanguptone_indicate(ch);
|
||||||
ch->bc->out_cause=1;
|
ch->bc->out_cause = AST_CAUSE_UNALLOCATED;
|
||||||
ch->state=MISDN_CLEANING;
|
ch->state=MISDN_CLEANING;
|
||||||
misdn_lib_send_event(ch->bc, EVENT_DISCONNECT);
|
misdn_lib_send_event(ch->bc, EVENT_DISCONNECT);
|
||||||
}
|
}
|
||||||
@@ -965,10 +949,11 @@ static char *handle_cli_misdn_set_debug(struct ast_cli_entry *e, int cmd, struct
|
|||||||
level = atoi(a->argv[3]);
|
level = atoi(a->argv[3]);
|
||||||
|
|
||||||
switch (a->argc) {
|
switch (a->argc) {
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
int only = 0, i;
|
int i;
|
||||||
|
int only = 0;
|
||||||
if (a->argc == 5) {
|
if (a->argc == 5) {
|
||||||
if (strncasecmp(a->argv[4], "only", strlen(a->argv[4])))
|
if (strncasecmp(a->argv[4], "only", strlen(a->argv[4])))
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
@@ -983,7 +968,7 @@ static char *handle_cli_misdn_set_debug(struct ast_cli_entry *e, int cmd, struct
|
|||||||
ast_cli(a->fd, "changing debug level for all ports to %d%s\n",misdn_debug[0], only?" (only)":"");
|
ast_cli(a->fd, "changing debug level for all ports to %d%s\n",misdn_debug[0], only?" (only)":"");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
int port;
|
int port;
|
||||||
@@ -1187,8 +1172,6 @@ static inline void show_config_description(int fd, enum misdn_cfg_elements elem)
|
|||||||
ast_cli(fd, "[%s] %s (Default: %s)\n\t%s\n", section, name, def, desc);
|
ast_cli(fd, "[%s] %s (Default: %s)\n\t%s\n", section, name, def, desc);
|
||||||
else
|
else
|
||||||
ast_cli(fd, "[%s] %s\n\t%s\n", section, name, desc);
|
ast_cli(fd, "[%s] %s\n\t%s\n", section, name, desc);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *handle_cli_misdn_show_config(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *handle_cli_misdn_show_config(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
@@ -1419,7 +1402,7 @@ static void print_bc_info (int fd, struct chan_list *help, struct misdn_bchannel
|
|||||||
|
|
||||||
static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
struct chan_list *help = NULL;
|
struct chan_list *help;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CLI_INIT:
|
case CLI_INIT:
|
||||||
@@ -1437,7 +1420,7 @@ static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, st
|
|||||||
|
|
||||||
help = cl_te;
|
help = cl_te;
|
||||||
|
|
||||||
ast_cli(a->fd, "Channel List: %p\n", cl_te);
|
ast_cli(a->fd, "Channel List: %p\n", cl_te);
|
||||||
|
|
||||||
for (; help; help = help->next) {
|
for (; help; help = help->next) {
|
||||||
struct misdn_bchannel *bc = help->bc;
|
struct misdn_bchannel *bc = help->bc;
|
||||||
@@ -1481,7 +1464,7 @@ static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, st
|
|||||||
|
|
||||||
static char *handle_cli_misdn_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *handle_cli_misdn_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
struct chan_list *help = NULL;
|
struct chan_list *help;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CLI_INIT:
|
case CLI_INIT:
|
||||||
@@ -1560,7 +1543,7 @@ static char *handle_cli_misdn_show_stacks(struct ast_cli_entry *e, int cmd, stru
|
|||||||
port = misdn_cfg_get_next_port(port)) {
|
port = misdn_cfg_get_next_port(port)) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
get_show_stack_details(port, buf);
|
get_show_stack_details(port, buf);
|
||||||
ast_cli(a->fd," %s Debug:%d%s\n", buf, misdn_debug[port], misdn_debug_only[port] ? "(only)" : "");
|
ast_cli(a->fd, " %s Debug:%d%s\n", buf, misdn_debug[port], misdn_debug_only[port] ? "(only)" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
@@ -1614,7 +1597,7 @@ static char *handle_cli_misdn_show_port(struct ast_cli_entry *e, int cmd, struct
|
|||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
|
|
||||||
port = atoi(a->argv[3]);
|
port = atoi(a->argv[3]);
|
||||||
|
|
||||||
ast_cli(a->fd, "BEGIN STACK_LIST:\n");
|
ast_cli(a->fd, "BEGIN STACK_LIST:\n");
|
||||||
get_show_stack_details(port, buf);
|
get_show_stack_details(port, buf);
|
||||||
ast_cli(a->fd, " %s Debug:%d%s\n", buf, misdn_debug[port], misdn_debug_only[port] ? "(only)" : "");
|
ast_cli(a->fd, " %s Debug:%d%s\n", buf, misdn_debug[port], misdn_debug_only[port] ? "(only)" : "");
|
||||||
@@ -1691,9 +1674,8 @@ static char *handle_cli_misdn_send_facility(struct ast_cli_entry *e, int cmd, st
|
|||||||
|
|
||||||
misdn_lib_send_event(bc, EVENT_FACILITY);
|
misdn_lib_send_event(bc, EVENT_FACILITY);
|
||||||
} else if (strstr(a->argv[3],"CFDeactivate")) {
|
} else if (strstr(a->argv[3],"CFDeactivate")) {
|
||||||
|
|
||||||
if (a->argc < 6) {
|
if (a->argc < 6) {
|
||||||
ast_verbose("CFActivate requires 1 arg: FromNumber\n\n");
|
ast_verbose("CFDeactivate requires 1 arg: FromNumber\n\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
port = atoi(a->argv[4]);
|
port = atoi(a->argv[4]);
|
||||||
@@ -1715,6 +1697,9 @@ static char *handle_cli_misdn_send_facility(struct ast_cli_entry *e, int cmd, st
|
|||||||
|
|
||||||
static char *handle_cli_misdn_send_restart(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *handle_cli_misdn_send_restart(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
|
int port;
|
||||||
|
int channel;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CLI_INIT:
|
case CLI_INIT:
|
||||||
e->command = "misdn send restart";
|
e->command = "misdn send restart";
|
||||||
@@ -1729,10 +1714,13 @@ static char *handle_cli_misdn_send_restart(struct ast_cli_entry *e, int cmd, str
|
|||||||
if (a->argc < 4 || a->argc > 5)
|
if (a->argc < 4 || a->argc > 5)
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
|
|
||||||
if (a->argc == 5)
|
port = atoi(a->argv[3]);
|
||||||
misdn_lib_send_restart(atoi(a->argv[3]), atoi(a->argv[4]));
|
if (a->argc == 5) {
|
||||||
else
|
channel = atoi(a->argv[4]);
|
||||||
misdn_lib_send_restart(atoi(a->argv[3]), -1);
|
misdn_lib_send_restart(port, channel);
|
||||||
|
} else {
|
||||||
|
misdn_lib_send_restart(port, -1);
|
||||||
|
}
|
||||||
|
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -1814,7 +1802,7 @@ static char *handle_cli_misdn_toggle_echocancel(struct ast_cli_entry *e, int cmd
|
|||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp->toggle_ec = tmp->toggle_ec?0:1;
|
tmp->toggle_ec = tmp->toggle_ec ? 0 : 1;
|
||||||
|
|
||||||
if (tmp->toggle_ec) {
|
if (tmp->toggle_ec) {
|
||||||
#ifdef MISDN_1_2
|
#ifdef MISDN_1_2
|
||||||
@@ -1998,51 +1986,46 @@ static int update_config(struct chan_list *ch, int orig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
misdn_cfg_get(port, MISDN_CFG_PRES, &pres, sizeof(pres));
|
misdn_cfg_get(port, MISDN_CFG_PRES, &pres, sizeof(pres));
|
||||||
misdn_cfg_get(port, MISDN_CFG_SCREEN, &screen, sizeof(screen));
|
misdn_cfg_get(port, MISDN_CFG_SCREEN, &screen, sizeof(screen));
|
||||||
chan_misdn_log(2, port, " --> pres: %d screen: %d\n", pres, screen);
|
chan_misdn_log(2, port, " --> pres: %d screen: %d\n", pres, screen);
|
||||||
|
|
||||||
if ( (pres + screen) < 0 ) {
|
if (pres < 0 || screen < 0) {
|
||||||
|
|
||||||
chan_misdn_log(2, port, " --> pres: %x\n", ast->cid.cid_pres);
|
chan_misdn_log(2, port, " --> pres: %x\n", ast->cid.cid_pres);
|
||||||
|
|
||||||
switch (ast->cid.cid_pres & 0x60) {
|
switch (ast->cid.cid_pres & 0x60) {
|
||||||
|
|
||||||
case AST_PRES_RESTRICTED:
|
case AST_PRES_RESTRICTED:
|
||||||
bc->pres = 1;
|
bc->pres = 1;
|
||||||
chan_misdn_log(2, port, " --> PRES: Restricted (0x1)\n");
|
chan_misdn_log(2, port, " --> PRES: Restricted (1)\n");
|
||||||
break;
|
break;
|
||||||
case AST_PRES_UNAVAILABLE:
|
case AST_PRES_UNAVAILABLE:
|
||||||
bc->pres = 2;
|
bc->pres = 2;
|
||||||
chan_misdn_log(2, port, " --> PRES: Unavailable (0x2)\n");
|
chan_misdn_log(2, port, " --> PRES: Unavailable (2)\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bc->pres = 0;
|
bc->pres = 0;
|
||||||
chan_misdn_log(2, port, " --> PRES: Allowed (0x0)\n");
|
chan_misdn_log(2, port, " --> PRES: Allowed (0)\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ast->cid.cid_pres & 0x3) {
|
|
||||||
|
|
||||||
|
switch (ast->cid.cid_pres & 0x3) {
|
||||||
|
default:
|
||||||
case AST_PRES_USER_NUMBER_UNSCREENED:
|
case AST_PRES_USER_NUMBER_UNSCREENED:
|
||||||
bc->screen = 0;
|
bc->screen = 0;
|
||||||
chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
|
chan_misdn_log(2, port, " --> SCREEN: Unscreened (0)\n");
|
||||||
break;
|
break;
|
||||||
case AST_PRES_USER_NUMBER_PASSED_SCREEN:
|
case AST_PRES_USER_NUMBER_PASSED_SCREEN:
|
||||||
bc->screen = 1;
|
bc->screen = 1;
|
||||||
chan_misdn_log(2, port, " --> SCREEN: Passed Screen (0x1)\n");
|
chan_misdn_log(2, port, " --> SCREEN: Passed Screen (1)\n");
|
||||||
break;
|
break;
|
||||||
case AST_PRES_USER_NUMBER_FAILED_SCREEN:
|
case AST_PRES_USER_NUMBER_FAILED_SCREEN:
|
||||||
bc->screen = 2;
|
bc->screen = 2;
|
||||||
chan_misdn_log(2, port, " --> SCREEN: Failed Screen (0x2)\n");
|
chan_misdn_log(2, port, " --> SCREEN: Failed Screen (2)\n");
|
||||||
break;
|
break;
|
||||||
case AST_PRES_NETWORK_NUMBER:
|
case AST_PRES_NETWORK_NUMBER:
|
||||||
bc->screen = 3;
|
bc->screen = 3;
|
||||||
chan_misdn_log(2, port, " --> SCREEN: Network Nr. (0x3)\n");
|
chan_misdn_log(2, port, " --> SCREEN: Network Nr. (3)\n");
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
bc->screen = 0;
|
|
||||||
chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bc->screen = screen;
|
bc->screen = screen;
|
||||||
@@ -2187,11 +2170,11 @@ static int read_config(struct chan_list *ch, int orig)
|
|||||||
misdn_cfg_get(port, MISDN_CFG_INCOMING_EARLY_AUDIO, &ch->incoming_early_audio, sizeof(ch->incoming_early_audio));
|
misdn_cfg_get(port, MISDN_CFG_INCOMING_EARLY_AUDIO, &ch->incoming_early_audio, sizeof(ch->incoming_early_audio));
|
||||||
|
|
||||||
misdn_cfg_get(port, MISDN_CFG_SENDDTMF, &bc->send_dtmf, sizeof(bc->send_dtmf));
|
misdn_cfg_get(port, MISDN_CFG_SENDDTMF, &bc->send_dtmf, sizeof(bc->send_dtmf));
|
||||||
|
|
||||||
misdn_cfg_get( port, MISDN_CFG_ASTDTMF, &ch->ast_dsp, sizeof(int));
|
misdn_cfg_get(port, MISDN_CFG_ASTDTMF, &ch->ast_dsp, sizeof(int));
|
||||||
|
|
||||||
if (ch->ast_dsp) {
|
if (ch->ast_dsp) {
|
||||||
ch->ignore_dtmf=1;
|
ch->ignore_dtmf = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
misdn_cfg_get(port, MISDN_CFG_NEED_MORE_INFOS, &bc->need_more_infos, sizeof(bc->need_more_infos));
|
misdn_cfg_get(port, MISDN_CFG_NEED_MORE_INFOS, &bc->need_more_infos, sizeof(bc->need_more_infos));
|
||||||
@@ -2372,22 +2355,10 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
|
|||||||
int r;
|
int r;
|
||||||
int exceed;
|
int exceed;
|
||||||
int bridging;
|
int bridging;
|
||||||
struct chan_list *ch = MISDN_ASTERISK_TECH_PVT(ast);
|
struct chan_list *ch;
|
||||||
struct misdn_bchannel *newbc;
|
struct misdn_bchannel *newbc;
|
||||||
char *opts = NULL, *ext, *tokb;
|
char *opts, *ext;
|
||||||
char *dest_cp = ast_strdupa(dest);
|
char *dest_cp;
|
||||||
|
|
||||||
ext = strtok_r(dest_cp, "/", &tokb);
|
|
||||||
|
|
||||||
if (ext) {
|
|
||||||
ext = strtok_r(NULL, "/", &tokb);
|
|
||||||
if (ext) {
|
|
||||||
opts = strtok_r(NULL, "/", &tokb);
|
|
||||||
} else {
|
|
||||||
chan_misdn_log(0, 0, "misdn_call: No Extension given!\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ast) {
|
if (!ast) {
|
||||||
ast_log(LOG_WARNING, " --> ! misdn_call called on ast_channel *ast where ast == NULL\n");
|
ast_log(LOG_WARNING, " --> ! misdn_call called on ast_channel *ast where ast == NULL\n");
|
||||||
@@ -2401,6 +2372,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ch = MISDN_ASTERISK_TECH_PVT(ast);
|
||||||
if (!ch) {
|
if (!ch) {
|
||||||
ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name);
|
ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name);
|
||||||
ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE;
|
ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE;
|
||||||
@@ -2409,7 +2381,6 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
newbc = ch->bc;
|
newbc = ch->bc;
|
||||||
|
|
||||||
if (!newbc) {
|
if (!newbc) {
|
||||||
ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name);
|
ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name);
|
||||||
ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE;
|
ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE;
|
||||||
@@ -2417,6 +2388,22 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dest is ---v
|
||||||
|
* Dial(mISDN/g:group_name[/extension[/options]])
|
||||||
|
* Dial(mISDN/port[:preselected_channel][/extension[/options]])
|
||||||
|
*
|
||||||
|
* The dial extension could be empty if you are using MISDN_KEYPAD
|
||||||
|
* to control ISDN provider features.
|
||||||
|
*/
|
||||||
|
dest_cp = ast_strdupa(dest);
|
||||||
|
strsep(&dest_cp, "/");/* Discard port/group token */
|
||||||
|
ext = strsep(&dest_cp, "/");
|
||||||
|
if (!ext) {
|
||||||
|
ext = "";
|
||||||
|
}
|
||||||
|
opts = dest_cp;
|
||||||
|
|
||||||
port = newbc->port;
|
port = newbc->port;
|
||||||
|
|
||||||
if ((exceed = add_out_calls(port))) {
|
if ((exceed = add_out_calls(port))) {
|
||||||
@@ -2507,7 +2494,7 @@ static int misdn_answer(struct ast_channel *ast)
|
|||||||
struct chan_list *p;
|
struct chan_list *p;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
if (!ast || ! (p = MISDN_ASTERISK_TECH_PVT(ast)) ) return -1;
|
if (!ast || !(p = MISDN_ASTERISK_TECH_PVT(ast))) return -1;
|
||||||
|
|
||||||
chan_misdn_log(1, p ? (p->bc ? p->bc->port : 0) : 0, "* ANSWER:\n");
|
chan_misdn_log(1, p ? (p->bc ? p->bc->port : 0) : 0, "* ANSWER:\n");
|
||||||
|
|
||||||
@@ -2523,7 +2510,6 @@ static int misdn_answer(struct ast_channel *ast)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmp = pbx_builtin_getvar_helper(p->ast, "CRYPT_KEY");
|
tmp = pbx_builtin_getvar_helper(p->ast, "CRYPT_KEY");
|
||||||
|
|
||||||
if (!ast_strlen_zero(tmp)) {
|
if (!ast_strlen_zero(tmp)) {
|
||||||
chan_misdn_log(1, p->bc->port, " --> Connection will be BF crypted\n");
|
chan_misdn_log(1, p->bc->port, " --> Connection will be BF crypted\n");
|
||||||
ast_copy_string(p->bc->crypt_key, tmp, sizeof(p->bc->crypt_key));
|
ast_copy_string(p->bc->crypt_key, tmp, sizeof(p->bc->crypt_key));
|
||||||
@@ -2565,7 +2551,7 @@ static int misdn_digit_end(struct ast_channel *ast, char digit, unsigned int dur
|
|||||||
struct misdn_bchannel *bc;
|
struct misdn_bchannel *bc;
|
||||||
char buf[2] = { digit, 0 };
|
char buf[2] = { digit, 0 };
|
||||||
|
|
||||||
if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast))) return -1;
|
if (!ast || !(p = MISDN_ASTERISK_TECH_PVT(ast))) return -1;
|
||||||
|
|
||||||
bc = p->bc;
|
bc = p->bc;
|
||||||
chan_misdn_log(1, bc ? bc->port : 0, "* IND : Digit %c\n", digit);
|
chan_misdn_log(1, bc ? bc->port : 0, "* IND : Digit %c\n", digit);
|
||||||
@@ -2596,7 +2582,7 @@ static int misdn_digit_end(struct ast_channel *ast, char digit, unsigned int dur
|
|||||||
if ( bc->send_dtmf )
|
if ( bc->send_dtmf )
|
||||||
send_digit_to_chan(p,digit);
|
send_digit_to_chan(p,digit);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2667,7 +2653,7 @@ static int misdn_indication(struct ast_channel *ast, int cond, const void *data,
|
|||||||
p->state = MISDN_ALERTING;
|
p->state = MISDN_ALERTING;
|
||||||
chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d\n", p->bc ? p->bc->pid : -1);
|
chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d\n", p->bc ? p->bc->pid : -1);
|
||||||
misdn_lib_send_event( p->bc, EVENT_ALERTING);
|
misdn_lib_send_event( p->bc, EVENT_ALERTING);
|
||||||
|
|
||||||
if (p->other_ch && p->other_ch->bc) {
|
if (p->other_ch && p->other_ch->bc) {
|
||||||
if (misdn_inband_avail(p->other_ch->bc)) {
|
if (misdn_inband_avail(p->other_ch->bc)) {
|
||||||
chan_misdn_log(2, p->bc->port, " --> other End is mISDN and has inband info available\n");
|
chan_misdn_log(2, p->bc->port, " --> other End is mISDN and has inband info available\n");
|
||||||
@@ -2682,8 +2668,8 @@ static int misdn_indication(struct ast_channel *ast, int cond, const void *data,
|
|||||||
|
|
||||||
chan_misdn_log(3, p->bc->port, " --> * SEND: State Ring pid:%d\n", p->bc ? p->bc->pid : -1);
|
chan_misdn_log(3, p->bc->port, " --> * SEND: State Ring pid:%d\n", p->bc ? p->bc->pid : -1);
|
||||||
ast_setstate(ast, AST_STATE_RING);
|
ast_setstate(ast, AST_STATE_RING);
|
||||||
|
|
||||||
if ( !p->bc->nt && (p->originator == ORG_MISDN) && !p->incoming_early_audio )
|
if (!p->bc->nt && (p->originator == ORG_MISDN) && !p->incoming_early_audio)
|
||||||
chan_misdn_log(2, p->bc->port, " --> incoming_early_audio off\n");
|
chan_misdn_log(2, p->bc->port, " --> incoming_early_audio off\n");
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
@@ -3162,7 +3148,7 @@ static int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
chan_misdn_log(9, ch->bc->port, "Sending :%d bytes 2 MISDN\n", frame->samples);
|
chan_misdn_log(9, ch->bc->port, "Sending :%d bytes to MISDN\n", frame->samples);
|
||||||
if ( !ch->bc->nojitter && misdn_cap_is_speech(ch->bc->capability) ) {
|
if ( !ch->bc->nojitter && misdn_cap_is_speech(ch->bc->capability) ) {
|
||||||
/* Buffered Transmit (triggered by read from isdn side)*/
|
/* Buffered Transmit (triggered by read from isdn side)*/
|
||||||
if (misdn_jb_fill(ch->jb, frame->data, frame->samples) < 0) {
|
if (misdn_jb_fill(ch->jb, frame->data, frame->samples) < 0) {
|
||||||
@@ -3172,7 +3158,7 @@ static int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*transmit without jitterbuffer*/
|
/*transmit without jitterbuffer*/
|
||||||
i=misdn_lib_tx2misdn_frm(ch->bc, frame->data, frame->samples);
|
i = misdn_lib_tx2misdn_frm(ch->bc, frame->data, frame->samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3366,7 +3352,6 @@ static struct chan_list *init_chan_list(int orig)
|
|||||||
struct chan_list *cl;
|
struct chan_list *cl;
|
||||||
|
|
||||||
cl = ast_calloc(1, sizeof(*cl));
|
cl = ast_calloc(1, sizeof(*cl));
|
||||||
|
|
||||||
if (!cl) {
|
if (!cl) {
|
||||||
chan_misdn_log(-1, 0, "misdn_request: malloc failed!");
|
chan_misdn_log(-1, 0, "misdn_request: malloc failed!");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3386,20 +3371,28 @@ static struct ast_channel *misdn_request(const char *type, int format, void *dat
|
|||||||
struct ast_channel *tmp = NULL;
|
struct ast_channel *tmp = NULL;
|
||||||
char group[BUFFERSIZE + 1] = "";
|
char group[BUFFERSIZE + 1] = "";
|
||||||
char dial_str[128];
|
char dial_str[128];
|
||||||
char *buf2 = ast_strdupa(data), *ext = NULL, *port_str;
|
char *buf2 = ast_strdupa(data);
|
||||||
char *tokb = NULL, *p = NULL;
|
char *ext;
|
||||||
int channel = 0, port = 0;
|
char *port_str;
|
||||||
|
char *p = NULL;
|
||||||
|
int channel = 0;
|
||||||
|
int port = 0;
|
||||||
struct misdn_bchannel *newbc = NULL;
|
struct misdn_bchannel *newbc = NULL;
|
||||||
int dec = 0;
|
int dec = 0;
|
||||||
struct chan_list *cl;
|
struct chan_list *cl;
|
||||||
|
|
||||||
snprintf(dial_str, sizeof(dial_str), "%s/%s", misdn_type, (char*)data);
|
snprintf(dial_str, sizeof(dial_str), "%s/%s", misdn_type, (char *) data);
|
||||||
|
|
||||||
port_str = strtok_r(buf2, "/", &tokb);
|
/*
|
||||||
|
* data is ---v
|
||||||
ext = strtok_r(NULL, "/", &tokb);
|
* Dial(mISDN/g:group_name[/extension[/options]])
|
||||||
|
* Dial(mISDN/port[:preselected_channel][/extension[/options]])
|
||||||
if (port_str) {
|
*
|
||||||
|
* The dial extension could be empty if you are using MISDN_KEYPAD
|
||||||
|
* to control ISDN provider features.
|
||||||
|
*/
|
||||||
|
port_str = strsep(&buf2, "/");
|
||||||
|
if (!ast_strlen_zero(port_str)) {
|
||||||
if (port_str[0] == 'g' && port_str[1] == ':' ) {
|
if (port_str[0] == 'g' && port_str[1] == ':' ) {
|
||||||
/* We make a group call lets checkout which ports are in my group */
|
/* We make a group call lets checkout which ports are in my group */
|
||||||
port_str += 2;
|
port_str += 2;
|
||||||
@@ -3415,12 +3408,17 @@ static struct ast_channel *misdn_request(const char *type, int format, void *dat
|
|||||||
port = atoi(port_str);
|
port = atoi(port_str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, " --> ! IND : CALL dad:%s WITHOUT PORT/Group, check extensions.conf\n", ext);
|
ast_log(LOG_WARNING, " --> ! IND : Dial(%s) WITHOUT Port or Group, check extensions.conf\n", dial_str);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext = strsep(&buf2, "/");
|
||||||
|
if (!ext) {
|
||||||
|
ext = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (misdn_cfg_is_group_method(group, METHOD_STANDARD_DEC)) {
|
if (misdn_cfg_is_group_method(group, METHOD_STANDARD_DEC)) {
|
||||||
chan_misdn_log(4, port, " --> STARTING STANDARDDEC...\n");
|
chan_misdn_log(4, port, " --> STARTING STANDARD DEC...\n");
|
||||||
dec = 1;
|
dec = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3633,9 +3631,9 @@ static void update_name(struct ast_channel *tmp, int port, int c)
|
|||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
ast_string_field_build(tmp, name, "%s/%d-u%d",
|
ast_string_field_build(tmp, name, "%s/%d-u%d",
|
||||||
misdn_type, chan_offset+c, glob_channel++);
|
misdn_type, chan_offset + c, glob_channel++);
|
||||||
|
|
||||||
chan_misdn_log(3 , port, " --> updating channel name to [%s]\n", tmp->name);
|
chan_misdn_log(3, port, " --> updating channel name to [%s]\n", tmp->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char *exten, char *callerid, int format, int port, int c)
|
static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char *exten, char *callerid, int format, int port, int c)
|
||||||
@@ -3649,16 +3647,16 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
|
|||||||
for (; tmp_port > 0; tmp_port = misdn_cfg_get_next_port(tmp_port)) {
|
for (; tmp_port > 0; tmp_port = misdn_cfg_get_next_port(tmp_port)) {
|
||||||
if (tmp_port == port)
|
if (tmp_port == port)
|
||||||
break;
|
break;
|
||||||
chan_offset += misdn_lib_port_is_pri(tmp_port) ? 30 : 2;
|
chan_offset += misdn_lib_port_is_pri(tmp_port) ? 30 : 2;
|
||||||
}
|
}
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
if (callerid)
|
if (callerid) {
|
||||||
ast_callerid_parse(callerid, &cid_name, &cid_num);
|
ast_callerid_parse(callerid, &cid_name, &cid_num);
|
||||||
|
}
|
||||||
|
|
||||||
tmp = ast_channel_alloc(1, state, cid_num, cid_name, "", exten, "", 0, "%s/%d-u%d", misdn_type, chan_offset + c, glob_channel++);
|
tmp = ast_channel_alloc(1, state, cid_num, cid_name, "", exten, "", 0, "%s/%d-u%d", misdn_type, chan_offset + c, glob_channel++);
|
||||||
|
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
chan_misdn_log(2, 0, " --> * NEW CHANNEL dad:%s oad:%s\n", exten, callerid);
|
chan_misdn_log(2, 0, " --> * NEW CHANNEL dad:%s oad:%s\n", exten, callerid);
|
||||||
|
|
||||||
@@ -3694,7 +3692,6 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
|
|||||||
|
|
||||||
if (pipe(chlist->pipe) < 0)
|
if (pipe(chlist->pipe) < 0)
|
||||||
ast_log(LOG_ERROR, "Pipe failed\n");
|
ast_log(LOG_ERROR, "Pipe failed\n");
|
||||||
|
|
||||||
ast_channel_set_fd(tmp, 0, chlist->pipe[0]);
|
ast_channel_set_fd(tmp, 0, chlist->pipe[0]);
|
||||||
|
|
||||||
if (state == AST_STATE_RING)
|
if (state == AST_STATE_RING)
|
||||||
@@ -3702,7 +3699,7 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
|
|||||||
else
|
else
|
||||||
tmp->rings = 0;
|
tmp->rings = 0;
|
||||||
|
|
||||||
ast_jb_configure(tmp, misdn_get_global_jbconf());
|
ast_jb_configure(tmp, misdn_get_global_jbconf());
|
||||||
} else {
|
} else {
|
||||||
chan_misdn_log(-1, 0, "Unable to allocate channel structure\n");
|
chan_misdn_log(-1, 0, "Unable to allocate channel structure\n");
|
||||||
}
|
}
|
||||||
@@ -4101,7 +4098,7 @@ static void do_immediate_setup(struct misdn_bchannel *bc, struct chan_list *ch,
|
|||||||
|
|
||||||
chan_misdn_log(1, bc->port, "* Starting Ast ctx:%s dad:%s oad:%s with 's' extension\n", ast->context, ast->exten, ast->cid.cid_num);
|
chan_misdn_log(1, bc->port, "* Starting Ast ctx:%s dad:%s oad:%s with 's' extension\n", ast->context, ast->exten, ast->cid.cid_num);
|
||||||
|
|
||||||
strncpy(ast->exten, "s", 2);
|
strcpy(ast->exten, "s");
|
||||||
|
|
||||||
if (!ast_canmatch_extension(ast, ast->context, ast->exten, 1, bc->oad) || pbx_start_chan(ch) < 0) {
|
if (!ast_canmatch_extension(ast, ast->context, ast->exten, 1, bc->oad) || pbx_start_chan(ch) < 0) {
|
||||||
ast = NULL;
|
ast = NULL;
|
||||||
@@ -4154,12 +4151,13 @@ static void send_cause2ast(struct ast_channel *ast, struct misdn_bchannel *bc, s
|
|||||||
|
|
||||||
switch (bc->cause) {
|
switch (bc->cause) {
|
||||||
|
|
||||||
case 1: /** Congestion Cases **/
|
case AST_CAUSE_UNALLOCATED:
|
||||||
case 2:
|
case AST_CAUSE_NO_ROUTE_TRANSIT_NET:
|
||||||
case 3:
|
case AST_CAUSE_NO_ROUTE_DESTINATION:
|
||||||
case 4:
|
case 4: /* Send special information tone */
|
||||||
case 22:
|
case AST_CAUSE_NUMBER_CHANGED:
|
||||||
case 27:
|
case AST_CAUSE_DESTINATION_OUT_OF_ORDER:
|
||||||
|
/* Congestion Cases */
|
||||||
/*
|
/*
|
||||||
* Not Queueing the Congestion anymore, since we want to hear
|
* Not Queueing the Congestion anymore, since we want to hear
|
||||||
* the inband message
|
* the inband message
|
||||||
@@ -4171,9 +4169,8 @@ static void send_cause2ast(struct ast_channel *ast, struct misdn_bchannel *bc, s
|
|||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 21:
|
case AST_CAUSE_CALL_REJECTED:
|
||||||
case 17: /* user busy */
|
case AST_CAUSE_USER_BUSY:
|
||||||
|
|
||||||
ch->state = MISDN_BUSY;
|
ch->state = MISDN_BUSY;
|
||||||
|
|
||||||
if (!ch->need_busy) {
|
if (!ch->need_busy) {
|
||||||
@@ -4195,7 +4192,9 @@ static void send_cause2ast(struct ast_channel *ast, struct misdn_bchannel *bc, s
|
|||||||
/*! \brief Import parameters from the dialplan environment variables */
|
/*! \brief Import parameters from the dialplan environment variables */
|
||||||
void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)
|
void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)
|
||||||
{
|
{
|
||||||
const char *tmp = pbx_builtin_getvar_helper(chan, "MISDN_PID");
|
const char *tmp;
|
||||||
|
|
||||||
|
tmp = pbx_builtin_getvar_helper(chan, "MISDN_PID");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
ch->other_pid = atoi(tmp);
|
ch->other_pid = atoi(tmp);
|
||||||
chan_misdn_log(3, bc->port, " --> IMPORT_PID: importing pid:%s\n", tmp);
|
chan_misdn_log(3, bc->port, " --> IMPORT_PID: importing pid:%s\n", tmp);
|
||||||
@@ -4219,8 +4218,9 @@ void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmp = pbx_builtin_getvar_helper(chan, "MISDN_KEYPAD");
|
tmp = pbx_builtin_getvar_helper(chan, "MISDN_KEYPAD");
|
||||||
if (tmp)
|
if (tmp) {
|
||||||
ast_copy_string(bc->keypad, tmp, sizeof(bc->keypad));
|
ast_copy_string(bc->keypad, tmp, sizeof(bc->keypad));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Export parameters to the dialplan environment variables */
|
/*! \brief Export parameters to the dialplan environment variables */
|
||||||
@@ -4305,6 +4305,7 @@ static void wait_for_digits(struct chan_list *ch, struct misdn_bchannel *bc, str
|
|||||||
static enum event_response_e
|
static enum event_response_e
|
||||||
cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
{
|
{
|
||||||
|
int msn_valid;
|
||||||
struct chan_list *held_ch;
|
struct chan_list *held_ch;
|
||||||
struct chan_list *ch = find_chan_by_bc(cl_te, bc);
|
struct chan_list *ch = find_chan_by_bc(cl_te, bc);
|
||||||
|
|
||||||
@@ -4403,7 +4404,9 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
case EVENT_DTMF_TONE:
|
case EVENT_DTMF_TONE:
|
||||||
{
|
{
|
||||||
/* sending INFOS as DTMF-Frames :) */
|
/* sending INFOS as DTMF-Frames :) */
|
||||||
struct ast_frame fr = { 0, };
|
struct ast_frame fr;
|
||||||
|
|
||||||
|
memset(&fr, 0, sizeof(fr));
|
||||||
fr.frametype = AST_FRAME_DTMF;
|
fr.frametype = AST_FRAME_DTMF;
|
||||||
fr.subclass = bc->dtmf ;
|
fr.subclass = bc->dtmf ;
|
||||||
fr.src = NULL;
|
fr.src = NULL;
|
||||||
@@ -4440,7 +4443,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
ast_copy_string(bc->info_dad, bc->keypad, sizeof(bc->info_dad));
|
ast_copy_string(bc->info_dad, bc->keypad, sizeof(bc->info_dad));
|
||||||
}
|
}
|
||||||
|
|
||||||
strncat(bc->dad,bc->info_dad, sizeof(bc->dad) - strlen(bc->dad) - 1);
|
strncat(bc->dad, bc->info_dad, sizeof(bc->dad) - strlen(bc->dad) - 1);
|
||||||
ast_copy_string(ch->ast->exten, bc->dad, sizeof(ch->ast->exten));
|
ast_copy_string(ch->ast->exten, bc->dad, sizeof(ch->ast->exten));
|
||||||
|
|
||||||
/* Check for Pickup Request first */
|
/* Check for Pickup Request first */
|
||||||
@@ -4477,7 +4480,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
if (bc->nt)
|
if (bc->nt)
|
||||||
hanguptone_indicate(ch);
|
hanguptone_indicate(ch);
|
||||||
ch->state = MISDN_EXTCANTMATCH;
|
ch->state = MISDN_EXTCANTMATCH;
|
||||||
bc->out_cause = 1;
|
bc->out_cause = AST_CAUSE_UNALLOCATED;
|
||||||
|
|
||||||
misdn_lib_send_event(bc, EVENT_DISCONNECT);
|
misdn_lib_send_event(bc, EVENT_DISCONNECT);
|
||||||
break;
|
break;
|
||||||
@@ -4503,6 +4506,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
/* sending INFOS as DTMF-Frames :) */
|
/* sending INFOS as DTMF-Frames :) */
|
||||||
struct ast_frame fr;
|
struct ast_frame fr;
|
||||||
int digits;
|
int digits;
|
||||||
|
|
||||||
memset(&fr, 0, sizeof(fr));
|
memset(&fr, 0, sizeof(fr));
|
||||||
fr.frametype = AST_FRAME_DTMF;
|
fr.frametype = AST_FRAME_DTMF;
|
||||||
fr.subclass = bc->info_dad[0] ;
|
fr.subclass = bc->info_dad[0] ;
|
||||||
@@ -4530,10 +4534,9 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
case EVENT_SETUP:
|
case EVENT_SETUP:
|
||||||
{
|
{
|
||||||
struct chan_list *ch = find_chan_by_bc(cl_te, bc);
|
struct chan_list *ch = find_chan_by_bc(cl_te, bc);
|
||||||
int msn_valid = misdn_cfg_is_msn_valid(bc->port, bc->dad);
|
|
||||||
struct ast_channel *chan;
|
struct ast_channel *chan;
|
||||||
int exceed;
|
int exceed;
|
||||||
int pres,screen;
|
int pres, screen;
|
||||||
int ai;
|
int ai;
|
||||||
int im;
|
int im;
|
||||||
|
|
||||||
@@ -4548,6 +4551,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msn_valid = misdn_cfg_is_msn_valid(bc->port, bc->dad);
|
||||||
if (!bc->nt && ! msn_valid) {
|
if (!bc->nt && ! msn_valid) {
|
||||||
chan_misdn_log(1, bc->port, " --> Ignoring Call, its not in our MSN List\n");
|
chan_misdn_log(1, bc->port, " --> Ignoring Call, its not in our MSN List\n");
|
||||||
return RESPONSE_IGNORE_SETUP; /* Ignore MSNs which are not in our List */
|
return RESPONSE_IGNORE_SETUP; /* Ignore MSNs which are not in our List */
|
||||||
@@ -4557,22 +4561,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
int cause;
|
int cause;
|
||||||
chan_misdn_log(0, bc->port, " --> Call Waiting on PMP sending RELEASE_COMPLETE\n");
|
chan_misdn_log(0, bc->port, " --> Call Waiting on PMP sending RELEASE_COMPLETE\n");
|
||||||
misdn_cfg_get(bc->port, MISDN_CFG_REJECT_CAUSE, &cause, sizeof(cause));
|
misdn_cfg_get(bc->port, MISDN_CFG_REJECT_CAUSE, &cause, sizeof(cause));
|
||||||
bc->out_cause = cause ? cause : 16;
|
bc->out_cause = cause ? cause : AST_CAUSE_NORMAL_CLEARING;
|
||||||
return RESPONSE_RELEASE_SETUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
print_bearer(bc);
|
|
||||||
|
|
||||||
if (!bc->nt && ! msn_valid) {
|
|
||||||
chan_misdn_log(1, bc->port, " --> Ignoring Call, its not in our MSN List\n");
|
|
||||||
return RESPONSE_IGNORE_SETUP; /* Ignore MSNs which are not in our List */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bc->cw) {
|
|
||||||
int cause;
|
|
||||||
chan_misdn_log(0, bc->port, " --> Call Waiting on PMP sending RELEASE_COMPLETE\n");
|
|
||||||
misdn_cfg_get(bc->port, MISDN_CFG_REJECT_CAUSE, &cause, sizeof(cause));
|
|
||||||
bc->out_cause = cause ? cause : 16;
|
|
||||||
return RESPONSE_RELEASE_SETUP;
|
return RESPONSE_RELEASE_SETUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4591,7 +4580,6 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
ch->originator = ORG_MISDN;
|
ch->originator = ORG_MISDN;
|
||||||
|
|
||||||
chan = misdn_new(ch, AST_STATE_RESERVED, bc->dad, bc->oad, AST_FORMAT_ALAW, bc->port, bc->channel);
|
chan = misdn_new(ch, AST_STATE_RESERVED, bc->dad, bc->oad, AST_FORMAT_ALAW, bc->port, bc->channel);
|
||||||
|
|
||||||
if (!chan) {
|
if (!chan) {
|
||||||
ast_free(ch);
|
ast_free(ch);
|
||||||
misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
|
misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
|
||||||
@@ -4621,17 +4609,19 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pres = AST_PRES_UNAVAILABLE;
|
pres = AST_PRES_UNAVAILABLE;
|
||||||
chan_misdn_log(2, bc->port, " --> PRES: Restricted (2)\n");
|
chan_misdn_log(2, bc->port, " --> PRES: Unavailable (2)\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pres = AST_PRES_ALLOWED;
|
pres = AST_PRES_ALLOWED;
|
||||||
chan_misdn_log(2, bc->port, " --> PRES: Restricted (%d)\n", bc->pres);
|
chan_misdn_log(2, bc->port, " --> PRES: Allowed (%d)\n", bc->pres);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (bc->screen) {
|
switch (bc->screen) {
|
||||||
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
screen = AST_PRES_USER_NUMBER_UNSCREENED;
|
screen = AST_PRES_USER_NUMBER_UNSCREENED;
|
||||||
chan_misdn_log(2, bc->port, " --> SCREEN: Unscreened (0)\n");
|
chan_misdn_log(2, bc->port, " --> SCREEN: Unscreened (%d)\n", bc->screen);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
screen = AST_PRES_USER_NUMBER_PASSED_SCREEN;
|
screen = AST_PRES_USER_NUMBER_PASSED_SCREEN;
|
||||||
@@ -4645,12 +4635,9 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
screen = AST_PRES_NETWORK_NUMBER;
|
screen = AST_PRES_NETWORK_NUMBER;
|
||||||
chan_misdn_log(2, bc->port, " --> SCREEN: Network Number (3)\n");
|
chan_misdn_log(2, bc->port, " --> SCREEN: Network Number (3)\n");
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
screen = AST_PRES_USER_NUMBER_UNSCREENED;
|
|
||||||
chan_misdn_log(2, bc->port, " --> SCREEN: Unscreened (%d)\n", bc->screen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chan->cid.cid_pres = pres + screen;
|
chan->cid.cid_pres = pres | screen;
|
||||||
|
|
||||||
pbx_builtin_setvar_helper(chan, "TRANSFERCAPABILITY", ast_transfercapability2str(bc->capability));
|
pbx_builtin_setvar_helper(chan, "TRANSFERCAPABILITY", ast_transfercapability2str(bc->capability));
|
||||||
chan->transfercapability = bc->capability;
|
chan->transfercapability = bc->capability;
|
||||||
@@ -4849,7 +4836,6 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
break;
|
break;
|
||||||
case EVENT_PROCEEDING:
|
case EVENT_PROCEEDING:
|
||||||
{
|
{
|
||||||
|
|
||||||
if (misdn_cap_is_speech(bc->capability) &&
|
if (misdn_cap_is_speech(bc->capability) &&
|
||||||
misdn_inband_avail(bc) ) {
|
misdn_inband_avail(bc) ) {
|
||||||
start_bc_tones(ch);
|
start_bc_tones(ch);
|
||||||
@@ -5104,7 +5090,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
{
|
{
|
||||||
if (ch->bc->AOCD_need_export)
|
if (ch->bc->AOCD_need_export)
|
||||||
export_aoc_vars(ch->originator, ch->ast, ch->bc);
|
export_aoc_vars(ch->originator, ch->ast, ch->bc);
|
||||||
if (!misdn_cap_is_speech(ch->bc->capability) ) {
|
if (!misdn_cap_is_speech(ch->bc->capability)) {
|
||||||
struct ast_frame frame;
|
struct ast_frame frame;
|
||||||
/*In Data Modes we queue frames*/
|
/*In Data Modes we queue frames*/
|
||||||
frame.frametype = AST_FRAME_VOICE; /*we have no data frames yet*/
|
frame.frametype = AST_FRAME_VOICE; /*we have no data frames yet*/
|
||||||
@@ -5140,7 +5126,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET(ch->pipe[1], &wrfs)) {
|
if (FD_ISSET(ch->pipe[1], &wrfs)) {
|
||||||
chan_misdn_log(9, bc->port, "writing %d bytes 2 asterisk\n", bc->bframe_len);
|
chan_misdn_log(9, bc->port, "writing %d bytes to asterisk\n", bc->bframe_len);
|
||||||
if (write(ch->pipe[1], bc->bframe, bc->bframe_len) <= 0) {
|
if (write(ch->pipe[1], bc->bframe, bc->bframe_len) <= 0) {
|
||||||
chan_misdn_log(0, bc->port, "Write returned <=0 (err=%s) --> hanging up channel\n", strerror(errno));
|
chan_misdn_log(0, bc->port, "Write returned <=0 (err=%s) --> hanging up channel\n", strerror(errno));
|
||||||
|
|
||||||
@@ -5155,7 +5141,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_TIMEOUT:
|
case EVENT_TIMEOUT:
|
||||||
{
|
{
|
||||||
if (ch && bc)
|
if (ch && bc)
|
||||||
chan_misdn_log(1, bc->port, "--> state: %s\n", misdn_get_ch_state(ch));
|
chan_misdn_log(1, bc->port, "--> state: %s\n", misdn_get_ch_state(ch));
|
||||||
|
|
||||||
@@ -5170,7 +5156,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
case MISDN_PROCEEDING:
|
case MISDN_PROCEEDING:
|
||||||
case MISDN_CALLING_ACKNOWLEDGE:
|
case MISDN_CALLING_ACKNOWLEDGE:
|
||||||
if (bc->nt) {
|
if (bc->nt) {
|
||||||
bc->progress_indicator = 8;
|
bc->progress_indicator = INFO_PI_INBAND_AVAILABLE;
|
||||||
hanguptone_indicate(ch);
|
hanguptone_indicate(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5180,7 +5166,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
|||||||
|
|
||||||
case MISDN_WAITING4DIGS:
|
case MISDN_WAITING4DIGS:
|
||||||
if (bc->nt) {
|
if (bc->nt) {
|
||||||
bc->progress_indicator = 8;
|
bc->progress_indicator = INFO_PI_INBAND_AVAILABLE;
|
||||||
bc->out_cause = AST_CAUSE_UNALLOCATED;
|
bc->out_cause = AST_CAUSE_UNALLOCATED;
|
||||||
hanguptone_indicate(ch);
|
hanguptone_indicate(ch);
|
||||||
misdn_lib_send_event(bc, EVENT_DISCONNECT);
|
misdn_lib_send_event(bc, EVENT_DISCONNECT);
|
||||||
@@ -5857,7 +5843,10 @@ static int misdn_set_opt_exec(struct ast_channel *chan, void *data)
|
|||||||
/* CRICH: callingpres!!! */
|
/* CRICH: callingpres!!! */
|
||||||
if (strstr(tok,"allowed")) {
|
if (strstr(tok,"allowed")) {
|
||||||
ch->bc->pres = 0;
|
ch->bc->pres = 0;
|
||||||
|
} else if (strstr(tok, "restricted")) {
|
||||||
|
ch->bc->pres = 1;
|
||||||
} else if (strstr(tok, "not_screened")) {
|
} else if (strstr(tok, "not_screened")) {
|
||||||
|
chan_misdn_log(0, ch->bc->port, "SETOPT: callerpres: not_screened is deprecated\n");
|
||||||
ch->bc->pres = 1;
|
ch->bc->pres = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -5928,15 +5917,13 @@ struct misdn_jb *misdn_jb_init(int size, int upper_threshold)
|
|||||||
jb->state_empty = 0;
|
jb->state_empty = 0;
|
||||||
jb->bytes_wrote = 0;
|
jb->bytes_wrote = 0;
|
||||||
jb->samples = ast_malloc(size * sizeof(char));
|
jb->samples = ast_malloc(size * sizeof(char));
|
||||||
|
|
||||||
if (!jb->samples) {
|
if (!jb->samples) {
|
||||||
ast_free(jb);
|
ast_free(jb);
|
||||||
chan_misdn_log(-1, 0, "No free Mem for jb->samples\n");
|
chan_misdn_log(-1, 0, "No free Mem for jb->samples\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
jb->ok = ast_malloc(size * sizeof(char));
|
|
||||||
|
|
||||||
|
jb->ok = ast_malloc(size * sizeof(char));
|
||||||
if (!jb->ok) {
|
if (!jb->ok) {
|
||||||
ast_free(jb->samples);
|
ast_free(jb->samples);
|
||||||
ast_free(jb);
|
ast_free(jb);
|
||||||
@@ -5996,7 +5983,7 @@ int misdn_jb_fill(struct misdn_jb *jb, const char *data, int len)
|
|||||||
|
|
||||||
rp = wp;
|
rp = wp;
|
||||||
for (j = 0; j < jb->upper_threshold; j++)
|
for (j = 0; j < jb->upper_threshold; j++)
|
||||||
rp = rp != 0 ? rp - 1 : jb->size - 1;
|
rp = (rp != 0) ? rp - 1 : jb->size - 1;
|
||||||
jb->rp = rp;
|
jb->rp = rp;
|
||||||
jb->state_full = 0;
|
jb->state_full = 0;
|
||||||
jb->state_empty = 1;
|
jb->state_empty = 1;
|
||||||
|
|||||||
@@ -25,6 +25,14 @@
|
|||||||
#include "isdn_lib_intern.h"
|
#include "isdn_lib_intern.h"
|
||||||
#include "isdn_lib.h"
|
#include "isdn_lib.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define ARRAY_LEN() because I cannot
|
||||||
|
* #include "asterisk/utils.h"
|
||||||
|
*/
|
||||||
|
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
|
#include "asterisk/causes.h"
|
||||||
|
|
||||||
void misdn_join_conf(struct misdn_bchannel *bc, int conf_id);
|
void misdn_join_conf(struct misdn_bchannel *bc, int conf_id);
|
||||||
void misdn_split_conf(struct misdn_bchannel *bc, int conf_id);
|
void misdn_split_conf(struct misdn_bchannel *bc, int conf_id);
|
||||||
|
|
||||||
@@ -137,17 +145,16 @@ int misdn_lib_get_maxchans(int port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc)
|
struct misdn_stack *get_stack_by_bc(struct misdn_bchannel *bc)
|
||||||
{
|
{
|
||||||
struct misdn_stack *stack=get_misdn_stack();
|
struct misdn_stack *stack = get_misdn_stack();
|
||||||
|
|
||||||
if (!bc) return NULL;
|
if (!bc)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for ( ; stack; stack=stack->next) {
|
for ( ; stack; stack = stack->next) {
|
||||||
int i;
|
if (bc->port == stack->port)
|
||||||
for (i=0; i <=stack->b_num; i++) {
|
return stack;
|
||||||
if ( bc->port == stack->port) return stack;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -163,12 +170,13 @@ void get_show_stack_details(int port, char *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack) {
|
if (stack) {
|
||||||
sprintf(buf, "* Port %d Type %s Prot. %s L2Link %s L1Link:%s Blocked:%d", stack->port, stack->nt?"NT":"TE", stack->ptp?"PTP":"PMP", stack->l2link?"UP":"DOWN", stack->l1link?"UP":"DOWN",stack->blocked);
|
sprintf(buf, "* Port %d Type %s Prot. %s L2Link %s L1Link:%s Blocked:%d",
|
||||||
|
stack->port, stack->nt ? "NT" : "TE", stack->ptp ? "PTP" : "PMP",
|
||||||
|
stack->l2link ? "UP" : "DOWN", stack->l1link ? "UP" : "DOWN",
|
||||||
|
stack->blocked);
|
||||||
} else {
|
} else {
|
||||||
buf[0]=0;
|
buf[0]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -193,8 +201,9 @@ static enum global_states global_state=MISDN_INITIALIZING;
|
|||||||
|
|
||||||
|
|
||||||
struct misdn_lib {
|
struct misdn_lib {
|
||||||
|
/*! \brief mISDN device handle returned by mISDN_open() */
|
||||||
int midev;
|
int midev;
|
||||||
int midev_nt;
|
int midev_nt; /* Not used */
|
||||||
|
|
||||||
pthread_t event_thread;
|
pthread_t event_thread;
|
||||||
pthread_t event_handler_thread;
|
pthread_t event_handler_thread;
|
||||||
@@ -260,9 +269,6 @@ void stack_holder_remove(struct misdn_stack *stack, struct misdn_bchannel *holde
|
|||||||
struct misdn_bchannel *stack_holder_find(struct misdn_stack *stack, unsigned long l3id);
|
struct misdn_bchannel *stack_holder_find(struct misdn_stack *stack, unsigned long l3id);
|
||||||
|
|
||||||
/* from isdn_lib.h */
|
/* from isdn_lib.h */
|
||||||
int init_bc(struct misdn_stack * stack, struct misdn_bchannel *bc, int midev, int port, int bidx, char *msn, int firsttime);
|
|
||||||
struct misdn_stack* stack_init(int midev, int port, int ptp);
|
|
||||||
void stack_destroy(struct misdn_stack* stack);
|
|
||||||
/* user iface */
|
/* user iface */
|
||||||
int te_lib_init( void ) ; /* returns midev */
|
int te_lib_init( void ) ; /* returns midev */
|
||||||
void te_lib_destroy(int midev) ;
|
void te_lib_destroy(int midev) ;
|
||||||
@@ -437,8 +443,10 @@ int misdn_cap_is_speech(int cap)
|
|||||||
int misdn_inband_avail(struct misdn_bchannel *bc)
|
int misdn_inband_avail(struct misdn_bchannel *bc)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*if ! early_bconnect we have never inband available*/
|
if (!bc->early_bconnect) {
|
||||||
if ( ! bc->early_bconnect ) return 0;
|
/* We have opted to never receive any available inband recorded messages */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch (bc->progress_indicator) {
|
switch (bc->progress_indicator) {
|
||||||
case INFO_PI_INBAND_AVAILABLE:
|
case INFO_PI_INBAND_AVAILABLE:
|
||||||
@@ -515,7 +523,7 @@ static int find_free_chan_in_stack(struct misdn_stack *stack, struct misdn_bchan
|
|||||||
|
|
||||||
if (dec) {
|
if (dec) {
|
||||||
for (i = bnums; i >=0; i--) {
|
for (i = bnums; i >=0; i--) {
|
||||||
if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 Dchannel ;) and work with chan preselection */
|
if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 D channel ;) and work with chan preselection */
|
||||||
if (!stack->channels[i]) {
|
if (!stack->channels[i]) {
|
||||||
cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
|
cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
|
||||||
chan=i+1;
|
chan=i+1;
|
||||||
@@ -525,7 +533,7 @@ static int find_free_chan_in_stack(struct misdn_stack *stack, struct misdn_bchan
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i <= bnums; i++) {
|
for (i = 0; i <= bnums; i++) {
|
||||||
if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 Dchannel ;) and work with chan preselection */
|
if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 D channel ;) and work with chan preselection */
|
||||||
if (!stack->channels[i]) {
|
if (!stack->channels[i]) {
|
||||||
cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
|
cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
|
||||||
chan=i+1;
|
chan=i+1;
|
||||||
@@ -538,13 +546,13 @@ static int find_free_chan_in_stack(struct misdn_stack *stack, struct misdn_bchan
|
|||||||
if (!chan) {
|
if (!chan) {
|
||||||
cb_log (1, stack->port, " !! NO FREE CHAN IN STACK\n");
|
cb_log (1, stack->port, " !! NO FREE CHAN IN STACK\n");
|
||||||
dump_chan_list(stack);
|
dump_chan_list(stack);
|
||||||
bc->out_cause=34;
|
bc->out_cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_chan_in_stack(stack, chan)<0) {
|
if (set_chan_in_stack(stack, chan)<0) {
|
||||||
cb_log (0, stack->port, "Channel Already in use:%d\n", chan);
|
cb_log (0, stack->port, "Channel Already in use:%d\n", chan);
|
||||||
bc->out_cause=44;
|
bc->out_cause = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,9 +689,9 @@ static void empty_bc(struct misdn_bchannel *bc)
|
|||||||
|
|
||||||
bc->orig=0;
|
bc->orig=0;
|
||||||
|
|
||||||
bc->cause=16;
|
bc->cause = AST_CAUSE_NORMAL_CLEARING;
|
||||||
bc->out_cause=16;
|
bc->out_cause = AST_CAUSE_NORMAL_CLEARING;
|
||||||
bc->pres=0 ; /* screened */
|
bc->pres = 0; /* allowed */
|
||||||
|
|
||||||
bc->evq=EVENT_NOTHING;
|
bc->evq=EVENT_NOTHING;
|
||||||
|
|
||||||
@@ -915,7 +923,7 @@ static int create_process(int midev, struct misdn_bchannel *bc)
|
|||||||
}
|
}
|
||||||
} /* end for */
|
} /* end for */
|
||||||
if (proc_id == MAXPROCS) {
|
if (proc_id == MAXPROCS) {
|
||||||
cb_log(0, stack->port, "Couldnt Create New ProcId.\n");
|
cb_log(0, stack->port, "Couldn't Create New ProcId.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -967,7 +975,10 @@ void misdn_lib_setup_bc(struct misdn_bchannel *bc)
|
|||||||
int setup_bc(struct misdn_bchannel *bc)
|
int setup_bc(struct misdn_bchannel *bc)
|
||||||
{
|
{
|
||||||
unsigned char buff[1025];
|
unsigned char buff[1025];
|
||||||
int midev, channel, b_stid, i;
|
int midev;
|
||||||
|
int channel;
|
||||||
|
int b_stid;
|
||||||
|
int i;
|
||||||
mISDN_pid_t pid;
|
mISDN_pid_t pid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -986,13 +997,13 @@ int setup_bc(struct misdn_bchannel *bc)
|
|||||||
case BCHAN_CLEANED:
|
case BCHAN_CLEANED:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cb_log(4, stack->port, "$$$ bc already upsetted stid :%x (state:%s)\n", b_stid, bc_state2str(bc->bc_state) );
|
cb_log(4, stack->port, "$$$ bc already setup stid :%x (state:%s)\n", b_stid, bc_state2str(bc->bc_state) );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cb_log(5, stack->port, "$$$ Setting up bc with stid :%x\n", b_stid);
|
cb_log(5, stack->port, "$$$ Setting up bc with stid :%x\n", b_stid);
|
||||||
|
|
||||||
/*check if the b_stid is alread initialized*/
|
/*check if the b_stid is already initialized*/
|
||||||
for (i=0; i <= stack->b_num; i++) {
|
for (i=0; i <= stack->b_num; i++) {
|
||||||
if (stack->bc[i].b_stid == b_stid) {
|
if (stack->bc[i].b_stid == b_stid) {
|
||||||
cb_log(0, bc->port, "setup_bc: b_stid:%x already in use !!!\n", b_stid);
|
cb_log(0, bc->port, "setup_bc: b_stid:%x already in use !!!\n", b_stid);
|
||||||
@@ -1042,10 +1053,9 @@ int setup_bc(struct misdn_bchannel *bc)
|
|||||||
li.name[l-1] = 0;
|
li.name[l-1] = 0;
|
||||||
}
|
}
|
||||||
li.pid.layermask = ISDN_LAYER((4));
|
li.pid.layermask = ISDN_LAYER((4));
|
||||||
li.pid.protocol[4] = ISDN_PID_L4_B_USER
|
li.pid.protocol[4] = ISDN_PID_L4_B_USER;
|
||||||
;
|
|
||||||
bc->layer=4;
|
bc->layer=4;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mISDN_new_layer(midev, &li);
|
ret = mISDN_new_layer(midev, &li);
|
||||||
@@ -1134,7 +1144,7 @@ int setup_bc(struct misdn_bchannel *bc)
|
|||||||
|
|
||||||
|
|
||||||
/** IFACE **/
|
/** IFACE **/
|
||||||
int init_bc(struct misdn_stack *stack, struct misdn_bchannel *bc, int midev, int port, int bidx, char *msn, int firsttime)
|
static int init_bc(struct misdn_stack *stack, struct misdn_bchannel *bc, int midev, int port, int bidx, char *msn, int firsttime)
|
||||||
{
|
{
|
||||||
unsigned char buff[1025] = "";
|
unsigned char buff[1025] = "";
|
||||||
iframe_t *frm = (iframe_t *)buff;
|
iframe_t *frm = (iframe_t *)buff;
|
||||||
@@ -1147,7 +1157,9 @@ int init_bc(struct misdn_stack *stack, struct misdn_bchannel *bc, int midev, in
|
|||||||
memset(bc, 0,sizeof(struct misdn_bchannel));
|
memset(bc, 0,sizeof(struct misdn_bchannel));
|
||||||
|
|
||||||
bc->send_lock=malloc(sizeof(struct send_lock));
|
bc->send_lock=malloc(sizeof(struct send_lock));
|
||||||
|
if (!bc->send_lock) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
pthread_mutex_init(&bc->send_lock->lock, NULL);
|
pthread_mutex_init(&bc->send_lock->lock, NULL);
|
||||||
|
|
||||||
if (msn) {
|
if (msn) {
|
||||||
@@ -1172,6 +1184,9 @@ int init_bc(struct misdn_stack *stack, struct misdn_bchannel *bc, int midev, in
|
|||||||
clear_ibuffer( ibuf);
|
clear_ibuffer( ibuf);
|
||||||
|
|
||||||
ibuf->rsem=malloc(sizeof(sem_t));
|
ibuf->rsem=malloc(sizeof(sem_t));
|
||||||
|
if (!ibuf->rsem) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
bc->astbuf=ibuf;
|
bc->astbuf=ibuf;
|
||||||
|
|
||||||
@@ -1198,7 +1213,7 @@ int init_bc(struct misdn_stack *stack, struct misdn_bchannel *bc, int midev, in
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct misdn_stack* stack_init( int midev, int port, int ptp )
|
static struct misdn_stack *stack_init(int midev, int port, int ptp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char buff[1025];
|
unsigned char buff[1025];
|
||||||
@@ -1384,7 +1399,7 @@ struct misdn_stack* stack_init( int midev, int port, int ptp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void stack_destroy(struct misdn_stack* stack)
|
static void stack_destroy(struct misdn_stack *stack)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
if (!stack) return;
|
if (!stack) return;
|
||||||
@@ -1644,7 +1659,7 @@ static int handle_cr ( struct misdn_stack *stack, iframe_t *frm)
|
|||||||
struct misdn_bchannel dummybc;
|
struct misdn_bchannel dummybc;
|
||||||
|
|
||||||
if (!bc) {
|
if (!bc) {
|
||||||
cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
|
cb_log(4, stack->port, " --> Didn't find BC so temporarily creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
|
||||||
misdn_make_dummy(&dummybc, stack->port, frm->dinfo, stack->nt, 0);
|
misdn_make_dummy(&dummybc, stack->port, frm->dinfo, stack->nt, 0);
|
||||||
|
|
||||||
bc=&dummybc;
|
bc=&dummybc;
|
||||||
@@ -1671,7 +1686,7 @@ static int handle_cr ( struct misdn_stack *stack, iframe_t *frm)
|
|||||||
dump_chan_list(stack);
|
dump_chan_list(stack);
|
||||||
|
|
||||||
if (bc->stack_holder) {
|
if (bc->stack_holder) {
|
||||||
cb_log(4,stack->port, "REMOVEING Holder\n");
|
cb_log(4,stack->port, "REMOVING Holder\n");
|
||||||
stack_holder_remove( stack, bc);
|
stack_holder_remove( stack, bc);
|
||||||
free(bc);
|
free(bc);
|
||||||
}
|
}
|
||||||
@@ -1690,7 +1705,7 @@ static int handle_cr ( struct misdn_stack *stack, iframe_t *frm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*Emptys bc if it's reserved (no SETUP out yet)*/
|
/* Empties bc if it's reserved (no SETUP out yet) */
|
||||||
void misdn_lib_release(struct misdn_bchannel *bc)
|
void misdn_lib_release(struct misdn_bchannel *bc)
|
||||||
{
|
{
|
||||||
struct misdn_stack *stack=get_stack_by_bc(bc);
|
struct misdn_stack *stack=get_stack_by_bc(bc);
|
||||||
@@ -1799,10 +1814,10 @@ int release_cr(struct misdn_stack *stack, mISDNuser_head_t *hh)
|
|||||||
frm.addr=stack->upper_id | FLG_MSG_DOWN;
|
frm.addr=stack->upper_id | FLG_MSG_DOWN;
|
||||||
|
|
||||||
frm.prim = CC_RELEASE_CR|INDICATION;
|
frm.prim = CC_RELEASE_CR|INDICATION;
|
||||||
cb_log(4, stack->port, " --> CC_RELEASE_CR: Faking Realease_cr for %x l3id:%x\n",frm.addr, frm.dinfo);
|
cb_log(4, stack->port, " --> CC_RELEASE_CR: Faking Release_cr for %x l3id:%x\n",frm.addr, frm.dinfo);
|
||||||
/** removing procid **/
|
/** removing procid **/
|
||||||
if (!bc) {
|
if (!bc) {
|
||||||
cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
|
cb_log(4, stack->port, " --> Didn't find BC so temporarily creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
|
||||||
misdn_make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
|
misdn_make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
|
||||||
bc=&dummybc;
|
bc=&dummybc;
|
||||||
}
|
}
|
||||||
@@ -1813,7 +1828,7 @@ int release_cr(struct misdn_stack *stack, mISDNuser_head_t *hh)
|
|||||||
stack->procids[bc->l3_id&0xff] = 0 ;
|
stack->procids[bc->l3_id&0xff] = 0 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else cb_log(0, stack->port, "Couldnt find BC so I couldnt remove the Process!!!! this is a bad port.\n");
|
else cb_log(0, stack->port, "Couldn't find BC so I couldn't remove the Process!!!! this is a bad port.\n");
|
||||||
|
|
||||||
if (handle_cr(stack, &frm)<0) {
|
if (handle_cr(stack, &frm)<0) {
|
||||||
}
|
}
|
||||||
@@ -1848,7 +1863,8 @@ handle_event_nt(void *dat, void *arg)
|
|||||||
switch(hh->prim){
|
switch(hh->prim){
|
||||||
case CC_RETRIEVE|INDICATION:
|
case CC_RETRIEVE|INDICATION:
|
||||||
{
|
{
|
||||||
struct misdn_bchannel *bc, *hold_bc;
|
struct misdn_bchannel *bc;
|
||||||
|
struct misdn_bchannel *hold_bc;
|
||||||
|
|
||||||
iframe_t frm; /* fake te frm to add callref to global callreflist */
|
iframe_t frm; /* fake te frm to add callref to global callreflist */
|
||||||
frm.dinfo = hh->dinfo;
|
frm.dinfo = hh->dinfo;
|
||||||
@@ -1872,7 +1888,7 @@ handle_event_nt(void *dat, void *arg)
|
|||||||
cb_log(4, stack->port, "bc_l3id:%x holded_bc_l3id:%x\n",bc->l3_id, hold_bc->l3_id);
|
cb_log(4, stack->port, "bc_l3id:%x holded_bc_l3id:%x\n",bc->l3_id, hold_bc->l3_id);
|
||||||
|
|
||||||
if (hold_bc) {
|
if (hold_bc) {
|
||||||
cb_log(4, stack->port, "REMOVEING Holder\n");
|
cb_log(4, stack->port, "REMOVING Holder\n");
|
||||||
|
|
||||||
/*swap the backup to our new channel back*/
|
/*swap the backup to our new channel back*/
|
||||||
stack_holder_remove(stack, hold_bc);
|
stack_holder_remove(stack, hold_bc);
|
||||||
@@ -2062,7 +2078,7 @@ handle_event_nt(void *dat, void *arg)
|
|||||||
cb_log(3 , stack->port, "%% GOT L2 DeActivate Info.\n");
|
cb_log(3 , stack->port, "%% GOT L2 DeActivate Info.\n");
|
||||||
|
|
||||||
if (stack->l2upcnt>3) {
|
if (stack->l2upcnt>3) {
|
||||||
cb_log(0 , stack->port, "!!! Could not Get the L2 up after 3 Attemps!!!\n");
|
cb_log(0 , stack->port, "!!! Could not Get the L2 up after 3 Attempts!!!\n");
|
||||||
} else {
|
} else {
|
||||||
#if 0
|
#if 0
|
||||||
if (stack->nt) misdn_lib_reinit_nt_stack(stack->port);
|
if (stack->nt) misdn_lib_reinit_nt_stack(stack->port);
|
||||||
@@ -2095,7 +2111,7 @@ handle_event_nt(void *dat, void *arg)
|
|||||||
bc=find_bc_by_l3id(stack, hh->dinfo);
|
bc=find_bc_by_l3id(stack, hh->dinfo);
|
||||||
|
|
||||||
if (!bc) {
|
if (!bc) {
|
||||||
cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x).\n", hh->dinfo);
|
cb_log(4, stack->port, " --> Didn't find BC so temporarily creating dummy BC (l3id:%x).\n", hh->dinfo);
|
||||||
misdn_make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
|
misdn_make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
|
||||||
bc=&dummybc;
|
bc=&dummybc;
|
||||||
}
|
}
|
||||||
@@ -2134,7 +2150,7 @@ handle_event_nt(void *dat, void *arg)
|
|||||||
} else {
|
} else {
|
||||||
if (reject) {
|
if (reject) {
|
||||||
switch(bc->cause){
|
switch(bc->cause){
|
||||||
case 17:
|
case AST_CAUSE_USER_BUSY:
|
||||||
cb_log(1, stack->port, "Siemens Busy reject..\n");
|
cb_log(1, stack->port, "Siemens Busy reject..\n");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -2708,12 +2724,12 @@ handle_frm_bc:
|
|||||||
switch (response) {
|
switch (response) {
|
||||||
case RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE:
|
case RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE:
|
||||||
|
|
||||||
cb_log(0, stack->port, "TOTALY IGNORING SETUP \n");
|
cb_log(0, stack->port, "TOTALLY IGNORING SETUP\n");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case RESPONSE_IGNORE_SETUP:
|
case RESPONSE_IGNORE_SETUP:
|
||||||
/* I think we should send CC_RELEASE_CR, but am not sure*/
|
/* I think we should send CC_RELEASE_CR, but am not sure*/
|
||||||
bc->out_cause=16;
|
bc->out_cause = AST_CAUSE_NORMAL_CLEARING;
|
||||||
|
|
||||||
case RESPONSE_RELEASE_SETUP:
|
case RESPONSE_RELEASE_SETUP:
|
||||||
misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
|
misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
|
||||||
@@ -2736,7 +2752,7 @@ handle_frm_bc:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event == EVENT_RELEASE_COMPLETE) {
|
if (event == EVENT_RELEASE_COMPLETE) {
|
||||||
/* release bchannel only after we've anounced the RELEASE_COMPLETE */
|
/* release bchannel only after we've announced the RELEASE_COMPLETE */
|
||||||
int channel=bc->channel;
|
int channel=bc->channel;
|
||||||
int tmpcause=bc->cause;
|
int tmpcause=bc->cause;
|
||||||
int tmp_out_cause=bc->out_cause;
|
int tmp_out_cause=bc->out_cause;
|
||||||
@@ -2745,8 +2761,8 @@ handle_frm_bc:
|
|||||||
bc->out_cause=tmp_out_cause;
|
bc->out_cause=tmp_out_cause;
|
||||||
clean_up_bc(bc);
|
clean_up_bc(bc);
|
||||||
|
|
||||||
if (tmpcause == 44) {
|
if (tmpcause == AST_CAUSE_REQUESTED_CHAN_UNAVAIL) {
|
||||||
cb_log(0,stack->port,"**** Received CAUSE:44, so not cleaning up channel %d\n", channel);
|
cb_log(0,stack->port,"**** Received CAUSE:%d, so not cleaning up channel %d\n", AST_CAUSE_REQUESTED_CHAN_UNAVAIL, channel);
|
||||||
cb_log(0,stack->port,"**** This channel is now no longer available,\nplease try to restart it with 'misdn send restart <port> <channel>'\n");
|
cb_log(0,stack->port,"**** This channel is now no longer available,\nplease try to restart it with 'misdn send restart <port> <channel>'\n");
|
||||||
set_chan_in_stack(stack, channel);
|
set_chan_in_stack(stack, channel);
|
||||||
bc->channel=channel;
|
bc->channel=channel;
|
||||||
@@ -2773,7 +2789,7 @@ handle_frm_bc:
|
|||||||
} else {
|
} else {
|
||||||
struct misdn_bchannel dummybc;
|
struct misdn_bchannel dummybc;
|
||||||
if (frm->prim!=(CC_FACILITY|INDICATION))
|
if (frm->prim!=(CC_FACILITY|INDICATION))
|
||||||
cb_log(0, stack->port, " --> Didn't find BC so temporarly creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
|
cb_log(0, stack->port, " --> Didn't find BC so temporarily creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
|
||||||
else
|
else
|
||||||
cb_log(5, stack->port, " --> Using Dummy BC for FACILITy\n");
|
cb_log(5, stack->port, " --> Using Dummy BC for FACILITy\n");
|
||||||
|
|
||||||
@@ -2819,7 +2835,7 @@ static int handle_l1(msg_t *msg)
|
|||||||
|
|
||||||
for (i=0;i<=stack->b_num; i++) {
|
for (i=0;i<=stack->b_num; i++) {
|
||||||
if (stack->bc[i].evq != EVENT_NOTHING) {
|
if (stack->bc[i].evq != EVENT_NOTHING) {
|
||||||
cb_log(4, stack->port, "Fireing Queued Event %s because L1 got up\n", isdn_get_info(msgs_g, stack->bc[i].evq, 0));
|
cb_log(4, stack->port, "Firing Queued Event %s because L1 got up\n", isdn_get_info(msgs_g, stack->bc[i].evq, 0));
|
||||||
misdn_lib_send_event(&stack->bc[i],stack->bc[i].evq);
|
misdn_lib_send_event(&stack->bc[i],stack->bc[i].evq);
|
||||||
stack->bc[i].evq=EVENT_NOTHING;
|
stack->bc[i].evq=EVENT_NOTHING;
|
||||||
}
|
}
|
||||||
@@ -3009,7 +3025,7 @@ static msg_t *fetch_msg(int midev)
|
|||||||
msg->len=r;
|
msg->len=r;
|
||||||
|
|
||||||
if (r==0) {
|
if (r==0) {
|
||||||
free_msg(msg); /* danger, cauz usualy freeing in main_loop */
|
free_msg(msg); /* danger, cause usually freeing in main_loop */
|
||||||
cb_log(6,0,"Got empty Msg..\n");
|
cb_log(6,0,"Got empty Msg..\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -3050,6 +3066,7 @@ void misdn_lib_isdn_l1watcher(int port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is a thread */
|
||||||
static void misdn_lib_isdn_event_catcher(void *arg)
|
static void misdn_lib_isdn_event_catcher(void *arg)
|
||||||
{
|
{
|
||||||
struct misdn_lib *mgr = arg;
|
struct misdn_lib *mgr = arg;
|
||||||
@@ -3066,7 +3083,7 @@ static void misdn_lib_isdn_event_catcher(void *arg)
|
|||||||
|
|
||||||
frm = (iframe_t*) msg->data;
|
frm = (iframe_t*) msg->data;
|
||||||
|
|
||||||
/** When we make a call from NT2Ast we get this frames **/
|
/** When we make a call from NT2Ast we get these frames **/
|
||||||
if (frm->len == 0 && frm->addr == 0 && frm->dinfo == 0 && frm->prim == 0 ) {
|
if (frm->len == 0 && frm->addr == 0 && frm->dinfo == 0 && frm->prim == 0 ) {
|
||||||
zero_frm++;
|
zero_frm++;
|
||||||
free_msg(msg);
|
free_msg(msg);
|
||||||
@@ -3130,7 +3147,7 @@ void te_lib_destroy(int midev)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
mISDN_write_frame(midev, buf, 0, MGR_DELENTITY | REQUEST, entity, 0, NULL, TIMEOUT_1SEC);
|
mISDN_write_frame(midev, buf, 0, MGR_DELENTITY | REQUEST, entity, 0, NULL, TIMEOUT_1SEC);
|
||||||
|
|
||||||
cb_log(4, 0, "Entetity deleted\n");
|
cb_log(4, 0, "Entity deleted\n");
|
||||||
mISDN_close(midev);
|
mISDN_close(midev);
|
||||||
cb_log(4, 0, "midev closed\n");
|
cb_log(4, 0, "midev closed\n");
|
||||||
}
|
}
|
||||||
@@ -3186,7 +3203,7 @@ static void prepare_bc(struct misdn_bchannel*bc, int channel)
|
|||||||
bc->need_disconnect=1;
|
bc->need_disconnect=1;
|
||||||
bc->need_release=1;
|
bc->need_release=1;
|
||||||
bc->need_release_complete=1;
|
bc->need_release_complete=1;
|
||||||
bc->cause=16;
|
bc->cause = AST_CAUSE_NORMAL_CLEARING;
|
||||||
|
|
||||||
if (++mypid>5000) mypid=1;
|
if (++mypid>5000) mypid=1;
|
||||||
bc->pid=mypid;
|
bc->pid=mypid;
|
||||||
@@ -3276,22 +3293,42 @@ struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel, int inout, i
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
static char *fac2str (enum FacFunction func)
|
* \internal
|
||||||
|
* \brief Convert the facility function enum value into a string.
|
||||||
|
*
|
||||||
|
* \return String version of the enum value
|
||||||
|
*/
|
||||||
|
static const char *fac2str(enum FacFunction facility)
|
||||||
{
|
{
|
||||||
struct arr_el {
|
static const struct {
|
||||||
enum FacFunction p;
|
enum FacFunction facility;
|
||||||
char *s ;
|
char *name;
|
||||||
} arr[] = {
|
} arr[] = {
|
||||||
|
/* *INDENT-OFF* */
|
||||||
{ Fac_None, "Fac_None" },
|
{ Fac_None, "Fac_None" },
|
||||||
{ Fac_CD, "Fac_CD"},
|
{ Fac_GetSupportedServices, "Fac_GetSupportedServices" },
|
||||||
|
{ Fac_Listen, "Fac_Listen" },
|
||||||
|
{ Fac_Suspend, "Fac_Suspend" },
|
||||||
|
{ Fac_Resume, "Fac_Resume" },
|
||||||
|
{ Fac_CFActivate, "Fac_CFActivate" },
|
||||||
|
{ Fac_CFDeactivate, "Fac_CFDeactivate" },
|
||||||
|
{ Fac_CFInterrogateParameters, "Fac_CFInterrogateParameters" },
|
||||||
|
{ Fac_CFInterrogateNumbers, "Fac_CFInterrogateNumbers" },
|
||||||
|
{ Fac_CD, "Fac_CD" },
|
||||||
|
{ Fac_AOCDCurrency, "Fac_AOCDCurrency" },
|
||||||
|
{ Fac_AOCDChargingUnit, "Fac_AOCDChargingUnit" },
|
||||||
|
/* *INDENT-ON* */
|
||||||
};
|
};
|
||||||
|
|
||||||
int i;
|
unsigned index;
|
||||||
|
|
||||||
for (i=0; i < sizeof(arr)/sizeof( struct arr_el) ; i ++)
|
|
||||||
if ( arr[i].p==func) return arr[i].s;
|
|
||||||
|
|
||||||
|
for (index = 0; index < ARRAY_LEN(arr); ++index) {
|
||||||
|
if (arr[index].facility == facility) {
|
||||||
|
return arr[index].name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3329,19 +3366,17 @@ void misdn_lib_log_ies(struct misdn_bchannel *bc)
|
|||||||
cb_log(5, stack->port, " --> bc:%p h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
|
cb_log(5, stack->port, " --> bc:%p h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void misdn_send_lock(struct misdn_bchannel *bc);
|
|
||||||
void misdn_send_unlock(struct misdn_bchannel *bc);
|
|
||||||
|
|
||||||
#define RETURN(a,b) {retval=a; goto b;}
|
#define RETURN(a,b) {retval=a; goto b;}
|
||||||
|
|
||||||
void misdn_send_lock(struct misdn_bchannel *bc)
|
static void misdn_send_lock(struct misdn_bchannel *bc)
|
||||||
{
|
{
|
||||||
//cb_log(0,bc->port,"Locking bc->pid:%d\n", bc->pid);
|
//cb_log(0,bc->port,"Locking bc->pid:%d\n", bc->pid);
|
||||||
if (bc->send_lock)
|
if (bc->send_lock)
|
||||||
pthread_mutex_lock(&bc->send_lock->lock);
|
pthread_mutex_lock(&bc->send_lock->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void misdn_send_unlock(struct misdn_bchannel *bc)
|
static void misdn_send_unlock(struct misdn_bchannel *bc)
|
||||||
{
|
{
|
||||||
//cb_log(0,bc->port,"UnLocking bc->pid:%d\n", bc->pid);
|
//cb_log(0,bc->port,"UnLocking bc->pid:%d\n", bc->pid);
|
||||||
if (bc->send_lock)
|
if (bc->send_lock)
|
||||||
@@ -3367,7 +3402,7 @@ int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
|
|||||||
misdn_send_lock(bc);
|
misdn_send_lock(bc);
|
||||||
|
|
||||||
|
|
||||||
cb_log(6,stack->port,"SENDEVENT: stack->nt:%d stack->uperid:%x\n",stack->nt, stack->upper_id);
|
cb_log(6,stack->port,"SENDEVENT: stack->nt:%d stack->upperid:%x\n",stack->nt, stack->upper_id);
|
||||||
|
|
||||||
if ( stack->nt && !stack->l1link) {
|
if ( stack->nt && !stack->l1link) {
|
||||||
/** Queue Event **/
|
/** Queue Event **/
|
||||||
@@ -3509,7 +3544,7 @@ int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
|
|||||||
bc->need_release_complete=0;
|
bc->need_release_complete=0;
|
||||||
|
|
||||||
if (!stack->nt) {
|
if (!stack->nt) {
|
||||||
/*create clenaup in TE*/
|
/*create cleanup in TE*/
|
||||||
int channel=bc->channel;
|
int channel=bc->channel;
|
||||||
|
|
||||||
int tmpcause=bc->cause;
|
int tmpcause=bc->cause;
|
||||||
@@ -3739,7 +3774,7 @@ int misdn_lib_get_port_info(int port)
|
|||||||
iframe_t *frm;
|
iframe_t *frm;
|
||||||
struct misdn_stack *stack=find_stack_by_port(port);
|
struct misdn_stack *stack=find_stack_by_port(port);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
cb_log(0, port, "misgn_lib_get_port: alloc_msg failed!\n");
|
cb_log(0, port, "misdn_lib_get_port_info: alloc_msg failed!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
frm=(iframe_t*)msg->data;
|
frm=(iframe_t*)msg->data;
|
||||||
@@ -3768,7 +3803,7 @@ int queue_cleanup_bc(struct misdn_bchannel *bc)
|
|||||||
msg_t *msg=alloc_msg(MAX_MSG_SIZE);
|
msg_t *msg=alloc_msg(MAX_MSG_SIZE);
|
||||||
iframe_t *frm;
|
iframe_t *frm;
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
cb_log(0, bc->port, "misgn_lib_get_port: alloc_msg failed!\n");
|
cb_log(0, bc->port, "queue_cleanup_bc: alloc_msg failed!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
frm=(iframe_t*)msg->data;
|
frm=(iframe_t*)msg->data;
|
||||||
@@ -3798,7 +3833,7 @@ int misdn_lib_pid_restart(int pid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Sends Restart message for every bchnanel*/
|
/*Sends Restart message for every bchannel*/
|
||||||
int misdn_lib_send_restart(int port, int channel)
|
int misdn_lib_send_restart(int port, int channel)
|
||||||
{
|
{
|
||||||
struct misdn_stack *stack=find_stack_by_port(port);
|
struct misdn_stack *stack=find_stack_by_port(port);
|
||||||
@@ -3880,6 +3915,7 @@ int misdn_lib_port_restart(int port)
|
|||||||
|
|
||||||
sem_t handler_started;
|
sem_t handler_started;
|
||||||
|
|
||||||
|
/* This is a thread */
|
||||||
static void manager_event_handler(void *arg)
|
static void manager_event_handler(void *arg)
|
||||||
{
|
{
|
||||||
sem_post(&handler_started);
|
sem_post(&handler_started);
|
||||||
@@ -3959,7 +3995,7 @@ static void manager_event_handler(void *arg)
|
|||||||
} else {
|
} else {
|
||||||
iframe_t *frm = (iframe_t *)msg->data;
|
iframe_t *frm = (iframe_t *)msg->data;
|
||||||
struct misdn_bchannel *bc = find_bc_by_l3id(stack, frm->dinfo);
|
struct misdn_bchannel *bc = find_bc_by_l3id(stack, frm->dinfo);
|
||||||
if (bc)
|
if (bc)
|
||||||
send_msg(glob_mgr->midev, bc, msg);
|
send_msg(glob_mgr->midev, bc, msg);
|
||||||
else {
|
else {
|
||||||
if (frm->dinfo == MISDN_ID_GLOBAL || frm->dinfo == MISDN_ID_DUMMY ) {
|
if (frm->dinfo == MISDN_ID_GLOBAL || frm->dinfo == MISDN_ID_DUMMY ) {
|
||||||
@@ -3978,8 +4014,10 @@ static void manager_event_handler(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int misdn_lib_maxports_get() { /** BE AWARE WE HAVE NO CB_LOG HERE! **/
|
int misdn_lib_maxports_get(void)
|
||||||
|
{
|
||||||
|
/* BE AWARE WE HAVE NO cb_log() HERE! */
|
||||||
|
|
||||||
int i = mISDN_open();
|
int i = mISDN_open();
|
||||||
int max=0;
|
int max=0;
|
||||||
|
|
||||||
@@ -4008,7 +4046,7 @@ void misdn_lib_nt_keepcalls( int kc)
|
|||||||
|
|
||||||
void misdn_lib_nt_debug_init( int flags, char *file )
|
void misdn_lib_nt_debug_init( int flags, char *file )
|
||||||
{
|
{
|
||||||
int static init=0;
|
static int init=0;
|
||||||
char *f;
|
char *f;
|
||||||
|
|
||||||
if (!flags)
|
if (!flags)
|
||||||
@@ -4087,7 +4125,7 @@ int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_dat
|
|||||||
stack=stack_init(midev, port, ptp);
|
stack=stack_init(midev, port, ptp);
|
||||||
|
|
||||||
if (!stack) {
|
if (!stack) {
|
||||||
perror("init_stack");
|
perror("stack_init");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4134,7 +4172,7 @@ int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_dat
|
|||||||
return (mgr == NULL);
|
return (mgr == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void misdn_lib_destroy()
|
void misdn_lib_destroy(void)
|
||||||
{
|
{
|
||||||
struct misdn_stack *help;
|
struct misdn_stack *help;
|
||||||
int i;
|
int i;
|
||||||
@@ -4196,7 +4234,6 @@ void manager_bchannel_activate(struct misdn_bchannel *bc)
|
|||||||
|
|
||||||
void manager_bchannel_deactivate(struct misdn_bchannel * bc)
|
void manager_bchannel_deactivate(struct misdn_bchannel * bc)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct misdn_stack *stack=get_stack_by_bc(bc);
|
struct misdn_stack *stack=get_stack_by_bc(bc);
|
||||||
iframe_t dact;
|
iframe_t dact;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
@@ -4358,9 +4395,6 @@ void stack_holder_add(struct misdn_stack *stack, struct misdn_bchannel *holder)
|
|||||||
cb_log(4,stack->port, "*HOLDER: add %x\n",holder->l3_id);
|
cb_log(4,stack->port, "*HOLDER: add %x\n",holder->l3_id);
|
||||||
|
|
||||||
holder->stack_holder=1;
|
holder->stack_holder=1;
|
||||||
|
|
||||||
if (!stack ) return ;
|
|
||||||
|
|
||||||
holder->next=NULL;
|
holder->next=NULL;
|
||||||
|
|
||||||
if (!stack->holding) {
|
if (!stack->holding) {
|
||||||
@@ -4581,7 +4615,8 @@ void misdn_split_conf(struct misdn_bchannel *bc, int conf_id)
|
|||||||
cb_log(4,bc->port, "Splitting bc:%x in conf:%d\n",bc->addr,conf_id);
|
cb_log(4,bc->port, "Splitting bc:%x in conf:%d\n",bc->addr,conf_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2) {
|
void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2)
|
||||||
|
{
|
||||||
int conf_id = bc1->pid + 1;
|
int conf_id = bc1->pid + 1;
|
||||||
struct misdn_bchannel *bc_list[] = { bc1, bc2, NULL };
|
struct misdn_bchannel *bc_list[] = { bc1, bc2, NULL };
|
||||||
struct misdn_bchannel **bc;
|
struct misdn_bchannel **bc;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* the GNU General Public License
|
* the GNU General Public License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file
|
/*! \file
|
||||||
* \brief Interface to mISDN
|
* \brief Interface to mISDN
|
||||||
*
|
*
|
||||||
* \author Christian Richter <crich@beronet.com>
|
* \author Christian Richter <crich@beronet.com>
|
||||||
@@ -27,9 +27,9 @@
|
|||||||
/** end of init usage **/
|
/** end of init usage **/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* uncomment the following to make chan_misdn create
|
* uncomment the following to make chan_misdn create
|
||||||
* record files in /tmp/misdn-{rx|tx}-PortChannel format
|
* record files in /tmp/misdn-{rx|tx}-PortChannel format
|
||||||
* */
|
* */
|
||||||
|
|
||||||
/*#define MISDN_SAVE_DATA*/
|
/*#define MISDN_SAVE_DATA*/
|
||||||
@@ -50,9 +50,9 @@ beroec_t *beroec_new(int tail, enum beroec_type type, int anti_howl,
|
|||||||
int tonedisable, int zerocoeff, int adapt, int nlp);
|
int tonedisable, int zerocoeff, int adapt, int nlp);
|
||||||
|
|
||||||
void beroec_destroy(beroec_t *ec);
|
void beroec_destroy(beroec_t *ec);
|
||||||
int beroec_cancel_alaw_chunk(beroec_t *ec,
|
int beroec_cancel_alaw_chunk(beroec_t *ec,
|
||||||
char *send,
|
char *send,
|
||||||
char *receive ,
|
char *receive,
|
||||||
int len);
|
int len);
|
||||||
|
|
||||||
int beroec_version(void);
|
int beroec_version(void);
|
||||||
@@ -103,7 +103,7 @@ enum mISDN_NUMBER_PLAN {
|
|||||||
NUMPLAN_NATIONAL=0x2,
|
NUMPLAN_NATIONAL=0x2,
|
||||||
NUMPLAN_SUBSCRIBER=0x4,
|
NUMPLAN_SUBSCRIBER=0x4,
|
||||||
NUMPLAN_UNKNOWN=0x0
|
NUMPLAN_UNKNOWN=0x0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum event_response_e {
|
enum event_response_e {
|
||||||
@@ -158,7 +158,7 @@ enum event_e {
|
|||||||
EVENT_PORT_ALARM,
|
EVENT_PORT_ALARM,
|
||||||
EVENT_NEW_CHANNEL,
|
EVENT_NEW_CHANNEL,
|
||||||
EVENT_UNKNOWN
|
EVENT_UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum ie_name_e {
|
enum ie_name_e {
|
||||||
@@ -192,7 +192,7 @@ enum { /* progress indicators */
|
|||||||
enum { /*CODECS*/
|
enum { /*CODECS*/
|
||||||
INFO_CODEC_ULAW=2,
|
INFO_CODEC_ULAW=2,
|
||||||
INFO_CODEC_ALAW=3
|
INFO_CODEC_ALAW=3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum layer_e {
|
enum layer_e {
|
||||||
@@ -200,85 +200,173 @@ enum layer_e {
|
|||||||
L2,
|
L2,
|
||||||
L1,
|
L1,
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct misdn_bchannel {
|
struct misdn_bchannel {
|
||||||
|
/*! \brief B channel send locking structure */
|
||||||
struct send_lock *send_lock;
|
struct send_lock *send_lock;
|
||||||
|
|
||||||
|
/*! \brief TRUE if this is a dummy BC record */
|
||||||
int dummy;
|
int dummy;
|
||||||
|
|
||||||
|
/*! \brief TRUE if NT side of protocol (TE otherwise) */
|
||||||
int nt;
|
int nt;
|
||||||
|
|
||||||
|
/*! \brief TRUE if ISDN-PRI (ISDN-BRI otherwise) */
|
||||||
int pri;
|
int pri;
|
||||||
|
|
||||||
|
/*! \brief Logical Layer 1 port associated with this B channel */
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
/** init stuff **/
|
/** init stuff **/
|
||||||
|
/*! \brief B Channel mISDN driver stack ID */
|
||||||
int b_stid;
|
int b_stid;
|
||||||
|
|
||||||
/* int b_addr; */
|
/* int b_addr; */
|
||||||
|
|
||||||
|
/*! \brief B Channel mISDN driver layer ID from mISDN_new_layer() */
|
||||||
int layer_id;
|
int layer_id;
|
||||||
|
|
||||||
|
/*! \brief B channel layer; set to 3 or 4 */
|
||||||
int layer;
|
int layer;
|
||||||
|
|
||||||
/*state stuff*/
|
/* state stuff */
|
||||||
|
/*! \brief TRUE if DISCONNECT needs to be sent to clear a call */
|
||||||
int need_disconnect;
|
int need_disconnect;
|
||||||
|
|
||||||
|
/*! \brief TRUE if RELEASE needs to be sent to clear a call */
|
||||||
int need_release;
|
int need_release;
|
||||||
|
|
||||||
|
/*! \brief TRUE if RELEASE_COMPLETE needs to be sent to clear a call */
|
||||||
int need_release_complete;
|
int need_release_complete;
|
||||||
|
|
||||||
|
/*! \brief TRUE if allocate higher B channels first */
|
||||||
int dec;
|
int dec;
|
||||||
/** var stuff**/
|
|
||||||
|
/* var stuff */
|
||||||
|
/*! \brief Layer 3 process ID */
|
||||||
int l3_id;
|
int l3_id;
|
||||||
|
|
||||||
|
/*! \brief B channel process ID (1-5000) */
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
|
/*! \brief Not used. Saved mISDN stack CONNECT_t ces value */
|
||||||
int ces;
|
int ces;
|
||||||
|
|
||||||
|
/*! \brief B channel to restart if received a RESTART message */
|
||||||
int restart_channel;
|
int restart_channel;
|
||||||
|
|
||||||
|
/*! \brief Assigned B channel number B1, B2... 0 if not assigned */
|
||||||
int channel;
|
int channel;
|
||||||
|
|
||||||
|
/*! \brief TRUE if the B channel number is preselected */
|
||||||
int channel_preselected;
|
int channel_preselected;
|
||||||
|
|
||||||
|
/*! \brief TRUE if B channel record is in use */
|
||||||
int in_use;
|
int in_use;
|
||||||
|
|
||||||
|
/*! \brief Time when empty_bc() last called on this record */
|
||||||
struct timeval last_used;
|
struct timeval last_used;
|
||||||
|
|
||||||
|
/*! \brief TRUE if call waiting */
|
||||||
int cw;
|
int cw;
|
||||||
|
|
||||||
|
/*! \brief B Channel mISDN driver layer ID from mISDN_get_layerid() */
|
||||||
int addr;
|
int addr;
|
||||||
|
|
||||||
char * bframe;
|
/*! \brief B channel speech sample data buffer */
|
||||||
|
char *bframe;
|
||||||
|
|
||||||
|
/*! \brief B channel speech sample data buffer size */
|
||||||
int bframe_len;
|
int bframe_len;
|
||||||
int time_usec;
|
int time_usec; /* Not used */
|
||||||
|
|
||||||
|
/*! \brief Not used. Contents are setup but not used. */
|
||||||
void *astbuf;
|
void *astbuf;
|
||||||
|
|
||||||
void *misdnbuf;
|
void *misdnbuf; /* Not used */
|
||||||
|
|
||||||
|
/*! \brief TRUE if the TE side should choose the B channel to use
|
||||||
|
* \note This value is user configurable in /etc/asterisk/misdn.conf
|
||||||
|
*/
|
||||||
int te_choose_channel;
|
int te_choose_channel;
|
||||||
|
|
||||||
|
/*! \brief TRUE if the call progress indicators can indicate an inband audio message for the user to listen to
|
||||||
|
* \note This value is user configurable in /etc/asterisk/misdn.conf
|
||||||
|
*/
|
||||||
int early_bconnect;
|
int early_bconnect;
|
||||||
|
|
||||||
/* dtmf digit */
|
/*! \brief Last decoded DTMF digit from mISDN driver */
|
||||||
int dtmf;
|
int dtmf;
|
||||||
|
|
||||||
|
/*! \brief TRUE if we should produce DTMF tones ourselves
|
||||||
|
* \note This value is user configurable in /etc/asterisk/misdn.conf
|
||||||
|
*/
|
||||||
int send_dtmf;
|
int send_dtmf;
|
||||||
|
|
||||||
/* get setup ack */
|
/*! \brief TRUE if we send SETUP_ACKNOWLEDGE on incoming calls anyway (instead of PROCEEDING).
|
||||||
|
*
|
||||||
|
* This requests additional INFORMATION messages, so we can
|
||||||
|
* wait for digits without issues.
|
||||||
|
* \note This value is user configurable in /etc/asterisk/misdn.conf
|
||||||
|
*/
|
||||||
int need_more_infos;
|
int need_more_infos;
|
||||||
|
|
||||||
/* may there be more infos ?*/
|
/*! \brief TRUE if all digits necessary to complete the call are available.
|
||||||
|
* No more INFORMATION messages are needed.
|
||||||
|
*/
|
||||||
int sending_complete;
|
int sending_complete;
|
||||||
|
|
||||||
|
|
||||||
/* wether we should use jollys dsp or not */
|
/*! \brief TRUE if we will not use jollys dsp */
|
||||||
int nodsp;
|
int nodsp;
|
||||||
|
|
||||||
/* wether we should use our jitter buf system or not */
|
/*! \brief TRUE if we will not use the jitter buffer system */
|
||||||
int nojitter;
|
int nojitter;
|
||||||
|
|
||||||
|
/*! \brief Type-of-number in ISDN terms for the dialed/called number
|
||||||
|
* \note This value is set to "dialplan" in /etc/asterisk/misdn.conf for outgoing calls
|
||||||
|
*/
|
||||||
enum mISDN_NUMBER_PLAN dnumplan;
|
enum mISDN_NUMBER_PLAN dnumplan;
|
||||||
|
|
||||||
|
/*! \brief Type-of-number in ISDN terms for the redirecting number which a call diversion or transfer was invoked.
|
||||||
|
* \note Collected from the incoming SETUP message but not used.
|
||||||
|
*/
|
||||||
enum mISDN_NUMBER_PLAN rnumplan;
|
enum mISDN_NUMBER_PLAN rnumplan;
|
||||||
|
|
||||||
|
/*! \brief Type-of-number in ISDN terms for the originating/calling number (Caller-ID)
|
||||||
|
* \note This value is set to "localdialplan" in /etc/asterisk/misdn.conf for outgoing calls
|
||||||
|
*/
|
||||||
enum mISDN_NUMBER_PLAN onumplan;
|
enum mISDN_NUMBER_PLAN onumplan;
|
||||||
|
|
||||||
|
/*! \brief Type-of-number in ISDN terms for the connected party number
|
||||||
|
* \note This value is set to "cpndialplan" in /etc/asterisk/misdn.conf for outgoing calls
|
||||||
|
*/
|
||||||
enum mISDN_NUMBER_PLAN cpnnumplan;
|
enum mISDN_NUMBER_PLAN cpnnumplan;
|
||||||
|
|
||||||
|
/*! \brief Progress Indicator IE coding standard field.
|
||||||
|
* \note Collected from the incoming messages but not used.
|
||||||
|
*/
|
||||||
int progress_coding;
|
int progress_coding;
|
||||||
|
|
||||||
|
/*! \brief Progress Indicator IE location field.
|
||||||
|
* \note Collected from the incoming messages but not used.
|
||||||
|
*/
|
||||||
int progress_location;
|
int progress_location;
|
||||||
|
|
||||||
|
/*! \brief Progress Indicator IE progress description field.
|
||||||
|
* Used to determine if there is an inband audio message present.
|
||||||
|
*/
|
||||||
int progress_indicator;
|
int progress_indicator;
|
||||||
|
|
||||||
|
/*! \brief Inbound FACILITY message function type and contents */
|
||||||
struct FacParm fac_in;
|
struct FacParm fac_in;
|
||||||
|
|
||||||
|
/*! \brief Outbound FACILITY message function type and contents.
|
||||||
|
* \note Filled in by misdn facility commands before FACILITY message sent.
|
||||||
|
*/
|
||||||
struct FacParm fac_out;
|
struct FacParm fac_out;
|
||||||
|
|
||||||
/* storing the current AOCD info here */
|
/* storing the current AOCD info here */
|
||||||
@@ -288,91 +376,192 @@ struct misdn_bchannel {
|
|||||||
struct FacAOCDChargingUnit chargingUnit;
|
struct FacAOCDChargingUnit chargingUnit;
|
||||||
} AOCD;
|
} AOCD;
|
||||||
int AOCD_need_export;
|
int AOCD_need_export;
|
||||||
|
|
||||||
enum event_e evq;
|
|
||||||
|
|
||||||
/*** CRYPTING STUFF ***/
|
|
||||||
|
|
||||||
int crypt;
|
|
||||||
int curprx;
|
|
||||||
int curptx;
|
|
||||||
char crypt_key[255];
|
|
||||||
|
|
||||||
int crypt_state;
|
|
||||||
|
|
||||||
/*char ast_dtmf_buf[255];
|
|
||||||
char misdn_dtmf_buf[255]; */
|
|
||||||
|
|
||||||
/*** CRYPTING STUFF END***/
|
|
||||||
|
|
||||||
int active;
|
|
||||||
int upset;
|
|
||||||
|
|
||||||
|
/*! \brief Event waiting for Layer 1 to come up */
|
||||||
|
enum event_e evq;
|
||||||
|
|
||||||
|
/*** CRYPTING STUFF ***/
|
||||||
|
int crypt; /* Initialized, Not used */
|
||||||
|
int curprx; /* Initialized, Not used */
|
||||||
|
int curptx; /* Initialized, Not used */
|
||||||
|
|
||||||
|
/*! \brief Blowfish encryption key string (secret) */
|
||||||
|
char crypt_key[255];
|
||||||
|
|
||||||
|
int crypt_state; /* Not used */
|
||||||
|
/*** CRYPTING STUFF END***/
|
||||||
|
|
||||||
|
/*! \brief Seems to have been intended for something to do with the jitter buffer.
|
||||||
|
* \note Used as a boolean. Only initialized to 0 and referenced in a couple places
|
||||||
|
*/
|
||||||
|
int active;
|
||||||
|
int upset; /* Not used */
|
||||||
|
|
||||||
|
/*! \brief TRUE if tone generator allowed to start */
|
||||||
int generate_tone;
|
int generate_tone;
|
||||||
|
|
||||||
|
/*! \brief Number of tone samples to generate */
|
||||||
int tone_cnt;
|
int tone_cnt;
|
||||||
|
|
||||||
|
/*! \brief Current B Channel state */
|
||||||
enum bchannel_state bc_state;
|
enum bchannel_state bc_state;
|
||||||
|
|
||||||
|
/*! \brief This is used as a pending bridge join request for when bc_state becomes BCHAN_ACTIVATED */
|
||||||
enum bchannel_state next_bc_state;
|
enum bchannel_state next_bc_state;
|
||||||
|
|
||||||
|
/*! \brief Bridging conference ID */
|
||||||
int conf_id;
|
int conf_id;
|
||||||
|
|
||||||
|
/*! \brief TRUE if this channel is on hold */
|
||||||
int holded;
|
int holded;
|
||||||
|
|
||||||
|
/*! \brief TRUE if this channel is on the misdn_stack->holding list
|
||||||
|
* \note If TRUE this implies that the structure is also malloced.
|
||||||
|
*/
|
||||||
int stack_holder;
|
int stack_holder;
|
||||||
|
|
||||||
|
/*! \brief Caller ID presentation restriction code
|
||||||
|
* 0=Allowed, 1=Restricted, 2=Unavailable
|
||||||
|
* \note It is settable by the misdn_set_opt() application.
|
||||||
|
*/
|
||||||
int pres;
|
int pres;
|
||||||
|
|
||||||
|
/*! \brief Caller ID screening code
|
||||||
|
* 0=Unscreened, 1=Passed Screen, 2=Failed Screen, 3=Network Number
|
||||||
|
*/
|
||||||
int screen;
|
int screen;
|
||||||
|
|
||||||
|
/*! \brief SETUP message bearer capability field code value */
|
||||||
int capability;
|
int capability;
|
||||||
|
|
||||||
|
/*! \brief Companding ALaw/uLaw encoding (INFO_CODEC_ALAW / INFO_CODEC_ULAW) */
|
||||||
int law;
|
int law;
|
||||||
/** V110 Stuff **/
|
|
||||||
|
/* V110 Stuff */
|
||||||
|
/*! \brief Q.931 Bearer Capability IE Information Transfer Rate field. Initialized to 0x10 (64kbit). Altered by incoming SETUP messages. */
|
||||||
int rate;
|
int rate;
|
||||||
|
|
||||||
|
/*! \brief Q.931 Bearer Capability IE Transfer Mode field. Initialized to 0 (Circuit). Altered by incoming SETUP messages. */
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
|
/*! \brief Q.931 Bearer Capability IE User Information Layer 1 Protocol field code.
|
||||||
|
* \note Collected from the incoming SETUP message but not used.
|
||||||
|
*/
|
||||||
int user1;
|
int user1;
|
||||||
|
|
||||||
|
/*! \brief Q.931 Bearer Capability IE Layer 1 User Rate field.
|
||||||
|
* \note Collected from the incoming SETUP message and exported to Asterisk variable MISDN_URATE.
|
||||||
|
*/
|
||||||
int urate;
|
int urate;
|
||||||
|
|
||||||
|
/*! \brief TRUE if call made in digital HDLC mode
|
||||||
|
* \note This value is user configurable in /etc/asterisk/misdn.conf.
|
||||||
|
* It is also settable by the misdn_set_opt() application.
|
||||||
|
*/
|
||||||
int hdlc;
|
int hdlc;
|
||||||
/* V110 */
|
/* V110 */
|
||||||
|
|
||||||
|
/*! \brief Display message that can be displayed by the user phone.
|
||||||
|
* \note Maximum displayable length is 34 or 82 octets.
|
||||||
|
* It is also settable by the misdn_set_opt() application.
|
||||||
|
*/
|
||||||
char display[84];
|
char display[84];
|
||||||
|
|
||||||
|
/*! \brief Not used. Contents are setup but not used. */
|
||||||
char msn[32];
|
char msn[32];
|
||||||
|
|
||||||
|
/*! \brief Originating/Calling Phone Number (Address)
|
||||||
|
* \note This value can be set to "callerid" in /etc/asterisk/misdn.conf for outgoing calls
|
||||||
|
*/
|
||||||
char oad[32];
|
char oad[32];
|
||||||
|
|
||||||
|
/*! \brief Redirecting Phone Number (Address) where a call diversion or transfer was invoked */
|
||||||
char rad[32];
|
char rad[32];
|
||||||
|
|
||||||
|
/*! \brief Dialed/Called Phone Number (Address) */
|
||||||
char dad[32];
|
char dad[32];
|
||||||
|
|
||||||
|
/*! \brief Connected Party/Line Phone Number (Address) */
|
||||||
char cad[32];
|
char cad[32];
|
||||||
|
|
||||||
|
/*! \brief Original Dialed/Called Phone Number (Address) before national/international dialing prefix added.
|
||||||
|
* \note Not used. Contents are setup but not used.
|
||||||
|
*/
|
||||||
char orig_dad[32];
|
char orig_dad[32];
|
||||||
|
|
||||||
|
/*! \brief Q.931 Keypad Facility IE contents
|
||||||
|
* \note Contents exported and imported to Asterisk variable MISDN_KEYPAD
|
||||||
|
*/
|
||||||
char keypad[32];
|
char keypad[32];
|
||||||
|
|
||||||
|
/*! \brief Current overlap dialing digits to/from INFORMATION messages */
|
||||||
char info_dad[64];
|
char info_dad[64];
|
||||||
|
|
||||||
|
/*! \brief Collected digits to go into info_dad[] while waiting for a SETUP_ACKNOWLEDGE to come in. */
|
||||||
char infos_pending[64];
|
char infos_pending[64];
|
||||||
|
|
||||||
/* unsigned char info_keypad[32]; */
|
/* unsigned char info_keypad[32]; */
|
||||||
/* unsigned char clisub[24]; */
|
/* unsigned char clisub[24]; */
|
||||||
/* unsigned char cldsub[24]; */
|
/* unsigned char cldsub[24]; */
|
||||||
|
|
||||||
|
/*! \brief User-User information string.
|
||||||
|
* \note Contents exported and imported to Asterisk variable MISDN_USERUSER
|
||||||
|
* \note We only support ASCII strings (IA5 characters).
|
||||||
|
*/
|
||||||
char uu[256];
|
char uu[256];
|
||||||
|
|
||||||
|
/*! \brief User-User information string length in uu[] */
|
||||||
int uulen;
|
int uulen;
|
||||||
|
|
||||||
|
/*! \brief Q.931 Cause for disconnection code (received)
|
||||||
|
* \note Need to use the AST_CAUSE_xxx code definitions in causes.h
|
||||||
|
*/
|
||||||
int cause;
|
int cause;
|
||||||
|
|
||||||
|
/*! \brief Q.931 Cause for disconnection code (sent)
|
||||||
|
* \note Need to use the AST_CAUSE_xxx code definitions in causes.h
|
||||||
|
* \note -1 is used to suppress including the cause code in the RELEASE message.
|
||||||
|
*/
|
||||||
int out_cause;
|
int out_cause;
|
||||||
|
|
||||||
/* struct misdn_bchannel hold_bc; */
|
/* struct misdn_bchannel hold_bc; */
|
||||||
|
|
||||||
/** list stuf **/
|
/** list stuf **/
|
||||||
|
|
||||||
#ifdef MISDN_1_2
|
#ifdef MISDN_1_2
|
||||||
|
/*! \brief The configuration string for the mISDN dsp pipeline in /etc/asterisk/misdn.conf. */
|
||||||
char pipeline[128];
|
char pipeline[128];
|
||||||
#else
|
#else
|
||||||
|
/*! \brief TRUE if the echo cancellor is enabled */
|
||||||
int ec_enable;
|
int ec_enable;
|
||||||
|
|
||||||
|
/*! \brief Number of taps in the echo cancellor when enabled.
|
||||||
|
* \note This value is user configurable in /etc/asterisk/misdn.conf (echocancel)
|
||||||
|
*/
|
||||||
int ec_deftaps;
|
int ec_deftaps;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*! \brief TRUE if the channel was allocated from the available B channels */
|
||||||
int channel_found;
|
int channel_found;
|
||||||
|
|
||||||
|
/*! \brief Who originated the call (ORG_AST, ORG_MISDN)
|
||||||
|
* \note Set but not used when the misdn_set_opt() application enables echo cancellation.
|
||||||
|
*/
|
||||||
int orig;
|
int orig;
|
||||||
|
|
||||||
|
/*! \brief Tx gain setting (range -8 to 8)
|
||||||
|
* \note This value is user configurable in /etc/asterisk/misdn.conf.
|
||||||
|
* It is also settable by the misdn_set_opt() application.
|
||||||
|
*/
|
||||||
int txgain;
|
int txgain;
|
||||||
|
|
||||||
|
/*! \brief Rx gain setting (range -8 to 8)
|
||||||
|
* \note This value is user configurable in /etc/asterisk/misdn.conf.
|
||||||
|
* It is also settable by the misdn_set_opt() application.
|
||||||
|
*/
|
||||||
int rxgain;
|
int rxgain;
|
||||||
|
|
||||||
|
/*! \brief Next node in the misdn_stack.holding list */
|
||||||
struct misdn_bchannel *next;
|
struct misdn_bchannel *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -437,7 +626,7 @@ int misdn_lib_port_up(int port, int notcheck);
|
|||||||
int misdn_lib_get_port_down(int port);
|
int misdn_lib_get_port_down(int port);
|
||||||
|
|
||||||
int misdn_lib_get_port_up (int port) ;
|
int misdn_lib_get_port_up (int port) ;
|
||||||
|
|
||||||
int misdn_lib_maxports_get(void) ;
|
int misdn_lib_maxports_get(void) ;
|
||||||
|
|
||||||
struct misdn_bchannel *misdn_lib_find_held_bc(int port, int l3_id);
|
struct misdn_bchannel *misdn_lib_find_held_bc(int port, int l3_id);
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ibuffer_t *astbuf;
|
ibuffer_t *astbuf; /* Not used */
|
||||||
ibuffer_t *misdnbuf;
|
ibuffer_t *misdnbuf; /* Not used */
|
||||||
|
|
||||||
struct send_lock {
|
struct send_lock {
|
||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
@@ -38,15 +38,14 @@ struct send_lock {
|
|||||||
|
|
||||||
struct isdn_msg {
|
struct isdn_msg {
|
||||||
unsigned long misdn_msg;
|
unsigned long misdn_msg;
|
||||||
|
|
||||||
enum layer_e layer;
|
enum layer_e layer;
|
||||||
enum event_e event;
|
enum event_e event;
|
||||||
|
|
||||||
void (*msg_parser)(struct isdn_msg *msgs, msg_t *msg, struct misdn_bchannel *bc, int nt);
|
void (*msg_parser)(struct isdn_msg *msgs, msg_t *msg, struct misdn_bchannel *bc, int nt);
|
||||||
msg_t *(*msg_builder)(struct isdn_msg *msgs, struct misdn_bchannel *bc, int nt);
|
msg_t *(*msg_builder)(struct isdn_msg *msgs, struct misdn_bchannel *bc, int nt);
|
||||||
char *info;
|
char *info;
|
||||||
|
} ;
|
||||||
} ;
|
|
||||||
|
|
||||||
/* for isdn_msg_parser.c */
|
/* for isdn_msg_parser.c */
|
||||||
msg_t *create_l3msg(int prim, int mt, int dinfo , int size, int nt);
|
msg_t *create_l3msg(int prim, int mt, int dinfo , int size, int nt);
|
||||||
@@ -58,57 +57,78 @@ struct misdn_stack {
|
|||||||
net_stack_t nst;
|
net_stack_t nst;
|
||||||
manager_t mgr;
|
manager_t mgr;
|
||||||
pthread_mutex_t nstlock;
|
pthread_mutex_t nstlock;
|
||||||
|
|
||||||
|
/*! \brief D Channel mISDN driver stack ID (Parent stack ID) */
|
||||||
int d_stid;
|
int d_stid;
|
||||||
|
|
||||||
|
/*! /brief Number of B channels supported by this port */
|
||||||
int b_num;
|
int b_num;
|
||||||
|
|
||||||
|
/*! \brief B Channel mISDN driver stack IDs (Child stack IDs) */
|
||||||
int b_stids[MAX_BCHANS + 1];
|
int b_stids[MAX_BCHANS + 1];
|
||||||
|
|
||||||
|
/*! \brief TRUE if Point-To-Point(PTP) (Point-To-Multipoint(PTMP) otherwise) */
|
||||||
int ptp;
|
int ptp;
|
||||||
|
|
||||||
|
/*! \brief Number of consecutive times PTP Layer 2 declared down */
|
||||||
int l2upcnt;
|
int l2upcnt;
|
||||||
|
|
||||||
int l2_id;
|
int l2_id; /* Not used */
|
||||||
int lower_id;
|
|
||||||
int upper_id;
|
|
||||||
|
|
||||||
|
|
||||||
|
/*! \brief Lower layer mISDN ID (addr) (Layer 1/3) */
|
||||||
|
int lower_id;
|
||||||
|
|
||||||
|
/*! \brief Upper layer mISDN ID (addr) (Layer 2/4) */
|
||||||
|
int upper_id;
|
||||||
|
|
||||||
|
/*! \brief TRUE if port is blocked */
|
||||||
int blocked;
|
int blocked;
|
||||||
|
|
||||||
|
/*! \brief TRUE if Layer 2 is UP */
|
||||||
int l2link;
|
int l2link;
|
||||||
|
|
||||||
time_t l2establish;
|
time_t l2establish; /* Not used */
|
||||||
|
|
||||||
|
/*! \brief TRUE if Layer 1 is UP */
|
||||||
int l1link;
|
int l1link;
|
||||||
|
|
||||||
|
/*! \brief TRUE if restart has been sent to the other side after stack startup */
|
||||||
int restart_sent;
|
int restart_sent;
|
||||||
|
|
||||||
|
/*! \brief mISDN device handle returned by mISDN_open() */
|
||||||
int midev;
|
int midev;
|
||||||
|
|
||||||
int nt;
|
|
||||||
|
|
||||||
int pri;
|
|
||||||
|
|
||||||
|
|
||||||
|
/*! \brief TRUE if NT side of protocol (TE otherwise) */
|
||||||
|
int nt;
|
||||||
|
|
||||||
|
/*! \brief TRUE if ISDN-PRI (ISDN-BRI otherwise) */
|
||||||
|
int pri;
|
||||||
|
|
||||||
|
/*! \brief CR Process ID allocation table. TRUE if ID allocated */
|
||||||
int procids[0x100+1];
|
int procids[0x100+1];
|
||||||
|
|
||||||
|
/*! \brief Queue of Event messages to send to mISDN */
|
||||||
msg_queue_t downqueue;
|
msg_queue_t downqueue;
|
||||||
msg_queue_t upqueue;
|
msg_queue_t upqueue; /* No code puts anything on this queue */
|
||||||
int busy;
|
int busy; /* Not used */
|
||||||
|
|
||||||
|
/*! \brief Logical Layer 1 port associated with this stack */
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
|
/*! \brief B Channel record pool array */
|
||||||
struct misdn_bchannel bc[MAX_BCHANS + 1];
|
struct misdn_bchannel bc[MAX_BCHANS + 1];
|
||||||
|
|
||||||
struct misdn_bchannel* bc_list;
|
struct misdn_bchannel* bc_list; /* Not used */
|
||||||
|
|
||||||
|
/*! \brief Array of B channels in use (a[0] = B1). TRUE if B channel in use */
|
||||||
int channels[MAX_BCHANS + 1];
|
int channels[MAX_BCHANS + 1];
|
||||||
|
|
||||||
|
/*! \brief List of holded channels */
|
||||||
struct misdn_bchannel *holding; /* Queue which holds holded channels :) */
|
struct misdn_bchannel *holding;
|
||||||
|
|
||||||
|
/*! \brief Next stack in the list of stacks */
|
||||||
struct misdn_stack *next;
|
struct misdn_stack *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc);
|
struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc);
|
||||||
|
|||||||
@@ -202,19 +202,19 @@ static const struct misdn_cfg_spec port_spec[] = {
|
|||||||
{ "presentation", MISDN_CFG_PRES, MISDN_CTYPE_INT, "-1", NONE,
|
{ "presentation", MISDN_CFG_PRES, MISDN_CTYPE_INT, "-1", NONE,
|
||||||
"These (presentation and screen) are the exact isdn screening and presentation\n"
|
"These (presentation and screen) are the exact isdn screening and presentation\n"
|
||||||
"\tindicators.\n"
|
"\tindicators.\n"
|
||||||
"\tIf -1 is given for both values, the presentation indicators are used from\n"
|
"\tIf -1 is given for either value, the presentation indicators are used from\n"
|
||||||
"\tAsterisks SetCallerPres application.\n"
|
"\tAsterisk's SetCallerPres application.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\tscreen=0, presentation=0 -> callerid presented not screened\n"
|
"\tscreen=0, presentation=0 -> callerid presented\n"
|
||||||
"\tscreen=1, presentation=1 -> callerid presented but screened (the remote end doesn't see it!)" },
|
"\tscreen=1, presentation=1 -> callerid restricted (the remote end doesn't see it!)" },
|
||||||
{ "screen", MISDN_CFG_SCREEN, MISDN_CTYPE_INT, "-1", NONE,
|
{ "screen", MISDN_CFG_SCREEN, MISDN_CTYPE_INT, "-1", NONE,
|
||||||
"These (presentation and screen) are the exact isdn screening and presentation\n"
|
"These (presentation and screen) are the exact isdn screening and presentation\n"
|
||||||
"\tindicators.\n"
|
"\tindicators.\n"
|
||||||
"\tIf -1 is given for both values, the presentation indicators are used from\n"
|
"\tIf -1 is given for either value, the presentation indicators are used from\n"
|
||||||
"\tAsterisks SetCallerPres application.\n"
|
"\tAsterisk's SetCallerPres application.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\tscreen=0, presentation=0 -> callerid presented not screened\n"
|
"\tscreen=0, presentation=0 -> callerid presented\n"
|
||||||
"\tscreen=1, presentation=1 -> callerid presented but screened (the remote end doesn't see it!)" },
|
"\tscreen=1, presentation=1 -> callerid restricted (the remote end doesn't see it!)" },
|
||||||
{ "always_immediate", MISDN_CFG_ALWAYS_IMMEDIATE, MISDN_CTYPE_BOOL, "no", NONE,
|
{ "always_immediate", MISDN_CFG_ALWAYS_IMMEDIATE, MISDN_CTYPE_BOOL, "no", NONE,
|
||||||
"Enable this to get into the s dialplan-extension.\n"
|
"Enable this to get into the s dialplan-extension.\n"
|
||||||
"\tThere you can use DigitTimeout if you can't or don't want to use\n"
|
"\tThere you can use DigitTimeout if you can't or don't want to use\n"
|
||||||
|
|||||||
@@ -372,10 +372,10 @@ nodialtone=no
|
|||||||
|
|
||||||
;
|
;
|
||||||
; these are the exact isdn screening and presentation indicators
|
; these are the exact isdn screening and presentation indicators
|
||||||
; if -1 is given for both values the presentation indicators are used
|
; if -1 is given for either value the presentation indicators are used
|
||||||
; from asterisks SetCallerPres application.
|
; from asterisks SetCallerPres application.
|
||||||
; s=0, p=0 -> callerid presented not screened
|
; s=0, p=0 -> callerid presented
|
||||||
; s=1, p=1 -> callerid presented but screened (the remote end does not see it!)
|
; s=1, p=1 -> callerid restricted (the remote end does not see it!)
|
||||||
;
|
;
|
||||||
; default values s=-1, p=-1
|
; default values s=-1, p=-1
|
||||||
presentation=-1
|
presentation=-1
|
||||||
|
|||||||
@@ -1,28 +1,27 @@
|
|||||||
\subsection{Introduction}
|
\subsection{Introduction}
|
||||||
|
|
||||||
This package contains the mISDN Channel Driver for the Asterisk PBX. It
|
This package contains the mISDN Channel Driver for the Asterisk PBX. It
|
||||||
supports every mISDN Hardware and provides an interface for asterisk.
|
supports every mISDN Hardware and provides an interface for Asterisk.
|
||||||
|
|
||||||
\subsection{Features}
|
\subsection{Features}
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item NT and TE mode
|
\item NT and TE mode
|
||||||
\item PP and PMP mode
|
\item PP and PMP mode
|
||||||
\item BRI and PRI (with BNE1 and BN2E1 Cards)
|
\item BRI and PRI (with BNE1 and BN2E1 Cards)
|
||||||
\item Hardware Bridging
|
\item Hardware bridging
|
||||||
\item DTMF Detection in HW+mISDNdsp
|
\item DTMF detection in HW+mISDNdsp
|
||||||
\item Display Messages on Phones (on those that support display msg)
|
\item Display messages on phones (on those that support it)
|
||||||
\item app\_SendText
|
\item app\_SendText
|
||||||
\item HOLD/RETRIEVE/TRANSFER on ISDN Phones : )
|
\item HOLD/RETRIEVE/TRANSFER on ISDN phones : )
|
||||||
\item Screen/ Not Screen User Number
|
\item Allow/restrict user number presentation
|
||||||
\item EchoCancellation
|
\item Volume control
|
||||||
\item Volume Control
|
\item Crypting with mISDNdsp (Blowfish)
|
||||||
\item Crypting with mISDNdsp (Blowfish)
|
\item Data (HDLC) callthrough
|
||||||
\item Data (HDLC) callthrough
|
\item Data calling (with app\_ptyfork +pppd)
|
||||||
\item Data Calling (with app\_ptyfork +pppd)
|
\item Echo cancellation
|
||||||
\item Echo cancellation
|
\item Call deflection
|
||||||
\item CallDeflection
|
\item Some others
|
||||||
\item Some other
|
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
\subsection{Fast Installation Guide}
|
\subsection{Fast Installation Guide}
|
||||||
@@ -31,7 +30,7 @@ It is easy to install mISDN and mISDNuser. This can be done by:
|
|||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item You can download latest stable releases from \url{http://www.misdn.org/downloads/}
|
\item You can download latest stable releases from \url{http://www.misdn.org/downloads/}
|
||||||
|
|
||||||
\item Just fetch the newest head of the GIT (mISDN provect moved from CVS)
|
\item Just fetch the newest head of the GIT (mISDN project moved from CVS)
|
||||||
In details this process described here: \url{http://www.misdn.org/index.php/GIT}
|
In details this process described here: \url{http://www.misdn.org/index.php/GIT}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ cd mISDNuser ;
|
|||||||
make && make install
|
make && make install
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
\end{astlisting}
|
\end{astlisting}
|
||||||
Now you can compile chan\_misdn, just by making asterisk:
|
Now you can compile chan\_misdn, just by making Asterisk:
|
||||||
\begin{astlisting}
|
\begin{astlisting}
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
cd asterisk ;
|
cd asterisk ;
|
||||||
@@ -66,8 +65,7 @@ Modules. Also install process described in \url{http://www.misdn.org/index.php/I
|
|||||||
|
|
||||||
To compile and install this driver, you'll need at least one mISDN Driver and
|
To compile and install this driver, you'll need at least one mISDN Driver and
|
||||||
the mISDNuser package. Chan\_misdn works with both, the current release version
|
the mISDNuser package. Chan\_misdn works with both, the current release version
|
||||||
and the development (svn trunk) version of Asterisk. mISDNuser and mISDN must
|
and the development (svn trunk) version of Asterisk.
|
||||||
be fetched from cvs.isdn4linux.de.
|
|
||||||
|
|
||||||
You should use Kernels $>$= 2.6.9
|
You should use Kernels $>$= 2.6.9
|
||||||
|
|
||||||
@@ -84,7 +82,7 @@ script is:
|
|||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
\end{astlisting}
|
\end{astlisting}
|
||||||
Now you will want to configure the misdn.conf file which resides in the
|
Now you will want to configure the misdn.conf file which resides in the
|
||||||
asterisk config directory (normally /etc/asterisk).
|
Asterisk config directory (normally /etc/asterisk).
|
||||||
|
|
||||||
\subsubsection{misdn.conf: [general]}
|
\subsubsection{misdn.conf: [general]}
|
||||||
The misdn.conf file contains a "general" subsection, and user subsections which
|
The misdn.conf file contains a "general" subsection, and user subsections which
|
||||||
@@ -93,13 +91,13 @@ contain misdn port settings and different Asterisk contexts.
|
|||||||
In the general subsection you can set options that are not directly port
|
In the general subsection you can set options that are not directly port
|
||||||
related. There is for example the very important debug variable which you can
|
related. There is for example the very important debug variable which you can
|
||||||
set from the Asterisk cli (command line interface) or in this configuration
|
set from the Asterisk cli (command line interface) or in this configuration
|
||||||
file, bigger numbers will lead to more debug output. There's also a tracefile
|
file, bigger numbers will lead to more debug output. There's also a trace file
|
||||||
option, which takes a path+filename where debug output is written to.
|
option, which takes a path+filename where debug output is written to.
|
||||||
|
|
||||||
\subsubsection{misdn.conf: [default] subsection}
|
\subsubsection{misdn.conf: [default] subsection}
|
||||||
|
|
||||||
The default subsection is another special subsection which can contain all the
|
The default subsection is another special subsection which can contain all the
|
||||||
options available in the user/port subsections. the user/port subsection inherit
|
options available in the user/port subsections. The user/port subsections inherit
|
||||||
their parameters from the default subsection.
|
their parameters from the default subsection.
|
||||||
|
|
||||||
\subsubsection{misdn.conf: user/port subsections}
|
\subsubsection{misdn.conf: user/port subsections}
|
||||||
@@ -108,13 +106,13 @@ The user subsections have names which are unequal to "general". Those subsection
|
|||||||
contain the ports variable which mean the mISDN Ports. Here you can add
|
contain the ports variable which mean the mISDN Ports. Here you can add
|
||||||
multiple ports, comma separated.
|
multiple ports, comma separated.
|
||||||
|
|
||||||
Espacially for TE-Mode Ports there is a msns option. This option tells the
|
Especially for TE-Mode Ports there is a msns option. This option tells the
|
||||||
chan\_misdn driver to listen for incoming calls with the given msns, you can
|
chan\_misdn driver to listen for incoming calls with the given msns, you can
|
||||||
insert a '*' as single msn, which leads in getting every incoming call (if you
|
insert a '*' as single msn, which leads to getting every incoming call. If you
|
||||||
want to share on PMP TE S0 with a asterisk and a phone or isdn card you should
|
want to share on PMP TE S0 with Asterisk and a phone or ISDN card you should
|
||||||
insert here the msns which you'll like to give the Asterisk). Finally a
|
insert here the msns which you assign to Asterisk. Finally a context variable
|
||||||
context variable resides in the user subsections, which tells chan\_misdn where to
|
resides in the user subsections, which tells chan\_misdn where to send incoming
|
||||||
send incoming calls to in the Asterisk dial plan (extension.conf).
|
calls to in the Asterisk dial plan (extension.conf).
|
||||||
|
|
||||||
|
|
||||||
\subsubsection{Dial and Options String}
|
\subsubsection{Dial and Options String}
|
||||||
@@ -127,20 +125,32 @@ so the generic dial string looks like:
|
|||||||
mISDN/<port>[:bchannel]|g:<group>/<extension>[/<OPTIONSSTRING>]
|
mISDN/<port>[:bchannel]|g:<group>/<extension>[/<OPTIONSSTRING>]
|
||||||
|
|
||||||
The Optionsstring looks Like:
|
The Optionsstring looks Like:
|
||||||
:<optchar1><OptParam1>:<optchar2><OptParam2>
|
:<optchar><optarg>:<optchar><optarg>...
|
||||||
|
|
||||||
the ":" character is the delimiter.
|
the ":" character is the delimiter.
|
||||||
|
|
||||||
The available Optchars are:
|
The available options are:
|
||||||
d - Send display text on called phone, text is the optparam
|
a - Have Asterisk detect DTMF tones on called channel
|
||||||
n - don't detect dtmf tones on called channel
|
c - Make crypted outgoing call, optarg is keyindex
|
||||||
h - make digital outgoing call
|
d - Send display text to called phone, text is the optarg
|
||||||
c - make crypted outgoing call, param is keyindex
|
e - Perform echo cancelation on this channel,
|
||||||
e - perform echo cancellation on this channel,
|
takes taps as optarg (32,64,128,256)
|
||||||
takes taps as arguments (32,64,128,256)
|
e! - Disable echo cancelation on this channel
|
||||||
s - send Non Inband DTMF as inband
|
f - Enable fax detection
|
||||||
vr - rxgain control
|
h - Make digital outgoing call
|
||||||
vt - txgain control
|
h1 - Make HDLC mode digital outgoing call
|
||||||
|
i - Ignore detected DTMF tones, don't signal them to Asterisk,
|
||||||
|
they will be transported inband.
|
||||||
|
jb - Set jitter buffer length, optarg is length
|
||||||
|
jt - Set jitter buffer upper threshold, optarg is threshold
|
||||||
|
jn - Disable jitter buffer
|
||||||
|
n - Disable mISDN DSP on channel.
|
||||||
|
Disables: echo cancel, DTMF detection, and volume control.
|
||||||
|
p - Caller ID presentation,
|
||||||
|
optarg is either 'allowed' or 'restricted'
|
||||||
|
s - Send Non-inband DTMF as inband
|
||||||
|
vr - Rx gain control, optarg is gain
|
||||||
|
vt - Tx gain control, optarg is gain
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
\end{astlisting}
|
\end{astlisting}
|
||||||
|
|
||||||
@@ -161,7 +171,7 @@ Phone1 --> * Box 1 --> PSTN_TE
|
|||||||
PSTN_TE --> * Box 2 --> Phone2
|
PSTN_TE --> * Box 2 --> Phone2
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
The Encryption must be done on the PSTN sides, so the dialplan on the boxes
|
The encryption must be done on the PSTN sides, so the dialplan on the boxes
|
||||||
are:
|
are:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
@@ -210,7 +220,7 @@ Now you should see the misdn cli commands:
|
|||||||
|
|
||||||
You can only use "misdn send display" when an Asterisk channel is created and
|
You can only use "misdn send display" when an Asterisk channel is created and
|
||||||
isdn is in the correct state. "correct state" means that you have established a
|
isdn is in the correct state. "correct state" means that you have established a
|
||||||
call to another phone (mustn't be isdn though).
|
call to another phone (must not be isdn though).
|
||||||
|
|
||||||
Then you use it like this:
|
Then you use it like this:
|
||||||
|
|
||||||
@@ -232,8 +242,8 @@ mISDN Exports/Imports a few Variables:
|
|||||||
\subsection{Debugging and sending bug reports}
|
\subsection{Debugging and sending bug reports}
|
||||||
|
|
||||||
If you encounter problems, you should set up the debugging flag, usually
|
If you encounter problems, you should set up the debugging flag, usually
|
||||||
debug=2 should be enough. the messages are divided in asterisk and misdn
|
debug=2 should be enough. The messages are divided into Asterisk and mISDN
|
||||||
parts. Misdn Debug messages begin with an 'I', asterisk messages begin with
|
parts. mISDN Debug messages begin with an 'I', Asterisk messages begin with
|
||||||
an '*', the rest is clear I think.
|
an '*', the rest is clear I think.
|
||||||
|
|
||||||
Please take a trace of the problem and open a report in the Asterisk issue
|
Please take a trace of the problem and open a report in the Asterisk issue
|
||||||
@@ -266,7 +276,7 @@ as Display Message to the Phone.
|
|||||||
|
|
||||||
\subsection{Known Problems}
|
\subsection{Known Problems}
|
||||||
|
|
||||||
Q: I cannot hear any tone after a successful CONNECT to the other end
|
Q: I cannot hear any tone after a successful CONNECT to the other end.
|
||||||
|
|
||||||
A: You forgot to load mISDNdsp, which is now needed by chan\_misdn for switching
|
A: You forgot to load mISDNdsp, which is now needed by chan\_misdn for switching
|
||||||
and dtmf tone detection
|
and DTMF tone detection.
|
||||||
|
|||||||
@@ -969,15 +969,15 @@ int ast_is_shrinkable_phonenumber(const char *exten)
|
|||||||
return ast_is_valid_string(exten, "0123456789*#+()-.");
|
return ast_is_valid_string(exten, "0123456789*#+()-.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief parse string for caller id information
|
/*!
|
||||||
\return always returns 0, as the code always returns something.
|
* \brief Destructively parse instr for caller id information
|
||||||
XXX note that 'name' is not parsed consistently e.g. we have
|
* \return always returns 0, as the code always returns something.
|
||||||
|
* \note XXX 'name' is not parsed consistently e.g. we have
|
||||||
input location name
|
* input location name
|
||||||
" foo bar " <123> 123 ' foo bar ' (with spaces around)
|
* " foo bar " <123> 123 ' foo bar ' (with spaces around)
|
||||||
" foo bar " NULL 'foo bar' (without spaces around)
|
* " foo bar " NULL 'foo bar' (without spaces around)
|
||||||
The parsing of leading and trailing space/quotes should be more consistent.
|
* The parsing of leading and trailing space/quotes should be more consistent.
|
||||||
*/
|
*/
|
||||||
int ast_callerid_parse(char *instr, char **name, char **location)
|
int ast_callerid_parse(char *instr, char **name, char **location)
|
||||||
{
|
{
|
||||||
char *ns, *ne, *ls, *le;
|
char *ns, *ne, *ls, *le;
|
||||||
|
|||||||
Reference in New Issue
Block a user