Allow use of resource PLCI instead of NULL PLCI, initial test
This commit is contained in:
parent
e9ef3dcb7f
commit
979d0b7c64
100
chan_capi.c
100
chan_capi.c
|
@ -532,7 +532,7 @@ static void capi_echo_canceller(struct capi_pvt *i, int function)
|
||||||
if ((i->isdnstate & CAPI_ISDN_STATE_DISCONNECT))
|
if ((i->isdnstate & CAPI_ISDN_STATE_DISCONNECT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (i->channeltype == CAPI_CHANNELTYPE_NULL) {
|
if (i->channeltype == CAPI_CHANNELTYPE_NULL && i->resource_plci_type != CAPI_RESOURCE_PLCI_DATA) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ static int capi_check_diva_tone_function_allowed(struct capi_pvt *i)
|
||||||
if ((i->isdnstate & CAPI_ISDN_STATE_DISCONNECT))
|
if ((i->isdnstate & CAPI_ISDN_STATE_DISCONNECT))
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
if (i->channeltype == CAPI_CHANNELTYPE_NULL) {
|
if (i->channeltype == CAPI_CHANNELTYPE_NULL && i->resource_plci_type != CAPI_RESOURCE_PLCI_DATA) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ static int capi_detect_dtmf(struct capi_pvt *i, int flag)
|
||||||
if ((i->isdnstate & CAPI_ISDN_STATE_DISCONNECT))
|
if ((i->isdnstate & CAPI_ISDN_STATE_DISCONNECT))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (i->channeltype == CAPI_CHANNELTYPE_NULL) {
|
if (i->channeltype == CAPI_CHANNELTYPE_NULL && i->resource_plci_type != CAPI_RESOURCE_PLCI_DATA) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5250,9 +5250,13 @@ static int pbx_capi_getplci(struct ast_channel *c, char *param)
|
||||||
*/
|
*/
|
||||||
static int pbx_capi_clamping(struct ast_channel *c, char *param)
|
static int pbx_capi_clamping(struct ast_channel *c, char *param)
|
||||||
{
|
{
|
||||||
struct capi_pvt *i = CC_CHANNEL_PVT(c);
|
struct capi_pvt *i;
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
|
|
||||||
|
i = pbx_check_resource_plci (c);
|
||||||
|
if (i == 0)
|
||||||
|
i = CC_CHANNEL_PVT(c);
|
||||||
|
|
||||||
if (param != 0) {
|
if (param != 0) {
|
||||||
duration = atoi(param);
|
duration = atoi(param);
|
||||||
if (duration != 0 && duration < 10)
|
if (duration != 0 && duration < 10)
|
||||||
|
@ -5824,53 +5828,55 @@ static struct capicommands_s {
|
||||||
char *cmdname;
|
char *cmdname;
|
||||||
pbx_capi_command_proc_t cmd;
|
pbx_capi_command_proc_t cmd;
|
||||||
int capionly;
|
int capionly;
|
||||||
|
int resourceplcisupported;
|
||||||
} capicommands[] = {
|
} capicommands[] = {
|
||||||
{ "getid", pbx_capi_get_id, 0 },
|
{ "getid", pbx_capi_get_id, 0, 0 },
|
||||||
{ "peerlink", pbx_capi_peer_link, 0 },
|
{ "peerlink", pbx_capi_peer_link, 0, 0 },
|
||||||
{ "progress", pbx_capi_signal_progress, 1 },
|
{ "progress", pbx_capi_signal_progress, 1, 0 },
|
||||||
{ "deflect", pbx_capi_call_deflect, 1 },
|
{ "deflect", pbx_capi_call_deflect, 1, 0 },
|
||||||
{ "receivefax", pbx_capi_receive_fax, 1 },
|
{ "receivefax", pbx_capi_receive_fax, 1, 0 },
|
||||||
{ "sendfax", pbx_capi_send_fax, 1 },
|
{ "sendfax", pbx_capi_send_fax, 1, 0 },
|
||||||
{ "echosquelch", pbx_capi_echosquelch, 1 },
|
{ "echosquelch", pbx_capi_echosquelch, 1, 0 },
|
||||||
{ "echocancel", pbx_capi_echocancel, 1 },
|
{ "echocancel", pbx_capi_echocancel, 1, 1 },
|
||||||
|
|
||||||
{ "noisesuppressor", pbx_capi_noisesuppressor, 1 },
|
{ "noisesuppressor", pbx_capi_noisesuppressor, 1, 1 },
|
||||||
{ "rxagc", pbx_capi_rxagc, 1 },
|
{ "rxagc", pbx_capi_rxagc, 1, 1 },
|
||||||
{ "txagc", pbx_capi_txagc, 1 },
|
{ "txagc", pbx_capi_txagc, 1, 1 },
|
||||||
{ "rxdgain", pbx_capi_rxdgain, 1 },
|
{ "rxdgain", pbx_capi_rxdgain, 1, 1 },
|
||||||
{ "incrxdgain", pbx_capi_incrxdgain, 1 },
|
{ "incrxdgain", pbx_capi_incrxdgain, 1, 1 },
|
||||||
{ "txdgain", pbx_capi_txdgain, 1 },
|
{ "txdgain", pbx_capi_txdgain, 1, 1 },
|
||||||
{ "inctxdgain", pbx_capi_inctxdgain, 1 },
|
{ "inctxdgain", pbx_capi_inctxdgain, 1, 1 },
|
||||||
{ "clamping", pbx_capi_clamping, 1 },
|
{ "clamping", pbx_capi_clamping, 1, 1 },
|
||||||
{ "mftonedetection", pbx_capi_mftonedetection, 1 },
|
{ "mftonedetection", pbx_capi_mftonedetection, 1, 1 },
|
||||||
{ "pulsedetection", pbx_capi_pulsedetection, 1 },
|
{ "pulsedetection", pbx_capi_pulsedetection, 1, 1 },
|
||||||
{ "sendtone", pbx_capi_sendtone, 1 },
|
{ "sendtone", pbx_capi_sendtone, 1, 1 },
|
||||||
{ "stoptone", pbx_capi_stoptone, 1 },
|
{ "stoptone", pbx_capi_stoptone, 1, 1 },
|
||||||
{ "starttonedetection", pbx_capi_starttonedetection, 1 },
|
{ "starttonedetection", pbx_capi_starttonedetection, 1, 1 },
|
||||||
{ "stoptonedetection", pbx_capi_stoptonedetection, 1 },
|
{ "stoptonedetection", pbx_capi_stoptonedetection, 1, 1 },
|
||||||
{ "pitchcontrol", pbx_capi_pitchcontrol, 1 },
|
{ "pitchcontrol", pbx_capi_pitchcontrol, 1, 1 },
|
||||||
{ "incpitchcontrol", pbx_capi_incpitchcontrol, 1 },
|
{ "incpitchcontrol", pbx_capi_incpitchcontrol, 1, 1 },
|
||||||
|
|
||||||
{ "vc", pbx_capi_voicecommand, 1 },
|
{ "vc", pbx_capi_voicecommand, 1, 1 },
|
||||||
{ "vctransparency", pbx_capi_voicecommand_transparency, 1 },
|
{ "vctransparency", pbx_capi_voicecommand_transparency, 1, 1 },
|
||||||
|
|
||||||
{ "getplci", pbx_capi_getplci, 1 },
|
{ "getplci", pbx_capi_getplci, 1, 0 },
|
||||||
|
|
||||||
{ "malicious", pbx_capi_malicious, 1 },
|
{ "malicious", pbx_capi_malicious, 1, 0 },
|
||||||
{ "hold", pbx_capi_hold, 1 },
|
{ "hold", pbx_capi_hold, 1, 0 },
|
||||||
{ "holdtype", pbx_capi_holdtype, 1 },
|
{ "holdtype", pbx_capi_holdtype, 1, 0 },
|
||||||
{ "retrieve", pbx_capi_retrieve, 0 },
|
{ "retrieve", pbx_capi_retrieve, 0, 0 },
|
||||||
{ "ect", pbx_capi_ect, 1 },
|
{ "ect", pbx_capi_ect, 1, 0 },
|
||||||
{ "3pty_begin", pbx_capi_3pty_begin, 1 },
|
{ "3pty_begin", pbx_capi_3pty_begin, 1, 0 },
|
||||||
{ "ccbs", pbx_capi_ccbs, 0 },
|
{ "ccbs", pbx_capi_ccbs, 0, 0 },
|
||||||
{ "ccbsstop", pbx_capi_ccbsstop, 0 },
|
{ "ccbsstop", pbx_capi_ccbsstop, 0, 0 },
|
||||||
{ "ccpartybusy", pbx_capi_ccpartybusy, 0 },
|
{ "ccpartybusy", pbx_capi_ccpartybusy, 0, 0 },
|
||||||
{ "chat", pbx_capi_chat, 0 },
|
{ "chat", pbx_capi_chat, 0, 0 },
|
||||||
{ "hangup", pbx_capi_realhangup, 0 },
|
{ "resource", pbx_capi_chat_associate_resource_plci, 0, 0 },
|
||||||
{ "qsig_ssct", pbx_capi_qsig_ssct, 1 },
|
{ "hangup", pbx_capi_realhangup, 0, 0 },
|
||||||
{ "qsig_ct", pbx_capi_qsig_ct, 1 },
|
{ "qsig_ssct", pbx_capi_qsig_ssct, 1, 0 },
|
||||||
{ "qsig_callmark",pbx_capi_qsig_callmark, 1 },
|
{ "qsig_ct", pbx_capi_qsig_ct, 1, 0 },
|
||||||
{ "qsig_getplci", pbx_capi_qsig_getplci, 1 },
|
{ "qsig_callmark",pbx_capi_qsig_callmark, 1, 0 },
|
||||||
|
{ "qsig_getplci", pbx_capi_qsig_getplci, 1, 0 },
|
||||||
{ NULL, NULL, 0 }
|
{ NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5937,7 +5943,7 @@ static int pbx_capicommand_exec(struct ast_channel *chan, void *data)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((capicmd->capionly) && (chan->tech != &capi_tech)) {
|
if ((capicmd->capionly != 0 && capicmd->resourceplcisupported == 0) && (chan->tech != &capi_tech)) {
|
||||||
#ifdef CC_AST_HAS_VERSION_1_4
|
#ifdef CC_AST_HAS_VERSION_1_4
|
||||||
ast_module_user_remove(u);
|
ast_module_user_remove(u);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -263,6 +263,10 @@ struct cc_capi_gains {
|
||||||
#define CAPI_CHANNELTYPE_D 1
|
#define CAPI_CHANNELTYPE_D 1
|
||||||
#define CAPI_CHANNELTYPE_NULL 2
|
#define CAPI_CHANNELTYPE_NULL 2
|
||||||
|
|
||||||
|
#define CAPI_RESOURCE_PLCI_NULL 0
|
||||||
|
#define CAPI_RESOURCE_PLCI_DATA 1
|
||||||
|
#define CAPI_RESOURCE_PLCI_LINE 2
|
||||||
|
|
||||||
/* the lower word is reserved for capi commands */
|
/* the lower word is reserved for capi commands */
|
||||||
#define CAPI_WAITEVENT_B3_UP 0x00010000
|
#define CAPI_WAITEVENT_B3_UP 0x00010000
|
||||||
#define CAPI_WAITEVENT_B3_DOWN 0x00020000
|
#define CAPI_WAITEVENT_B3_DOWN 0x00020000
|
||||||
|
@ -483,6 +487,9 @@ struct capi_pvt {
|
||||||
/* Q.SIG features */
|
/* Q.SIG features */
|
||||||
int qsigfeat;
|
int qsigfeat;
|
||||||
struct cc_qsig_data qsig_data;
|
struct cc_qsig_data qsig_data;
|
||||||
|
|
||||||
|
/* Resource PLCI data */
|
||||||
|
int resource_plci_type; /* NULL PLCI, DATA, LINE */
|
||||||
|
|
||||||
/*! Next channel in list */
|
/*! Next channel in list */
|
||||||
struct capi_pvt *next;
|
struct capi_pvt *next;
|
||||||
|
|
|
@ -424,7 +424,10 @@ int pbx_capi_chat(struct ast_channel *c, char *param)
|
||||||
i = CC_CHANNEL_PVT(c);
|
i = CC_CHANNEL_PVT(c);
|
||||||
} else {
|
} else {
|
||||||
/* virtual CAPI channel */
|
/* virtual CAPI channel */
|
||||||
i = capi_mknullif(c, contr);
|
i = pbx_check_resource_plci (c);
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
i = capi_mknullif(c, contr);
|
||||||
if (!i) {
|
if (!i) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -456,6 +459,48 @@ out:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct capi_pvt* pbx_check_resource_plci (struct ast_channel *c)
|
||||||
|
{
|
||||||
|
struct capi_pvt *i = NULL;
|
||||||
|
const char* id = pbx_builtin_getvar_helper(c, "RESOURCEPLCI");
|
||||||
|
|
||||||
|
if (id != 0) {
|
||||||
|
i = (struct capi_pvt*)strtoul(id, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
int pbx_capi_chat_associate_resource_plci(struct ast_channel *c, char *param)
|
||||||
|
{
|
||||||
|
struct capi_pvt *i = NULL;
|
||||||
|
char *controller;
|
||||||
|
char *p;
|
||||||
|
ast_group_t tmpcntr;
|
||||||
|
unsigned long long contr = 0;
|
||||||
|
|
||||||
|
controller = param;
|
||||||
|
|
||||||
|
if (controller) {
|
||||||
|
for (p = controller; p && *p; p++) {
|
||||||
|
if (*p == '|') *p = ',';
|
||||||
|
}
|
||||||
|
tmpcntr = ast_get_group(controller);
|
||||||
|
contr = (unsigned long long)(tmpcntr >> 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c->tech != &capi_tech) {
|
||||||
|
i = capi_mkresourceif(c, contr);
|
||||||
|
if (i != 0) {
|
||||||
|
char buffer[24];
|
||||||
|
snprintf(buffer, sizeof(buffer)-1, "%p", i);
|
||||||
|
pbx_builtin_setvar_helper(c, "RESOURCEPLCI", buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((i != 0) ? 0 : -1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* do command capi chatinfo
|
* do command capi chatinfo
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
* prototypes
|
* prototypes
|
||||||
*/
|
*/
|
||||||
extern int pbx_capi_chat(struct ast_channel *c, char *param);
|
extern int pbx_capi_chat(struct ast_channel *c, char *param);
|
||||||
|
extern int pbx_capi_chat_associate_resource_plci(struct ast_channel *c, char *param);
|
||||||
|
extern struct capi_pvt* pbx_check_resource_plci (struct ast_channel *c);
|
||||||
#ifdef CC_AST_HAS_VERSION_1_6
|
#ifdef CC_AST_HAS_VERSION_1_6
|
||||||
extern char *pbxcli_capi_chatinfo(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
|
extern char *pbxcli_capi_chatinfo(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -245,6 +245,7 @@ struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long con
|
||||||
snprintf(data_ifc->vname, sizeof(data_ifc->vname) - 1, "%s", data_ifc->name);
|
snprintf(data_ifc->vname, sizeof(data_ifc->vname) - 1, "%s", data_ifc->name);
|
||||||
|
|
||||||
data_ifc->channeltype = CAPI_CHANNELTYPE_NULL;
|
data_ifc->channeltype = CAPI_CHANNELTYPE_NULL;
|
||||||
|
data_ifc->resource_plci_type = CAPI_RESOURCE_PLCI_DATA;
|
||||||
|
|
||||||
data_ifc->used = c;
|
data_ifc->used = c;
|
||||||
data_ifc->peer = c;
|
data_ifc->peer = c;
|
||||||
|
|
Loading…
Reference in New Issue