#include <mISDNuser/suppserv.h>
Go to the source code of this file.
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_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 262 of file isdn_lib.h.
#define MISDN_MAX_NAME_LEN (50 + 1) |
Maximum name length plus null terminator (From ECMA-164)
Definition at line 256 of file isdn_lib.h.
#define MISDN_MAX_NUMBER_LEN (31 + 1) |
Maximum phone number (address) length plus null terminator
Definition at line 253 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 259 of file isdn_lib.h.
#define PRI_TRANS_CAP_3_1K_AUDIO 0x10 |
Definition at line 832 of file isdn_lib.h.
#define PRI_TRANS_CAP_7K_AUDIO 0x11 |
Definition at line 833 of file isdn_lib.h.
#define PRI_TRANS_CAP_DIGITAL 0x08 |
#define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09 |
Definition at line 831 of file isdn_lib.h.
#define PRI_TRANS_CAP_SPEECH 0x0 |
Definition at line 829 of file isdn_lib.h.
anonymous enum |
Definition at line 178 of file isdn_lib.h.
00178 { /* bearer capability */ 00179 INFO_CAPABILITY_SPEECH=0, 00180 INFO_CAPABILITY_AUDIO_3_1K=0x10 , 00181 INFO_CAPABILITY_AUDIO_7K=0x11 , 00182 INFO_CAPABILITY_VIDEO =0x18, 00183 INFO_CAPABILITY_DIGITAL_UNRESTRICTED =0x8, 00184 INFO_CAPABILITY_DIGITAL_RESTRICTED =0x09, 00185 INFO_CAPABILITY_DIGITAL_UNRESTRICTED_TONES 00186 };
anonymous enum |
Definition at line 188 of file isdn_lib.h.
00188 { /* progress indicators */ 00189 INFO_PI_CALL_NOT_E2E_ISDN =0x01, 00190 INFO_PI_CALLED_NOT_ISDN =0x02, 00191 INFO_PI_CALLER_NOT_ISDN =0x03, 00192 INFO_PI_CALLER_RETURNED_TO_ISDN =0x04, 00193 INFO_PI_INBAND_AVAILABLE =0x08, 00194 INFO_PI_DELAY_AT_INTERF =0x0a, 00195 INFO_PI_INTERWORKING_WITH_PUBLIC =0x10, 00196 INFO_PI_INTERWORKING_NO_RELEASE =0x11, 00197 INFO_PI_INTERWORKING_NO_RELEASE_PRE_ANSWER =0x12, 00198 INFO_PI_INTERWORKING_NO_RELEASE_POST_ANSWER =0x13 00199 };
anonymous enum |
Definition at line 239 of file isdn_lib.h.
00239 { /*CODECS*/ 00240 INFO_CODEC_ULAW=2, 00241 INFO_CODEC_ALAW=3 00242 };
enum bchannel_state |
BCHAN_CLEANED | |
BCHAN_EMPTY | |
BCHAN_SETUP | |
BCHAN_SETUPED | |
BCHAN_ACTIVE | |
BCHAN_ACTIVATED | |
BCHAN_BRIDGE | |
BCHAN_BRIDGED | |
BCHAN_RELEASE | |
BCHAN_RELEASED | |
BCHAN_CLEAN | |
BCHAN_CLEAN_REQUEST | |
BCHAN_ERROR |
Definition at line 78 of file isdn_lib.h.
00078 { 00079 BCHAN_CLEANED=0, 00080 BCHAN_EMPTY, 00081 BCHAN_SETUP, 00082 BCHAN_SETUPED, 00083 BCHAN_ACTIVE, 00084 BCHAN_ACTIVATED, 00085 BCHAN_BRIDGE, 00086 BCHAN_BRIDGED, 00087 BCHAN_RELEASE, 00088 BCHAN_RELEASED, 00089 BCHAN_CLEAN, 00090 BCHAN_CLEAN_REQUEST, 00091 BCHAN_ERROR 00092 };
enum event_e |
Definition at line 126 of file isdn_lib.h.
00126 { 00127 EVENT_NOTHING, 00128 EVENT_TONE_GENERATE, 00129 EVENT_BCHAN_DATA, 00130 EVENT_BCHAN_ACTIVATED, 00131 EVENT_BCHAN_ERROR, 00132 EVENT_CLEANUP, 00133 EVENT_PROCEEDING, 00134 EVENT_PROGRESS, 00135 EVENT_SETUP, 00136 EVENT_REGISTER, 00137 EVENT_ALERTING, 00138 EVENT_CONNECT, 00139 EVENT_SETUP_ACKNOWLEDGE, 00140 EVENT_CONNECT_ACKNOWLEDGE , 00141 EVENT_USER_INFORMATION, 00142 EVENT_SUSPEND_REJECT, 00143 EVENT_RESUME_REJECT, 00144 EVENT_HOLD, 00145 EVENT_SUSPEND, 00146 EVENT_RESUME, 00147 EVENT_HOLD_ACKNOWLEDGE, 00148 EVENT_SUSPEND_ACKNOWLEDGE, 00149 EVENT_RESUME_ACKNOWLEDGE, 00150 EVENT_HOLD_REJECT, 00151 EVENT_RETRIEVE, 00152 EVENT_RETRIEVE_ACKNOWLEDGE, 00153 EVENT_RETRIEVE_REJECT, 00154 EVENT_DISCONNECT, 00155 EVENT_RESTART, 00156 EVENT_RELEASE, 00157 EVENT_RELEASE_COMPLETE, 00158 EVENT_FACILITY, 00159 EVENT_NOTIFY, 00160 EVENT_STATUS_ENQUIRY, 00161 EVENT_INFORMATION, 00162 EVENT_STATUS, 00163 EVENT_TIMEOUT, 00164 EVENT_DTMF_TONE, 00165 EVENT_NEW_L3ID, 00166 EVENT_NEW_BC, 00167 EVENT_PORT_ALARM, 00168 EVENT_NEW_CHANNEL, 00169 EVENT_UNKNOWN 00170 };
enum event_response_e |
RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE | |
RESPONSE_IGNORE_SETUP | |
RESPONSE_RELEASE_SETUP | |
RESPONSE_ERR | |
RESPONSE_OK |
Definition at line 117 of file isdn_lib.h.
00117 { 00118 RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE, 00119 RESPONSE_IGNORE_SETUP, 00120 RESPONSE_RELEASE_SETUP, 00121 RESPONSE_ERR, 00122 RESPONSE_OK 00123 };
enum ie_name_e |
enum layer_e |
enum misdn_err_e |
enum mISDN_NOTIFY_CODE |
Notification description code enumeration.
Definition at line 223 of file isdn_lib.h.
00223 { 00224 mISDN_NOTIFY_CODE_INVALID = -1, 00225 /*! Call is placed on hold (Q.931) */ 00226 mISDN_NOTIFY_CODE_USER_SUSPEND = 0x00, 00227 /*! Call is taken off of hold (Q.931) */ 00228 mISDN_NOTIFY_CODE_USER_RESUME = 0x01, 00229 /*! Call is diverting (EN 300 207-1 Section 7.2.1) */ 00230 mISDN_NOTIFY_CODE_CALL_IS_DIVERTING = 0x7B, 00231 /*! Call diversion is enabled (cfu, cfb, cfnr) (EN 300 207-1 Section 7.2.1) */ 00232 mISDN_NOTIFY_CODE_DIVERSION_ACTIVATED = 0x68, 00233 /*! Call transfer, alerting (EN 300 369-1 Section 7.2) */ 00234 mISDN_NOTIFY_CODE_CALL_TRANSFER_ALERTING = 0x69, 00235 /*! Call transfer, active(answered) (EN 300 369-1 Section 7.2) */ 00236 mISDN_NOTIFY_CODE_CALL_TRANSFER_ACTIVE = 0x6A, 00237 };
enum mISDN_NUMBER_PLAN |
NUMPLAN_UNKNOWN | |
NUMPLAN_ISDN | |
NUMPLAN_DATA | |
NUMPLAN_TELEX | |
NUMPLAN_NATIONAL | |
NUMPLAN_PRIVATE |
Definition at line 99 of file isdn_lib.h.
00099 { 00100 NUMPLAN_UNKNOWN = 0x0, 00101 NUMPLAN_ISDN = 0x1, /* ISDN/Telephony numbering plan E.164 */ 00102 NUMPLAN_DATA = 0x3, /* Data numbering plan X.121 */ 00103 NUMPLAN_TELEX = 0x4, /* Telex numbering plan F.69 */ 00104 NUMPLAN_NATIONAL = 0x8, 00105 NUMPLAN_PRIVATE = 0x9 00106 };
enum mISDN_NUMBER_TYPE |
NUMTYPE_UNKNOWN | |
NUMTYPE_INTERNATIONAL | |
NUMTYPE_NATIONAL | |
NUMTYPE_NETWORK_SPECIFIC | |
NUMTYPE_SUBSCRIBER | |
NUMTYPE_ABBREVIATED |
Definition at line 108 of file isdn_lib.h.
00108 { 00109 NUMTYPE_UNKNOWN = 0x0, 00110 NUMTYPE_INTERNATIONAL = 0x1, 00111 NUMTYPE_NATIONAL = 0x2, 00112 NUMTYPE_NETWORK_SPECIFIC = 0x3, 00113 NUMTYPE_SUBSCRIBER = 0x4, 00114 NUMTYPE_ABBREVIATED = 0x5 00115 };
Q.931 encoded redirecting reason.
Definition at line 204 of file isdn_lib.h.
00204 { 00205 mISDN_REDIRECTING_REASON_UNKNOWN = 0x0, 00206 /*! Call forwarding busy or called DTE busy */ 00207 mISDN_REDIRECTING_REASON_CALL_FWD_BUSY = 0x1, 00208 /*! Call forwarding no reply */ 00209 mISDN_REDIRECTING_REASON_NO_REPLY = 0x2, 00210 /*! Call deflection */ 00211 mISDN_REDIRECTING_REASON_DEFLECTION = 0x4, 00212 /*! Called DTE out of order */ 00213 mISDN_REDIRECTING_REASON_OUT_OF_ORDER = 0x9, 00214 /*! Call forwarding by the called DTE */ 00215 mISDN_REDIRECTING_REASON_CALL_FWD_DTE = 0xA, 00216 /*! Call forwarding unconditional or systematic call redirection */ 00217 mISDN_REDIRECTING_REASON_CALL_FWD = 0xF 00218 };
enum tone_e |
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 621 of file isdn_lib.c.
References BCHAN_ACTIVATED, BCHAN_ACTIVE, BCHAN_BRIDGE, BCHAN_BRIDGED, BCHAN_CLEAN, BCHAN_CLEAN_REQUEST, BCHAN_CLEANED, BCHAN_EMPTY, BCHAN_ERROR, BCHAN_RELEASE, BCHAN_RELEASED, BCHAN_SETUP, and BCHAN_SETUPED.
Referenced by bc_next_state_change(), bc_state_change(), cb_events(), handle_bchan(), handle_err(), misdn_lib_send_event(), misdn_lib_split_bridge(), misdn_lib_tx2misdn_frm(), print_bc_info(), and setup_bc().
00621 { 00622 int i; 00623 00624 struct bchan_state_s { 00625 char *n; 00626 enum bchannel_state s; 00627 } states[] = { 00628 {"BCHAN_CLEANED", BCHAN_CLEANED }, 00629 {"BCHAN_EMPTY", BCHAN_EMPTY}, 00630 {"BCHAN_SETUP", BCHAN_SETUP}, 00631 {"BCHAN_SETUPED", BCHAN_SETUPED}, 00632 {"BCHAN_ACTIVE", BCHAN_ACTIVE}, 00633 {"BCHAN_ACTIVATED", BCHAN_ACTIVATED}, 00634 {"BCHAN_BRIDGE", BCHAN_BRIDGE}, 00635 {"BCHAN_BRIDGED", BCHAN_BRIDGED}, 00636 {"BCHAN_RELEASE", BCHAN_RELEASE}, 00637 {"BCHAN_RELEASED", BCHAN_RELEASED}, 00638 {"BCHAN_CLEAN", BCHAN_CLEAN}, 00639 {"BCHAN_CLEAN_REQUEST", BCHAN_CLEAN_REQUEST}, 00640 {"BCHAN_ERROR", BCHAN_ERROR} 00641 }; 00642 00643 for (i=0; i< sizeof(states)/sizeof(struct bchan_state_s); i++) 00644 if ( states[i].s == state) 00645 return states[i].n; 00646 00647 return "UNKNOWN"; 00648 }
void bc_state_change | ( | struct misdn_bchannel * | bc, | |
enum bchannel_state | state | |||
) |
Definition at line 650 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(), handle_bchan(), handle_frm(), init_bc(), manager_bchannel_deactivate(), misdn_join_conf(), misdn_lib_send_event(), and misdn_split_conf().
00651 { 00652 cb_log(5,bc->port,"BC_STATE_CHANGE: l3id:%x from:%s to:%s\n", 00653 bc->l3_id, 00654 bc_state2str(bc->bc_state), 00655 bc_state2str(state) ); 00656 00657 switch (state) { 00658 case BCHAN_ACTIVATED: 00659 if (bc->next_bc_state == BCHAN_BRIDGED) { 00660 misdn_join_conf(bc, bc->conf_id); 00661 bc->next_bc_state = BCHAN_EMPTY; 00662 return; 00663 } 00664 default: 00665 bc->bc_state=state; 00666 break; 00667 } 00668 }
void get_show_stack_details | ( | int | port, | |
char * | buf | |||
) |
Definition at line 168 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, and misdn_stack::port.
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->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 4633 of file isdn_lib.c.
References misdn_stack::bc, and manager_ph_control().
Referenced by process_ast_dsp().
04634 { 04635 manager_ph_control(bc, DTMF_TONE_STOP, 0); 04636 }
void isdn_lib_update_ec | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4621 of file isdn_lib.c.
References misdn_stack::bc, misdn_bchannel::ec_enable, manager_ec_disable(), and manager_ec_enable().
Referenced by process_ast_dsp().
04622 { 04623 #ifdef MISDN_1_2 04624 if (*bc->pipeline) 04625 #else 04626 if (bc->ec_enable) 04627 #endif 04628 manager_ec_enable(bc); 04629 else 04630 manager_ec_disable(bc); 04631 }
void isdn_lib_update_rxgain | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4611 of file isdn_lib.c.
References misdn_stack::bc, manager_ph_control(), and misdn_bchannel::rxgain.
Referenced by process_ast_dsp().
04612 { 04613 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 04614 }
void isdn_lib_update_txgain | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4616 of file isdn_lib.c.
References misdn_stack::bc, manager_ph_control(), and misdn_bchannel::txgain.
Referenced by process_ast_dsp().
04617 { 04618 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 04619 }
void manager_bchannel_activate | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4494 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_bchannel::astbuf, misdn_stack::bc, cb_log, get_stack_by_bc(), misdn_stack::midev, misdn_stack::port, and misdn_bchannel::port.
04495 { 04496 char buf[128]; 04497 04498 struct misdn_stack *stack=get_stack_by_bc(bc); 04499 04500 if (!stack) { 04501 cb_log(0, bc->port, "bchannel_activate: Stack not found !"); 04502 return ; 04503 } 04504 04505 /* we must activate if we are deactivated */ 04506 clear_ibuffer(bc->astbuf); 04507 04508 cb_log(5, stack->port, "$$$ Bchan Activated addr %x\n", bc->addr); 04509 04510 mISDN_write_frame(stack->midev, buf, bc->addr | FLG_MSG_DOWN, DL_ESTABLISH | REQUEST, 0,0, NULL, TIMEOUT_1SEC); 04511 04512 return ; 04513 }
void manager_bchannel_deactivate | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4516 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_bchannel::astbuf, misdn_stack::bc, 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().
04517 { 04518 struct misdn_stack *stack=get_stack_by_bc(bc); 04519 iframe_t dact; 04520 char buf[128]; 04521 04522 switch (bc->bc_state) { 04523 case BCHAN_ACTIVATED: 04524 break; 04525 case BCHAN_BRIDGED: 04526 misdn_split_conf(bc,bc->conf_id); 04527 break; 04528 default: 04529 cb_log( 4, bc->port,"bchan_deactivate: called but not activated\n"); 04530 return ; 04531 04532 } 04533 04534 cb_log(5, stack->port, "$$$ Bchan deActivated addr %x\n", bc->addr); 04535 04536 bc->generate_tone=0; 04537 04538 dact.prim = DL_RELEASE | REQUEST; 04539 dact.addr = bc->addr | FLG_MSG_DOWN; 04540 dact.dinfo = 0; 04541 dact.len = 0; 04542 mISDN_write_frame(stack->midev, buf, bc->addr | FLG_MSG_DOWN, DL_RELEASE|REQUEST,0,0,NULL, TIMEOUT_1SEC); 04543 04544 clear_ibuffer(bc->astbuf); 04545 04546 bc_state_change(bc,BCHAN_RELEASE); 04547 04548 return; 04549 }
void manager_ec_disable | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4850 of file isdn_lib.c.
References misdn_stack::bc, 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().
04851 { 04852 struct misdn_stack *stack=get_stack_by_bc(bc); 04853 04854 cb_log(4, stack?stack->port:0," --> ec_disable\n"); 04855 04856 if (!misdn_cap_is_speech(bc->capability)) { 04857 cb_log(1, stack?stack->port:0, " --> no speech? cannot disable EC\n"); 04858 return; 04859 } 04860 04861 #ifdef MISDN_1_2 04862 manager_ph_control_block(bc, PIPELINE_CFG, "", 0); 04863 #else 04864 if ( ! bc->ec_enable) { 04865 cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n"); 04866 manager_ph_control(bc, ECHOCAN_OFF, 0); 04867 } 04868 #endif 04869 }
void manager_ec_enable | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4801 of file isdn_lib.c.
References misdn_stack::bc, 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(), isdn_lib_update_ec(), and misdn_lib_send_event().
04802 { 04803 struct misdn_stack *stack=get_stack_by_bc(bc); 04804 04805 cb_log(4, stack?stack->port:0,"ec_enable\n"); 04806 04807 if (!misdn_cap_is_speech(bc->capability)) { 04808 cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n"); 04809 } else { 04810 04811 #ifdef MISDN_1_2 04812 if (*bc->pipeline) { 04813 cb_log(3, stack?stack->port:0,"Sending Control PIPELINE_CFG %s\n",bc->pipeline); 04814 manager_ph_control_block(bc, PIPELINE_CFG, bc->pipeline, strlen(bc->pipeline) + 1); 04815 } 04816 #else 04817 int ec_arr[2]; 04818 04819 if (bc->ec_enable) { 04820 cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d\n",bc->ec_deftaps); 04821 04822 switch (bc->ec_deftaps) { 04823 case 4: 04824 case 8: 04825 case 16: 04826 case 32: 04827 case 64: 04828 case 128: 04829 case 256: 04830 case 512: 04831 case 1024: 04832 cb_log(4, stack->port, "Taps is %d\n",bc->ec_deftaps); 04833 break; 04834 default: 04835 cb_log(0, stack->port, "Taps should be power of 2\n"); 04836 bc->ec_deftaps=128; 04837 } 04838 04839 ec_arr[0]=bc->ec_deftaps; 04840 ec_arr[1]=0; 04841 04842 manager_ph_control_block(bc, ECHOCAN_ON, ec_arr, sizeof(ec_arr)); 04843 } 04844 #endif 04845 } 04846 }
char* manager_isdn_get_info | ( | enum event_e | event | ) |
Definition at line 4489 of file isdn_lib.c.
References isdn_get_info(), and msgs_g.
Referenced by cb_events().
04490 { 04491 return isdn_get_info(msgs_g , event, 0); 04492 }
void manager_ph_control | ( | struct misdn_bchannel * | bc, | |
int | c1, | |||
int | c2 | |||
) |
Definition at line 4590 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_stack::bc, cb_log, glob_mgr, misdn_lib::midev, and misdn_bchannel::port.
Referenced by handle_event(), 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().
04591 { 04592 unsigned char buffer[mISDN_HEADER_LEN+2*sizeof(int)]; 04593 iframe_t *ctrl = (iframe_t *)buffer; /* preload data */ 04594 unsigned int *d = (unsigned int*)&ctrl->data.p; 04595 /*struct misdn_stack *stack=get_stack_by_bc(bc);*/ 04596 04597 cb_log(4,bc->port,"ph_control: c1:%x c2:%x\n",c1,c2); 04598 04599 ctrl->prim = PH_CONTROL | REQUEST; 04600 ctrl->addr = bc->addr | FLG_MSG_DOWN; 04601 ctrl->dinfo = 0; 04602 ctrl->len = sizeof(unsigned int)*2; 04603 *d++ = c1; 04604 *d++ = c2; 04605 mISDN_write(glob_mgr->midev, ctrl, mISDN_HEADER_LEN+ctrl->len, TIMEOUT_1SEC); 04606 }
int misdn_cap_is_speech | ( | int | cap | ) |
Poor mans version
Definition at line 440 of file isdn_lib.c.
References INFO_CAPABILITY_DIGITAL_RESTRICTED, and INFO_CAPABILITY_DIGITAL_UNRESTRICTED.
Referenced by cb_events(), handle_bchan(), handle_event(), manager_ec_disable(), manager_ec_enable(), misdn_lib_send_event(), and misdn_lib_tx2misdn_frm().
00442 { 00443 if ( (cap != INFO_CAPABILITY_DIGITAL_UNRESTRICTED) && 00444 (cap != INFO_CAPABILITY_DIGITAL_RESTRICTED) ) return 1; 00445 return 0; 00446 }
void misdn_dump_chanlist | ( | void | ) |
Definition at line 487 of file isdn_lib.c.
References dump_chan_list(), get_misdn_stack(), and misdn_stack::next.
Referenced by handle_cli_misdn_show_channels().
00488 { 00489 struct misdn_stack *stack=get_misdn_stack(); 00490 for ( ; stack; stack=stack->next) { 00491 dump_chan_list(stack); 00492 } 00493 00494 }
int misdn_inband_avail | ( | struct misdn_bchannel * | bc | ) |
Definition at line 448 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().
00449 { 00450 00451 if (!bc->early_bconnect) { 00452 /* We have opted to never receive any available inband recorded messages */ 00453 return 0; 00454 } 00455 00456 switch (bc->progress_indicator) { 00457 case INFO_PI_INBAND_AVAILABLE: 00458 case INFO_PI_CALL_NOT_E2E_ISDN: 00459 case INFO_PI_CALLED_NOT_ISDN: 00460 return 1; 00461 default: 00462 return 0; 00463 } 00464 return 0; 00465 }
void misdn_lib_bridge | ( | struct misdn_bchannel * | bc1, | |
struct misdn_bchannel * | bc2 | |||
) |
Definition at line 4901 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().
04902 { 04903 int conf_id = bc1->pid + 1; 04904 struct misdn_bchannel *bc_list[] = { bc1, bc2, NULL }; 04905 struct misdn_bchannel **bc; 04906 04907 cb_log(4, bc1->port, "I Send: BRIDGE from:%d to:%d\n",bc1->port,bc2->port); 04908 04909 for (bc=bc_list; *bc; bc++) { 04910 (*bc)->conf_id=conf_id; 04911 cb_log(4, (*bc)->port, " --> bc_addr:%x\n",(*bc)->addr); 04912 04913 switch((*bc)->bc_state) { 04914 case BCHAN_ACTIVATED: 04915 misdn_join_conf(*bc,conf_id); 04916 break; 04917 default: 04918 bc_next_state_change(*bc,BCHAN_BRIDGED); 04919 break; 04920 } 04921 } 04922 }
void misdn_lib_destroy | ( | void | ) |
Definition at line 4456 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, glob_mgr, global_state, 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().
04457 { 04458 struct misdn_stack *help; 04459 int i; 04460 04461 for ( help=glob_mgr->stack_list; help; help=help->next ) { 04462 for(i=0;i<=help->b_num; i++) { 04463 char buf[1024]; 04464 mISDN_write_frame(help->midev, buf, help->bc[i].addr, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); 04465 help->bc[i].addr = 0; 04466 } 04467 cb_log (1, help->port, "Destroying this port.\n"); 04468 stack_destroy(help); 04469 } 04470 04471 if (global_state == MISDN_INITIALIZED) { 04472 cb_log(4, 0, "Killing Handler Thread\n"); 04473 if ( pthread_cancel(glob_mgr->event_handler_thread) == 0 ) { 04474 cb_log(4, 0, "Joining Handler Thread\n"); 04475 pthread_join(glob_mgr->event_handler_thread, NULL); 04476 } 04477 04478 cb_log(4, 0, "Killing Main Thread\n"); 04479 if ( pthread_cancel(glob_mgr->event_thread) == 0 ) { 04480 cb_log(4, 0, "Joining Main Thread\n"); 04481 pthread_join(glob_mgr->event_thread, NULL); 04482 } 04483 } 04484 04485 cb_log(1, 0, "Closing mISDN device\n"); 04486 te_lib_destroy(glob_mgr->midev); 04487 }
void misdn_lib_echo | ( | struct misdn_bchannel * | bc, | |
int | onoff | |||
) |
Definition at line 4944 of file isdn_lib.c.
References cb_log, manager_ph_control(), and misdn_bchannel::port.
04945 { 04946 cb_log(3,bc->port, " --> ECHO %s\n", onoff?"ON":"OFF"); 04947 manager_ph_control(bc, onoff?CMX_ECHO_ON:CMX_ECHO_OFF, 0); 04948 }
struct misdn_bchannel* misdn_lib_find_held_bc | ( | int | port, | |
int | l3_id | |||
) |
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 4753 of file isdn_lib.c.
References misdn_stack::bc, get_misdn_stack(), misdn_stack::next, misdn_stack::port, and stack_holder_find().
Referenced by misdn_hangup().
04754 { 04755 struct misdn_bchannel *bc; 04756 struct misdn_stack *stack; 04757 04758 bc = NULL; 04759 for (stack = get_misdn_stack(); stack; stack = stack->next) { 04760 if (stack->port == port) { 04761 bc = stack_holder_find(stack, l3_id); 04762 break; 04763 } 04764 } 04765 04766 return bc; 04767 }
struct misdn_bchannel* misdn_lib_get_free_bc | ( | int | port, | |
int | channel, | |||
int | inout, | |||
int | dec | |||
) |
Definition at line 3312 of file isdn_lib.c.
References misdn_stack::b_num, misdn_stack::bc, misdn_stack::blocked, cb_log, misdn_bchannel::channel, find_stack_by_port(), MAX_BCHANS, prepare_bc(), pthread_mutex_lock, pthread_mutex_unlock, misdn_stack::st_lock, and test_inuse().
Referenced by handle_cr(), handle_event_nt(), and misdn_request().
03313 { 03314 struct misdn_stack *stack; 03315 int i; 03316 int maxnum; 03317 03318 if (channel < 0 || channel > MAX_BCHANS) { 03319 cb_log(0, port, "Requested channel out of bounds (%d)\n", channel); 03320 return NULL; 03321 } 03322 03323 /* Find the port stack structure */ 03324 stack = find_stack_by_port(port); 03325 if (!stack) { 03326 cb_log(0, port, "Port is not configured (%d)\n", port); 03327 return NULL; 03328 } 03329 03330 if (stack->blocked) { 03331 cb_log(0, port, "Port is blocked\n"); 03332 return NULL; 03333 } 03334 03335 pthread_mutex_lock(&stack->st_lock); 03336 if (channel > 0) { 03337 if (channel <= stack->b_num) { 03338 for (i = 0; i < stack->b_num; i++) { 03339 if (stack->bc[i].channel == channel) { 03340 if (test_inuse(&stack->bc[i])) { 03341 pthread_mutex_unlock(&stack->st_lock); 03342 cb_log(0, port, "Requested channel:%d on port:%d is already in use\n", channel, port); 03343 return NULL; 03344 } else { 03345 prepare_bc(&stack->bc[i], channel); 03346 pthread_mutex_unlock(&stack->st_lock); 03347 return &stack->bc[i]; 03348 } 03349 } 03350 } 03351 } else { 03352 pthread_mutex_unlock(&stack->st_lock); 03353 cb_log(0, port, "Requested channel:%d is out of bounds on port:%d\n", channel, port); 03354 return NULL; 03355 } 03356 } 03357 03358 /* Note: channel == 0 here */ 03359 maxnum = (inout && !stack->pri && !stack->ptp) ? stack->b_num + 1 : stack->b_num; 03360 if (dec) { 03361 for (i = maxnum - 1; i >= 0; --i) { 03362 if (!test_inuse(&stack->bc[i])) { 03363 /* 3. channel on bri means CW*/ 03364 if (!stack->pri && i == stack->b_num) { 03365 stack->bc[i].cw = 1; 03366 } 03367 03368 prepare_bc(&stack->bc[i], channel); 03369 stack->bc[i].dec = 1; 03370 pthread_mutex_unlock(&stack->st_lock); 03371 return &stack->bc[i]; 03372 } 03373 } 03374 } else { 03375 for (i = 0; i < maxnum; ++i) { 03376 if (!test_inuse(&stack->bc[i])) { 03377 /* 3. channel on bri means CW */ 03378 if (!stack->pri && i == stack->b_num) { 03379 stack->bc[i].cw = 1; 03380 } 03381 03382 prepare_bc(&stack->bc[i], channel); 03383 pthread_mutex_unlock(&stack->st_lock); 03384 return &stack->bc[i]; 03385 } 03386 } 03387 } 03388 pthread_mutex_unlock(&stack->st_lock); 03389 03390 cb_log(1, port, "There is no free channel on port (%d)\n", port); 03391 return NULL; 03392 }
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 1868 of file isdn_lib.c.
References glob_mgr, 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().
01869 { /* Pull Down L1 */ 01870 struct misdn_stack *stack; 01871 for (stack=glob_mgr->stack_list; 01872 stack; 01873 stack=stack->next) { 01874 if (stack->port == port) { 01875 if (stack->l2link) 01876 misdn_lib_get_l2_down(stack); 01877 misdn_lib_get_l1_down(stack); 01878 return 0; 01879 } 01880 } 01881 return 0; 01882 }
int misdn_lib_get_port_info | ( | int | port | ) |
Definition at line 4045 of file isdn_lib.c.
References misdn_lib::activatequeue, cb_log, find_stack_by_port(), glob_mgr, misdn_lib::new_msg, and misdn_stack::upper_id.
04046 { 04047 msg_t *msg=alloc_msg(MAX_MSG_SIZE); 04048 iframe_t *frm; 04049 struct misdn_stack *stack=find_stack_by_port(port); 04050 if (!msg) { 04051 cb_log(0, port, "misdn_lib_get_port_info: alloc_msg failed!\n"); 04052 return -1; 04053 } 04054 frm=(iframe_t*)msg->data; 04055 if (!stack ) { 04056 cb_log(0, port, "There is no Stack for this port.\n"); 04057 return -1; 04058 } 04059 /* activate bchannel */ 04060 frm->prim = CC_STATUS_ENQUIRY | REQUEST; 04061 04062 frm->addr = stack->upper_id| FLG_MSG_DOWN; 04063 04064 frm->dinfo = 0; 04065 frm->len = 0; 04066 04067 msg_queue_tail(&glob_mgr->activatequeue, msg); 04068 sem_post(&glob_mgr->new_msg); 04069 04070 04071 return 0; 04072 }
int misdn_lib_get_port_up | ( | int | port | ) |
Definition at line 1846 of file isdn_lib.c.
References glob_mgr, misdn_stack::l1link, misdn_stack::l2link, misdn_lib_get_l1_up(), misdn_lib_get_l2_up(), misdn_stack::next, misdn_stack::port, and misdn_lib::stack_list.
Referenced by handle_cli_misdn_port_up(), and misdn_check_l2l1().
01847 { /* Pull Up L1 */ 01848 struct misdn_stack *stack; 01849 01850 for (stack=glob_mgr->stack_list; 01851 stack; 01852 stack=stack->next) { 01853 01854 if (stack->port == port) { 01855 01856 if (!stack->l1link) 01857 misdn_lib_get_l1_up(stack); 01858 if (!stack->l2link) 01859 misdn_lib_get_l2_up(stack); 01860 01861 return 0; 01862 } 01863 } 01864 return 0; 01865 }
int misdn_lib_init | ( | char * | portlist, | |
struct misdn_lib_iface * | iface, | |||
void * | user_data | |||
) |
Definition at line 4340 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, flip_buf_bits(), glob_mgr, global_state, init_bc(), init_flip_bits(), misdn_bchannel::is_register_pool, manager_event_handler(), MAX_BCHANS, misdn_stack::mgr, 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_init(), te_lib_init(), tone_425_flip, and tone_silence_flip.
Referenced by load_module().
04341 { 04342 struct misdn_lib *mgr=calloc(1, sizeof(struct misdn_lib)); 04343 char *tok, *tokb; 04344 char plist[1024]; 04345 int midev; 04346 int port_count=0; 04347 04348 cb_log = iface->cb_log; 04349 cb_event = iface->cb_event; 04350 cb_jb_empty = iface->cb_jb_empty; 04351 04352 glob_mgr = mgr; 04353 04354 msg_init(); 04355 04356 misdn_lib_nt_debug_init(0,NULL); 04357 04358 if (!portlist || (*portlist == 0) ) return 1; 04359 04360 init_flip_bits(); 04361 04362 { 04363 strncpy(plist,portlist, 1024); 04364 plist[1023] = 0; 04365 } 04366 04367 memcpy(tone_425_flip,tone_425,TONE_425_SIZE); 04368 flip_buf_bits(tone_425_flip,TONE_425_SIZE); 04369 04370 memcpy(tone_silence_flip,tone_SILENCE,TONE_SILENCE_SIZE); 04371 flip_buf_bits(tone_silence_flip,TONE_SILENCE_SIZE); 04372 04373 midev=te_lib_init(); 04374 mgr->midev=midev; 04375 04376 port_count=mISDN_get_stack_count(midev); 04377 04378 msg_queue_init(&mgr->activatequeue); 04379 04380 if (sem_init(&mgr->new_msg, 1, 0)<0) 04381 sem_init(&mgr->new_msg, 0, 0); 04382 04383 for (tok=strtok_r(plist," ,",&tokb ); 04384 tok; 04385 tok=strtok_r(NULL," ,",&tokb)) { 04386 int port = atoi(tok); 04387 struct misdn_stack *stack; 04388 struct misdn_stack *help; 04389 int ptp=0; 04390 int i; 04391 int r; 04392 04393 if (strstr(tok, "ptp")) 04394 ptp=1; 04395 04396 if (port > port_count) { 04397 cb_log(0, port, "Couldn't Initialize this port since we have only %d ports\n", port_count); 04398 exit(1); 04399 } 04400 04401 stack = stack_init(midev, port, ptp); 04402 if (!stack) { 04403 perror("stack_init"); 04404 exit(1); 04405 } 04406 04407 /* Initialize the B channel records for real B channels. */ 04408 for (i = 0; i <= stack->b_num; i++) { 04409 r = init_bc(stack, &stack->bc[i], stack->midev, port, i); 04410 if (r < 0) { 04411 cb_log(0, port, "Got Err @ init_bc :%d\n", r); 04412 exit(1); 04413 } 04414 } 04415 #if defined(AST_MISDN_ENHANCEMENTS) 04416 /* Initialize the B channel records for REGISTER signaling links. */ 04417 for (i = MAX_BCHANS + 1; i < ARRAY_LEN(stack->bc); ++i) { 04418 r = init_bc(stack, &stack->bc[i], stack->midev, port, i); 04419 if (r < 0) { 04420 cb_log(0, port, "Got Err @ init_bc :%d\n", r); 04421 exit(1); 04422 } 04423 stack->bc[i].is_register_pool = 1; 04424 } 04425 #endif /* defined(AST_MISDN_ENHANCEMENTS) */ 04426 04427 /* Add the new stack to the end of the list */ 04428 help = mgr->stack_list; 04429 if (!help) { 04430 mgr->stack_list = stack; 04431 } else { 04432 while (help->next) { 04433 help = help->next; 04434 } 04435 help->next = stack; 04436 } 04437 } 04438 04439 if (sem_init(&handler_started, 1, 0)<0) 04440 sem_init(&handler_started, 0, 0); 04441 04442 cb_log(8, 0, "Starting Event Handler\n"); 04443 pthread_create( &mgr->event_handler_thread, NULL,(void*)manager_event_handler, mgr); 04444 04445 sem_wait(&handler_started) ; 04446 cb_log(8, 0, "Starting Event Catcher\n"); 04447 pthread_create( &mgr->event_thread, NULL, (void*)misdn_lib_isdn_event_catcher, mgr); 04448 04449 cb_log(8, 0, "Event Catcher started\n"); 04450 04451 global_state= MISDN_INITIALIZED; 04452 04453 return (mgr == NULL); 04454 }
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 3151 of file isdn_lib.c.
References cb_log, glob_mgr, 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().
03152 { 03153 struct misdn_stack *stack; 03154 03155 for (stack = glob_mgr->stack_list; stack && (stack->port != port); stack = stack->next) 03156 ; 03157 03158 if (stack) { 03159 cb_log(4, port, "Checking L1 State\n"); 03160 if (!stack->l1link) { 03161 cb_log(4, port, "L1 State Down, trying to get it up again\n"); 03162 misdn_lib_get_short_status(stack); 03163 misdn_lib_get_l1_up(stack); 03164 misdn_lib_get_l2_up(stack); 03165 } 03166 } 03167 }
void misdn_lib_log_ies | ( | struct misdn_bchannel * | bc | ) |
Definition at line 3538 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_bchannel::b_stid, misdn_stack::bc, 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().
03539 { 03540 struct misdn_stack *stack; 03541 03542 if (!bc) return; 03543 03544 stack = get_stack_by_bc(bc); 03545 03546 if (!stack) return; 03547 03548 cb_log(2, stack->port, 03549 " --> channel:%d mode:%s cause:%d ocause:%d\n", 03550 bc->channel, 03551 stack->nt ? "NT" : "TE", 03552 bc->cause, 03553 bc->out_cause); 03554 03555 cb_log(2, stack->port, 03556 " --> info_dad:%s dialed numtype:%d plan:%d\n", 03557 bc->info_dad, 03558 bc->dialed.number_type, 03559 bc->dialed.number_plan); 03560 03561 cb_log(2, stack->port, 03562 " --> caller:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03563 bc->caller.name, 03564 bc->caller.number, 03565 bc->caller.number_type, 03566 bc->caller.number_plan, 03567 bc->caller.presentation, 03568 bc->caller.screening); 03569 03570 cb_log(2, stack->port, 03571 " --> redirecting-from:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03572 bc->redirecting.from.name, 03573 bc->redirecting.from.number, 03574 bc->redirecting.from.number_type, 03575 bc->redirecting.from.number_plan, 03576 bc->redirecting.from.presentation, 03577 bc->redirecting.from.screening); 03578 cb_log(2, stack->port, 03579 " --> redirecting-to:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03580 bc->redirecting.to.name, 03581 bc->redirecting.to.number, 03582 bc->redirecting.to.number_type, 03583 bc->redirecting.to.number_plan, 03584 bc->redirecting.to.presentation, 03585 bc->redirecting.to.screening); 03586 cb_log(2, stack->port, 03587 " --> redirecting reason:%d count:%d\n", 03588 bc->redirecting.reason, 03589 bc->redirecting.count); 03590 03591 cb_log(2, stack->port, 03592 " --> connected:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03593 bc->connected.name, 03594 bc->connected.number, 03595 bc->connected.number_type, 03596 bc->connected.number_plan, 03597 bc->connected.presentation, 03598 bc->connected.screening); 03599 03600 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); 03601 03602 cb_log(4, stack->port, " --> set_pres:%d pres:%d\n", bc->set_presentation, bc->presentation); 03603 03604 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); 03605 03606 cb_log(4, stack->port, " --> facility in:%s out:%s\n", fac2str(bc->fac_in.Function), fac2str(bc->fac_out.Function)); 03607 03608 cb_log(5, stack->port, " --> urate:%d rate:%d mode:%d user1:%d\n", bc->urate, bc->rate, bc->mode,bc->user1); 03609 03610 cb_log(5, stack->port, " --> bc:%p h:%d sh:%d\n", bc, bc->holded, bc->stack_holder); 03611 }
int misdn_lib_maxports_get | ( | void | ) |
Definition at line 4291 of file isdn_lib.c.
Referenced by load_module().
04292 { 04293 /* BE AWARE WE HAVE NO cb_log() HERE! */ 04294 04295 int i = mISDN_open(); 04296 int max=0; 04297 04298 if (i<0) 04299 return -1; 04300 04301 max = mISDN_get_stack_count(i); 04302 04303 mISDN_close(i); 04304 04305 return max; 04306 }
void misdn_lib_nt_debug_init | ( | int | flags, | |
char * | file | |||
) |
Definition at line 4321 of file isdn_lib.c.
References f.
Referenced by load_module(), and misdn_lib_init().
04322 { 04323 static int init=0; 04324 char *f; 04325 04326 if (!flags) 04327 f=NULL; 04328 else 04329 f=file; 04330 04331 if (!init) { 04332 debug_init( flags , f, f, f); 04333 init=1; 04334 } else { 04335 debug_close(); 04336 debug_init( flags , f, f, f); 04337 } 04338 }
void misdn_lib_nt_keepcalls | ( | int | kc | ) |
Definition at line 4309 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, and misdn_stack::nst.
Referenced by load_module().
04310 { 04311 #ifdef FEATURE_NET_KEEPCALLS 04312 if (kc) { 04313 struct misdn_stack *stack=get_misdn_stack(); 04314 for ( ; stack; stack=stack->next) { 04315 stack->nst.feature |= FEATURE_NET_KEEPCALLS; 04316 } 04317 } 04318 #endif 04319 }
int misdn_lib_pid_restart | ( | int | pid | ) |
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 | ) |
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 1884 of file isdn_lib.c.
References misdn_stack::blocked, cb_log, glob_mgr, 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().
01885 { 01886 struct misdn_stack *stack; 01887 01888 01889 for (stack=glob_mgr->stack_list; 01890 stack; 01891 stack=stack->next) { 01892 01893 if (stack->port == port) { 01894 01895 if (stack->blocked) { 01896 cb_log(0,port, "Port Blocked:%d L2:%d L1:%d\n", stack->blocked, stack->l2link, stack->l1link); 01897 return -1; 01898 } 01899 01900 if (stack->ptp ) { 01901 01902 if (stack->l1link && stack->l2link) { 01903 return 1; 01904 } else { 01905 cb_log(1,port, "Port Down L2:%d L1:%d\n", 01906 stack->l2link, stack->l1link); 01907 return 0; 01908 } 01909 } else { 01910 if ( !check || stack->l1link ) 01911 return 1; 01912 else { 01913 cb_log(1,port, "Port down PMP\n"); 01914 return 0; 01915 } 01916 } 01917 } 01918 } 01919 01920 return -1; 01921 }
void misdn_lib_reinit_nt_stack | ( | int | port | ) |
Definition at line 4952 of file isdn_lib.c.
References misdn_stack::blocked, misdn_stack::d_stid, find_stack_by_port(), glob_mgr, handle_event_nt(), misdn_stack::l2link, misdn_stack::lower_id, misdn_stack::mgr, misdn_lib::midev, misdn_lib_get_l1_up(), misdn_lib_get_l2_up(), misdn_stack::nst, misdn_stack::pri, misdn_stack::ptp, and misdn_stack::upper_id.
Referenced by handle_event_nt(), and misdn_lib_port_restart().
04953 { 04954 struct misdn_stack *stack=find_stack_by_port(port); 04955 04956 if (stack) { 04957 stack->l2link=0; 04958 stack->blocked=0; 04959 04960 cleanup_Isdnl3(&stack->nst); 04961 cleanup_Isdnl2(&stack->nst); 04962 04963 04964 memset(&stack->nst, 0, sizeof(net_stack_t)); 04965 memset(&stack->mgr, 0, sizeof(manager_t)); 04966 04967 stack->mgr.nst = &stack->nst; 04968 stack->nst.manager = &stack->mgr; 04969 04970 stack->nst.l3_manager = handle_event_nt; 04971 stack->nst.device = glob_mgr->midev; 04972 stack->nst.cardnr = port; 04973 stack->nst.d_stid = stack->d_stid; 04974 04975 stack->nst.feature = FEATURE_NET_HOLD; 04976 if (stack->ptp) 04977 stack->nst.feature |= FEATURE_NET_PTP; 04978 if (stack->pri) 04979 stack->nst.feature |= FEATURE_NET_CRLEN2 | FEATURE_NET_EXTCID; 04980 04981 stack->nst.l1_id = stack->lower_id; 04982 stack->nst.l2_id = stack->upper_id; 04983 04984 msg_queue_init(&stack->nst.down_queue); 04985 04986 Isdnl2Init(&stack->nst); 04987 Isdnl3Init(&stack->nst); 04988 04989 if (!stack->ptp) 04990 misdn_lib_get_l1_up(stack); 04991 misdn_lib_get_l2_up(stack); 04992 } 04993 }
void misdn_lib_release | ( | struct misdn_bchannel * | bc | ) |
Definition at line 1824 of file isdn_lib.c.
References misdn_stack::bc, 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().
01825 { 01826 int channel; 01827 struct misdn_stack *stack=get_stack_by_bc(bc); 01828 01829 if (!stack) { 01830 cb_log(1,0,"misdn_release: No Stack found\n"); 01831 return; 01832 } 01833 01834 channel = bc->channel; 01835 empty_bc(bc); 01836 clean_up_bc(bc); 01837 if (channel > 0) { 01838 empty_chan_in_stack(stack, channel); 01839 } 01840 bc->in_use=0; 01841 }
int misdn_lib_send_event | ( | struct misdn_bchannel * | bc, | |
enum event_e | event | |||
) |
Definition at line 3630 of file isdn_lib.c.
References misdn_stack::bc, 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, misdn_bchannel::evq, find_bc_by_confid(), find_free_chan_in_stack(), get_stack_by_bc(), glob_mgr, 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, 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(), handle_event_nt(), handle_frm(), handle_l1(), 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().
03631 { 03632 msg_t *msg; 03633 struct misdn_bchannel *bc2; 03634 struct misdn_bchannel *held_bc; 03635 struct misdn_stack *stack; 03636 int retval = 0; 03637 int channel; 03638 int tmpcause; 03639 int tmp_out_cause; 03640 03641 if (!bc) 03642 RETURN(-1,OUT_POST_UNLOCK); 03643 03644 stack = get_stack_by_bc(bc); 03645 if (!stack) { 03646 cb_log(0,bc->port, 03647 "SENDEVENT: no Stack for event:%s caller:\"%s\" <%s> dialed:%s \n", 03648 isdn_get_info(msgs_g, event, 0), 03649 bc->caller.name, 03650 bc->caller.number, 03651 bc->dialed.number); 03652 RETURN(-1,OUT); 03653 } 03654 03655 misdn_send_lock(bc); 03656 03657 03658 cb_log(6,stack->port,"SENDEVENT: stack->nt:%d stack->upperid:%x\n",stack->nt, stack->upper_id); 03659 03660 if ( stack->nt && !stack->l1link) { 03661 /** Queue Event **/ 03662 bc->evq=event; 03663 cb_log(1, stack->port, "Queueing Event %s because L1 is down (btw. Activating L1)\n", isdn_get_info(msgs_g, event, 0)); 03664 misdn_lib_get_l1_up(stack); 03665 RETURN(0,OUT); 03666 } 03667 03668 cb_log(1, stack->port, 03669 "I SEND:%s caller:\"%s\" <%s> dialed:%s pid:%d\n", 03670 isdn_get_info(msgs_g, event, 0), 03671 bc->caller.name, 03672 bc->caller.number, 03673 bc->dialed.number, 03674 bc->pid); 03675 cb_log(4, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state)); 03676 misdn_lib_log_ies(bc); 03677 03678 switch (event) { 03679 case EVENT_REGISTER: 03680 case EVENT_SETUP: 03681 if (create_process(glob_mgr->midev, bc) < 0) { 03682 cb_log(0, stack->port, " No free channel at the moment @ send_event\n"); 03683 03684 RETURN(-ENOCHAN,OUT); 03685 } 03686 break; 03687 03688 case EVENT_PROGRESS: 03689 case EVENT_ALERTING: 03690 case EVENT_PROCEEDING: 03691 case EVENT_SETUP_ACKNOWLEDGE: 03692 case EVENT_CONNECT: 03693 if (!stack->nt) 03694 break; 03695 03696 case EVENT_RETRIEVE_ACKNOWLEDGE: 03697 if (stack->nt) { 03698 if (bc->channel <=0 ) { /* else we have the channel already */ 03699 if (find_free_chan_in_stack(stack, bc, 0, 0)<0) { 03700 cb_log(0, stack->port, " No free channel at the moment\n"); 03701 /*FIXME: add disconnect*/ 03702 RETURN(-ENOCHAN,OUT); 03703 } 03704 } 03705 /* Its that i generate channels */ 03706 } 03707 03708 retval=setup_bc(bc); 03709 if (retval == -EINVAL) { 03710 cb_log(0,bc->port,"send_event: setup_bc failed\n"); 03711 } 03712 03713 if (misdn_cap_is_speech(bc->capability)) { 03714 if ((event==EVENT_CONNECT)||(event==EVENT_RETRIEVE_ACKNOWLEDGE)) { 03715 if ( *bc->crypt_key ) { 03716 cb_log(4, stack->port, 03717 " --> ENABLING BLOWFISH channel:%d caller%d:\"%s\" <%s> dialed%d:%s\n", 03718 bc->channel, 03719 bc->caller.number_type, 03720 bc->caller.name, 03721 bc->caller.number, 03722 bc->dialed.number_type, 03723 bc->dialed.number); 03724 03725 manager_ph_control_block(bc, BF_ENABLE_KEY, bc->crypt_key, strlen(bc->crypt_key) ); 03726 } 03727 03728 if (!bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0); 03729 manager_ec_enable(bc); 03730 03731 if (bc->txgain != 0) { 03732 cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain); 03733 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 03734 } 03735 03736 if ( bc->rxgain != 0 ) { 03737 cb_log(4, stack->port, "--> Changing rxgain to %d\n", bc->rxgain); 03738 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 03739 } 03740 } 03741 } 03742 break; 03743 03744 case EVENT_HOLD_ACKNOWLEDGE: 03745 held_bc = malloc(sizeof(struct misdn_bchannel)); 03746 if (!held_bc) { 03747 cb_log(0, bc->port, "Could not allocate held_bc!!!\n"); 03748 RETURN(-1,OUT); 03749 } 03750 03751 /* backup the bc and put it in storage */ 03752 *held_bc = *bc; 03753 held_bc->holded = 1; 03754 held_bc->channel = 0;/* A held call does not have a channel anymore. */ 03755 held_bc->channel_preselected = 0; 03756 held_bc->channel_found = 0; 03757 bc_state_change(held_bc, BCHAN_CLEANED); 03758 stack_holder_add(stack, held_bc); 03759 03760 /* kill the bridge and clean the real b-channel record */ 03761 if (stack->nt) { 03762 if (bc->bc_state == BCHAN_BRIDGED) { 03763 misdn_split_conf(bc,bc->conf_id); 03764 bc2 = find_bc_by_confid(bc->conf_id); 03765 if (!bc2) { 03766 cb_log(0,bc->port,"We have no second bc in bridge???\n"); 03767 } else { 03768 misdn_split_conf(bc2,bc->conf_id); 03769 } 03770 } 03771 03772 channel = bc->channel; 03773 03774 empty_bc(bc); 03775 clean_up_bc(bc); 03776 03777 if (channel>0) 03778 empty_chan_in_stack(stack,channel); 03779 03780 bc->in_use=0; 03781 } 03782 break; 03783 03784 /* finishing the channel eh ? */ 03785 case EVENT_DISCONNECT: 03786 if (!bc->need_disconnect) { 03787 cb_log(0, bc->port, " --> we have already sent DISCONNECT\n"); 03788 RETURN(-1,OUT); 03789 } 03790 03791 bc->need_disconnect=0; 03792 break; 03793 case EVENT_RELEASE: 03794 if (!bc->need_release) { 03795 cb_log(0, bc->port, " --> we have already sent RELEASE\n"); 03796 RETURN(-1,OUT); 03797 } 03798 bc->need_disconnect=0; 03799 bc->need_release=0; 03800 break; 03801 case EVENT_RELEASE_COMPLETE: 03802 if (!bc->need_release_complete) { 03803 cb_log(0, bc->port, " --> we have already sent RELEASE_COMPLETE\n"); 03804 RETURN(-1,OUT); 03805 } 03806 bc->need_disconnect=0; 03807 bc->need_release=0; 03808 bc->need_release_complete=0; 03809 03810 if (!stack->nt) { 03811 /* create cleanup in TE */ 03812 channel = bc->channel; 03813 tmpcause = bc->cause; 03814 tmp_out_cause = bc->out_cause; 03815 03816 empty_bc(bc); 03817 bc->cause=tmpcause; 03818 bc->out_cause=tmp_out_cause; 03819 clean_up_bc(bc); 03820 03821 if (channel>0) 03822 empty_chan_in_stack(stack,channel); 03823 03824 bc->in_use=0; 03825 } 03826 break; 03827 03828 case EVENT_CONNECT_ACKNOWLEDGE: 03829 if ( bc->nt || misdn_cap_is_speech(bc->capability)) { 03830 int retval=setup_bc(bc); 03831 if (retval == -EINVAL){ 03832 cb_log(0,bc->port,"send_event: setup_bc failed\n"); 03833 03834 } 03835 } 03836 03837 if (misdn_cap_is_speech(bc->capability)) { 03838 if ( !bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0); 03839 manager_ec_enable(bc); 03840 03841 if ( bc->txgain != 0 ) { 03842 cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain); 03843 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 03844 } 03845 if ( bc->rxgain != 0 ) { 03846 cb_log(4, stack->port, "--> Changing rxgain to %d\n", bc->rxgain); 03847 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 03848 } 03849 } 03850 break; 03851 03852 default: 03853 break; 03854 } 03855 03856 /* Later we should think about sending bchannel data directly to misdn. */ 03857 msg = isdn_msg_build_event(msgs_g, bc, event, stack->nt); 03858 if (!msg) { 03859 /* 03860 * The message was not built. 03861 * 03862 * NOTE: The only time that the message will fail to build 03863 * is because the requested FACILITY message is not supported. 03864 * A failed malloc() results in exit() being called. 03865 */ 03866 RETURN(-1, OUT); 03867 } else { 03868 msg_queue_tail(&stack->downqueue, msg); 03869 sem_post(&glob_mgr->new_msg); 03870 } 03871 03872 OUT: 03873 misdn_send_unlock(bc); 03874 03875 OUT_POST_UNLOCK: 03876 return retval; 03877 }
int misdn_lib_send_restart | ( | int | port, | |
int | channel | |||
) |
Definition at line 4111 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().
04112 { 04113 struct misdn_stack *stack=find_stack_by_port(port); 04114 struct misdn_bchannel dummybc; 04115 /*default is all channels*/ 04116 cb_log(0, port, "Sending Restarts on this port.\n"); 04117 04118 misdn_make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0); 04119 04120 /*default is all channels*/ 04121 if (channel <0) { 04122 dummybc.channel=-1; 04123 cb_log(0, port, "Restarting and all Interfaces\n"); 04124 misdn_lib_send_event(&dummybc, EVENT_RESTART); 04125 04126 return 0; 04127 } 04128 04129 /*if a channel is specified we restart only this one*/ 04130 if (channel >0) { 04131 int cnt; 04132 dummybc.channel=channel; 04133 cb_log(0, port, "Restarting and cleaning channel %d\n",channel); 04134 misdn_lib_send_event(&dummybc, EVENT_RESTART); 04135 /* clean up chan in stack, to be sure we don't think it's 04136 * in use anymore */ 04137 for (cnt=0; cnt<=stack->b_num; cnt++) { 04138 if (stack->bc[cnt].in_use && stack->bc[cnt].channel == channel) { 04139 empty_bc(&stack->bc[cnt]); 04140 clean_up_bc(&stack->bc[cnt]); 04141 stack->bc[cnt].in_use=0; 04142 } 04143 } 04144 } 04145 04146 return 0; 04147 }
void misdn_lib_send_tone | ( | struct misdn_bchannel * | bc, | |
enum tone_e | tone | |||
) |
Definition at line 4769 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_stack::bc, glob_mgr, manager_ph_control(), misdn_lib::midev, TONE_ALERTING, TONE_DIAL, TONE_HANGUP, and TONE_NONE.
Referenced by hanguptone_indicate().
04770 { 04771 char buf[mISDN_HEADER_LEN + 128] = ""; 04772 iframe_t *frm = (iframe_t*)buf; 04773 04774 switch(tone) { 04775 case TONE_DIAL: 04776 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_DIALTONE); 04777 break; 04778 04779 case TONE_ALERTING: 04780 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_RINGING); 04781 break; 04782 04783 case TONE_HANGUP: 04784 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_HANGUP); 04785 break; 04786 04787 case TONE_NONE: 04788 default: 04789 manager_ph_control(bc, TONE_PATT_OFF, TONE_GERMAN_HANGUP); 04790 } 04791 04792 frm->prim=DL_DATA|REQUEST; 04793 frm->addr=bc->addr|FLG_MSG_DOWN; 04794 frm->dinfo=0; 04795 frm->len=128; 04796 04797 mISDN_write(glob_mgr->midev, frm, mISDN_HEADER_LEN+frm->len, TIMEOUT_1SEC); 04798 }
void misdn_lib_setup_bc | ( | struct misdn_bchannel * | bc | ) |
Definition at line 1066 of file isdn_lib.c.
References misdn_stack::bc, clean_up_bc(), and setup_bc().
01067 { 01068 clean_up_bc(bc); 01069 setup_bc(bc); 01070 }
void misdn_lib_split_bridge | ( | struct misdn_bchannel * | bc1, | |
struct misdn_bchannel * | bc2 | |||
) |
Definition at line 4924 of file isdn_lib.c.
References bc_state2str(), BCHAN_BRIDGED, cb_log, misdn_bchannel::conf_id, and misdn_split_conf().
Referenced by misdn_bridge().
04925 { 04926 04927 struct misdn_bchannel *bc_list[]={ 04928 bc1,bc2,NULL 04929 }; 04930 struct misdn_bchannel **bc; 04931 04932 for (bc=bc_list; *bc; bc++) { 04933 if ( (*bc)->bc_state == BCHAN_BRIDGED){ 04934 misdn_split_conf( *bc, (*bc)->conf_id); 04935 } else { 04936 cb_log( 2, (*bc)->port, "BC not bridged (state:%s) so not splitting it\n",bc_state2str((*bc)->bc_state)); 04937 } 04938 } 04939 04940 }
void misdn_lib_tone_generator_start | ( | struct misdn_bchannel * | bc | ) |
Definition at line 2341 of file isdn_lib.c.
References misdn_bchannel::generate_tone.
Referenced by misdn_write().
02342 { 02343 bc->generate_tone=1; 02344 }
void misdn_lib_tone_generator_stop | ( | struct misdn_bchannel * | bc | ) |
Definition at line 2346 of file isdn_lib.c.
References misdn_bchannel::generate_tone.
Referenced by start_bc_tones(), and stop_indicate().
02347 { 02348 bc->generate_tone=0; 02349 }
int misdn_lib_tx2misdn_frm | ( | struct misdn_bchannel * | bc, | |
void * | data, | |||
int | len | |||
) |
Definition at line 4552 of file isdn_lib.c.
References misdn_bchannel::addr, misdn_stack::bc, 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().
04553 { 04554 struct misdn_stack *stack=get_stack_by_bc(bc); 04555 char buf[4096 + mISDN_HEADER_LEN]; 04556 iframe_t *frm = (iframe_t*)buf; 04557 int r; 04558 04559 switch (bc->bc_state) { 04560 case BCHAN_ACTIVATED: 04561 case BCHAN_BRIDGED: 04562 break; 04563 default: 04564 cb_log(3, bc->port, "BC not yet activated (state:%s)\n",bc_state2str(bc->bc_state)); 04565 return -1; 04566 } 04567 04568 frm->prim = DL_DATA|REQUEST; 04569 frm->dinfo = 0; 04570 frm->addr = bc->addr | FLG_MSG_DOWN ; 04571 04572 frm->len = len; 04573 memcpy(&buf[mISDN_HEADER_LEN], data,len); 04574 04575 if ( misdn_cap_is_speech(bc->capability) ) 04576 flip_buf_bits( &buf[mISDN_HEADER_LEN], len); 04577 else 04578 cb_log(6, stack->port, "Writing %d data bytes\n",len); 04579 04580 cb_log(9, stack->port, "Writing %d bytes 2 mISDN\n",len); 04581 r=mISDN_write(stack->midev, buf, frm->len + mISDN_HEADER_LEN, TIMEOUT_INFINIT); 04582 return 0; 04583 }
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(), manager_event_handler(), misdn_lib_send_restart(), and release_cr().
00078 { 00079 memset (dummybc,0,sizeof(struct misdn_bchannel)); 00080 dummybc->port=port; 00081 if (l3id==0) 00082 dummybc->l3_id = MISDN_ID_DUMMY; 00083 else 00084 dummybc->l3_id=l3id; 00085 00086 dummybc->nt=nt; 00087 dummybc->dummy=1; 00088 dummybc->channel=channel; 00089 }
enum event_response_e(*) cb_event(enum event_e event, struct misdn_bchannel *bc, void *user_data) |
Definition at line 28 of file isdn_lib.c.
Referenced by clear_l3(), do_tone(), handle_bchan(), handle_cr(), handle_event_nt(), handle_frm(), handle_l1(), handle_l2(), manager_clean_bc(), misdn_lib_init(), and set_channel().
int(*) cb_jb_empty(struct misdn_bchannel *bc, char *buffer, int len) |
void(*) cb_log(int level, int port, char *tmpl,...) |
Definition at line 30 of file isdn_lib.c.
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(), handle_event_nt(), handle_frm(), handle_frm_nt(), 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_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(), parse_facility(), parse_release_complete(), parse_restart(), parse_setup(), queue_cleanup_bc(), 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().