From: Super User Date: Sun, 3 Feb 2008 12:47:33 +0000 (+0100) Subject: now gives warning if mISDN branch is wrong. X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=commitdiff_plain;h=5ad4c41dc406a15beaa0a7b73d9dada1df74f939 now gives warning if mISDN branch is wrong. also some work on chan_lcr. modified: Makefile modified: apppbx.cpp modified: bchannel.c modified: chan_lcr.c modified: chan_lcr.h modified: dss1.cpp modified: dss1.h modified: extension.c modified: extension.h modified: genrc.c modified: ie.cpp renamed: admin_client.c -> lcradmin.c renamed: admin.h -> lcrsocket.h modified: mISDN.cpp modified: main.h renamed: admin_server.c -> socket_server.c renamed: admin_server.h -> socket_server.h modified: todo.txt --- diff --git a/Makefile b/Makefile index fd73542..c19a500 100644 --- a/Makefile +++ b/Makefile @@ -146,8 +146,8 @@ crypt.o: crypt.cpp *.h Makefile genext.o: genext.c *.h Makefile $(PP) -c $(CFLAGS) genext.c -o genext.o -admin_server.o: admin_server.c *.h Makefile - $(PP) -c $(CFLAGS) admin_server.c -o admin_server.o +socket_server.o: socket_server.c *.h Makefile + $(PP) -c $(CFLAGS) socket_server.c -o socket_server.o trace.o: trace.c *.h Makefile $(PP) -c $(CFLAGS) trace.c -o trace.o @@ -187,7 +187,7 @@ $(LCR): main.o \ join.o \ joinpbx.o \ joinremote.o \ - admin_server.o \ + socket_server.o \ trace.o $(PP) $(LIBDIR) \ main.o \ @@ -214,12 +214,12 @@ $(LCR): main.o \ join.o \ joinpbx.o \ joinremote.o \ - admin_server.o \ + socket_server.o \ trace.o \ $(LIBS) -o $(LCR) -$(LCRADMIN): admin_client.c cause.c *.h Makefile - $(PP) $(LIBDIR) $(CFLAGS) $(CURSES) -lm admin_client.c cause.c \ +$(LCRADMIN): lcradmin.c cause.c *.h Makefile + $(PP) $(LIBDIR) $(CFLAGS) $(CURSES) -lm lcradmin.c cause.c \ -o $(LCRADMIN) $(CHAN_LCR): chan_lcr.o bchannel.o diff --git a/apppbx.cpp b/apppbx.cpp index c2619e9..66aba31 100644 --- a/apppbx.cpp +++ b/apppbx.cpp @@ -1001,7 +1001,7 @@ void EndpointAppPBX::out_setup(void) goto check_anycall_intern; } /* directory.list */ - if (e_callerinfo.id[0] && (e_ext.centrex || e_ext.display_name)) + if (e_callerinfo.id[0] && e_ext.display_name) { dirname = parse_directory(e_callerinfo.id, e_callerinfo.ntype); if (dirname) @@ -1025,8 +1025,8 @@ void EndpointAppPBX::out_setup(void) SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name)); //printf("\n\ndisplay = %s\n\n\n",message->param.setup.callerinfo.display); /* use cnip, if enabld */ - if (!e_ext.centrex) - message->param.setup.callerinfo.name[0] = '\0'; + // if (!e_ext.centrex) + // message->param.setup.callerinfo.name[0] = '\0'; /* screen clip if prefix is required */ if (message->param.setup.callerinfo.id[0] && e_ext.clip_prefix[0]) { @@ -2986,8 +2986,8 @@ void EndpointAppPBX::join_connect(struct port_list *portlist, int message_type, SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype, message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name)); /* use conp, if enabld */ - if (!e_ext.centrex) - message->param.connectinfo.name[0] = '\0'; +// if (!e_ext.centrex) +// message->param.connectinfo.name[0] = '\0'; /* send connect */ message_put(message); diff --git a/bchannel.c b/bchannel.c index ea8e8e1..a66a62a 100644 --- a/bchannel.c +++ b/bchannel.c @@ -424,6 +424,8 @@ static void bchannel_activated(struct bchannel *channel) ph_control(handle, DTMF_TONE_START, 0, "DSP-DTMF", 1); if (channel->b_crypt_len) ph_control_block(handle, BF_ENABLE_KEY, channel->b_crypt_key, channel->b_crypt_len, "DSP-CRYPT", channel->b_crypt_len); + if (channel->b_conf) + ph_control(handle, CMX_CONF_JOIN, channel->b_conf, "DSP-CONF", channel->b_conf); channel->b_state = BSTATE_ACTIVE; } diff --git a/chan_lcr.c b/chan_lcr.c index 9216699..3f6c29d 100644 --- a/chan_lcr.c +++ b/chan_lcr.c @@ -42,7 +42,7 @@ with that reference. #include #include "extension.h" #include "message.h" -#include "admin.h" +#include "lcrsocket.h" #include "cause.h" #include "bchannel.h" #include "chan_lcr.h" @@ -112,6 +112,28 @@ void free_call(struct chan_call *call) } } +unsigned short new_brige_id(void) +{ + struct chan_call *call; + unsigned short id = 1; + + /* search for lowest bridge id that is not in use and not 0 */ + while(id) + { + call = call_first; + while(call) + { + if (call->bridge_id == id) + break; + call = call->next; + } + if (!call) + break; + id++; + } + return(id); +} + /* * receive bchannel data @@ -195,6 +217,8 @@ int receive_message(int message_type, unsigned long ref, union parameter *param) { bchannel->ref = ref; call->bchannel_handle = param->bchannel.handle; +#warning hier muesen alle stati gesetzt werden falls sie vor dem b-kanal verfügbar waren + bchannel_join(call->bridge_id); } if (bchannel_create(bchannel)) bchannel_activate(bchannel, 1); @@ -495,6 +519,146 @@ void lcr_thread(void) } } +/* call from asterisk (new instance) */ +static int lcr_call(struct ast_channel *ast, char *dest, int timeout) +{ + int port=0; + int r; + struct chan_list *ch=MISDN_ASTERISK_TECH_PVT(ast); + struct misdn_bchannel *newbc; + char *opts=NULL, *ext; + char dest_cp[256]; + + { + strncpy(dest_cp,dest,sizeof(dest_cp)-1); + dest_cp[sizeof(dest_cp)]=0; + + ext=dest_cp; + strsep(&ext,"/"); + if (ext) { + opts=ext; + strsep(&opts,"/"); + } else { + ast_log(LOG_WARNING, "Malformed dialstring\n"); + return -1; + } + } + + if (!ast) { + ast_log(LOG_WARNING, " --> ! misdn_call called on ast_channel *ast where ast == NULL\n"); + return -1; + } + + if (((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) || !dest ) { + ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name); + ast->hangupcause=41; + ast_setstate(ast, AST_STATE_DOWN); + return -1; + } + + if (!ch) { + ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name); + ast->hangupcause=41; + ast_setstate(ast, AST_STATE_DOWN); + return -1; + } + + newbc=ch->bc; + + if (!newbc) { + ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name); + ast->hangupcause=41; + ast_setstate(ast, AST_STATE_DOWN); + return -1; + } + + port=newbc->port; + + + chan_misdn_log(1, port, "* CALL: %s\n",dest); + + chan_misdn_log(2, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context); + + chan_misdn_log(3, port, " --> * adding2newbc ext %s\n",ast->exten); + if (ast->exten) { + int l = sizeof(newbc->dad); + strncpy(ast->exten,ext,sizeof(ast->exten)); + + strncpy(newbc->dad,ext,l); + + newbc->dad[l-1] = 0; + } + newbc->rad[0]=0; + chan_misdn_log(3, port, " --> * adding2newbc callerid %s\n",AST_CID_P(ast)); + if (ast_strlen_zero(newbc->oad) && AST_CID_P(ast) ) { + + if (AST_CID_P(ast)) { + int l = sizeof(newbc->oad); + strncpy(newbc->oad,AST_CID_P(ast), l); + newbc->oad[l-1] = 0; + } + } + + { + struct chan_list *ch=MISDN_ASTERISK_TECH_PVT(ast); + if (!ch) { ast_verbose("No chan_list in misdn_call\n"); return -1;} + + newbc->capability=ast->transfercapability; + pbx_builtin_setvar_helper(ast,"TRANSFERCAPABILITY",ast_transfercapability2str(newbc->capability)); + if ( ast->transfercapability == INFO_CAPABILITY_DIGITAL_UNRESTRICTED) { + chan_misdn_log(2, port, " --> * Call with flag Digital\n"); + } + + + /* update screening and presentation */ + update_config(ch,ORG_AST); + + /* fill in some ies from channel vary*/ + import_ch(ast, newbc, ch); + + /* Finally The Options Override Everything */ + if (opts) + misdn_set_opt_exec(ast,opts); + else + chan_misdn_log(2,port,"NO OPTS GIVEN\n"); + + /*check for bridging*/ + int bridging; + misdn_cfg_get( 0, MISDN_GEN_BRIDGING, &bridging, sizeof(int)); + if (bridging && ch->other_ch) { + chan_misdn_log(1, port, "Disabling EC (aka Pipeline) on both Sides\n"); + *ch->bc->pipeline=0; + *ch->other_ch->bc->pipeline=0; + } + + r=misdn_lib_send_event( newbc, EVENT_SETUP ); + + /** we should have l3id after sending setup **/ + ch->l3id=newbc->l3_id; + } + + if ( r == -ENOCHAN ) { + chan_misdn_log(0, port, " --> * Theres no Channel at the moment .. !\n"); + chan_misdn_log(1, port, " --> * SEND: State Down pid:%d\n",newbc?newbc->pid:-1); + ast->hangupcause=34; + ast_setstate(ast, AST_STATE_DOWN); + return -1; + } + + chan_misdn_log(2, port, " --> * SEND: State Dialing pid:%d\n",newbc?newbc->pid:1); + + ast_setstate(ast, AST_STATE_DIALING); + ast->hangupcause=16; + +wenn pattern available soll gestoppt werden, sonst nicht: + if (newbc->nt) stop_bc_tones(ch); + + ch->state=MISDN_CALLING; + + return 0; +} + + static struct ast_channel_tech misdn_tech = { .type="lcr", .description="Channel driver for connecting to Linux-Call-Router", @@ -542,12 +706,13 @@ int load_module(void) return -1; } - ast_cli_register(&cli_show_cls); - ast_cli_register(&cli_show_cl); - ast_cli_register(&cli_show_config); - - ast_cli_register(&cli_reload); + ast_cli_register(&cli_show_lcr); + ast_cli_register(&cli_show_calls); + ast_cli_register(&cli_reload_routing); + ast_cli_register(&cli_reload_interfaces); + ast_cli_register(&cli_port_block); + ast_cli_register(&cli_port_unblock); ast_register_application("misdn_set_opt", misdn_set_opt_exec, "misdn_set_opt", "misdn_set_opt(::..):\n" @@ -582,10 +747,12 @@ int unload_module(void) if (!g_config_initialized) return 0; - ast_cli_unregister(&cli_show_cls); - ast_cli_unregister(&cli_show_cl); - ast_cli_unregister(&cli_show_config); - ast_cli_unregister(&cli_reload); + ast_cli_unregister(&cli_show_lcr); + ast_cli_unregister(&cli_show_calls); + ast_cli_unregister(&cli_reload_routing); + ast_cli_unregister(&cli_reload_interfaces); + ast_cli_unregister(&cli_port_block); + ast_cli_unregister(&cli_port_unblock); ast_unregister_application("misdn_set_opt"); ast_channel_unregister(&lcr_tech); diff --git a/chan_lcr.h b/chan_lcr.h index 0f861fe..8633d3a 100644 --- a/chan_lcr.h +++ b/chan_lcr.h @@ -14,6 +14,8 @@ struct chan_call { struct chan_call *next; unsigned long ref; /* callref, is 0, if not yet set */ unsigned long bchannel_handle; /* reference to bchannel, if set */ + + unsigned short bridge_id; /* 0 = off, equal ids are bridged */ }; diff --git a/dss1.cpp b/dss1.cpp index 49af6ea..7021860 100644 --- a/dss1.cpp +++ b/dss1.cpp @@ -25,8 +25,6 @@ extern "C" { #include } -//#define CENTREX - #include "q931.h" #include "ie.cpp" @@ -501,11 +499,9 @@ void Pdss1::setup_ind(unsigned long prim, unsigned long dinfo, void *data) dec_ie_calling_pn(setup->CALLING_PN, (Q931_info_t *)((unsigned long)data+headerlen), &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id)); dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *)((unsigned long)data+headerlen), &called_type, &called_plan, (unsigned char *)p_dialinginfo.id, sizeof(p_dialinginfo.id)); dec_ie_keypad(setup->KEYPAD, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)keypad, sizeof(keypad)); -#ifdef CENTREX /* te-mode: CNIP (calling name identification presentation) */ if (!p_m_d_ntmode) dec_facility_centrex(setup->FACILITY, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)p_callerinfo.name, sizeof(p_callerinfo.name)); -#endif dec_ie_useruser(setup->USER_USER, (Q931_info_t *)((unsigned long)data+headerlen), &useruser_protocol, useruser, &useruser_len); dec_ie_complete(setup->COMPLETE, (Q931_info_t *)((unsigned long)data+headerlen), &p_dialinginfo.sending_complete); dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *)((unsigned long)data+headerlen), &redir_type, &redir_plan, &redir_present, &redir_screen, &redir_reason, (unsigned char *)p_redirinfo.id, sizeof(p_redirinfo.id)); @@ -1016,11 +1012,9 @@ void Pdss1::connect_ind(unsigned long prim, unsigned long dinfo, void *data) l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN); dec_ie_channel_id(connect->CHANNEL_ID, (Q931_info_t *)((unsigned long)data+headerlen), &exclusive, &channel); dec_ie_connected_pn(connect->CONNECT_PN, (Q931_info_t *)((unsigned long)data+headerlen), &type, &plan, &present, &screen, (unsigned char *)p_connectinfo.id, sizeof(p_connectinfo.id)); -#ifdef CENTREX /* te-mode: CONP (connected name identification presentation) */ if (!p_m_d_ntmode) dec_facility_centrex(connect->FACILITY, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)p_connectinfo.name, sizeof(p_connectinfo.name)); -#endif end_trace(); /* select channel */ @@ -2310,11 +2304,9 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet /* display */ if (p_callerinfo.display[0] && p_m_d_ntmode) enc_ie_display(&setup->DISPLAY, dmsg, (unsigned char *)p_callerinfo.display); -#ifdef CENTREX /* nt-mode: CNIP (calling name identification presentation) */ - if (p_callerinfo.name[0] && p_m_d_ntmode) - enc_facility_centrex(&setup->FACILITY, dmsg, (unsigned char *)p_callerinfo.name, 1); -#endif +// if (p_callerinfo.name[0] && p_m_d_ntmode) +// enc_facility_centrex(&setup->FACILITY, dmsg, (unsigned char *)p_callerinfo.name, 1); end_trace(); /* send setup message now */ @@ -2650,11 +2642,9 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param /* display */ if (p_connectinfo.display[0] && p_m_d_ntmode) enc_ie_display(&connect->DISPLAY, dmsg, (unsigned char *)p_connectinfo.display); -#ifdef CENTREX /* nt-mode: CONP (connected name identification presentation) */ - if (p_connectinfo.name[0] && p_m_d_ntmode) - enc_facility_centrex(&connect->FACILITY, dmsg, (unsigned char *)p_connectinfo.name, 0); -#endif +// if (p_connectinfo.name[0] && p_m_d_ntmode) +// enc_facility_centrex(&connect->FACILITY, dmsg, (unsigned char *)p_connectinfo.name, 0); /* date & time */ if (p_m_d_ntmode) { @@ -3271,7 +3261,7 @@ int stack2manager_te(struct mISDNport *mISDNport, msg_t *msg) if (frm->prim == (CC_RELEASE_CR | INDICATION)) { - PERROR("unhandled message from stack: call ref released (l3id=0x%x)\n", frm->dinfo); + PDEBUG(DEBUG_ISDN, "unhandled message from stack: call ref released (l3id=0x%x)\n", frm->dinfo); free_msg(msg); return(0); } diff --git a/dss1.h b/dss1.h index 488e56b..49121fa 100644 --- a/dss1.h +++ b/dss1.h @@ -94,7 +94,6 @@ class Pdss1 : public PmISDN void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, unsigned char *number, int number_len); void enc_ie_facility(unsigned char **ntmode, msg_t *msg, unsigned char *facility, int facility_len); void dec_ie_facility(unsigned char *p, Q931_info_t *qi, unsigned char *facility, int *facility_len); - void enc_facility_centrex(unsigned char **ntmode, msg_t *msg, unsigned char *cnip, int setup); void dec_facility_centrex(unsigned char *p, Q931_info_t *qi, unsigned char *cnip, int cnip_len); void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, unsigned char *user, int user_len); void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, unsigned char *user, int *user_len); diff --git a/extension.c b/extension.c index 391bb88..0309b33 100644 --- a/extension.c +++ b/extension.c @@ -396,24 +396,6 @@ int read_extension(struct extension *ext, char *num) PDEBUG(DEBUG_CONFIG, "unknown parameter given keypad: %s\n", param); } } else - if (!strcmp(option,"centrex")) - { - i=0; - while(ext_yesno[i]) - { - if (!strcasecmp(param,ext_yesno[i])) - break; - i++; - } - if (ext_yesno[i]) - { - ext->centrex = i; - PDEBUG(DEBUG_CONFIG, "use centrex to display name %s\n", ext_yesno[i]); - } else - { - PDEBUG(DEBUG_CONFIG, "unknown parameter given centrex: %s\n", param); - } - } else if (!strcmp(option,"rights")) { i=0; @@ -1094,11 +1076,6 @@ int write_extension(struct extension *ext, char *number) fprintf(fp,"# DTMF tone, but the digit is transmitted via D-channel diaing info.\n"); fprintf(fp,"keypad %s\n\n",(ext->keypad)?"yes":"no"); - fprintf(fp,"# Called Name Identification Presentation (CNIP/CONP)\n"); - fprintf(fp,"# If supported by telephone, special information element on the d-channel are\n"); - fprintf(fp,"# used to show name of caller. It is supported by newer Siemens telephones\n# (Centrex).\n"); - fprintf(fp,"centrex %s #this is currently not working!!!\n\n",(ext->centrex)?"yes":"no"); - fprintf(fp,"# Ignore restriction of COLP and CLIP\n"); fprintf(fp,"# In this case even restricted numbers are presented to this extension.\n"); fprintf(fp,"# This also works for incoming external anonymous calls IF:\n"); diff --git a/extension.h b/extension.h index 4672637..88bfc72 100644 --- a/extension.h +++ b/extension.h @@ -132,7 +132,6 @@ struct extension { int colp; /* how to present called line id on forwarded calls */ char clip_prefix[32]; /* prefix for screening incoming clip */ int keypad; /* support keypad for call control */ - int centrex; /* present name of caller/called on internal extension */ int anon_ignore; /* ignore anonymouse calls */ int rights; int delete_ext; /* delete function for external dialing */ diff --git a/genrc.c b/genrc.c index 7c5089f..e42abb2 100644 --- a/genrc.c +++ b/genrc.c @@ -171,14 +171,14 @@ int main(void) fprintf(fp, "# rc script for mISDN driver\n\n"); fprintf(fp, "case \"$1\" in\n"); fprintf(fp, "\tstart|--start)\n"); - fprintf(fp, "\t\t%s %smISDN_core%s debug=0x%x\n", input[0]?"insmod -f":"modprobe", input, input[0]?".ko":"", coredebug); + fprintf(fp, "\t\t%s %smISDN_core%s debug=0x%x\n", input[0]?"insmod -f":"modprobe --ignore-install", input, input[0]?".ko":"", coredebug); if (anyte) { - fprintf(fp, "\t\t%s %smISDN_l1%s debug=0x%x\n", input[0]?"insmod -f":"modprobe", input, input[0]?".ko":"", l1debug); - fprintf(fp, "\t\t%s %smISDN_l2%s debug=0x%x\n", input[0]?"insmod -f":"modprobe", input, input[0]?".ko":"", l2debug); - fprintf(fp, "\t\t%s %sl3udss1%s debug=0x%x\n", input[0]?"insmod -f":"modprobe", input, input[0]?".ko":"", l3debug); + fprintf(fp, "\t\t%s %smISDN_l1%s debug=0x%x\n", input[0]?"insmod -f":"modprobe --ignore-install", input, input[0]?".ko":"", l1debug); + fprintf(fp, "\t\t%s %smISDN_l2%s debug=0x%x\n", input[0]?"insmod -f":"modprobe --ignore-install", input, input[0]?".ko":"", l2debug); + fprintf(fp, "\t\t%s %sl3udss1%s debug=0x%x\n", input[0]?"insmod -f":"modprobe --ignore-install", input, input[0]?".ko":"", l3debug); } - fprintf(fp, "\t\t%s %smISDN_dsp%s debug=0x%x options=0x%x\n", input[0]?"insmod -f":"modprobe", input, input[0]?".ko":"", dspdebug, lawopt); + fprintf(fp, "\t\t%s %smISDN_dsp%s debug=0x%x options=0x%x\n", input[0]?"insmod -f":"modprobe --ignore-install", input, input[0]?".ko":"", dspdebug, lawopt); j = 0; while(cards[j].card) { @@ -202,9 +202,9 @@ int main(void) if (types[0]) { types[strlen(types)-1] = '\0'; - fprintf(fp, "\t\t%s %s%s%s type=%s protocol=%s layermask=%s debug=0x%x\n", input[0]?"insmod -f":"modprobe", input, cards[j].module, input[0]?".ko":"", types, protocol, layermask, carddebug); + fprintf(fp, "\t\t%s %s%s%s type=%s protocol=%s layermask=%s debug=0x%x\n", input[0]?"insmod -f":"modprobe --ignore-install", input, cards[j].module, input[0]?".ko":"", types, protocol, layermask, carddebug); } else - fprintf(fp, "\t\t%s %s%s%s protocol=%s layermask=%s debug=0x%x\n", input[0]?"insmod -f":"modprobe", input, cards[j].module, input[0]?".ko":"", protocol, layermask, carddebug); + fprintf(fp, "\t\t%s %s%s%s protocol=%s layermask=%s debug=0x%x\n", input[0]?"insmod -f":"modprobe --ignore-install", input, cards[j].module, input[0]?".ko":"", protocol, layermask, carddebug); } j++; } diff --git a/ie.cpp b/ie.cpp index f866349..5e3074a 100644 --- a/ie.cpp +++ b/ie.cpp @@ -1450,58 +1450,6 @@ void Pdss1::dec_ie_facility(unsigned char *p, Q931_info_t *qi, unsigned char *fa } -/* facility for siemens CENTEX (known parts implemented only) */ -void Pdss1::enc_facility_centrex(unsigned char **ntmode, msg_t *msg, unsigned char *cnip, int setup) -{ - unsigned char centrex[256]; - int i = 0; - - if (!cnip) - return; - - /* centrex facility */ - centrex[i++] = CENTREX_FAC; - centrex[i++] = CENTREX_ID; - - /* cnip */ - if (strlen((char *)cnip) > 15) - { - PDEBUG(DEBUG_PORT, "%s: CNIP/CONP text too long (max 13 chars), cutting.\n"); - cnip[15] = '\0'; - } - // dunno what the 8 bytes mean - if (setup) - { - centrex[i++] = 0x17; - centrex[i++] = 0x02; - centrex[i++] = 0x02; - centrex[i++] = 0x44; - centrex[i++] = 0x18; - centrex[i++] = 0x02; - centrex[i++] = 0x01; - centrex[i++] = 0x09; - } else - { - centrex[i++] = 0x18; - centrex[i++] = 0x02; - centrex[i++] = 0x02; - centrex[i++] = 0x81; - centrex[i++] = 0x09; - centrex[i++] = 0x02; - centrex[i++] = 0x01; - centrex[i++] = 0x0a; - } - - centrex[i++] = 0x80; - centrex[i++] = strlen((char *)cnip); - UCPY((char *)(¢rex[i]), (char *)cnip); - i += strlen((char *)cnip); - add_trace("facility", "cnip", "%s", cnip); - - /* encode facility */ - enc_ie_facility(ntmode, msg, centrex, i); -} - void Pdss1::dec_facility_centrex(unsigned char *p, Q931_info_t *qi, unsigned char *cnip, int cnip_len) { unsigned char centrex[256]; diff --git a/admin_client.c b/lcradmin.c similarity index 99% rename from admin_client.c rename to lcradmin.c index 2c0b362..cf97f69 100644 --- a/admin_client.c +++ b/lcradmin.c @@ -27,7 +27,7 @@ #include "joinpbx.h" #include "extension.h" #include "message.h" -#include "admin.h" +#include "lcrsocket.h" #include "cause.h" #define LTEE {addch(ACS_LTEE);addch(ACS_HLINE);addch(ACS_HLINE);} diff --git a/admin.h b/lcrsocket.h similarity index 100% rename from admin.h rename to lcrsocket.h diff --git a/mISDN.cpp b/mISDN.cpp index 7bd1388..7bdb30d 100644 --- a/mISDN.cpp +++ b/mISDN.cpp @@ -9,7 +9,6 @@ ** ** \*****************************************************************************/ - #include "main.h" #include #include @@ -32,6 +31,43 @@ extern "C" { } #endif +#ifndef CMX_TXDATA_ON +#define OLD_MISDN +#endif +#ifndef CMX_TXDATA_OFF +#define OLD_MISDN +#endif +#ifndef CMX_DELAY +#define OLD_MISDN +#endif +#ifndef PIPELINE_CFG +#define OLD_MISDN +#endif +#ifndef CMX_TX_DATA +#define OLD_MISDN +#endif + +#ifdef OLD_MISDN +#warning +#warning ********************************************************* +#warning * +#warning * It seems that you use an older version of mISDN. +#warning * Features like voice recording or echo will not work. +#warning * Also it causes problems with loading modules and may +#warning * not work at all. +#warning * +#warning * Please upgrade to newer version. A working version can +#warning * be found at www.linux-call-router.de. +#warning * +#warning * Do not use the mISDN_1_1 branch, it does not have all +#warning * the features that are required. Use the master branch +#warning * instead. +#warning * +#warning ********************************************************* +#warning +#error +#endif + #ifndef ISDN_PID_L4_B_USER #define ISDN_PID_L4_B_USER 0x440000ff #endif @@ -633,16 +669,20 @@ static void _bchannel_configure(struct mISDNport *mISDNport, int i) } /* set dsp features */ +#ifndef OLD_MISDN if (port->p_m_txdata) ph_control(mISDNport, port, handle, (port->p_m_txdata)?CMX_TXDATA_ON:CMX_TXDATA_OFF, 0, "DSP-TXDATA", port->p_m_txdata); if (port->p_m_delay) ph_control(mISDNport, port, handle, CMX_DELAY, port->p_m_delay, "DSP-DELAY", port->p_m_delay); +#endif if (port->p_m_tx_gain) ph_control(mISDNport, port, handle, VOL_CHANGE_TX, port->p_m_tx_gain, "DSP-TX_GAIN", port->p_m_tx_gain); if (port->p_m_rx_gain) ph_control(mISDNport, port, handle, VOL_CHANGE_RX, port->p_m_rx_gain, "DSP-RX_GAIN", port->p_m_rx_gain); +#ifndef OLD_MISDN if (port->p_m_pipeline[0]) ph_control_block(mISDNport, port, handle, PIPELINE_CFG, port->p_m_pipeline, strlen(port->p_m_pipeline)+1, "DSP-PIPELINE", 0); +#endif if (port->p_m_conf) ph_control(mISDNport, port, handle, CMX_CONF_JOIN, port->p_m_conf, "DSP-CONF", port->p_m_conf); if (port->p_m_echo) @@ -1570,6 +1610,7 @@ void PmISDN::bchannel_receive(iframe_t *frm) { switch(frm->dinfo) { +#ifndef OLD_MISDN case CMX_TX_DATA: if (!p_m_txdata) { @@ -1585,6 +1626,7 @@ void PmISDN::bchannel_receive(iframe_t *frm) if (p_record) record(data, len, 1); // from up break; +#endif default: chan_trace_header(p_m_mISDNport, this, "BCHANNEL signal", DIRECTION_IN); @@ -1870,6 +1912,7 @@ void PmISDN::message_mISDNsignal(unsigned long epoint_id, int message_id, union { p_m_delay = param->mISDNsignal.delay; PDEBUG(DEBUG_BCHANNEL, "we change delay mode to delay=%d.\n", p_m_delay); +#ifndef OLD_MISDN if (p_m_b_index >= 0) if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE) #ifdef SOCKET_MISDN @@ -1877,6 +1920,7 @@ void PmISDN::message_mISDNsignal(unsigned long epoint_id, int message_id, union #else ph_control(p_m_mISDNport, this, p_m_mISDNport->b_addr[p_m_b_index], p_m_delay?CMX_DELAY:CMX_JITTER, p_m_delay, "DSP-DELAY", p_m_delay); #endif +#endif } else PDEBUG(DEBUG_BCHANNEL, "we already have delay=%d.\n", p_m_delay); break; @@ -2208,8 +2252,10 @@ int mISDN_handler(void) /* turn on RX */ isdnport->p_m_txdata = 1; PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is required, so we turn them on\n"); +#ifndef OLD_MISDN if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE) ph_control(mISDNport, isdnport, mISDNport->b_addr[isdnport->p_m_b_index], CMX_TXDATA_ON, 0, "DSP-TXDATA", 1); +#endif return(1); } } else @@ -2220,8 +2266,10 @@ int mISDN_handler(void) /* turn off RX */ isdnport->p_m_txdata = 0; PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is not required, so we turn them off\n"); +#ifndef OLD_MISDN if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE) ph_control(mISDNport, isdnport, mISDNport->b_addr[isdnport->p_m_b_index], CMX_TXDATA_OFF, 0, "DSP-TXDATA", 0); +#endif return(1); } } diff --git a/main.h b/main.h index f30a2b4..61ffc80 100644 --- a/main.h +++ b/main.h @@ -140,7 +140,7 @@ extern "C" { #include "alawulaw.h" #include "tones.h" #include "crypt.h" -#include "admin_server.h" +#include "socket_server.h" #include "trace.h" extern double now_d; diff --git a/admin_server.c b/socket_server.c similarity index 100% rename from admin_server.c rename to socket_server.c diff --git a/admin_server.h b/socket_server.h similarity index 98% rename from admin_server.h rename to socket_server.h index 9d1c8a2..305deb5 100644 --- a/admin_server.h +++ b/socket_server.h @@ -9,7 +9,7 @@ ** ** \*****************************************************************************/ -#include "admin.h" +#include "lcrsocket.h" struct admin_queue { struct admin_queue *next; diff --git a/todo.txt b/todo.txt index e43d19b..72615af 100644 --- a/todo.txt +++ b/todo.txt @@ -1,3 +1,25 @@ +chan_lcr: + +show calls +show lcr +block/unblock port +reload interfaces/routing +release call + +setup: es werden setupdaten gespeichert, bis eine ref vom lcr erfolgt. +dabei werden zusätzliche wahlinformationen der rufummer hinzugefügt. + +bridge: jede instanz (chan_call) hat eine bridge_id +wenn keine bridge, dann ist sie 0. +mit new_bridge_id() wird eine neue id gesucht. diese wird in beide instanzen eingetragen +zudem wird fuer jede instanz (zwei) der bridge eine bchannel_join ausgeführt, wenn die bchannels verfügbar sind. +schon implementiert: falls der bchannel später kommt, wird der join beim exporieren des b-channels ausgeführt. + + + + + + doku: rx_vol -> rx_gain context @@ -26,20 +48,5 @@ delay - per param setzen, lokal als mISDNsignal und remote mittels setup -old stuff.... - -NOTE: check CENTREX - -durchstellen mit disconnect -durchstellen mit keypad -short ring -sleep relaxed -auto pick -alarm clock (timer) -sonderwahlton -facility: diversion, 3pty, ... - - -