issue #5739 (plus ast_copy_string() usage conversion)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
e88e390bb8
commit
3d599e6501
6 changed files with 210 additions and 85 deletions
|
@ -1,5 +1,7 @@
|
||||||
2005-11-15 Kevin P. Fleming <kpfleming@limerick.digium.com>
|
2005-11-15 Kevin P. Fleming <kpfleming@limerick.digium.com>
|
||||||
|
|
||||||
|
* channels/chan_misdn.c (and other files): various fixes (issue #5739)
|
||||||
|
|
||||||
* channels/chan_sip.c (handle_request_info): properly forward 'flash' events received via SIP INFO (issue #5751, different patch)
|
* channels/chan_sip.c (handle_request_info): properly forward 'flash' events received via SIP INFO (issue #5751, different patch)
|
||||||
|
|
||||||
* apps/app_disa.c (disa_exec): don't duplicate constant strings when not needed
|
* apps/app_disa.c (disa_exec): don't duplicate constant strings when not needed
|
||||||
|
|
|
@ -152,6 +152,7 @@ static inline void free_robin_list_r (struct robin_list *r)
|
||||||
static void free_robin_list ( void )
|
static void free_robin_list ( void )
|
||||||
{
|
{
|
||||||
free_robin_list_r(robin);
|
free_robin_list_r(robin);
|
||||||
|
robin = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct robin_list* get_robin_position (char *group)
|
struct robin_list* get_robin_position (char *group)
|
||||||
|
@ -1040,19 +1041,27 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
|
||||||
int r;
|
int r;
|
||||||
struct chan_list *ch=MISDN_ASTERISK_TECH_PVT(ast);
|
struct chan_list *ch=MISDN_ASTERISK_TECH_PVT(ast);
|
||||||
struct misdn_bchannel *newbc;
|
struct misdn_bchannel *newbc;
|
||||||
char *opts=NULL;
|
char *opts=NULL, *ext=NULL;
|
||||||
char dest_cp[256];
|
char dest_cp[256];
|
||||||
|
char *tokb;
|
||||||
|
|
||||||
{
|
{
|
||||||
strncpy(dest_cp,dest,sizeof(dest_cp)-1);
|
strncpy(dest_cp,dest,sizeof(dest_cp)-1);
|
||||||
dest_cp[sizeof(dest_cp)]=0;
|
dest_cp[sizeof(dest_cp)]=0;
|
||||||
opts=strchr(dest_cp,'/');
|
|
||||||
if ( opts && (opts=strchr(++opts,'/')) ) {
|
ext=strtok_r(dest_cp,"/",&tokb);
|
||||||
if (opts) {
|
|
||||||
opts++;
|
if (ext) {
|
||||||
if (!*opts) opts=NULL;
|
ext=strtok_r(NULL,"/",&tokb);
|
||||||
|
if (ext) {
|
||||||
|
opts=strtok_r(NULL,"/",&tokb);
|
||||||
|
} else {
|
||||||
|
chan_misdn_log(-1,0,"misdn_call: No Extension given!\n");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ast) {
|
if (!ast) {
|
||||||
|
@ -1086,6 +1095,9 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
|
||||||
|
|
||||||
port=newbc->port;
|
port=newbc->port;
|
||||||
|
|
||||||
|
ast_copy_string(newbc->dad, ext, sizeof(newbc->dad));
|
||||||
|
ast_copy_string(ast->exten, ext, sizeof(ast->exten));
|
||||||
|
|
||||||
|
|
||||||
chan_misdn_log(1, 0, "* CALL: %s\n",dest);
|
chan_misdn_log(1, 0, "* CALL: %s\n",dest);
|
||||||
|
|
||||||
|
@ -1148,17 +1160,40 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
|
||||||
int def_callingpres;
|
int def_callingpres;
|
||||||
misdn_cfg_get( port, MISDN_CFG_USE_CALLINGPRES, &def_callingpres, sizeof(int));
|
misdn_cfg_get( port, MISDN_CFG_USE_CALLINGPRES, &def_callingpres, sizeof(int));
|
||||||
if ( def_callingpres) {
|
if ( def_callingpres) {
|
||||||
switch (ast->cid.cid_pres){
|
switch (ast->cid.cid_pres & 0x60){
|
||||||
case AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED:
|
|
||||||
|
case AST_PRES_RESTRICTED:
|
||||||
newbc->pres=1;
|
newbc->pres=1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN:
|
case AST_PRES_UNAVAILABLE:
|
||||||
newbc->pres=0;
|
newbc->pres=2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
newbc->pres=0;
|
newbc->pres=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (ast->cid.cid_pres & 0x3){
|
||||||
|
|
||||||
|
case AST_PRES_USER_NUMBER_UNSCREENED:
|
||||||
|
newbc->screen=0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AST_PRES_USER_NUMBER_PASSED_SCREEN:
|
||||||
|
newbc->screen=1;
|
||||||
|
break;
|
||||||
|
case AST_PRES_USER_NUMBER_FAILED_SCREEN:
|
||||||
|
newbc->screen=2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AST_PRES_NETWORK_NUMBER:
|
||||||
|
newbc->screen=3;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
newbc->screen=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1290,11 +1325,18 @@ int misdn_answer(struct ast_channel *ast)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
char *async=pbx_builtin_getvar_helper(ast, "MISDN_DIGITAL_TRANS");
|
||||||
|
if (async) {
|
||||||
|
chan_misdn_log(1, p->bc->port, " --> Connection is transparent digital\n");
|
||||||
|
p->bc->async=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p->state = MISDN_CONNECTED;
|
p->state = MISDN_CONNECTED;
|
||||||
misdn_lib_send_event( p->bc, EVENT_CONNECT);
|
misdn_lib_send_event( p->bc, EVENT_CONNECT);
|
||||||
start_bc_tones(p);
|
start_bc_tones(p);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1506,6 +1548,13 @@ int misdn_hangup(struct ast_channel *ast)
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bc=p->bc;
|
||||||
|
|
||||||
|
if (!bc) {
|
||||||
|
release_unlock;
|
||||||
|
ast_log(LOG_WARNING,"Hangup with private but no bc ?\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MISDN_ASTERISK_TECH_PVT(ast)=NULL;
|
MISDN_ASTERISK_TECH_PVT(ast)=NULL;
|
||||||
|
@ -1529,12 +1578,9 @@ int misdn_hangup(struct ast_channel *ast)
|
||||||
release_unlock;
|
release_unlock;
|
||||||
|
|
||||||
|
|
||||||
bc=p->bc;
|
|
||||||
|
|
||||||
if (!bc) {
|
|
||||||
ast_log(LOG_WARNING,"Hangup with private but no bc ?\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
char *varcause=NULL;
|
char *varcause=NULL;
|
||||||
|
@ -1645,7 +1691,6 @@ struct ast_frame *misdn_read(struct ast_channel *ast)
|
||||||
tmp->frame.data = tmp->ast_rd_buf ;
|
tmp->frame.data = tmp->ast_rd_buf ;
|
||||||
|
|
||||||
chan_misdn_trace_call(tmp->ast,3,"*->I: EVENT_READ len=%d\n",len);
|
chan_misdn_trace_call(tmp->ast,3,"*->I: EVENT_READ len=%d\n",len);
|
||||||
|
|
||||||
return &tmp->frame;
|
return &tmp->frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1692,7 +1737,6 @@ int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
chan_misdn_trace_call(ast,3,"*->I: EVENT_WRITE len=%d\n",frame->samples);
|
chan_misdn_trace_call(ast,3,"*->I: EVENT_WRITE len=%d\n",frame->samples);
|
||||||
|
|
||||||
i= manager_tx2misdn_frm(p->bc, frame->data, frame->samples);
|
i= manager_tx2misdn_frm(p->bc, frame->data, frame->samples);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1841,11 +1885,13 @@ static struct ast_channel *misdn_request(const char *type, int format, void *dat
|
||||||
|
|
||||||
ext=strtok_r(NULL,"/", &tokb);
|
ext=strtok_r(NULL,"/", &tokb);
|
||||||
|
|
||||||
|
/*
|
||||||
if (!ext) {
|
if (!ext) {
|
||||||
ast_log(LOG_WARNING, " --> ! IND : CALL dad:%s WITH WRONG ARGS, check extension.conf\n",ext);
|
ast_log(LOG_WARNING, " --> ! IND : CALL dad:%s WITH WRONG ARGS, check extension.conf\n",ext);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (port_str) {
|
if (port_str) {
|
||||||
if (port_str[0]=='g' && port_str[1]==':' ) {
|
if (port_str[0]=='g' && port_str[1]==':' ) {
|
||||||
|
@ -2017,7 +2063,7 @@ struct ast_channel *misdn_new(struct chan_list *chlist, int state, char * name,
|
||||||
{
|
{
|
||||||
struct ast_channel *tmp;
|
struct ast_channel *tmp;
|
||||||
|
|
||||||
tmp = ast_channel_alloc(0);
|
tmp = ast_channel_alloc(1);
|
||||||
|
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
chan_misdn_log(2, 0, " --> * NEW CHANNEL dad:%s oad:%s ctx:%s\n",exten,callerid, context);
|
chan_misdn_log(2, 0, " --> * NEW CHANNEL dad:%s oad:%s ctx:%s\n",exten,callerid, context);
|
||||||
|
@ -2053,8 +2099,14 @@ struct ast_channel *misdn_new(struct chan_list *chlist, int state, char * name,
|
||||||
tmp->priority=1;
|
tmp->priority=1;
|
||||||
|
|
||||||
|
|
||||||
strncpy(tmp->context, context, sizeof(tmp->context)-1);
|
if (context)
|
||||||
strncpy(tmp->exten, exten, sizeof(tmp->exten) - 1);
|
ast_copy_string(tmp->context, context, sizeof(tmp->context));
|
||||||
|
else
|
||||||
|
chan_misdn_log(1,0,"misdn_new: no context given.\n");
|
||||||
|
if (exten)
|
||||||
|
ast_copy_string(tmp->exten, exten, sizeof(tmp->exten));
|
||||||
|
else
|
||||||
|
chan_misdn_log(1,0,"misdn_new: no exten given.\n");
|
||||||
|
|
||||||
if (callerid) {
|
if (callerid) {
|
||||||
char *cid_name, *cid_num;
|
char *cid_name, *cid_num;
|
||||||
|
@ -2208,7 +2260,6 @@ int misdn_tx2ast_frm(struct chan_list * tmp, char * buf, int len )
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
#endif
|
#endif
|
||||||
chan_misdn_log(9, tmp->bc->port, "Queueing %d bytes 2 Asterisk\n",len);
|
chan_misdn_log(9, tmp->bc->port, "Queueing %d bytes 2 Asterisk\n",len);
|
||||||
|
|
||||||
ast_queue_frame(tmp->ast,&frame);
|
ast_queue_frame(tmp->ast,&frame);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -2812,24 +2863,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
/** queue new chan **/
|
/** queue new chan **/
|
||||||
cl_queue_chan(&cl_te, ch) ;
|
cl_queue_chan(&cl_te, ch) ;
|
||||||
|
|
||||||
/* Check for Pickup Request first */
|
|
||||||
if (!strcmp(chan->exten, ast_pickup_ext())) {
|
|
||||||
int ret;/** Sending SETUP_ACK**/
|
|
||||||
ret = misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
|
|
||||||
|
|
||||||
if (ast_pickup_call(chan)) {
|
|
||||||
ast_hangup(chan);
|
|
||||||
} else {
|
|
||||||
ch->state = MISDN_CALLING_ACKNOWLEDGE;
|
|
||||||
|
|
||||||
ch->ast=NULL;
|
|
||||||
|
|
||||||
ast_setstate(chan, AST_STATE_DOWN);
|
|
||||||
ast_hangup(chan);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
added support for s extension hope it will help those poor cretains
|
added support for s extension hope it will help those poor cretains
|
||||||
which haven't overlap dial.
|
which haven't overlap dial.
|
||||||
|
@ -2854,6 +2888,51 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
int ec, ectr;
|
||||||
|
|
||||||
|
misdn_cfg_get( bc->port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int));
|
||||||
|
|
||||||
|
misdn_cfg_get( bc->port, MISDN_CFG_ECHOTRAINING, &ectr, sizeof(int));
|
||||||
|
if (ec == 1 ) {
|
||||||
|
bc->ec_enable=1;
|
||||||
|
} else if ( ec > 1 ) {
|
||||||
|
bc->ec_enable=1;
|
||||||
|
bc->ec_deftaps=ec;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !ectr ) {
|
||||||
|
bc->ec_training=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (bc->urate>0) {
|
||||||
|
char buf[16];
|
||||||
|
snprintf(buf,16,"%d",bc->urate);
|
||||||
|
pbx_builtin_setvar_helper(chan,"MISDN_URATE",buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for Pickup Request first */
|
||||||
|
if (!strcmp(chan->exten, ast_pickup_ext())) {
|
||||||
|
int ret;/** Sending SETUP_ACK**/
|
||||||
|
ret = misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
|
||||||
|
|
||||||
|
if (ast_pickup_call(chan)) {
|
||||||
|
ast_hangup(chan);
|
||||||
|
} else {
|
||||||
|
ch->state = MISDN_CALLING_ACKNOWLEDGE;
|
||||||
|
|
||||||
|
ch->ast=NULL;
|
||||||
|
|
||||||
|
ast_setstate(chan, AST_STATE_DOWN);
|
||||||
|
ast_hangup(chan);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Now after we've finished configuring our channel object
|
/** Now after we've finished configuring our channel object
|
||||||
we'll jump into the dialplan **/
|
we'll jump into the dialplan **/
|
||||||
|
|
||||||
|
@ -2966,11 +3045,11 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
{
|
{
|
||||||
ch->state = MISDN_ALERTING;
|
ch->state = MISDN_ALERTING;
|
||||||
|
|
||||||
chan_misdn_trace_call(ch->ast,1,"I->*: EVENT_ALERTING\n");
|
|
||||||
|
|
||||||
ast_queue_control(ch->ast, AST_CONTROL_RINGING);
|
ast_queue_control(ch->ast, AST_CONTROL_RINGING);
|
||||||
ast_setstate(ch->ast, AST_STATE_RINGING);
|
ast_setstate(ch->ast, AST_STATE_RINGING);
|
||||||
|
|
||||||
|
cb_log(1,bc->port,"Set State Ringing\n");
|
||||||
|
|
||||||
if ( misdn_cap_is_speech(bc->capability) && misdn_inband_avail(bc)) {
|
if ( misdn_cap_is_speech(bc->capability) && misdn_inband_avail(bc)) {
|
||||||
start_bc_tones(ch);
|
start_bc_tones(ch);
|
||||||
}
|
}
|
||||||
|
@ -2998,6 +3077,20 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
|
|
||||||
struct chan_list *holded_ch=find_holded(cl_te, bc);
|
struct chan_list *holded_ch=find_holded(cl_te, bc);
|
||||||
|
|
||||||
|
|
||||||
|
send_cause2ast(ch->ast,bc);
|
||||||
|
|
||||||
|
if (misdn_inband_avail(bc) && ch->state != MISDN_CONNECTED) {
|
||||||
|
/* If there's inband information available (e.g. a
|
||||||
|
recorded message saying what was wrong with the
|
||||||
|
dialled number, or perhaps even giving an
|
||||||
|
alternative number, then play it instead of
|
||||||
|
immediately releasing the call */
|
||||||
|
start_bc_tones(ch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Check for holded channel, to implement transfer*/
|
||||||
if (holded_ch ) {
|
if (holded_ch ) {
|
||||||
if (ch->state == MISDN_CONNECTED ) {
|
if (ch->state == MISDN_CONNECTED ) {
|
||||||
misdn_transfer_bc(ch, holded_ch) ;
|
misdn_transfer_bc(ch, holded_ch) ;
|
||||||
|
@ -3006,12 +3099,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
send_cause2ast(ch->ast,bc);
|
|
||||||
|
|
||||||
if (!misdn_inband_avail(bc)) {
|
|
||||||
/* If Inband Avail. In TE, wait till we get hangup from ast. */
|
|
||||||
stop_bc_tones(ch);
|
stop_bc_tones(ch);
|
||||||
}
|
|
||||||
bc->out_cause=16;
|
bc->out_cause=16;
|
||||||
misdn_lib_send_event(bc,EVENT_RELEASE);
|
misdn_lib_send_event(bc,EVENT_RELEASE);
|
||||||
|
|
||||||
|
@ -3600,9 +3688,13 @@ static int misdn_set_opt_exec(struct ast_channel *chan, void *data)
|
||||||
chan_misdn_log(1, ch->bc->port, "SETOPT: Digital TRANS_DIGITAL\n");
|
chan_misdn_log(1, ch->bc->port, "SETOPT: Digital TRANS_DIGITAL\n");
|
||||||
ch->bc->async=1;
|
ch->bc->async=1;
|
||||||
ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
|
ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
|
||||||
|
/*ch->bc->state=STATE_CONNECTED;
|
||||||
|
misdn_lib_setup_bc(ch->bc);*/
|
||||||
} else {
|
} else {
|
||||||
ch->bc->async=0;
|
ch->bc->async=0;
|
||||||
ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
|
ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
|
||||||
|
/*ch->bc->state=STATE_CONNECTED;
|
||||||
|
misdn_lib_setup_bc(ch->bc);*/
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "chan_misdn_config.h"
|
#include "chan_misdn_config.h"
|
||||||
|
|
||||||
#include <asterisk/config.h>
|
#include <asterisk/config.h>
|
||||||
|
@ -34,9 +37,6 @@
|
||||||
#include <asterisk/logger.h>
|
#include <asterisk/logger.h>
|
||||||
#include <asterisk/lock.h>
|
#include <asterisk/lock.h>
|
||||||
#include <asterisk/strings.h>
|
#include <asterisk/strings.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <asterisk/utils.h>
|
#include <asterisk/utils.h>
|
||||||
#define AST_LOAD_CFG ast_config_load
|
#define AST_LOAD_CFG ast_config_load
|
||||||
|
|
|
@ -51,6 +51,7 @@ 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;
|
||||||
|
|
||||||
for ( ; stack; stack=stack->next) {
|
for ( ; stack; stack=stack->next) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -333,7 +334,8 @@ static int mypid=0;
|
||||||
int misdn_cap_is_speech(int cap)
|
int misdn_cap_is_speech(int cap)
|
||||||
/** Poor mans version **/
|
/** Poor mans version **/
|
||||||
{
|
{
|
||||||
if (cap != INFO_CAPABILITY_DIGITAL_UNRESTRICTED) return 1;
|
if ( (cap != INFO_CAPABILITY_DIGITAL_UNRESTRICTED) &&
|
||||||
|
(cap != INFO_CAPABILITY_DIGITAL_RESTRICTED) ) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +344,7 @@ int misdn_inband_avail(struct misdn_bchannel *bc)
|
||||||
switch (bc->progress_indicator) {
|
switch (bc->progress_indicator) {
|
||||||
case INFO_PI_INBAND_AVAILABLE:
|
case INFO_PI_INBAND_AVAILABLE:
|
||||||
case INFO_PI_CALL_NOT_E2E_ISDN:
|
case INFO_PI_CALL_NOT_E2E_ISDN:
|
||||||
|
case INFO_PI_CALLED_NOT_ISDN:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -400,6 +403,8 @@ int empty_chan_in_stack(struct misdn_stack *stack, int channel)
|
||||||
|
|
||||||
void empty_bc(struct misdn_bchannel *bc)
|
void empty_bc(struct misdn_bchannel *bc)
|
||||||
{
|
{
|
||||||
|
bc->state=STATE_NOTHING;
|
||||||
|
|
||||||
bc->channel = 0;
|
bc->channel = 0;
|
||||||
bc->in_use = 0;
|
bc->in_use = 0;
|
||||||
|
|
||||||
|
@ -674,6 +679,11 @@ static int create_process (int midev, struct misdn_bchannel *bc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void misdn_lib_setup_bc(struct misdn_bchannel *bc)
|
||||||
|
{
|
||||||
|
setup_bc(bc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int setup_bc(struct misdn_bchannel *bc)
|
int setup_bc(struct misdn_bchannel *bc)
|
||||||
{
|
{
|
||||||
|
@ -688,14 +698,17 @@ int setup_bc(struct misdn_bchannel *bc)
|
||||||
int channel=bc->channel-1-(bc->channel>16);
|
int channel=bc->channel-1-(bc->channel>16);
|
||||||
int b_stid=stack->b_stids[channel>=0?channel:0];
|
int b_stid=stack->b_stids[channel>=0?channel:0];
|
||||||
|
|
||||||
if (bc->upset) {
|
|
||||||
cb_log(5, stack->port, "$$$ bc already upsetted stid :%x\n", b_stid);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (bc->nodsp )
|
||||||
if (bc->nodsp) {
|
|
||||||
clean_up_bc(bc);
|
clean_up_bc(bc);
|
||||||
|
|
||||||
|
if ( !misdn_cap_is_speech(bc->capability))
|
||||||
|
clean_up_bc(bc);
|
||||||
|
|
||||||
|
|
||||||
|
if (bc->upset) {
|
||||||
|
cb_log(4, stack->port, "$$$ bc already upsetted stid :%x\n", b_stid);
|
||||||
|
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);
|
||||||
|
@ -756,11 +769,12 @@ int setup_bc(struct misdn_bchannel *bc)
|
||||||
|
|
||||||
|
|
||||||
if (bc->async == 1 || bc->nodsp) {
|
if (bc->async == 1 || bc->nodsp) {
|
||||||
cb_log(4, stack->port," --> TRANSPARENT Mode (no DSP)\n");
|
cb_log(4, stack->port," --> TRANSPARENT Mode (no DSP, no HDLC)\n");
|
||||||
pid.protocol[1] = ISDN_PID_L1_B_64TRANS;
|
pid.protocol[1] = ISDN_PID_L1_B_64TRANS;
|
||||||
pid.protocol[2] = ISDN_PID_L2_B_TRANS;
|
pid.protocol[2] = ISDN_PID_L2_B_TRANS;
|
||||||
pid.protocol[3] = ISDN_PID_L3_B_USER;
|
pid.protocol[3] = ISDN_PID_L3_B_USER;
|
||||||
pid.layermask = ISDN_LAYER((1)) | ISDN_LAYER((2)) | ISDN_LAYER((3));
|
pid.layermask = ISDN_LAYER((1)) | ISDN_LAYER((2)) | ISDN_LAYER((3));
|
||||||
|
|
||||||
} else if ( misdn_cap_is_speech(bc->capability)) {
|
} else if ( misdn_cap_is_speech(bc->capability)) {
|
||||||
cb_log(4, stack->port," --> TRANSPARENT Mode\n");
|
cb_log(4, stack->port," --> TRANSPARENT Mode\n");
|
||||||
pid.protocol[1] = ISDN_PID_L1_B_64TRANS;
|
pid.protocol[1] = ISDN_PID_L1_B_64TRANS;
|
||||||
|
@ -1201,7 +1215,12 @@ int handle_event ( struct misdn_bchannel *bc, enum event_e event, iframe_t *frm)
|
||||||
struct misdn_stack *stack=get_stack_by_bc(bc);
|
struct misdn_stack *stack=get_stack_by_bc(bc);
|
||||||
if (stack->mode == TE_MODE) {
|
if (stack->mode == TE_MODE) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
||||||
|
case EVENT_CONNECT_ACKNOWLEDGE:
|
||||||
|
manager_bchannel_activate(bc);
|
||||||
|
break;
|
||||||
case EVENT_CONNECT:
|
case EVENT_CONNECT:
|
||||||
|
|
||||||
if ( *bc->crypt_key ) {
|
if ( *bc->crypt_key ) {
|
||||||
cb_log(4, stack->port, "ENABLING BLOWFISH port:%d channel:%d oad%d:%s dad%d:%s\n", stack->port, bc->channel, bc->onumplan,bc->oad, bc->dnumplan,bc->dad);
|
cb_log(4, stack->port, "ENABLING BLOWFISH port:%d channel:%d oad%d:%s dad%d:%s\n", stack->port, bc->channel, bc->onumplan,bc->oad, bc->dnumplan,bc->dad);
|
||||||
|
|
||||||
|
@ -1327,6 +1346,11 @@ 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);
|
||||||
|
|
||||||
|
if (!stack) {
|
||||||
|
cb_log(1,0,"misdn_release: No Stack found\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (bc->channel>=0) {
|
if (bc->channel>=0) {
|
||||||
empty_chan_in_stack(stack,bc->channel);
|
empty_chan_in_stack(stack,bc->channel);
|
||||||
empty_bc(bc);
|
empty_bc(bc);
|
||||||
|
@ -1490,9 +1514,10 @@ handle_event_nt(void *dat, void *arg)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case CC_CONNECT|INDICATION:
|
||||||
case CC_ALERTING|INDICATION:
|
case CC_ALERTING|INDICATION:
|
||||||
case CC_PROCEEDING|INDICATION:
|
case CC_PROCEEDING|INDICATION:
|
||||||
case CC_CONNECT|INDICATION:
|
|
||||||
{
|
{
|
||||||
struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
|
struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
|
||||||
|
|
||||||
|
@ -1507,6 +1532,7 @@ handle_event_nt(void *dat, void *arg)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_bc(bc);
|
setup_bc(bc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1850,6 +1876,7 @@ int handle_bchan(msg_t *msg)
|
||||||
case DL_ESTABLISH | CONFIRM:
|
case DL_ESTABLISH | CONFIRM:
|
||||||
cb_log(4, stack->port, "BCHAN: bchan ACT Confirm\n");
|
cb_log(4, stack->port, "BCHAN: bchan ACT Confirm\n");
|
||||||
free_msg(msg);
|
free_msg(msg);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case PH_DEACTIVATE | INDICATION:
|
case PH_DEACTIVATE | INDICATION:
|
||||||
|
@ -1899,6 +1926,7 @@ int handle_bchan(msg_t *msg)
|
||||||
bc->bframe_len = frm->len;
|
bc->bframe_len = frm->len;
|
||||||
|
|
||||||
/** Anyway flip the bufbits **/
|
/** Anyway flip the bufbits **/
|
||||||
|
if ( misdn_cap_is_speech(bc->capability) )
|
||||||
flip_buf_bits(bc->bframe, bc->bframe_len);
|
flip_buf_bits(bc->bframe, bc->bframe_len);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2417,6 +2445,8 @@ void misdn_lib_log_ies(struct misdn_bchannel *bc)
|
||||||
|
|
||||||
cb_log(2, stack->port, " --> channel:%d caps:%s pi:%x keypad:%s\n", bc->channel, bearer2str(bc->capability),bc->progress_indicator, bc->keypad);
|
cb_log(2, stack->port, " --> channel:%d caps:%s pi:%x keypad:%s\n", bc->channel, bearer2str(bc->capability),bc->progress_indicator, bc->keypad);
|
||||||
|
|
||||||
|
cb_log(3, stack->port, " --> urate:%d rate:%d mode:%d user1:%d\n", bc->urate, bc->rate, bc->mode,bc->user1);
|
||||||
|
|
||||||
cb_log(3, stack->port, " --> pid:%d addr:%x l3id:%x\n", bc->pid, bc->addr, bc->l3_id);
|
cb_log(3, stack->port, " --> pid:%d addr:%x l3id:%x\n", bc->pid, bc->addr, bc->l3_id);
|
||||||
|
|
||||||
cb_log(4, stack->port, " --> bc:%x h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
|
cb_log(4, stack->port, " --> bc:%x h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
|
||||||
|
@ -3031,6 +3061,7 @@ int manager_tx2misdn_frm(struct misdn_bchannel *bc, void *data, int len)
|
||||||
struct misdn_stack *stack=get_stack_by_bc(bc);
|
struct misdn_stack *stack=get_stack_by_bc(bc);
|
||||||
if (!bc->active) return -1;
|
if (!bc->active) return -1;
|
||||||
|
|
||||||
|
if ( misdn_cap_is_speech(bc->capability) )
|
||||||
flip_buf_bits(data,len);
|
flip_buf_bits(data,len);
|
||||||
|
|
||||||
if ( !bc->nojitter && misdn_cap_is_speech(bc->capability) ) {
|
if ( !bc->nojitter && misdn_cap_is_speech(bc->capability) ) {
|
||||||
|
|
|
@ -235,8 +235,7 @@ struct misdn_bchannel {
|
||||||
int stack_holder;
|
int stack_holder;
|
||||||
|
|
||||||
int pres;
|
int pres;
|
||||||
|
int screen;
|
||||||
int nohdlc;
|
|
||||||
|
|
||||||
int capability;
|
int capability;
|
||||||
int law;
|
int law;
|
||||||
|
@ -350,6 +349,7 @@ void misdn_ibuf_memcpy_w(void *buf, char *from, int len);
|
||||||
|
|
||||||
/** Ibuf interface End **/
|
/** Ibuf interface End **/
|
||||||
|
|
||||||
|
void misdn_lib_setup_bc(struct misdn_bchannel *bc);
|
||||||
|
|
||||||
void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
|
void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
|
||||||
void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
|
void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
|
||||||
|
|
|
@ -267,7 +267,7 @@ msg_t *build_setup (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
|
||||||
enc_ie_channel_id(&setup->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
|
enc_ie_channel_id(&setup->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
|
||||||
|
|
||||||
{
|
{
|
||||||
int type=bc->onumplan,plan=1,present=bc->pres,screen=0;
|
int type=bc->onumplan,plan=1,present=bc->pres,screen=bc->screen;
|
||||||
enc_ie_calling_pn(&setup->CALLING_PN, msg, type, plan, present,
|
enc_ie_calling_pn(&setup->CALLING_PN, msg, type, plan, present,
|
||||||
screen, bc->oad, nt, bc);
|
screen, bc->oad, nt, bc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue