Interface to mISDN. More...
#include <mISDNuser/suppserv.h>
Go to the source code of this file.
Interface to mISDN.
Definition in file isdn_lib.h.
#define MAX_BCHANS 31 |
Definition at line 76 of file isdn_lib.h.
Referenced by clear_l3(), dump_chan_list(), find_bc_by_l3id(), find_bc_by_masked_l3id(), find_free_chan_in_stack(), misdn_lib_get_free_bc(), and misdn_lib_init().
#define MISDN_MAX_KEYPAD_LEN (31 + 1) |
Maximum keypad facility content length plus null terminator
Definition at line 255 of file isdn_lib.h.
#define MISDN_MAX_NAME_LEN (50 + 1) |
Maximum name length plus null terminator (From ECMA-164)
Definition at line 249 of file isdn_lib.h.
#define MISDN_MAX_NUMBER_LEN (31 + 1) |
Maximum phone number (address) length plus null terminator
Definition at line 246 of file isdn_lib.h.
Referenced by misdn_add_number_prefix().
#define MISDN_MAX_SUBADDRESS_LEN (23 + 1) |
Maximum subaddress length plus null terminator
Definition at line 252 of file isdn_lib.h.
#define PRI_TRANS_CAP_3_1K_AUDIO 0x10 |
Definition at line 820 of file isdn_lib.h.
#define PRI_TRANS_CAP_7K_AUDIO 0x11 |
Definition at line 821 of file isdn_lib.h.
#define PRI_TRANS_CAP_DIGITAL 0x08 |
Definition at line 818 of file isdn_lib.h.
#define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09 |
Definition at line 819 of file isdn_lib.h.
#define PRI_TRANS_CAP_SPEECH 0x0 |
Definition at line 817 of file isdn_lib.h.
anonymous enum |
Definition at line 171 of file isdn_lib.h.
00171 { /* bearer capability */ 00172 INFO_CAPABILITY_SPEECH=0, 00173 INFO_CAPABILITY_AUDIO_3_1K=0x10 , 00174 INFO_CAPABILITY_AUDIO_7K=0x11 , 00175 INFO_CAPABILITY_VIDEO =0x18, 00176 INFO_CAPABILITY_DIGITAL_UNRESTRICTED =0x8, 00177 INFO_CAPABILITY_DIGITAL_RESTRICTED =0x09, 00178 INFO_CAPABILITY_DIGITAL_UNRESTRICTED_TONES 00179 };
anonymous enum |
Definition at line 181 of file isdn_lib.h.
00181 { /* progress indicators */ 00182 INFO_PI_CALL_NOT_E2E_ISDN =0x01, 00183 INFO_PI_CALLED_NOT_ISDN =0x02, 00184 INFO_PI_CALLER_NOT_ISDN =0x03, 00185 INFO_PI_CALLER_RETURNED_TO_ISDN =0x04, 00186 INFO_PI_INBAND_AVAILABLE =0x08, 00187 INFO_PI_DELAY_AT_INTERF =0x0a, 00188 INFO_PI_INTERWORKING_WITH_PUBLIC =0x10, 00189 INFO_PI_INTERWORKING_NO_RELEASE =0x11, 00190 INFO_PI_INTERWORKING_NO_RELEASE_PRE_ANSWER =0x12, 00191 INFO_PI_INTERWORKING_NO_RELEASE_POST_ANSWER =0x13 00192 };
anonymous enum |
Definition at line 232 of file isdn_lib.h.
00232 { /*CODECS*/ 00233 INFO_CODEC_ULAW=2, 00234 INFO_CODEC_ALAW=3 00235 };
enum bchannel_state |
Definition at line 78 of file isdn_lib.h.
00078 { 00079 BCHAN_CLEANED=0, 00080 BCHAN_EMPTY, 00081 BCHAN_ACTIVATED, 00082 BCHAN_BRIDGED, 00083 BCHAN_RELEASE, 00084 BCHAN_ERROR 00085 };
enum event_e |
Definition at line 119 of file isdn_lib.h.
00119 { 00120 EVENT_NOTHING, 00121 EVENT_TONE_GENERATE, 00122 EVENT_BCHAN_DATA, 00123 EVENT_BCHAN_ACTIVATED, 00124 EVENT_BCHAN_ERROR, 00125 EVENT_CLEANUP, 00126 EVENT_PROCEEDING, 00127 EVENT_PROGRESS, 00128 EVENT_SETUP, 00129 EVENT_REGISTER, 00130 EVENT_ALERTING, 00131 EVENT_CONNECT, 00132 EVENT_SETUP_ACKNOWLEDGE, 00133 EVENT_CONNECT_ACKNOWLEDGE , 00134 EVENT_USER_INFORMATION, 00135 EVENT_SUSPEND_REJECT, 00136 EVENT_RESUME_REJECT, 00137 EVENT_HOLD, 00138 EVENT_SUSPEND, 00139 EVENT_RESUME, 00140 EVENT_HOLD_ACKNOWLEDGE, 00141 EVENT_SUSPEND_ACKNOWLEDGE, 00142 EVENT_RESUME_ACKNOWLEDGE, 00143 EVENT_HOLD_REJECT, 00144 EVENT_RETRIEVE, 00145 EVENT_RETRIEVE_ACKNOWLEDGE, 00146 EVENT_RETRIEVE_REJECT, 00147 EVENT_DISCONNECT, 00148 EVENT_RESTART, 00149 EVENT_RELEASE, 00150 EVENT_RELEASE_COMPLETE, 00151 EVENT_FACILITY, 00152 EVENT_NOTIFY, 00153 EVENT_STATUS_ENQUIRY, 00154 EVENT_INFORMATION, 00155 EVENT_STATUS, 00156 EVENT_TIMEOUT, 00157 EVENT_DTMF_TONE, 00158 EVENT_NEW_L3ID, 00159 EVENT_NEW_BC, 00160 EVENT_PORT_ALARM, 00161 EVENT_NEW_CHANNEL, 00162 EVENT_UNKNOWN 00163 };
enum event_response_e |
RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE | |
RESPONSE_IGNORE_SETUP | |
RESPONSE_RELEASE_SETUP | |
RESPONSE_ERR | |
RESPONSE_OK |
Definition at line 110 of file isdn_lib.h.
00110 { 00111 RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE, 00112 RESPONSE_IGNORE_SETUP, 00113 RESPONSE_RELEASE_SETUP, 00114 RESPONSE_ERR, 00115 RESPONSE_OK 00116 };
enum ie_name_e |
Definition at line 166 of file isdn_lib.h.
enum layer_e |
enum misdn_err_e |
enum mISDN_NOTIFY_CODE |
Notification description code enumeration.
Definition at line 216 of file isdn_lib.h.
00216 { 00217 mISDN_NOTIFY_CODE_INVALID = -1, 00218 /*! Call is placed on hold (Q.931) */ 00219 mISDN_NOTIFY_CODE_USER_SUSPEND = 0x00, 00220 /*! Call is taken off of hold (Q.931) */ 00221 mISDN_NOTIFY_CODE_USER_RESUME = 0x01, 00222 /*! Call is diverting (EN 300 207-1 Section 7.2.1) */ 00223 mISDN_NOTIFY_CODE_CALL_IS_DIVERTING = 0x7B, 00224 /*! Call diversion is enabled (cfu, cfb, cfnr) (EN 300 207-1 Section 7.2.1) */ 00225 mISDN_NOTIFY_CODE_DIVERSION_ACTIVATED = 0x68, 00226 /*! Call transfer, alerting (EN 300 369-1 Section 7.2) */ 00227 mISDN_NOTIFY_CODE_CALL_TRANSFER_ALERTING = 0x69, 00228 /*! Call transfer, active(answered) (EN 300 369-1 Section 7.2) */ 00229 mISDN_NOTIFY_CODE_CALL_TRANSFER_ACTIVE = 0x6A, 00230 };
enum mISDN_NUMBER_PLAN |
NUMPLAN_UNKNOWN | |
NUMPLAN_ISDN | |
NUMPLAN_DATA | |
NUMPLAN_TELEX | |
NUMPLAN_NATIONAL | |
NUMPLAN_PRIVATE |
Definition at line 92 of file isdn_lib.h.
00092 { 00093 NUMPLAN_UNKNOWN = 0x0, 00094 NUMPLAN_ISDN = 0x1, /* ISDN/Telephony numbering plan E.164 */ 00095 NUMPLAN_DATA = 0x3, /* Data numbering plan X.121 */ 00096 NUMPLAN_TELEX = 0x4, /* Telex numbering plan F.69 */ 00097 NUMPLAN_NATIONAL = 0x8, 00098 NUMPLAN_PRIVATE = 0x9 00099 };
enum mISDN_NUMBER_TYPE |
NUMTYPE_UNKNOWN | |
NUMTYPE_INTERNATIONAL | |
NUMTYPE_NATIONAL | |
NUMTYPE_NETWORK_SPECIFIC | |
NUMTYPE_SUBSCRIBER | |
NUMTYPE_ABBREVIATED |
Definition at line 101 of file isdn_lib.h.
00101 { 00102 NUMTYPE_UNKNOWN = 0x0, 00103 NUMTYPE_INTERNATIONAL = 0x1, 00104 NUMTYPE_NATIONAL = 0x2, 00105 NUMTYPE_NETWORK_SPECIFIC = 0x3, 00106 NUMTYPE_SUBSCRIBER = 0x4, 00107 NUMTYPE_ABBREVIATED = 0x5 00108 };
Q.931 encoded redirecting reason.
Definition at line 197 of file isdn_lib.h.
00197 { 00198 mISDN_REDIRECTING_REASON_UNKNOWN = 0x0, 00199 /*! Call forwarding busy or called DTE busy */ 00200 mISDN_REDIRECTING_REASON_CALL_FWD_BUSY = 0x1, 00201 /*! Call forwarding no reply */ 00202 mISDN_REDIRECTING_REASON_NO_REPLY = 0x2, 00203 /*! Call deflection */ 00204 mISDN_REDIRECTING_REASON_DEFLECTION = 0x4, 00205 /*! Called DTE out of order */ 00206 mISDN_REDIRECTING_REASON_OUT_OF_ORDER = 0x9, 00207 /*! Call forwarding by the called DTE */ 00208 mISDN_REDIRECTING_REASON_CALL_FWD_DTE = 0xA, 00209 /*! Call forwarding unconditional or systematic call redirection */ 00210 mISDN_REDIRECTING_REASON_CALL_FWD = 0xF 00211 };
enum tone_e |
For initialization usage end of init usage
TONE_NONE | |
TONE_DIAL | |
TONE_ALERTING | |
TONE_FAR_ALERTING | |
TONE_BUSY | |
TONE_HANGUP | |
TONE_CUSTOM | |
TONE_FILE |
Definition at line 63 of file isdn_lib.h.
00063 { 00064 TONE_NONE=0, 00065 TONE_DIAL, 00066 TONE_ALERTING, 00067 TONE_FAR_ALERTING, 00068 TONE_BUSY, 00069 TONE_HANGUP, 00070 TONE_CUSTOM, 00071 TONE_FILE 00072 };
char* bc_state2str | ( | enum bchannel_state | state | ) |
Definition at line 617 of file isdn_lib.c.
References BCHAN_ACTIVATED, BCHAN_BRIDGED, BCHAN_CLEANED, BCHAN_EMPTY, BCHAN_ERROR, and BCHAN_RELEASE.
Referenced by bc_next_state_change(), bc_state_change(), cb_events(), misdn_lib_send_event(), misdn_lib_split_bridge(), misdn_lib_tx2misdn_frm(), print_bc_info(), and setup_bc().
00617 { 00618 int i; 00619 00620 struct bchan_state_s { 00621 char *n; 00622 enum bchannel_state s; 00623 } states[] = { 00624 {"BCHAN_CLEANED", BCHAN_CLEANED }, 00625 {"BCHAN_EMPTY", BCHAN_EMPTY}, 00626 {"BCHAN_ACTIVATED", BCHAN_ACTIVATED}, 00627 {"BCHAN_BRIDGED", BCHAN_BRIDGED}, 00628 {"BCHAN_RELEASE", BCHAN_RELEASE}, 00629 {"BCHAN_ERROR", BCHAN_ERROR} 00630 }; 00631 00632 for (i=0; i< sizeof(states)/sizeof(struct bchan_state_s); i++) 00633 if ( states[i].s == state) 00634 return states[i].n; 00635 00636 return "UNKNOWN"; 00637 }
void bc_state_change | ( | struct misdn_bchannel * | bc, | |
enum bchannel_state | state | |||
) |
Definition at line 639 of file isdn_lib.c.
References misdn_bchannel::bc_state, bc_state2str(), BCHAN_ACTIVATED, BCHAN_BRIDGED, BCHAN_EMPTY, cb_log, misdn_bchannel::conf_id, misdn_bchannel::l3_id, misdn_join_conf(), misdn_bchannel::next_bc_state, and misdn_bchannel::port.
Referenced by clean_up_bc(), init_bc(), manager_bchannel_deactivate(), misdn_join_conf(), misdn_lib_send_event(), misdn_split_conf(), and setup_bc().
00640 { 00641 cb_log(5,bc->port,"BC_STATE_CHANGE: l3id:%x from:%s to:%s\n", 00642 bc->l3_id, 00643 bc_state2str(bc->bc_state), 00644 bc_state2str(state) ); 00645 00646 switch (state) { 00647 case BCHAN_ACTIVATED: 00648 if (bc->next_bc_state == BCHAN_BRIDGED) { 00649 misdn_join_conf(bc, bc->conf_id); 00650 bc->next_bc_state = BCHAN_EMPTY; 00651 return; 00652 } 00653 default: 00654 bc->bc_state=state; 00655 break; 00656 } 00657 }
void get_show_stack_details | ( | int | port, | |
char * | buf | |||
) |
Definition at line 168 of file isdn_lib.c.
References misdn_stack::blocked, get_misdn_stack(), misdn_stack::l1link, misdn_stack::l2link, misdn_stack::next, misdn_stack::nt, misdn_stack::port, and misdn_stack::ptp.
Referenced by handle_cli_misdn_show_port(), and handle_cli_misdn_show_stacks().
00169 { 00170 struct misdn_stack *stack = get_misdn_stack(); 00171 00172 for (; stack; stack = stack->next) { 00173 if (stack->port == port) { 00174 break; 00175 } 00176 } 00177 00178 if (stack) { 00179 sprintf(buf, "* Port %2d Type %s Prot. %s L2Link %s L1Link:%s Blocked:%d", 00180 stack->port, 00181 stack->nt ? "NT" : "TE", 00182 stack->ptp ? "PTP" : "PMP", 00183 (stack->nt && !stack->ptp) ? "UNKN" : stack->l2link ? "UP " : "DOWN", 00184 stack->l1link ? "UP " : "DOWN", 00185 stack->blocked); 00186 } else { 00187 buf[0] = 0; 00188 } 00189 }
void isdn_lib_stop_dtmf | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4462 of file isdn_lib.c.
References manager_ph_control().
Referenced by process_ast_dsp().
04463 { 04464 manager_ph_control(bc, DTMF_TONE_STOP, 0); 04465 }
void isdn_lib_update_ec | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4450 of file isdn_lib.c.
References misdn_bchannel::ec_enable, manager_ec_disable(), and manager_ec_enable().
Referenced by process_ast_dsp().
04451 { 04452 #ifdef MISDN_1_2 04453 if (*bc->pipeline) 04454 #else 04455 if (bc->ec_enable) 04456 #endif 04457 manager_ec_enable(bc); 04458 else 04459 manager_ec_disable(bc); 04460 }
void isdn_lib_update_rxgain | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4440 of file isdn_lib.c.
References manager_ph_control(), and misdn_bchannel::rxgain.
Referenced by process_ast_dsp().
04441 { 04442 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 04443 }
void isdn_lib_update_txgain | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4445 of file isdn_lib.c.
References manager_ph_control(), and misdn_bchannel::txgain.
Referenced by process_ast_dsp().
04446 { 04447 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 04448 }
void manager_bchannel_activate | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4329 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_bchannel::astbuf, cb_log, get_stack_by_bc(), misdn_stack::midev, misdn_stack::port, and misdn_bchannel::port.
Referenced by setup_bc().
04330 { 04331 char buf[128]; 04332 04333 struct misdn_stack *stack=get_stack_by_bc(bc); 04334 04335 if (!stack) { 04336 cb_log(0, bc->port, "bchannel_activate: Stack not found !"); 04337 return ; 04338 } 04339 04340 /* we must activate if we are deactivated */ 04341 clear_ibuffer(bc->astbuf); 04342 04343 cb_log(5, stack->port, "$$$ Bchan Activated addr %x\n", bc->addr); 04344 04345 mISDN_write_frame(stack->midev, buf, bc->addr | FLG_MSG_DOWN, DL_ESTABLISH | REQUEST, 0,0, NULL, TIMEOUT_1SEC); 04346 04347 return ; 04348 }
void manager_bchannel_deactivate | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4351 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_bchannel::astbuf, misdn_bchannel::bc_state, bc_state_change(), BCHAN_ACTIVATED, BCHAN_BRIDGED, BCHAN_RELEASE, cb_log, misdn_bchannel::conf_id, misdn_bchannel::generate_tone, get_stack_by_bc(), misdn_stack::midev, misdn_split_conf(), misdn_stack::port, and misdn_bchannel::port.
Referenced by clean_up_bc().
04352 { 04353 struct misdn_stack *stack=get_stack_by_bc(bc); 04354 char buf[128]; 04355 04356 switch (bc->bc_state) { 04357 case BCHAN_ACTIVATED: 04358 break; 04359 case BCHAN_BRIDGED: 04360 misdn_split_conf(bc,bc->conf_id); 04361 break; 04362 default: 04363 cb_log( 4, bc->port,"bchan_deactivate: called but not activated\n"); 04364 return ; 04365 04366 } 04367 04368 cb_log(5, stack->port, "$$$ Bchan deActivated addr %x\n", bc->addr); 04369 04370 bc->generate_tone=0; 04371 04372 mISDN_write_frame(stack->midev, buf, bc->addr | FLG_MSG_DOWN, DL_RELEASE|REQUEST,0,0,NULL, TIMEOUT_1SEC); 04373 04374 clear_ibuffer(bc->astbuf); 04375 04376 bc_state_change(bc,BCHAN_RELEASE); 04377 04378 return; 04379 }
void manager_ec_disable | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4677 of file isdn_lib.c.
References misdn_bchannel::capability, cb_log, misdn_bchannel::ec_enable, ECHOCAN_OFF, get_stack_by_bc(), manager_ph_control(), manager_ph_control_block(), misdn_cap_is_speech(), and misdn_stack::port.
Referenced by clean_up_bc(), handle_cli_misdn_toggle_echocancel(), and isdn_lib_update_ec().
04678 { 04679 struct misdn_stack *stack=get_stack_by_bc(bc); 04680 04681 cb_log(4, stack?stack->port:0," --> ec_disable\n"); 04682 04683 if (!misdn_cap_is_speech(bc->capability)) { 04684 cb_log(1, stack?stack->port:0, " --> no speech? cannot disable EC\n"); 04685 return; 04686 } 04687 04688 #ifdef MISDN_1_2 04689 manager_ph_control_block(bc, PIPELINE_CFG, "", 0); 04690 #else 04691 if ( ! bc->ec_enable) { 04692 cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n"); 04693 manager_ph_control(bc, ECHOCAN_OFF, 0); 04694 } 04695 #endif 04696 }
void manager_ec_enable | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4628 of file isdn_lib.c.
References misdn_bchannel::capability, cb_log, misdn_bchannel::ec_deftaps, misdn_bchannel::ec_enable, ECHOCAN_ON, get_stack_by_bc(), manager_ph_control_block(), misdn_cap_is_speech(), and misdn_stack::port.
Referenced by handle_cli_misdn_toggle_echocancel(), handle_event_te(), isdn_lib_update_ec(), and misdn_lib_send_event().
04629 { 04630 struct misdn_stack *stack=get_stack_by_bc(bc); 04631 04632 cb_log(4, stack?stack->port:0,"ec_enable\n"); 04633 04634 if (!misdn_cap_is_speech(bc->capability)) { 04635 cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n"); 04636 } else { 04637 04638 #ifdef MISDN_1_2 04639 if (*bc->pipeline) { 04640 cb_log(3, stack?stack->port:0,"Sending Control PIPELINE_CFG %s\n",bc->pipeline); 04641 manager_ph_control_block(bc, PIPELINE_CFG, bc->pipeline, strlen(bc->pipeline) + 1); 04642 } 04643 #else 04644 int ec_arr[2]; 04645 04646 if (bc->ec_enable) { 04647 cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d\n",bc->ec_deftaps); 04648 04649 switch (bc->ec_deftaps) { 04650 case 4: 04651 case 8: 04652 case 16: 04653 case 32: 04654 case 64: 04655 case 128: 04656 case 256: 04657 case 512: 04658 case 1024: 04659 cb_log(4, stack->port, "Taps is %d\n",bc->ec_deftaps); 04660 break; 04661 default: 04662 cb_log(0, stack->port, "Taps should be power of 2\n"); 04663 bc->ec_deftaps=128; 04664 } 04665 04666 ec_arr[0]=bc->ec_deftaps; 04667 ec_arr[1]=0; 04668 04669 manager_ph_control_block(bc, ECHOCAN_ON, ec_arr, sizeof(ec_arr)); 04670 } 04671 #endif 04672 } 04673 }
char* manager_isdn_get_info | ( | enum event_e | event | ) |
Definition at line 4324 of file isdn_lib.c.
References isdn_get_info(), and msgs_g.
Referenced by cb_events().
04325 { 04326 return isdn_get_info(msgs_g , event, 0); 04327 }
void manager_ph_control | ( | struct misdn_bchannel * | bc, | |
int | c1, | |||
int | c2 | |||
) |
Definition at line 4419 of file isdn_lib.c.
References misdn_bchannel::addr, cb_log, misdn_lib::midev, and misdn_bchannel::port.
Referenced by handle_event_te(), isdn_lib_stop_dtmf(), isdn_lib_update_rxgain(), isdn_lib_update_txgain(), manager_ec_disable(), misdn_join_conf(), misdn_lib_echo(), misdn_lib_send_event(), misdn_lib_send_tone(), and misdn_split_conf().
04420 { 04421 unsigned char buffer[mISDN_HEADER_LEN+2*sizeof(int)]; 04422 iframe_t *ctrl = (iframe_t *)buffer; /* preload data */ 04423 unsigned int *d = (unsigned int*)&ctrl->data.p; 04424 /*struct misdn_stack *stack=get_stack_by_bc(bc);*/ 04425 04426 cb_log(4,bc->port,"ph_control: c1:%x c2:%x\n",c1,c2); 04427 04428 ctrl->prim = PH_CONTROL | REQUEST; 04429 ctrl->addr = bc->addr | FLG_MSG_DOWN; 04430 ctrl->dinfo = 0; 04431 ctrl->len = sizeof(unsigned int)*2; 04432 *d++ = c1; 04433 *d++ = c2; 04434 mISDN_write(glob_mgr->midev, ctrl, mISDN_HEADER_LEN+ctrl->len, TIMEOUT_1SEC); 04435 }
int misdn_cap_is_speech | ( | int | cap | ) |
Poor mans version
Definition at line 436 of file isdn_lib.c.
References INFO_CAPABILITY_DIGITAL_RESTRICTED, and INFO_CAPABILITY_DIGITAL_UNRESTRICTED.
Referenced by cb_events(), handle_bchan(), handle_event_te(), manager_ec_disable(), manager_ec_enable(), misdn_lib_send_event(), misdn_lib_tx2misdn_frm(), and misdn_write().
00438 { 00439 if ( (cap != INFO_CAPABILITY_DIGITAL_UNRESTRICTED) && 00440 (cap != INFO_CAPABILITY_DIGITAL_RESTRICTED) ) return 1; 00441 return 0; 00442 }
void misdn_dump_chanlist | ( | void | ) |
Definition at line 483 of file isdn_lib.c.
References dump_chan_list(), get_misdn_stack(), and misdn_stack::next.
Referenced by handle_cli_misdn_show_channels().
00484 { 00485 struct misdn_stack *stack=get_misdn_stack(); 00486 for ( ; stack; stack=stack->next) { 00487 dump_chan_list(stack); 00488 } 00489 00490 }
int misdn_inband_avail | ( | struct misdn_bchannel * | bc | ) |
Definition at line 444 of file isdn_lib.c.
References misdn_bchannel::early_bconnect, INFO_PI_CALL_NOT_E2E_ISDN, INFO_PI_CALLED_NOT_ISDN, INFO_PI_INBAND_AVAILABLE, and misdn_bchannel::progress_indicator.
Referenced by cb_events().
00445 { 00446 00447 if (!bc->early_bconnect) { 00448 /* We have opted to never receive any available inband recorded messages */ 00449 return 0; 00450 } 00451 00452 switch (bc->progress_indicator) { 00453 case INFO_PI_INBAND_AVAILABLE: 00454 case INFO_PI_CALL_NOT_E2E_ISDN: 00455 case INFO_PI_CALLED_NOT_ISDN: 00456 return 1; 00457 default: 00458 return 0; 00459 } 00460 return 0; 00461 }
void misdn_lib_bridge | ( | struct misdn_bchannel * | bc1, | |
struct misdn_bchannel * | bc2 | |||
) |
Definition at line 4728 of file isdn_lib.c.
References bc_next_state_change(), BCHAN_ACTIVATED, BCHAN_BRIDGED, cb_log, misdn_join_conf(), misdn_bchannel::pid, and misdn_bchannel::port.
Referenced by misdn_bridge().
04729 { 04730 int conf_id = bc1->pid + 1; 04731 struct misdn_bchannel *bc_list[] = { bc1, bc2, NULL }; 04732 struct misdn_bchannel **bc; 04733 04734 cb_log(4, bc1->port, "I Send: BRIDGE from:%d to:%d\n",bc1->port,bc2->port); 04735 04736 for (bc=bc_list; *bc; bc++) { 04737 (*bc)->conf_id=conf_id; 04738 cb_log(4, (*bc)->port, " --> bc_addr:%x\n",(*bc)->addr); 04739 04740 switch((*bc)->bc_state) { 04741 case BCHAN_ACTIVATED: 04742 misdn_join_conf(*bc,conf_id); 04743 break; 04744 default: 04745 bc_next_state_change(*bc,BCHAN_BRIDGED); 04746 break; 04747 } 04748 } 04749 }
void misdn_lib_destroy | ( | void | ) |
Definition at line 4285 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_stack::b_num, misdn_stack::bc, cb_log, misdn_lib::event_handler_thread, misdn_lib::event_thread, free, misdn_lib::midev, misdn_stack::midev, MISDN_INITIALIZED, misdn_stack::next, misdn_stack::port, stack_destroy(), misdn_lib::stack_list, and te_lib_destroy().
Referenced by unload_module().
04286 { 04287 struct misdn_stack *help; 04288 int i; 04289 04290 for ( help=glob_mgr->stack_list; help; help=help->next ) { 04291 for(i=0;i<=help->b_num; i++) { 04292 char buf[1024]; 04293 mISDN_write_frame(help->midev, buf, help->bc[i].addr, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); 04294 help->bc[i].addr = 0; 04295 } 04296 cb_log (1, help->port, "Destroying this port.\n"); 04297 stack_destroy(help); 04298 } 04299 04300 if (global_state == MISDN_INITIALIZED) { 04301 cb_log(4, 0, "Killing Handler Thread\n"); 04302 if ( pthread_cancel(glob_mgr->event_handler_thread) == 0 ) { 04303 cb_log(4, 0, "Joining Handler Thread\n"); 04304 pthread_join(glob_mgr->event_handler_thread, NULL); 04305 } 04306 04307 cb_log(4, 0, "Killing Main Thread\n"); 04308 if ( pthread_cancel(glob_mgr->event_thread) == 0 ) { 04309 cb_log(4, 0, "Joining Main Thread\n"); 04310 pthread_join(glob_mgr->event_thread, NULL); 04311 } 04312 } 04313 04314 cb_log(1, 0, "Closing mISDN device\n"); 04315 te_lib_destroy(glob_mgr->midev); 04316 while ((help = glob_mgr->stack_list)) { 04317 glob_mgr->stack_list = help->next; 04318 free(help); 04319 } 04320 free(glob_mgr); 04321 glob_mgr = NULL; 04322 }
void misdn_lib_echo | ( | struct misdn_bchannel * | bc, | |
int | onoff | |||
) |
Definition at line 4771 of file isdn_lib.c.
References cb_log, manager_ph_control(), and misdn_bchannel::port.
04772 { 04773 cb_log(3,bc->port, " --> ECHO %s\n", onoff?"ON":"OFF"); 04774 manager_ph_control(bc, onoff?CMX_ECHO_ON:CMX_ECHO_OFF, 0); 04775 }
struct misdn_bchannel* misdn_lib_find_held_bc | ( | int | port, | |
int | l3_id | |||
) | [read] |
Find a held call's B channel record.
port | Port the call is on. | |
l3_id | mISDN Layer 3 ID of held call. |
Definition at line 4580 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, misdn_stack::port, and stack_holder_find().
Referenced by misdn_hangup().
04581 { 04582 struct misdn_bchannel *bc; 04583 struct misdn_stack *stack; 04584 04585 bc = NULL; 04586 for (stack = get_misdn_stack(); stack; stack = stack->next) { 04587 if (stack->port == port) { 04588 bc = stack_holder_find(stack, l3_id); 04589 break; 04590 } 04591 } 04592 04593 return bc; 04594 }
struct misdn_bchannel* misdn_lib_get_free_bc | ( | int | port, | |
int | channel, | |||
int | inout, | |||
int | dec | |||
) | [read] |
Definition at line 3205 of file isdn_lib.c.
References misdn_stack::b_num, misdn_stack::bc, misdn_stack::blocked, cb_log, misdn_bchannel::channel, misdn_bchannel::cw, misdn_bchannel::dec, find_stack_by_port(), MAX_BCHANS, prepare_bc(), misdn_stack::pri, pthread_mutex_lock, pthread_mutex_unlock, misdn_stack::ptp, misdn_stack::st_lock, and test_inuse().
Referenced by handle_cr(), handle_event_nt(), and misdn_request().
03206 { 03207 struct misdn_stack *stack; 03208 int i; 03209 int maxnum; 03210 03211 if (channel < 0 || channel > MAX_BCHANS) { 03212 cb_log(0, port, "Requested channel out of bounds (%d)\n", channel); 03213 return NULL; 03214 } 03215 03216 /* Find the port stack structure */ 03217 stack = find_stack_by_port(port); 03218 if (!stack) { 03219 cb_log(0, port, "Port is not configured (%d)\n", port); 03220 return NULL; 03221 } 03222 03223 if (stack->blocked) { 03224 cb_log(0, port, "Port is blocked\n"); 03225 return NULL; 03226 } 03227 03228 pthread_mutex_lock(&stack->st_lock); 03229 if (channel > 0) { 03230 if (channel <= stack->b_num) { 03231 for (i = 0; i < stack->b_num; i++) { 03232 if (stack->bc[i].channel == channel) { 03233 if (test_inuse(&stack->bc[i])) { 03234 pthread_mutex_unlock(&stack->st_lock); 03235 cb_log(0, port, "Requested channel:%d on port:%d is already in use\n", channel, port); 03236 return NULL; 03237 } else { 03238 prepare_bc(&stack->bc[i], channel); 03239 pthread_mutex_unlock(&stack->st_lock); 03240 return &stack->bc[i]; 03241 } 03242 } 03243 } 03244 } else { 03245 pthread_mutex_unlock(&stack->st_lock); 03246 cb_log(0, port, "Requested channel:%d is out of bounds on port:%d\n", channel, port); 03247 return NULL; 03248 } 03249 } 03250 03251 /* Note: channel == 0 here */ 03252 maxnum = (inout && !stack->pri && !stack->ptp) ? stack->b_num + 1 : stack->b_num; 03253 if (dec) { 03254 for (i = maxnum - 1; i >= 0; --i) { 03255 if (!test_inuse(&stack->bc[i])) { 03256 /* 3. channel on bri means CW*/ 03257 if (!stack->pri && i == stack->b_num) { 03258 stack->bc[i].cw = 1; 03259 } 03260 03261 prepare_bc(&stack->bc[i], channel); 03262 stack->bc[i].dec = 1; 03263 pthread_mutex_unlock(&stack->st_lock); 03264 return &stack->bc[i]; 03265 } 03266 } 03267 } else { 03268 for (i = 0; i < maxnum; ++i) { 03269 if (!test_inuse(&stack->bc[i])) { 03270 /* 3. channel on bri means CW */ 03271 if (!stack->pri && i == stack->b_num) { 03272 stack->bc[i].cw = 1; 03273 } 03274 03275 prepare_bc(&stack->bc[i], channel); 03276 pthread_mutex_unlock(&stack->st_lock); 03277 return &stack->bc[i]; 03278 } 03279 } 03280 } 03281 pthread_mutex_unlock(&stack->st_lock); 03282 03283 cb_log(1, port, "There is no free channel on port (%d)\n", port); 03284 return NULL; 03285 }
int misdn_lib_get_maxchans | ( | int | port | ) |
Definition at line 137 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, misdn_stack::port, and misdn_stack::pri.
Referenced by misdn_request().
00138 { 00139 struct misdn_stack *stack=get_misdn_stack(); 00140 for ( ; stack; stack=stack->next) { 00141 if (stack->port == port) { 00142 if (stack->pri) 00143 return 30; 00144 else 00145 return 2; 00146 } 00147 } 00148 return -1; 00149 }
int misdn_lib_get_port_down | ( | int | port | ) |
Definition at line 1805 of file isdn_lib.c.
References misdn_stack::l2link, misdn_lib_get_l1_down(), misdn_lib_get_l2_down(), misdn_stack::next, misdn_stack::port, and misdn_lib::stack_list.
Referenced by handle_cli_misdn_port_down().
01806 { /* Pull Down L1 */ 01807 struct misdn_stack *stack; 01808 for (stack=glob_mgr->stack_list; 01809 stack; 01810 stack=stack->next) { 01811 if (stack->port == port) { 01812 if (stack->l2link) 01813 misdn_lib_get_l2_down(stack); 01814 misdn_lib_get_l1_down(stack); 01815 return 0; 01816 } 01817 } 01818 return 0; 01819 }
int misdn_lib_get_port_info | ( | int | port | ) |
Definition at line 3903 of file isdn_lib.c.
References misdn_lib::activatequeue, cb_log, find_stack_by_port(), misdn_lib::new_msg, and misdn_stack::upper_id.
03904 { 03905 msg_t *msg=alloc_msg(MAX_MSG_SIZE); 03906 iframe_t *frm; 03907 struct misdn_stack *stack=find_stack_by_port(port); 03908 if (!msg) { 03909 cb_log(0, port, "misdn_lib_get_port_info: alloc_msg failed!\n"); 03910 return -1; 03911 } 03912 frm=(iframe_t*)msg->data; 03913 if (!stack ) { 03914 cb_log(0, port, "There is no Stack for this port.\n"); 03915 return -1; 03916 } 03917 /* activate bchannel */ 03918 frm->prim = CC_STATUS_ENQUIRY | REQUEST; 03919 03920 frm->addr = stack->upper_id| FLG_MSG_DOWN; 03921 03922 frm->dinfo = 0; 03923 frm->len = 0; 03924 03925 msg_queue_tail(&glob_mgr->activatequeue, msg); 03926 sem_post(&glob_mgr->new_msg); 03927 03928 03929 return 0; 03930 }
int misdn_lib_get_port_up | ( | int | port | ) |
Definition at line 1781 of file isdn_lib.c.
References misdn_stack::l1link, misdn_stack::l2link, misdn_lib_get_l1_up(), misdn_lib_get_l2_up(), misdn_stack::next, misdn_stack::nt, misdn_stack::port, and misdn_lib::stack_list.
Referenced by handle_cli_misdn_port_up(), and misdn_check_l2l1().
01782 { /* Pull Up L1 */ 01783 struct misdn_stack *stack; 01784 01785 for (stack=glob_mgr->stack_list; 01786 stack; 01787 stack=stack->next) { 01788 01789 if (stack->port == port) { 01790 01791 if (!stack->l1link) 01792 misdn_lib_get_l1_up(stack); 01793 /* handle_l1 will start L2 for NT. */ 01794 if (!stack->l2link && !stack->nt) { 01795 misdn_lib_get_l2_up(stack); 01796 } 01797 01798 return 0; 01799 } 01800 } 01801 return 0; 01802 }
int misdn_lib_init | ( | char * | portlist, | |
struct misdn_lib_iface * | iface, | |||
void * | user_data | |||
) |
Definition at line 4143 of file isdn_lib.c.
References misdn_lib::activatequeue, ARRAY_LEN, misdn_stack::b_num, misdn_stack::bc, calloc, misdn_lib_iface::cb_event, cb_event, misdn_lib_iface::cb_jb_empty, cb_jb_empty, misdn_lib_iface::cb_log, cb_log, misdn_lib::event_handler_thread, misdn_lib::event_thread, flip_buf_bits(), free, init_bc(), init_flip_bits(), misdn_bchannel::is_register_pool, manager_event_handler(), MAX_BCHANS, misdn_stack::midev, misdn_lib::midev, MISDN_INITIALIZED, misdn_lib_isdn_event_catcher(), misdn_lib_nt_debug_init(), misdn_lib::new_msg, misdn_stack::next, pthread_create, ptp, stack_destroy(), stack_init(), misdn_lib::stack_list, te_lib_destroy(), and te_lib_init().
Referenced by load_module().
04144 { 04145 struct misdn_lib *mgr; 04146 char *tok, *tokb; 04147 char plist[1024]; 04148 int midev; 04149 int port_count=0; 04150 04151 cb_log = iface->cb_log; 04152 cb_event = iface->cb_event; 04153 cb_jb_empty = iface->cb_jb_empty; 04154 04155 if (!portlist || (*portlist == 0)) { 04156 return 1; 04157 } 04158 04159 mgr = calloc(1, sizeof(*mgr)); 04160 if (!mgr) { 04161 return 1; 04162 } 04163 glob_mgr = mgr; 04164 04165 msg_init(); 04166 04167 misdn_lib_nt_debug_init(0,NULL); 04168 04169 init_flip_bits(); 04170 04171 strncpy(plist, portlist, 1024); 04172 plist[1023] = 0; 04173 04174 memcpy(tone_425_flip,tone_425,TONE_425_SIZE); 04175 flip_buf_bits(tone_425_flip,TONE_425_SIZE); 04176 04177 memcpy(tone_silence_flip,tone_SILENCE,TONE_SILENCE_SIZE); 04178 flip_buf_bits(tone_silence_flip,TONE_SILENCE_SIZE); 04179 04180 midev=te_lib_init(); 04181 if (midev <= 0) { 04182 free(glob_mgr); 04183 glob_mgr = NULL; 04184 return 1; 04185 } 04186 mgr->midev=midev; 04187 04188 port_count=mISDN_get_stack_count(midev); 04189 04190 msg_queue_init(&mgr->activatequeue); 04191 04192 if (sem_init(&mgr->new_msg, 1, 0)<0) 04193 sem_init(&mgr->new_msg, 0, 0); 04194 04195 for (tok=strtok_r(plist," ,",&tokb ); 04196 tok; 04197 tok=strtok_r(NULL," ,",&tokb)) { 04198 int port = atoi(tok); 04199 struct misdn_stack *stack; 04200 struct misdn_stack *help; 04201 int ptp=0; 04202 int i; 04203 int r; 04204 04205 if (strstr(tok, "ptp")) 04206 ptp=1; 04207 04208 if (port > port_count) { 04209 cb_log(0, port, "Couldn't Initialize this port since we have only %d ports\n", port_count); 04210 continue; 04211 } 04212 04213 stack = stack_init(midev, port, ptp); 04214 if (!stack) { 04215 cb_log(0, port, "stack_init() failed for this port\n"); 04216 continue; 04217 } 04218 04219 /* Initialize the B channel records for real B channels. */ 04220 for (i = 0; i <= stack->b_num; i++) { 04221 r = init_bc(stack, &stack->bc[i], stack->midev, port, i); 04222 if (r < 0) { 04223 cb_log(0, port, "Got Err @ init_bc :%d\n", r); 04224 break; 04225 } 04226 } 04227 if (i <= stack->b_num) { 04228 stack_destroy(stack); 04229 free(stack); 04230 continue; 04231 } 04232 #if defined(AST_MISDN_ENHANCEMENTS) 04233 /* Initialize the B channel records for REGISTER signaling links. */ 04234 for (i = MAX_BCHANS + 1; i < ARRAY_LEN(stack->bc); ++i) { 04235 r = init_bc(stack, &stack->bc[i], stack->midev, port, i); 04236 if (r < 0) { 04237 cb_log(0, port, "Got Err @ init_bc :%d\n", r); 04238 break; 04239 } 04240 stack->bc[i].is_register_pool = 1; 04241 } 04242 if (i < ARRAY_LEN(stack->bc)) { 04243 stack_destroy(stack); 04244 free(stack); 04245 continue; 04246 } 04247 #endif /* defined(AST_MISDN_ENHANCEMENTS) */ 04248 04249 /* Add the new stack to the end of the list */ 04250 help = mgr->stack_list; 04251 if (!help) { 04252 mgr->stack_list = stack; 04253 } else { 04254 while (help->next) { 04255 help = help->next; 04256 } 04257 help->next = stack; 04258 } 04259 } 04260 04261 if (!mgr->stack_list) { 04262 /* no stacks were successfully initialized !? */ 04263 te_lib_destroy(midev); 04264 free(glob_mgr); 04265 glob_mgr = NULL; 04266 return 1; 04267 } 04268 if (sem_init(&handler_started, 1, 0)<0) 04269 sem_init(&handler_started, 0, 0); 04270 04271 cb_log(8, 0, "Starting Event Handler\n"); 04272 pthread_create( &mgr->event_handler_thread, NULL,(void*)manager_event_handler, mgr); 04273 04274 sem_wait(&handler_started) ; 04275 cb_log(8, 0, "Starting Event Catcher\n"); 04276 pthread_create( &mgr->event_thread, NULL, (void*)misdn_lib_isdn_event_catcher, mgr); 04277 04278 cb_log(8, 0, "Event Catcher started\n"); 04279 04280 global_state= MISDN_INITIALIZED; 04281 04282 return (mgr == NULL); 04283 }
int misdn_lib_is_port_blocked | ( | int | port | ) |
Definition at line 117 of file isdn_lib.c.
References misdn_stack::blocked, get_misdn_stack(), misdn_stack::next, and misdn_stack::port.
00118 { 00119 struct misdn_stack *stack=get_misdn_stack(); 00120 for ( ; stack; stack=stack->next) { 00121 if (stack->port == port) { 00122 return stack->blocked; 00123 } 00124 } 00125 return -1; 00126 }
int misdn_lib_is_ptp | ( | int | port | ) |
Definition at line 128 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, misdn_stack::port, and misdn_stack::ptp.
Referenced by build_setup(), cb_events(), do_immediate_setup(), misdn_call(), misdn_update_connected_line(), and misdn_update_redirecting().
00129 { 00130 struct misdn_stack *stack=get_misdn_stack(); 00131 for ( ; stack; stack=stack->next) { 00132 if (stack->port == port) return stack->ptp; 00133 } 00134 return -1; 00135 }
void misdn_lib_isdn_l1watcher | ( | int | port | ) |
Definition at line 3049 of file isdn_lib.c.
References cb_log, misdn_stack::l1link, misdn_lib_get_l1_up(), misdn_lib_get_l2_up(), misdn_lib_get_short_status(), misdn_stack::next, misdn_stack::port, and misdn_lib::stack_list.
Referenced by misdn_l1_task().
03050 { 03051 struct misdn_stack *stack; 03052 03053 for (stack = glob_mgr->stack_list; stack && (stack->port != port); stack = stack->next) 03054 ; 03055 03056 if (stack) { 03057 cb_log(4, port, "Checking L1 State\n"); 03058 if (!stack->l1link) { 03059 cb_log(4, port, "L1 State Down, trying to get it up again\n"); 03060 misdn_lib_get_short_status(stack); 03061 misdn_lib_get_l1_up(stack); 03062 misdn_lib_get_l2_up(stack); 03063 } 03064 } 03065 }
void misdn_lib_log_ies | ( | struct misdn_bchannel * | bc | ) |
Definition at line 3431 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_bchannel::b_stid, bearer2str(), misdn_bchannel::caller, misdn_bchannel::capability, misdn_bchannel::cause, cb_log, misdn_bchannel::channel, misdn_bchannel::connected, misdn_party_redirecting::count, misdn_bchannel::dialed, fac2str(), misdn_bchannel::fac_in, misdn_bchannel::fac_out, misdn_party_redirecting::from, get_stack_by_bc(), misdn_bchannel::holded, misdn_bchannel::info_dad, misdn_bchannel::keypad, misdn_bchannel::l3_id, misdn_bchannel::layer_id, misdn_bchannel::mode, misdn_party_id::name, misdn_stack::nt, misdn_party_id::number, misdn_party_id::number_plan, misdn_party_dialing::number_plan, misdn_party_id::number_type, misdn_party_dialing::number_type, misdn_bchannel::out_cause, misdn_stack::port, misdn_bchannel::presentation, misdn_party_id::presentation, misdn_bchannel::progress_indicator, misdn_bchannel::rate, misdn_party_redirecting::reason, misdn_bchannel::redirecting, misdn_party_id::screening, misdn_bchannel::sending_complete, misdn_bchannel::set_presentation, misdn_bchannel::stack_holder, misdn_party_redirecting::to, misdn_bchannel::urate, and misdn_bchannel::user1.
Referenced by cb_events(), and misdn_lib_send_event().
03432 { 03433 struct misdn_stack *stack; 03434 03435 if (!bc) return; 03436 03437 stack = get_stack_by_bc(bc); 03438 03439 if (!stack) return; 03440 03441 cb_log(2, stack->port, 03442 " --> channel:%d mode:%s cause:%d ocause:%d\n", 03443 bc->channel, 03444 stack->nt ? "NT" : "TE", 03445 bc->cause, 03446 bc->out_cause); 03447 03448 cb_log(2, stack->port, 03449 " --> info_dad:%s dialed numtype:%d plan:%d\n", 03450 bc->info_dad, 03451 bc->dialed.number_type, 03452 bc->dialed.number_plan); 03453 03454 cb_log(2, stack->port, 03455 " --> caller:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03456 bc->caller.name, 03457 bc->caller.number, 03458 bc->caller.number_type, 03459 bc->caller.number_plan, 03460 bc->caller.presentation, 03461 bc->caller.screening); 03462 03463 cb_log(2, stack->port, 03464 " --> redirecting-from:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03465 bc->redirecting.from.name, 03466 bc->redirecting.from.number, 03467 bc->redirecting.from.number_type, 03468 bc->redirecting.from.number_plan, 03469 bc->redirecting.from.presentation, 03470 bc->redirecting.from.screening); 03471 cb_log(2, stack->port, 03472 " --> redirecting-to:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03473 bc->redirecting.to.name, 03474 bc->redirecting.to.number, 03475 bc->redirecting.to.number_type, 03476 bc->redirecting.to.number_plan, 03477 bc->redirecting.to.presentation, 03478 bc->redirecting.to.screening); 03479 cb_log(2, stack->port, 03480 " --> redirecting reason:%d count:%d\n", 03481 bc->redirecting.reason, 03482 bc->redirecting.count); 03483 03484 cb_log(2, stack->port, 03485 " --> connected:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03486 bc->connected.name, 03487 bc->connected.number, 03488 bc->connected.number_type, 03489 bc->connected.number_plan, 03490 bc->connected.presentation, 03491 bc->connected.screening); 03492 03493 cb_log(3, stack->port, " --> caps:%s pi:%x keypad:%s sending_complete:%d\n", bearer2str(bc->capability),bc->progress_indicator, bc->keypad, bc->sending_complete); 03494 03495 cb_log(4, stack->port, " --> set_pres:%d pres:%d\n", bc->set_presentation, bc->presentation); 03496 03497 cb_log(4, stack->port, " --> addr:%x l3id:%x b_stid:%x layer_id:%x\n", bc->addr, bc->l3_id, bc->b_stid, bc->layer_id); 03498 03499 cb_log(4, stack->port, " --> facility in:%s out:%s\n", fac2str(bc->fac_in.Function), fac2str(bc->fac_out.Function)); 03500 03501 cb_log(5, stack->port, " --> urate:%d rate:%d mode:%d user1:%d\n", bc->urate, bc->rate, bc->mode,bc->user1); 03502 03503 cb_log(5, stack->port, " --> bc:%p h:%d sh:%d\n", bc, bc->holded, bc->stack_holder); 03504 }
int misdn_lib_maxports_get | ( | void | ) |
Definition at line 4094 of file isdn_lib.c.
Referenced by load_module().
void misdn_lib_nt_debug_init | ( | int | flags, | |
char * | file | |||
) |
Definition at line 4124 of file isdn_lib.c.
References f.
Referenced by load_module(), and misdn_lib_init().
04125 { 04126 static int init=0; 04127 char *f; 04128 04129 if (!flags) 04130 f=NULL; 04131 else 04132 f=file; 04133 04134 if (!init) { 04135 debug_init( flags , f, f, f); 04136 init=1; 04137 } else { 04138 debug_close(); 04139 debug_init( flags , f, f, f); 04140 } 04141 }
void misdn_lib_nt_keepcalls | ( | int | kc | ) |
Definition at line 4112 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, and misdn_stack::nst.
Referenced by load_module().
04113 { 04114 #ifdef FEATURE_NET_KEEPCALLS 04115 if (kc) { 04116 struct misdn_stack *stack=get_misdn_stack(); 04117 for ( ; stack; stack=stack->next) { 04118 stack->nst.feature |= FEATURE_NET_KEEPCALLS; 04119 } 04120 } 04121 #endif 04122 }
int misdn_lib_pid_restart | ( | int | pid | ) |
Definition at line 3932 of file isdn_lib.c.
References manager_clean_bc(), and manager_find_bc_by_pid().
Referenced by handle_cli_misdn_restart_pid().
03933 { 03934 struct misdn_bchannel *bc=manager_find_bc_by_pid(pid); 03935 03936 if (bc) { 03937 manager_clean_bc(bc); 03938 } 03939 return 0; 03940 }
int misdn_lib_port_block | ( | int | port | ) |
Definition at line 91 of file isdn_lib.c.
References misdn_stack::blocked, get_misdn_stack(), misdn_stack::next, and misdn_stack::port.
Referenced by cb_events(), and handle_cli_misdn_port_block().
00092 { 00093 struct misdn_stack *stack=get_misdn_stack(); 00094 for ( ; stack; stack=stack->next) { 00095 if (stack->port == port) { 00096 stack->blocked=1; 00097 return 0; 00098 } 00099 } 00100 return -1; 00101 00102 }
int misdn_lib_port_is_nt | ( | int | port | ) |
Definition at line 65 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, misdn_stack::nt, and misdn_stack::port.
Referenced by handle_cli_misdn_send_facility(), misdn_update_connected_line(), and misdn_update_redirecting().
00066 { 00067 struct misdn_stack *stack=get_misdn_stack(); 00068 for ( ; stack; stack=stack->next) { 00069 if (stack->port == port) { 00070 return stack->nt; 00071 } 00072 } 00073 00074 return -1; 00075 }
int misdn_lib_port_is_pri | ( | int | port | ) |
Definition at line 53 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, misdn_stack::port, and misdn_stack::pri.
Referenced by misdn_new(), test_inuse(), and update_name().
00054 { 00055 struct misdn_stack *stack=get_misdn_stack(); 00056 for ( ; stack; stack=stack->next) { 00057 if (stack->port == port) { 00058 return stack->pri; 00059 } 00060 } 00061 00062 return -1; 00063 }
int misdn_lib_port_restart | ( | int | port | ) |
Definition at line 3982 of file isdn_lib.c.
References misdn_lib::activatequeue, cb_log, clear_l3(), find_stack_by_port(), misdn_lib_reinit_nt_stack(), misdn_lib::new_msg, misdn_stack::nt, misdn_stack::port, and misdn_stack::upper_id.
Referenced by handle_cli_misdn_restart_port().
03983 { 03984 struct misdn_stack *stack=find_stack_by_port(port); 03985 03986 cb_log(0, port, "Restarting this port.\n"); 03987 if (stack) { 03988 cb_log(0, port, "Stack:%p\n",stack); 03989 03990 clear_l3(stack); 03991 { 03992 msg_t *msg=alloc_msg(MAX_MSG_SIZE); 03993 iframe_t *frm; 03994 03995 if (!msg) { 03996 cb_log(0, port, "port_restart: alloc_msg failed\n"); 03997 return -1; 03998 } 03999 04000 frm=(iframe_t*)msg->data; 04001 /* we must activate if we are deactivated */ 04002 /* activate bchannel */ 04003 frm->prim = DL_RELEASE | REQUEST; 04004 frm->addr = stack->upper_id | FLG_MSG_DOWN; 04005 04006 frm->dinfo = 0; 04007 frm->len = 0; 04008 msg_queue_tail(&glob_mgr->activatequeue, msg); 04009 sem_post(&glob_mgr->new_msg); 04010 } 04011 04012 if (stack->nt) 04013 misdn_lib_reinit_nt_stack(stack->port); 04014 04015 } 04016 04017 return 0; 04018 }
int misdn_lib_port_unblock | ( | int | port | ) |
Definition at line 104 of file isdn_lib.c.
References misdn_stack::blocked, get_misdn_stack(), misdn_stack::next, and misdn_stack::port.
Referenced by handle_cli_misdn_port_unblock().
00105 { 00106 struct misdn_stack *stack=get_misdn_stack(); 00107 for ( ; stack; stack=stack->next) { 00108 if (stack->port == port) { 00109 stack->blocked=0; 00110 return 0; 00111 } 00112 } 00113 return -1; 00114 00115 }
int misdn_lib_port_up | ( | int | port, | |
int | notcheck | |||
) |
Definition at line 1821 of file isdn_lib.c.
References misdn_stack::blocked, cb_log, misdn_stack::l1link, misdn_stack::l2link, misdn_stack::next, misdn_stack::port, misdn_stack::ptp, and misdn_lib::stack_list.
Referenced by misdn_check_l2l1(), and misdn_request().
01822 { 01823 struct misdn_stack *stack; 01824 01825 01826 for (stack=glob_mgr->stack_list; 01827 stack; 01828 stack=stack->next) { 01829 01830 if (stack->port == port) { 01831 01832 if (stack->blocked) { 01833 cb_log(0,port, "Port Blocked:%d L2:%d L1:%d\n", stack->blocked, stack->l2link, stack->l1link); 01834 return -1; 01835 } 01836 01837 if (stack->ptp ) { 01838 01839 if (stack->l1link && stack->l2link) { 01840 return 1; 01841 } else { 01842 cb_log(1,port, "Port Down L2:%d L1:%d\n", 01843 stack->l2link, stack->l1link); 01844 return 0; 01845 } 01846 } else { 01847 if ( !check || stack->l1link ) 01848 return 1; 01849 else { 01850 cb_log(1,port, "Port down PMP\n"); 01851 return 0; 01852 } 01853 } 01854 } 01855 } 01856 01857 return -1; 01858 }
void misdn_lib_reinit_nt_stack | ( | int | port | ) |
Definition at line 4779 of file isdn_lib.c.
References misdn_stack::blocked, misdn_stack::d_stid, find_stack_by_port(), handle_event_nt(), misdn_stack::l2link, misdn_stack::lower_id, misdn_stack::mgr, misdn_lib::midev, misdn_lib_get_l1_up(), misdn_stack::nst, misdn_stack::pri, misdn_stack::ptp, and misdn_stack::upper_id.
Referenced by misdn_lib_port_restart().
04780 { 04781 struct misdn_stack *stack=find_stack_by_port(port); 04782 04783 if (stack) { 04784 stack->l2link=0; 04785 stack->blocked=0; 04786 04787 cleanup_Isdnl3(&stack->nst); 04788 cleanup_Isdnl2(&stack->nst); 04789 04790 04791 memset(&stack->nst, 0, sizeof(net_stack_t)); 04792 memset(&stack->mgr, 0, sizeof(manager_t)); 04793 04794 stack->mgr.nst = &stack->nst; 04795 stack->nst.manager = &stack->mgr; 04796 04797 stack->nst.l3_manager = handle_event_nt; 04798 stack->nst.device = glob_mgr->midev; 04799 stack->nst.cardnr = port; 04800 stack->nst.d_stid = stack->d_stid; 04801 04802 stack->nst.feature = FEATURE_NET_HOLD; 04803 if (stack->ptp) 04804 stack->nst.feature |= FEATURE_NET_PTP; 04805 if (stack->pri) 04806 stack->nst.feature |= FEATURE_NET_CRLEN2 | FEATURE_NET_EXTCID; 04807 04808 stack->nst.l1_id = stack->lower_id; /* never used */ 04809 stack->nst.l2_id = stack->upper_id; 04810 04811 msg_queue_init(&stack->nst.down_queue); 04812 04813 Isdnl2Init(&stack->nst); 04814 Isdnl3Init(&stack->nst); 04815 04816 if (!stack->ptp) 04817 misdn_lib_get_l1_up(stack); 04818 } 04819 }
void misdn_lib_release | ( | struct misdn_bchannel * | bc | ) |
Definition at line 1759 of file isdn_lib.c.
References cb_log, misdn_bchannel::channel, clean_up_bc(), empty_bc(), empty_chan_in_stack(), get_stack_by_bc(), and misdn_bchannel::in_use.
Referenced by misdn_hangup(), and misdn_request().
01760 { 01761 int channel; 01762 struct misdn_stack *stack=get_stack_by_bc(bc); 01763 01764 if (!stack) { 01765 cb_log(1,0,"misdn_release: No Stack found\n"); 01766 return; 01767 } 01768 01769 channel = bc->channel; 01770 empty_bc(bc); 01771 clean_up_bc(bc); 01772 if (channel > 0) { 01773 empty_chan_in_stack(stack, channel); 01774 } 01775 bc->in_use=0; 01776 }
int misdn_lib_send_event | ( | struct misdn_bchannel * | bc, | |
enum event_e | event | |||
) |
Definition at line 3523 of file isdn_lib.c.
References misdn_bchannel::bc_state, bc_state2str(), bc_state_change(), BCHAN_BRIDGED, BCHAN_CLEANED, misdn_bchannel::caller, misdn_bchannel::capability, misdn_bchannel::cause, cb_log, misdn_bchannel::channel, misdn_bchannel::channel_found, misdn_bchannel::channel_preselected, clean_up_bc(), misdn_bchannel::conf_id, create_process(), misdn_bchannel::crypt_key, misdn_bchannel::dialed, misdn_stack::downqueue, empty_bc(), empty_chan_in_stack(), ENOCHAN, EVENT_ALERTING, EVENT_CONNECT, EVENT_CONNECT_ACKNOWLEDGE, EVENT_DISCONNECT, EVENT_HOLD_ACKNOWLEDGE, EVENT_PROCEEDING, EVENT_PROGRESS, EVENT_REGISTER, EVENT_RELEASE, EVENT_RELEASE_COMPLETE, EVENT_RETRIEVE_ACKNOWLEDGE, EVENT_SETUP, EVENT_SETUP_ACKNOWLEDGE, find_bc_by_confid(), find_free_chan_in_stack(), get_stack_by_bc(), misdn_bchannel::holded, misdn_bchannel::in_use, isdn_get_info(), isdn_msg_build_event(), misdn_stack::l1link, malloc, manager_ec_enable(), manager_ph_control(), manager_ph_control_block(), misdn_lib::midev, misdn_cap_is_speech(), misdn_lib_get_l1_up(), misdn_lib_log_ies(), misdn_send_lock(), misdn_send_unlock(), misdn_split_conf(), msgs_g, misdn_party_id::name, misdn_bchannel::need_disconnect, misdn_bchannel::need_release, misdn_bchannel::need_release_complete, misdn_lib::new_msg, misdn_bchannel::nodsp, misdn_bchannel::nt, misdn_stack::nt, misdn_party_dialing::number, misdn_party_id::number, misdn_party_dialing::number_type, misdn_party_id::number_type, misdn_bchannel::out_cause, misdn_bchannel::pid, misdn_stack::port, misdn_bchannel::port, misdn_stack::ptp, RETURN, misdn_bchannel::rxgain, setup_bc(), stack_holder_add(), misdn_bchannel::txgain, and misdn_stack::upper_id.
Referenced by cb_events(), do_immediate_setup(), handle_cli_misdn_send_display(), handle_cli_misdn_send_facility(), handle_event_nt(), handle_event_te(), handle_frm_te(), misdn_answer(), misdn_call(), misdn_digit_end(), misdn_facility_exec(), misdn_facility_ie_handler(), misdn_hangup(), misdn_indication(), misdn_lib_send_restart(), misdn_overlap_dial_task(), misdn_send_text(), misdn_update_connected_line(), misdn_update_redirecting(), start_pbx(), and wait_for_digits().
03524 { 03525 msg_t *msg; 03526 struct misdn_bchannel *bc2; 03527 struct misdn_bchannel *held_bc; 03528 struct misdn_stack *stack; 03529 int retval = 0; 03530 int channel; 03531 int tmpcause; 03532 int tmp_out_cause; 03533 03534 if (!bc) 03535 RETURN(-1,OUT_POST_UNLOCK); 03536 03537 stack = get_stack_by_bc(bc); 03538 if (!stack) { 03539 cb_log(0,bc->port, 03540 "SENDEVENT: no Stack for event:%s caller:\"%s\" <%s> dialed:%s \n", 03541 isdn_get_info(msgs_g, event, 0), 03542 bc->caller.name, 03543 bc->caller.number, 03544 bc->dialed.number); 03545 RETURN(-1,OUT); 03546 } 03547 03548 misdn_send_lock(bc); 03549 03550 03551 cb_log(6,stack->port,"SENDEVENT: stack->nt:%d stack->upperid:%x\n",stack->nt, stack->upper_id); 03552 03553 if ( stack->nt && !stack->l1link) { 03554 misdn_lib_get_l1_up(stack); 03555 } 03556 03557 cb_log(1, stack->port, 03558 "I SEND:%s caller:\"%s\" <%s> dialed:%s pid:%d\n", 03559 isdn_get_info(msgs_g, event, 0), 03560 bc->caller.name, 03561 bc->caller.number, 03562 bc->dialed.number, 03563 bc->pid); 03564 cb_log(4, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state)); 03565 misdn_lib_log_ies(bc); 03566 03567 switch (event) { 03568 case EVENT_REGISTER: 03569 case EVENT_SETUP: 03570 if (create_process(glob_mgr->midev, bc) < 0) { 03571 cb_log(0, stack->port, " No free channel at the moment @ send_event\n"); 03572 03573 RETURN(-ENOCHAN,OUT); 03574 } 03575 break; 03576 03577 case EVENT_PROGRESS: 03578 case EVENT_ALERTING: 03579 case EVENT_PROCEEDING: 03580 case EVENT_SETUP_ACKNOWLEDGE: 03581 case EVENT_CONNECT: 03582 if (!stack->nt) { 03583 if (stack->ptp) { 03584 setup_bc(bc); 03585 } 03586 break; 03587 } 03588 /* fall through */ 03589 03590 case EVENT_RETRIEVE_ACKNOWLEDGE: 03591 if (stack->nt) { 03592 if (bc->channel <=0 ) { /* else we have the channel already */ 03593 if (find_free_chan_in_stack(stack, bc, 0, 0)<0) { 03594 cb_log(0, stack->port, " No free channel at the moment\n"); 03595 /*FIXME: add disconnect*/ 03596 RETURN(-ENOCHAN,OUT); 03597 } 03598 } 03599 /* Its that i generate channels */ 03600 } 03601 03602 retval=setup_bc(bc); 03603 if (retval == -EINVAL) { 03604 cb_log(0,bc->port,"send_event: setup_bc failed\n"); 03605 } 03606 03607 if (misdn_cap_is_speech(bc->capability)) { 03608 if ((event==EVENT_CONNECT)||(event==EVENT_RETRIEVE_ACKNOWLEDGE)) { 03609 if ( *bc->crypt_key ) { 03610 cb_log(4, stack->port, 03611 " --> ENABLING BLOWFISH channel:%d caller%d:\"%s\" <%s> dialed%d:%s\n", 03612 bc->channel, 03613 bc->caller.number_type, 03614 bc->caller.name, 03615 bc->caller.number, 03616 bc->dialed.number_type, 03617 bc->dialed.number); 03618 03619 manager_ph_control_block(bc, BF_ENABLE_KEY, bc->crypt_key, strlen(bc->crypt_key) ); 03620 } 03621 03622 if (!bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0); 03623 manager_ec_enable(bc); 03624 03625 if (bc->txgain != 0) { 03626 cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain); 03627 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 03628 } 03629 03630 if ( bc->rxgain != 0 ) { 03631 cb_log(4, stack->port, "--> Changing rxgain to %d\n", bc->rxgain); 03632 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 03633 } 03634 } 03635 } 03636 break; 03637 03638 case EVENT_HOLD_ACKNOWLEDGE: 03639 held_bc = malloc(sizeof(struct misdn_bchannel)); 03640 if (!held_bc) { 03641 cb_log(0, bc->port, "Could not allocate held_bc!!!\n"); 03642 RETURN(-1,OUT); 03643 } 03644 03645 /* backup the bc and put it in storage */ 03646 *held_bc = *bc; 03647 held_bc->holded = 1; 03648 held_bc->channel = 0;/* A held call does not have a channel anymore. */ 03649 held_bc->channel_preselected = 0; 03650 held_bc->channel_found = 0; 03651 bc_state_change(held_bc, BCHAN_CLEANED); 03652 stack_holder_add(stack, held_bc); 03653 03654 /* kill the bridge and clean the real b-channel record */ 03655 if (stack->nt) { 03656 if (bc->bc_state == BCHAN_BRIDGED) { 03657 misdn_split_conf(bc,bc->conf_id); 03658 bc2 = find_bc_by_confid(bc->conf_id); 03659 if (!bc2) { 03660 cb_log(0,bc->port,"We have no second bc in bridge???\n"); 03661 } else { 03662 misdn_split_conf(bc2,bc->conf_id); 03663 } 03664 } 03665 03666 channel = bc->channel; 03667 03668 empty_bc(bc); 03669 clean_up_bc(bc); 03670 03671 if (channel>0) 03672 empty_chan_in_stack(stack,channel); 03673 03674 bc->in_use=0; 03675 } 03676 break; 03677 03678 /* finishing the channel eh ? */ 03679 case EVENT_DISCONNECT: 03680 if (!bc->need_disconnect) { 03681 cb_log(0, bc->port, " --> we have already sent DISCONNECT\n"); 03682 RETURN(-1,OUT); 03683 } 03684 /* IE cause is mandatory for DISCONNECT, but optional for the answers to DISCONNECT. 03685 * We must initialize cause, so it is later correctly indicated to ast_channel 03686 * in case the answer does not include one! 03687 */ 03688 bc->cause = bc->out_cause; 03689 03690 bc->need_disconnect=0; 03691 break; 03692 case EVENT_RELEASE: 03693 if (!bc->need_release) { 03694 cb_log(0, bc->port, " --> we have already sent RELEASE\n"); 03695 RETURN(-1,OUT); 03696 } 03697 bc->need_disconnect=0; 03698 bc->need_release=0; 03699 break; 03700 case EVENT_RELEASE_COMPLETE: 03701 if (!bc->need_release_complete) { 03702 cb_log(0, bc->port, " --> we have already sent RELEASE_COMPLETE\n"); 03703 RETURN(-1,OUT); 03704 } 03705 bc->need_disconnect=0; 03706 bc->need_release=0; 03707 bc->need_release_complete=0; 03708 03709 if (!stack->nt) { 03710 /* create cleanup in TE */ 03711 channel = bc->channel; 03712 tmpcause = bc->cause; 03713 tmp_out_cause = bc->out_cause; 03714 03715 empty_bc(bc); 03716 bc->cause=tmpcause; 03717 bc->out_cause=tmp_out_cause; 03718 clean_up_bc(bc); 03719 03720 if (channel>0) 03721 empty_chan_in_stack(stack,channel); 03722 03723 bc->in_use=0; 03724 } 03725 break; 03726 03727 case EVENT_CONNECT_ACKNOWLEDGE: 03728 if ( bc->nt || misdn_cap_is_speech(bc->capability)) { 03729 int retval=setup_bc(bc); 03730 if (retval == -EINVAL){ 03731 cb_log(0,bc->port,"send_event: setup_bc failed\n"); 03732 03733 } 03734 } 03735 03736 if (misdn_cap_is_speech(bc->capability)) { 03737 if ( !bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0); 03738 manager_ec_enable(bc); 03739 03740 if ( bc->txgain != 0 ) { 03741 cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain); 03742 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 03743 } 03744 if ( bc->rxgain != 0 ) { 03745 cb_log(4, stack->port, "--> Changing rxgain to %d\n", bc->rxgain); 03746 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 03747 } 03748 } 03749 break; 03750 03751 default: 03752 break; 03753 } 03754 03755 /* Later we should think about sending bchannel data directly to misdn. */ 03756 msg = isdn_msg_build_event(msgs_g, bc, event, stack->nt); 03757 if (!msg) { 03758 /* 03759 * The message was not built. 03760 * 03761 * NOTE: The only time that the message will fail to build 03762 * is because the requested FACILITY message is not supported. 03763 * A failed malloc() results in exit() being called. 03764 */ 03765 RETURN(-1, OUT); 03766 } else { 03767 msg_queue_tail(&stack->downqueue, msg); 03768 sem_post(&glob_mgr->new_msg); 03769 } 03770 03771 OUT: 03772 misdn_send_unlock(bc); 03773 03774 OUT_POST_UNLOCK: 03775 return retval; 03776 }
int misdn_lib_send_restart | ( | int | port, | |
int | channel | |||
) |
Definition at line 3943 of file isdn_lib.c.
References misdn_stack::b_num, misdn_stack::bc, cb_log, misdn_bchannel::channel, clean_up_bc(), empty_bc(), EVENT_RESTART, find_stack_by_port(), misdn_bchannel::in_use, misdn_lib_send_event(), misdn_make_dummy(), misdn_stack::nt, and misdn_stack::port.
Referenced by handle_cli_misdn_send_restart(), handle_event_nt(), and handle_frm_te().
03944 { 03945 struct misdn_stack *stack=find_stack_by_port(port); 03946 struct misdn_bchannel dummybc; 03947 /*default is all channels*/ 03948 cb_log(0, port, "Sending Restarts on this port.\n"); 03949 03950 misdn_make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0); 03951 03952 /*default is all channels*/ 03953 if (channel <0) { 03954 dummybc.channel=-1; 03955 cb_log(0, port, "Restarting and all Interfaces\n"); 03956 misdn_lib_send_event(&dummybc, EVENT_RESTART); 03957 03958 return 0; 03959 } 03960 03961 /*if a channel is specified we restart only this one*/ 03962 if (channel >0) { 03963 int cnt; 03964 dummybc.channel=channel; 03965 cb_log(0, port, "Restarting and cleaning channel %d\n",channel); 03966 misdn_lib_send_event(&dummybc, EVENT_RESTART); 03967 /* clean up chan in stack, to be sure we don't think it's 03968 * in use anymore */ 03969 for (cnt=0; cnt<=stack->b_num; cnt++) { 03970 if (stack->bc[cnt].in_use && stack->bc[cnt].channel == channel) { 03971 empty_bc(&stack->bc[cnt]); 03972 clean_up_bc(&stack->bc[cnt]); 03973 stack->bc[cnt].in_use=0; 03974 } 03975 } 03976 } 03977 03978 return 0; 03979 }
void misdn_lib_send_tone | ( | struct misdn_bchannel * | bc, | |
enum tone_e | tone | |||
) |
Definition at line 4596 of file isdn_lib.c.
References misdn_bchannel::addr, manager_ph_control(), misdn_lib::midev, TONE_ALERTING, TONE_DIAL, TONE_HANGUP, and TONE_NONE.
Referenced by hanguptone_indicate().
04597 { 04598 char buf[mISDN_HEADER_LEN + 128] = ""; 04599 iframe_t *frm = (iframe_t*)buf; 04600 04601 switch(tone) { 04602 case TONE_DIAL: 04603 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_DIALTONE); 04604 break; 04605 04606 case TONE_ALERTING: 04607 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_RINGING); 04608 break; 04609 04610 case TONE_HANGUP: 04611 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_HANGUP); 04612 break; 04613 04614 case TONE_NONE: 04615 default: 04616 manager_ph_control(bc, TONE_PATT_OFF, TONE_GERMAN_HANGUP); 04617 } 04618 04619 frm->prim=DL_DATA|REQUEST; 04620 frm->addr=bc->addr|FLG_MSG_DOWN; 04621 frm->dinfo=0; 04622 frm->len=128; 04623 04624 mISDN_write(glob_mgr->midev, frm, mISDN_HEADER_LEN+frm->len, TIMEOUT_1SEC); 04625 }
void misdn_lib_split_bridge | ( | struct misdn_bchannel * | bc1, | |
struct misdn_bchannel * | bc2 | |||
) |
Definition at line 4751 of file isdn_lib.c.
References bc_state2str(), BCHAN_BRIDGED, cb_log, misdn_bchannel::conf_id, and misdn_split_conf().
Referenced by misdn_bridge().
04752 { 04753 04754 struct misdn_bchannel *bc_list[]={ 04755 bc1,bc2,NULL 04756 }; 04757 struct misdn_bchannel **bc; 04758 04759 for (bc=bc_list; *bc; bc++) { 04760 if ( (*bc)->bc_state == BCHAN_BRIDGED){ 04761 misdn_split_conf( *bc, (*bc)->conf_id); 04762 } else { 04763 cb_log( 2, (*bc)->port, "BC not bridged (state:%s) so not splitting it\n",bc_state2str((*bc)->bc_state)); 04764 } 04765 } 04766 04767 }
void misdn_lib_tone_generator_start | ( | struct misdn_bchannel * | bc | ) |
Definition at line 2271 of file isdn_lib.c.
References misdn_bchannel::generate_tone.
Referenced by misdn_write().
02272 { 02273 bc->generate_tone=1; 02274 }
void misdn_lib_tone_generator_stop | ( | struct misdn_bchannel * | bc | ) |
Definition at line 2276 of file isdn_lib.c.
References misdn_bchannel::generate_tone.
Referenced by start_bc_tones(), and stop_indicate().
02277 { 02278 bc->generate_tone=0; 02279 }
int misdn_lib_tx2misdn_frm | ( | struct misdn_bchannel * | bc, | |
void * | data, | |||
int | len | |||
) |
Definition at line 4382 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_bchannel::bc_state, bc_state2str(), BCHAN_ACTIVATED, BCHAN_BRIDGED, misdn_bchannel::capability, cb_log, flip_buf_bits(), get_stack_by_bc(), misdn_stack::midev, misdn_cap_is_speech(), misdn_stack::port, and misdn_bchannel::port.
Referenced by misdn_join_conf(), and misdn_write().
04383 { 04384 struct misdn_stack *stack=get_stack_by_bc(bc); 04385 char buf[4096 + mISDN_HEADER_LEN]; 04386 iframe_t *frm = (iframe_t*)buf; 04387 04388 switch (bc->bc_state) { 04389 case BCHAN_ACTIVATED: 04390 case BCHAN_BRIDGED: 04391 break; 04392 default: 04393 cb_log(3, bc->port, "BC not yet activated (state:%s)\n",bc_state2str(bc->bc_state)); 04394 return -1; 04395 } 04396 04397 frm->prim = DL_DATA|REQUEST; 04398 frm->dinfo = 0; 04399 frm->addr = bc->addr | FLG_MSG_DOWN ; 04400 04401 frm->len = len; 04402 memcpy(&buf[mISDN_HEADER_LEN], data,len); 04403 04404 if ( misdn_cap_is_speech(bc->capability) ) 04405 flip_buf_bits( &buf[mISDN_HEADER_LEN], len); 04406 else 04407 cb_log(6, stack->port, "Writing %d data bytes\n",len); 04408 04409 cb_log(9, stack->port, "Writing %d bytes 2 mISDN\n",len); 04410 mISDN_write(stack->midev, buf, frm->len + mISDN_HEADER_LEN, TIMEOUT_INFINIT); 04411 return 0; 04412 }
void misdn_make_dummy | ( | struct misdn_bchannel * | dummybc, | |
int | port, | |||
int | l3id, | |||
int | nt, | |||
int | channel | |||
) |
Definition at line 77 of file isdn_lib.c.
References misdn_bchannel::channel, misdn_bchannel::dummy, misdn_bchannel::l3_id, misdn_bchannel::nt, and misdn_bchannel::port.
Referenced by handle_cli_misdn_send_facility(), handle_cr(), handle_event_nt(), handle_frm_te(), manager_event_handler(), misdn_lib_send_restart(), and release_cr().
enum event_response_e(* cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data) |
Referenced by clear_l3(), do_tone(), handle_bchan(), handle_cr(), handle_event_nt(), handle_frm_te(), handle_l1(), handle_l2(), manager_clean_bc(), misdn_lib_init(), set_channel(), and setup_bc().
int(* cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len) |
Referenced by misdn_lib_init(), and misdn_tx_jitter().
void(* cb_log)(int level, int port, char *tmpl,...) |
Referenced by bc_next_state_change(), bc_state_change(), build_connect(), build_disconnect(), build_release(), build_release_complete(), build_restart(), build_setup(), cb_events(), clean_up_bc(), config_jitterbuffer(), create_process(), dec_ie_facility(), dump_chan_list(), empty_chan_in_stack(), fetch_msg(), find_free_chan_in_stack(), handle_bchan(), handle_cr(), handle_err(), handle_event_nt(), handle_event_te(), handle_frm_nt(), handle_frm_te(), handle_l1(), handle_l2(), handle_mgmt(), handle_timers(), hangup_chan(), init_bc(), isdn_msg_get_index_by_event(), manager_bchannel_activate(), manager_bchannel_deactivate(), manager_ec_disable(), manager_ec_enable(), manager_event_handler(), manager_isdn_handler(), manager_ph_control(), misdn_join_conf(), misdn_lib_bridge(), misdn_lib_destroy(), misdn_lib_echo(), misdn_lib_get_free_bc(), misdn_lib_get_l1_down(), misdn_lib_get_l1_up(), misdn_lib_get_port_info(), misdn_lib_init(), misdn_lib_isdn_event_catcher(), misdn_lib_isdn_l1watcher(), misdn_lib_log_ies(), misdn_lib_port_restart(), misdn_lib_port_up(), misdn_lib_release(), misdn_lib_send_event(), misdn_lib_send_restart(), misdn_lib_split_bridge(), misdn_lib_tx2misdn_frm(), misdn_split_conf(), misdn_tasks_destroy(), misdn_tx_jitter(), misdn_write(), parse_facility(), parse_release_complete(), parse_restart(), parse_setup(), release_cr(), send_msg(), set_chan_in_stack(), set_channel(), setup_bc(), stack_holder_add(), stack_holder_find(), stack_holder_remove(), stack_init(), te_lib_destroy(), and test_inuse().