#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 623 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().
00623 { 00624 int i; 00625 00626 struct bchan_state_s { 00627 char *n; 00628 enum bchannel_state s; 00629 } states[] = { 00630 {"BCHAN_CLEANED", BCHAN_CLEANED }, 00631 {"BCHAN_EMPTY", BCHAN_EMPTY}, 00632 {"BCHAN_SETUP", BCHAN_SETUP}, 00633 {"BCHAN_SETUPED", BCHAN_SETUPED}, 00634 {"BCHAN_ACTIVE", BCHAN_ACTIVE}, 00635 {"BCHAN_ACTIVATED", BCHAN_ACTIVATED}, 00636 {"BCHAN_BRIDGE", BCHAN_BRIDGE}, 00637 {"BCHAN_BRIDGED", BCHAN_BRIDGED}, 00638 {"BCHAN_RELEASE", BCHAN_RELEASE}, 00639 {"BCHAN_RELEASED", BCHAN_RELEASED}, 00640 {"BCHAN_CLEAN", BCHAN_CLEAN}, 00641 {"BCHAN_CLEAN_REQUEST", BCHAN_CLEAN_REQUEST}, 00642 {"BCHAN_ERROR", BCHAN_ERROR} 00643 }; 00644 00645 for (i=0; i< sizeof(states)/sizeof(struct bchan_state_s); i++) 00646 if ( states[i].s == state) 00647 return states[i].n; 00648 00649 return "UNKNOWN"; 00650 }
void bc_state_change | ( | struct misdn_bchannel * | bc, | |
enum bchannel_state | state | |||
) |
Definition at line 652 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().
00653 { 00654 cb_log(5,bc->port,"BC_STATE_CHANGE: l3id:%x from:%s to:%s\n", 00655 bc->l3_id, 00656 bc_state2str(bc->bc_state), 00657 bc_state2str(state) ); 00658 00659 switch (state) { 00660 case BCHAN_ACTIVATED: 00661 if (bc->next_bc_state == BCHAN_BRIDGED) { 00662 misdn_join_conf(bc, bc->conf_id); 00663 bc->next_bc_state = BCHAN_EMPTY; 00664 return; 00665 } 00666 default: 00667 bc->bc_state=state; 00668 break; 00669 } 00670 }
void get_show_stack_details | ( | int | port, | |
char * | buf | |||
) |
Definition at line 170 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().
00171 { 00172 struct misdn_stack *stack = get_misdn_stack(); 00173 00174 for (; stack; stack = stack->next) { 00175 if (stack->port == port) { 00176 break; 00177 } 00178 } 00179 00180 if (stack) { 00181 sprintf(buf, "* Port %2d Type %s Prot. %s L2Link %s L1Link:%s Blocked:%d", 00182 stack->port, 00183 stack->nt ? "NT" : "TE", 00184 stack->ptp ? "PTP" : "PMP", 00185 stack->l2link ? "UP " : "DOWN", 00186 stack->l1link ? "UP " : "DOWN", 00187 stack->blocked); 00188 } else { 00189 buf[0] = 0; 00190 } 00191 }
void isdn_lib_stop_dtmf | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4628 of file isdn_lib.c.
References misdn_stack::bc, and manager_ph_control().
Referenced by process_ast_dsp().
04629 { 04630 manager_ph_control(bc, DTMF_TONE_STOP, 0); 04631 }
void isdn_lib_update_ec | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4616 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().
04617 { 04618 #ifdef MISDN_1_2 04619 if (*bc->pipeline) 04620 #else 04621 if (bc->ec_enable) 04622 #endif 04623 manager_ec_enable(bc); 04624 else 04625 manager_ec_disable(bc); 04626 }
void isdn_lib_update_rxgain | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4606 of file isdn_lib.c.
References misdn_stack::bc, manager_ph_control(), and misdn_bchannel::rxgain.
Referenced by process_ast_dsp().
04607 { 04608 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 04609 }
void isdn_lib_update_txgain | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4611 of file isdn_lib.c.
References misdn_stack::bc, manager_ph_control(), and misdn_bchannel::txgain.
Referenced by process_ast_dsp().
04612 { 04613 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 04614 }
void manager_bchannel_activate | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4495 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.
04496 { 04497 char buf[128]; 04498 04499 struct misdn_stack *stack=get_stack_by_bc(bc); 04500 04501 if (!stack) { 04502 cb_log(0, bc->port, "bchannel_activate: Stack not found !"); 04503 return ; 04504 } 04505 04506 /* we must activate if we are deactivated */ 04507 clear_ibuffer(bc->astbuf); 04508 04509 cb_log(5, stack->port, "$$$ Bchan Activated addr %x\n", bc->addr); 04510 04511 mISDN_write_frame(stack->midev, buf, bc->addr | FLG_MSG_DOWN, DL_ESTABLISH | REQUEST, 0,0, NULL, TIMEOUT_1SEC); 04512 04513 return ; 04514 }
void manager_bchannel_deactivate | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4517 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().
04518 { 04519 struct misdn_stack *stack=get_stack_by_bc(bc); 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 mISDN_write_frame(stack->midev, buf, bc->addr | FLG_MSG_DOWN, DL_RELEASE|REQUEST,0,0,NULL, TIMEOUT_1SEC); 04539 04540 clear_ibuffer(bc->astbuf); 04541 04542 bc_state_change(bc,BCHAN_RELEASE); 04543 04544 return; 04545 }
void manager_ec_disable | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4845 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().
04846 { 04847 struct misdn_stack *stack=get_stack_by_bc(bc); 04848 04849 cb_log(4, stack?stack->port:0," --> ec_disable\n"); 04850 04851 if (!misdn_cap_is_speech(bc->capability)) { 04852 cb_log(1, stack?stack->port:0, " --> no speech? cannot disable EC\n"); 04853 return; 04854 } 04855 04856 #ifdef MISDN_1_2 04857 manager_ph_control_block(bc, PIPELINE_CFG, "", 0); 04858 #else 04859 if ( ! bc->ec_enable) { 04860 cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n"); 04861 manager_ph_control(bc, ECHOCAN_OFF, 0); 04862 } 04863 #endif 04864 }
void manager_ec_enable | ( | struct misdn_bchannel * | bc | ) |
Definition at line 4796 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().
04797 { 04798 struct misdn_stack *stack=get_stack_by_bc(bc); 04799 04800 cb_log(4, stack?stack->port:0,"ec_enable\n"); 04801 04802 if (!misdn_cap_is_speech(bc->capability)) { 04803 cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n"); 04804 } else { 04805 04806 #ifdef MISDN_1_2 04807 if (*bc->pipeline) { 04808 cb_log(3, stack?stack->port:0,"Sending Control PIPELINE_CFG %s\n",bc->pipeline); 04809 manager_ph_control_block(bc, PIPELINE_CFG, bc->pipeline, strlen(bc->pipeline) + 1); 04810 } 04811 #else 04812 int ec_arr[2]; 04813 04814 if (bc->ec_enable) { 04815 cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d\n",bc->ec_deftaps); 04816 04817 switch (bc->ec_deftaps) { 04818 case 4: 04819 case 8: 04820 case 16: 04821 case 32: 04822 case 64: 04823 case 128: 04824 case 256: 04825 case 512: 04826 case 1024: 04827 cb_log(4, stack->port, "Taps is %d\n",bc->ec_deftaps); 04828 break; 04829 default: 04830 cb_log(0, stack->port, "Taps should be power of 2\n"); 04831 bc->ec_deftaps=128; 04832 } 04833 04834 ec_arr[0]=bc->ec_deftaps; 04835 ec_arr[1]=0; 04836 04837 manager_ph_control_block(bc, ECHOCAN_ON, ec_arr, sizeof(ec_arr)); 04838 } 04839 #endif 04840 } 04841 }
char* manager_isdn_get_info | ( | enum event_e | event | ) |
Definition at line 4490 of file isdn_lib.c.
References isdn_get_info(), and msgs_g.
Referenced by cb_events().
04491 { 04492 return isdn_get_info(msgs_g , event, 0); 04493 }
void manager_ph_control | ( | struct misdn_bchannel * | bc, | |
int | c1, | |||
int | c2 | |||
) |
Definition at line 4585 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().
04586 { 04587 unsigned char buffer[mISDN_HEADER_LEN+2*sizeof(int)]; 04588 iframe_t *ctrl = (iframe_t *)buffer; /* preload data */ 04589 unsigned int *d = (unsigned int*)&ctrl->data.p; 04590 /*struct misdn_stack *stack=get_stack_by_bc(bc);*/ 04591 04592 cb_log(4,bc->port,"ph_control: c1:%x c2:%x\n",c1,c2); 04593 04594 ctrl->prim = PH_CONTROL | REQUEST; 04595 ctrl->addr = bc->addr | FLG_MSG_DOWN; 04596 ctrl->dinfo = 0; 04597 ctrl->len = sizeof(unsigned int)*2; 04598 *d++ = c1; 04599 *d++ = c2; 04600 mISDN_write(glob_mgr->midev, ctrl, mISDN_HEADER_LEN+ctrl->len, TIMEOUT_1SEC); 04601 }
int misdn_cap_is_speech | ( | int | cap | ) |
Poor mans version
Definition at line 442 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().
00444 { 00445 if ( (cap != INFO_CAPABILITY_DIGITAL_UNRESTRICTED) && 00446 (cap != INFO_CAPABILITY_DIGITAL_RESTRICTED) ) return 1; 00447 return 0; 00448 }
void misdn_dump_chanlist | ( | void | ) |
Definition at line 489 of file isdn_lib.c.
References dump_chan_list(), get_misdn_stack(), and misdn_stack::next.
Referenced by handle_cli_misdn_show_channels().
00490 { 00491 struct misdn_stack *stack=get_misdn_stack(); 00492 for ( ; stack; stack=stack->next) { 00493 dump_chan_list(stack); 00494 } 00495 00496 }
int misdn_inband_avail | ( | struct misdn_bchannel * | bc | ) |
Definition at line 450 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().
00451 { 00452 00453 if (!bc->early_bconnect) { 00454 /* We have opted to never receive any available inband recorded messages */ 00455 return 0; 00456 } 00457 00458 switch (bc->progress_indicator) { 00459 case INFO_PI_INBAND_AVAILABLE: 00460 case INFO_PI_CALL_NOT_E2E_ISDN: 00461 case INFO_PI_CALLED_NOT_ISDN: 00462 return 1; 00463 default: 00464 return 0; 00465 } 00466 return 0; 00467 }
void misdn_lib_bridge | ( | struct misdn_bchannel * | bc1, | |
struct misdn_bchannel * | bc2 | |||
) |
Definition at line 4896 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().
04897 { 04898 int conf_id = bc1->pid + 1; 04899 struct misdn_bchannel *bc_list[] = { bc1, bc2, NULL }; 04900 struct misdn_bchannel **bc; 04901 04902 cb_log(4, bc1->port, "I Send: BRIDGE from:%d to:%d\n",bc1->port,bc2->port); 04903 04904 for (bc=bc_list; *bc; bc++) { 04905 (*bc)->conf_id=conf_id; 04906 cb_log(4, (*bc)->port, " --> bc_addr:%x\n",(*bc)->addr); 04907 04908 switch((*bc)->bc_state) { 04909 case BCHAN_ACTIVATED: 04910 misdn_join_conf(*bc,conf_id); 04911 break; 04912 default: 04913 bc_next_state_change(*bc,BCHAN_BRIDGED); 04914 break; 04915 } 04916 } 04917 }
void misdn_lib_destroy | ( | void | ) |
Definition at line 4457 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().
04458 { 04459 struct misdn_stack *help; 04460 int i; 04461 04462 for ( help=glob_mgr->stack_list; help; help=help->next ) { 04463 for(i=0;i<=help->b_num; i++) { 04464 char buf[1024]; 04465 mISDN_write_frame(help->midev, buf, help->bc[i].addr, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); 04466 help->bc[i].addr = 0; 04467 } 04468 cb_log (1, help->port, "Destroying this port.\n"); 04469 stack_destroy(help); 04470 } 04471 04472 if (global_state == MISDN_INITIALIZED) { 04473 cb_log(4, 0, "Killing Handler Thread\n"); 04474 if ( pthread_cancel(glob_mgr->event_handler_thread) == 0 ) { 04475 cb_log(4, 0, "Joining Handler Thread\n"); 04476 pthread_join(glob_mgr->event_handler_thread, NULL); 04477 } 04478 04479 cb_log(4, 0, "Killing Main Thread\n"); 04480 if ( pthread_cancel(glob_mgr->event_thread) == 0 ) { 04481 cb_log(4, 0, "Joining Main Thread\n"); 04482 pthread_join(glob_mgr->event_thread, NULL); 04483 } 04484 } 04485 04486 cb_log(1, 0, "Closing mISDN device\n"); 04487 te_lib_destroy(glob_mgr->midev); 04488 }
void misdn_lib_echo | ( | struct misdn_bchannel * | bc, | |
int | onoff | |||
) |
Definition at line 4939 of file isdn_lib.c.
References cb_log, manager_ph_control(), and misdn_bchannel::port.
04940 { 04941 cb_log(3,bc->port, " --> ECHO %s\n", onoff?"ON":"OFF"); 04942 manager_ph_control(bc, onoff?CMX_ECHO_ON:CMX_ECHO_OFF, 0); 04943 }
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 4748 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().
04749 { 04750 struct misdn_bchannel *bc; 04751 struct misdn_stack *stack; 04752 04753 bc = NULL; 04754 for (stack = get_misdn_stack(); stack; stack = stack->next) { 04755 if (stack->port == port) { 04756 bc = stack_holder_find(stack, l3_id); 04757 break; 04758 } 04759 } 04760 04761 return bc; 04762 }
struct misdn_bchannel* misdn_lib_get_free_bc | ( | int | port, | |
int | channel, | |||
int | inout, | |||
int | dec | |||
) |
Definition at line 3313 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().
03314 { 03315 struct misdn_stack *stack; 03316 int i; 03317 int maxnum; 03318 03319 if (channel < 0 || channel > MAX_BCHANS) { 03320 cb_log(0, port, "Requested channel out of bounds (%d)\n", channel); 03321 return NULL; 03322 } 03323 03324 /* Find the port stack structure */ 03325 stack = find_stack_by_port(port); 03326 if (!stack) { 03327 cb_log(0, port, "Port is not configured (%d)\n", port); 03328 return NULL; 03329 } 03330 03331 if (stack->blocked) { 03332 cb_log(0, port, "Port is blocked\n"); 03333 return NULL; 03334 } 03335 03336 pthread_mutex_lock(&stack->st_lock); 03337 if (channel > 0) { 03338 if (channel <= stack->b_num) { 03339 for (i = 0; i < stack->b_num; i++) { 03340 if (stack->bc[i].channel == channel) { 03341 if (test_inuse(&stack->bc[i])) { 03342 pthread_mutex_unlock(&stack->st_lock); 03343 cb_log(0, port, "Requested channel:%d on port:%d is already in use\n", channel, port); 03344 return NULL; 03345 } else { 03346 prepare_bc(&stack->bc[i], channel); 03347 pthread_mutex_unlock(&stack->st_lock); 03348 return &stack->bc[i]; 03349 } 03350 } 03351 } 03352 } else { 03353 pthread_mutex_unlock(&stack->st_lock); 03354 cb_log(0, port, "Requested channel:%d is out of bounds on port:%d\n", channel, port); 03355 return NULL; 03356 } 03357 } 03358 03359 /* Note: channel == 0 here */ 03360 maxnum = (inout && !stack->pri && !stack->ptp) ? stack->b_num + 1 : stack->b_num; 03361 if (dec) { 03362 for (i = maxnum - 1; i >= 0; --i) { 03363 if (!test_inuse(&stack->bc[i])) { 03364 /* 3. channel on bri means CW*/ 03365 if (!stack->pri && i == stack->b_num) { 03366 stack->bc[i].cw = 1; 03367 } 03368 03369 prepare_bc(&stack->bc[i], channel); 03370 stack->bc[i].dec = 1; 03371 pthread_mutex_unlock(&stack->st_lock); 03372 return &stack->bc[i]; 03373 } 03374 } 03375 } else { 03376 for (i = 0; i < maxnum; ++i) { 03377 if (!test_inuse(&stack->bc[i])) { 03378 /* 3. channel on bri means CW */ 03379 if (!stack->pri && i == stack->b_num) { 03380 stack->bc[i].cw = 1; 03381 } 03382 03383 prepare_bc(&stack->bc[i], channel); 03384 pthread_mutex_unlock(&stack->st_lock); 03385 return &stack->bc[i]; 03386 } 03387 } 03388 } 03389 pthread_mutex_unlock(&stack->st_lock); 03390 03391 cb_log(1, port, "There is no free channel on port (%d)\n", port); 03392 return NULL; 03393 }
int misdn_lib_get_maxchans | ( | int | port | ) |
Definition at line 139 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, misdn_stack::port, and misdn_stack::pri.
Referenced by misdn_request().
00140 { 00141 struct misdn_stack *stack=get_misdn_stack(); 00142 for ( ; stack; stack=stack->next) { 00143 if (stack->port == port) { 00144 if (stack->pri) 00145 return 30; 00146 else 00147 return 2; 00148 } 00149 } 00150 return -1; 00151 }
int misdn_lib_get_port_down | ( | int | port | ) |
Definition at line 1870 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().
01871 { /* Pull Down L1 */ 01872 struct misdn_stack *stack; 01873 for (stack=glob_mgr->stack_list; 01874 stack; 01875 stack=stack->next) { 01876 if (stack->port == port) { 01877 if (stack->l2link) 01878 misdn_lib_get_l2_down(stack); 01879 misdn_lib_get_l1_down(stack); 01880 return 0; 01881 } 01882 } 01883 return 0; 01884 }
int misdn_lib_get_port_info | ( | int | port | ) |
Definition at line 4046 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.
04047 { 04048 msg_t *msg=alloc_msg(MAX_MSG_SIZE); 04049 iframe_t *frm; 04050 struct misdn_stack *stack=find_stack_by_port(port); 04051 if (!msg) { 04052 cb_log(0, port, "misdn_lib_get_port_info: alloc_msg failed!\n"); 04053 return -1; 04054 } 04055 frm=(iframe_t*)msg->data; 04056 if (!stack ) { 04057 cb_log(0, port, "There is no Stack for this port.\n"); 04058 return -1; 04059 } 04060 /* activate bchannel */ 04061 frm->prim = CC_STATUS_ENQUIRY | REQUEST; 04062 04063 frm->addr = stack->upper_id| FLG_MSG_DOWN; 04064 04065 frm->dinfo = 0; 04066 frm->len = 0; 04067 04068 msg_queue_tail(&glob_mgr->activatequeue, msg); 04069 sem_post(&glob_mgr->new_msg); 04070 04071 04072 return 0; 04073 }
int misdn_lib_get_port_up | ( | int | port | ) |
Definition at line 1848 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().
01849 { /* Pull Up L1 */ 01850 struct misdn_stack *stack; 01851 01852 for (stack=glob_mgr->stack_list; 01853 stack; 01854 stack=stack->next) { 01855 01856 if (stack->port == port) { 01857 01858 if (!stack->l1link) 01859 misdn_lib_get_l1_up(stack); 01860 if (!stack->l2link) 01861 misdn_lib_get_l2_up(stack); 01862 01863 return 0; 01864 } 01865 } 01866 return 0; 01867 }
int misdn_lib_init | ( | char * | portlist, | |
struct misdn_lib_iface * | iface, | |||
void * | user_data | |||
) |
Definition at line 4341 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().
04342 { 04343 struct misdn_lib *mgr=calloc(1, sizeof(struct misdn_lib)); 04344 char *tok, *tokb; 04345 char plist[1024]; 04346 int midev; 04347 int port_count=0; 04348 04349 cb_log = iface->cb_log; 04350 cb_event = iface->cb_event; 04351 cb_jb_empty = iface->cb_jb_empty; 04352 04353 glob_mgr = mgr; 04354 04355 msg_init(); 04356 04357 misdn_lib_nt_debug_init(0,NULL); 04358 04359 if (!portlist || (*portlist == 0) ) return 1; 04360 04361 init_flip_bits(); 04362 04363 { 04364 strncpy(plist,portlist, 1024); 04365 plist[1023] = 0; 04366 } 04367 04368 memcpy(tone_425_flip,tone_425,TONE_425_SIZE); 04369 flip_buf_bits(tone_425_flip,TONE_425_SIZE); 04370 04371 memcpy(tone_silence_flip,tone_SILENCE,TONE_SILENCE_SIZE); 04372 flip_buf_bits(tone_silence_flip,TONE_SILENCE_SIZE); 04373 04374 midev=te_lib_init(); 04375 mgr->midev=midev; 04376 04377 port_count=mISDN_get_stack_count(midev); 04378 04379 msg_queue_init(&mgr->activatequeue); 04380 04381 if (sem_init(&mgr->new_msg, 1, 0)<0) 04382 sem_init(&mgr->new_msg, 0, 0); 04383 04384 for (tok=strtok_r(plist," ,",&tokb ); 04385 tok; 04386 tok=strtok_r(NULL," ,",&tokb)) { 04387 int port = atoi(tok); 04388 struct misdn_stack *stack; 04389 struct misdn_stack *help; 04390 int ptp=0; 04391 int i; 04392 int r; 04393 04394 if (strstr(tok, "ptp")) 04395 ptp=1; 04396 04397 if (port > port_count) { 04398 cb_log(0, port, "Couldn't Initialize this port since we have only %d ports\n", port_count); 04399 exit(1); 04400 } 04401 04402 stack = stack_init(midev, port, ptp); 04403 if (!stack) { 04404 perror("stack_init"); 04405 exit(1); 04406 } 04407 04408 /* Initialize the B channel records for real B channels. */ 04409 for (i = 0; i <= stack->b_num; i++) { 04410 r = init_bc(stack, &stack->bc[i], stack->midev, port, i); 04411 if (r < 0) { 04412 cb_log(0, port, "Got Err @ init_bc :%d\n", r); 04413 exit(1); 04414 } 04415 } 04416 #if defined(AST_MISDN_ENHANCEMENTS) 04417 /* Initialize the B channel records for REGISTER signaling links. */ 04418 for (i = MAX_BCHANS + 1; i < ARRAY_LEN(stack->bc); ++i) { 04419 r = init_bc(stack, &stack->bc[i], stack->midev, port, i); 04420 if (r < 0) { 04421 cb_log(0, port, "Got Err @ init_bc :%d\n", r); 04422 exit(1); 04423 } 04424 stack->bc[i].is_register_pool = 1; 04425 } 04426 #endif /* defined(AST_MISDN_ENHANCEMENTS) */ 04427 04428 /* Add the new stack to the end of the list */ 04429 help = mgr->stack_list; 04430 if (!help) { 04431 mgr->stack_list = stack; 04432 } else { 04433 while (help->next) { 04434 help = help->next; 04435 } 04436 help->next = stack; 04437 } 04438 } 04439 04440 if (sem_init(&handler_started, 1, 0)<0) 04441 sem_init(&handler_started, 0, 0); 04442 04443 cb_log(8, 0, "Starting Event Handler\n"); 04444 pthread_create( &mgr->event_handler_thread, NULL,(void*)manager_event_handler, mgr); 04445 04446 sem_wait(&handler_started) ; 04447 cb_log(8, 0, "Starting Event Catcher\n"); 04448 pthread_create( &mgr->event_thread, NULL, (void*)misdn_lib_isdn_event_catcher, mgr); 04449 04450 cb_log(8, 0, "Event Catcher started\n"); 04451 04452 global_state= MISDN_INITIALIZED; 04453 04454 return (mgr == NULL); 04455 }
int misdn_lib_is_port_blocked | ( | int | port | ) |
Definition at line 119 of file isdn_lib.c.
References misdn_stack::blocked, get_misdn_stack(), misdn_stack::next, and misdn_stack::port.
00120 { 00121 struct misdn_stack *stack=get_misdn_stack(); 00122 for ( ; stack; stack=stack->next) { 00123 if (stack->port == port) { 00124 return stack->blocked; 00125 } 00126 } 00127 return -1; 00128 }
int misdn_lib_is_ptp | ( | int | port | ) |
Definition at line 130 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().
00131 { 00132 struct misdn_stack *stack=get_misdn_stack(); 00133 for ( ; stack; stack=stack->next) { 00134 if (stack->port == port) return stack->ptp; 00135 } 00136 return -1; 00137 }
void misdn_lib_isdn_l1watcher | ( | int | port | ) |
Definition at line 3152 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().
03153 { 03154 struct misdn_stack *stack; 03155 03156 for (stack = glob_mgr->stack_list; stack && (stack->port != port); stack = stack->next) 03157 ; 03158 03159 if (stack) { 03160 cb_log(4, port, "Checking L1 State\n"); 03161 if (!stack->l1link) { 03162 cb_log(4, port, "L1 State Down, trying to get it up again\n"); 03163 misdn_lib_get_short_status(stack); 03164 misdn_lib_get_l1_up(stack); 03165 misdn_lib_get_l2_up(stack); 03166 } 03167 } 03168 }
void misdn_lib_log_ies | ( | struct misdn_bchannel * | bc | ) |
Definition at line 3539 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().
03540 { 03541 struct misdn_stack *stack; 03542 03543 if (!bc) return; 03544 03545 stack = get_stack_by_bc(bc); 03546 03547 if (!stack) return; 03548 03549 cb_log(2, stack->port, 03550 " --> channel:%d mode:%s cause:%d ocause:%d\n", 03551 bc->channel, 03552 stack->nt ? "NT" : "TE", 03553 bc->cause, 03554 bc->out_cause); 03555 03556 cb_log(2, stack->port, 03557 " --> info_dad:%s dialed numtype:%d plan:%d\n", 03558 bc->info_dad, 03559 bc->dialed.number_type, 03560 bc->dialed.number_plan); 03561 03562 cb_log(2, stack->port, 03563 " --> caller:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03564 bc->caller.name, 03565 bc->caller.number, 03566 bc->caller.number_type, 03567 bc->caller.number_plan, 03568 bc->caller.presentation, 03569 bc->caller.screening); 03570 03571 cb_log(2, stack->port, 03572 " --> redirecting-from:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03573 bc->redirecting.from.name, 03574 bc->redirecting.from.number, 03575 bc->redirecting.from.number_type, 03576 bc->redirecting.from.number_plan, 03577 bc->redirecting.from.presentation, 03578 bc->redirecting.from.screening); 03579 cb_log(2, stack->port, 03580 " --> redirecting-to:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03581 bc->redirecting.to.name, 03582 bc->redirecting.to.number, 03583 bc->redirecting.to.number_type, 03584 bc->redirecting.to.number_plan, 03585 bc->redirecting.to.presentation, 03586 bc->redirecting.to.screening); 03587 cb_log(2, stack->port, 03588 " --> redirecting reason:%d count:%d\n", 03589 bc->redirecting.reason, 03590 bc->redirecting.count); 03591 03592 cb_log(2, stack->port, 03593 " --> connected:\"%s\" <%s> type:%d plan:%d pres:%d screen:%d\n", 03594 bc->connected.name, 03595 bc->connected.number, 03596 bc->connected.number_type, 03597 bc->connected.number_plan, 03598 bc->connected.presentation, 03599 bc->connected.screening); 03600 03601 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); 03602 03603 cb_log(4, stack->port, " --> set_pres:%d pres:%d\n", bc->set_presentation, bc->presentation); 03604 03605 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); 03606 03607 cb_log(4, stack->port, " --> facility in:%s out:%s\n", fac2str(bc->fac_in.Function), fac2str(bc->fac_out.Function)); 03608 03609 cb_log(5, stack->port, " --> urate:%d rate:%d mode:%d user1:%d\n", bc->urate, bc->rate, bc->mode,bc->user1); 03610 03611 cb_log(5, stack->port, " --> bc:%p h:%d sh:%d\n", bc, bc->holded, bc->stack_holder); 03612 }
int misdn_lib_maxports_get | ( | void | ) |
Definition at line 4292 of file isdn_lib.c.
Referenced by load_module().
04293 { 04294 /* BE AWARE WE HAVE NO cb_log() HERE! */ 04295 04296 int i = mISDN_open(); 04297 int max=0; 04298 04299 if (i<0) 04300 return -1; 04301 04302 max = mISDN_get_stack_count(i); 04303 04304 mISDN_close(i); 04305 04306 return max; 04307 }
void misdn_lib_nt_debug_init | ( | int | flags, | |
char * | file | |||
) |
Definition at line 4322 of file isdn_lib.c.
References f.
Referenced by load_module(), and misdn_lib_init().
04323 { 04324 static int init=0; 04325 char *f; 04326 04327 if (!flags) 04328 f=NULL; 04329 else 04330 f=file; 04331 04332 if (!init) { 04333 debug_init( flags , f, f, f); 04334 init=1; 04335 } else { 04336 debug_close(); 04337 debug_init( flags , f, f, f); 04338 } 04339 }
void misdn_lib_nt_keepcalls | ( | int | kc | ) |
Definition at line 4310 of file isdn_lib.c.
References get_misdn_stack(), misdn_stack::next, and misdn_stack::nst.
Referenced by load_module().
04311 { 04312 #ifdef FEATURE_NET_KEEPCALLS 04313 if (kc) { 04314 struct misdn_stack *stack=get_misdn_stack(); 04315 for ( ; stack; stack=stack->next) { 04316 stack->nst.feature |= FEATURE_NET_KEEPCALLS; 04317 } 04318 } 04319 #endif 04320 }
int misdn_lib_pid_restart | ( | int | pid | ) |
int misdn_lib_port_block | ( | int | port | ) |
Definition at line 93 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().
00094 { 00095 struct misdn_stack *stack=get_misdn_stack(); 00096 for ( ; stack; stack=stack->next) { 00097 if (stack->port == port) { 00098 stack->blocked=1; 00099 return 0; 00100 } 00101 } 00102 return -1; 00103 00104 }
int misdn_lib_port_is_nt | ( | int | port | ) |
Definition at line 67 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().
00068 { 00069 struct misdn_stack *stack=get_misdn_stack(); 00070 for ( ; stack; stack=stack->next) { 00071 if (stack->port == port) { 00072 return stack->nt; 00073 } 00074 } 00075 00076 return -1; 00077 }
int misdn_lib_port_is_pri | ( | int | port | ) |
Definition at line 55 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().
00056 { 00057 struct misdn_stack *stack=get_misdn_stack(); 00058 for ( ; stack; stack=stack->next) { 00059 if (stack->port == port) { 00060 return stack->pri; 00061 } 00062 } 00063 00064 return -1; 00065 }
int misdn_lib_port_restart | ( | int | port | ) |
int misdn_lib_port_unblock | ( | int | port | ) |
Definition at line 106 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().
00107 { 00108 struct misdn_stack *stack=get_misdn_stack(); 00109 for ( ; stack; stack=stack->next) { 00110 if (stack->port == port) { 00111 stack->blocked=0; 00112 return 0; 00113 } 00114 } 00115 return -1; 00116 00117 }
int misdn_lib_port_up | ( | int | port, | |
int | notcheck | |||
) |
Definition at line 1886 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().
01887 { 01888 struct misdn_stack *stack; 01889 01890 01891 for (stack=glob_mgr->stack_list; 01892 stack; 01893 stack=stack->next) { 01894 01895 if (stack->port == port) { 01896 01897 if (stack->blocked) { 01898 cb_log(0,port, "Port Blocked:%d L2:%d L1:%d\n", stack->blocked, stack->l2link, stack->l1link); 01899 return -1; 01900 } 01901 01902 if (stack->ptp ) { 01903 01904 if (stack->l1link && stack->l2link) { 01905 return 1; 01906 } else { 01907 cb_log(1,port, "Port Down L2:%d L1:%d\n", 01908 stack->l2link, stack->l1link); 01909 return 0; 01910 } 01911 } else { 01912 if ( !check || stack->l1link ) 01913 return 1; 01914 else { 01915 cb_log(1,port, "Port down PMP\n"); 01916 return 0; 01917 } 01918 } 01919 } 01920 } 01921 01922 return -1; 01923 }
void misdn_lib_reinit_nt_stack | ( | int | port | ) |
Definition at line 4947 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().
04948 { 04949 struct misdn_stack *stack=find_stack_by_port(port); 04950 04951 if (stack) { 04952 stack->l2link=0; 04953 stack->blocked=0; 04954 04955 cleanup_Isdnl3(&stack->nst); 04956 cleanup_Isdnl2(&stack->nst); 04957 04958 04959 memset(&stack->nst, 0, sizeof(net_stack_t)); 04960 memset(&stack->mgr, 0, sizeof(manager_t)); 04961 04962 stack->mgr.nst = &stack->nst; 04963 stack->nst.manager = &stack->mgr; 04964 04965 stack->nst.l3_manager = handle_event_nt; 04966 stack->nst.device = glob_mgr->midev; 04967 stack->nst.cardnr = port; 04968 stack->nst.d_stid = stack->d_stid; 04969 04970 stack->nst.feature = FEATURE_NET_HOLD; 04971 if (stack->ptp) 04972 stack->nst.feature |= FEATURE_NET_PTP; 04973 if (stack->pri) 04974 stack->nst.feature |= FEATURE_NET_CRLEN2 | FEATURE_NET_EXTCID; 04975 04976 stack->nst.l1_id = stack->lower_id; 04977 stack->nst.l2_id = stack->upper_id; 04978 04979 msg_queue_init(&stack->nst.down_queue); 04980 04981 Isdnl2Init(&stack->nst); 04982 Isdnl3Init(&stack->nst); 04983 04984 if (!stack->ptp) 04985 misdn_lib_get_l1_up(stack); 04986 misdn_lib_get_l2_up(stack); 04987 } 04988 }
void misdn_lib_release | ( | struct misdn_bchannel * | bc | ) |
Definition at line 1826 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().
01827 { 01828 int channel; 01829 struct misdn_stack *stack=get_stack_by_bc(bc); 01830 01831 if (!stack) { 01832 cb_log(1,0,"misdn_release: No Stack found\n"); 01833 return; 01834 } 01835 01836 channel = bc->channel; 01837 empty_bc(bc); 01838 clean_up_bc(bc); 01839 if (channel > 0) { 01840 empty_chan_in_stack(stack, channel); 01841 } 01842 bc->in_use=0; 01843 }
int misdn_lib_send_event | ( | struct misdn_bchannel * | bc, | |
enum event_e | event | |||
) |
Definition at line 3631 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().
03632 { 03633 msg_t *msg; 03634 struct misdn_bchannel *bc2; 03635 struct misdn_bchannel *held_bc; 03636 struct misdn_stack *stack; 03637 int retval = 0; 03638 int channel; 03639 int tmpcause; 03640 int tmp_out_cause; 03641 03642 if (!bc) 03643 RETURN(-1,OUT_POST_UNLOCK); 03644 03645 stack = get_stack_by_bc(bc); 03646 if (!stack) { 03647 cb_log(0,bc->port, 03648 "SENDEVENT: no Stack for event:%s caller:\"%s\" <%s> dialed:%s \n", 03649 isdn_get_info(msgs_g, event, 0), 03650 bc->caller.name, 03651 bc->caller.number, 03652 bc->dialed.number); 03653 RETURN(-1,OUT); 03654 } 03655 03656 misdn_send_lock(bc); 03657 03658 03659 cb_log(6,stack->port,"SENDEVENT: stack->nt:%d stack->upperid:%x\n",stack->nt, stack->upper_id); 03660 03661 if ( stack->nt && !stack->l1link) { 03662 /** Queue Event **/ 03663 bc->evq=event; 03664 cb_log(1, stack->port, "Queueing Event %s because L1 is down (btw. Activating L1)\n", isdn_get_info(msgs_g, event, 0)); 03665 misdn_lib_get_l1_up(stack); 03666 RETURN(0,OUT); 03667 } 03668 03669 cb_log(1, stack->port, 03670 "I SEND:%s caller:\"%s\" <%s> dialed:%s pid:%d\n", 03671 isdn_get_info(msgs_g, event, 0), 03672 bc->caller.name, 03673 bc->caller.number, 03674 bc->dialed.number, 03675 bc->pid); 03676 cb_log(4, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state)); 03677 misdn_lib_log_ies(bc); 03678 03679 switch (event) { 03680 case EVENT_REGISTER: 03681 case EVENT_SETUP: 03682 if (create_process(glob_mgr->midev, bc) < 0) { 03683 cb_log(0, stack->port, " No free channel at the moment @ send_event\n"); 03684 03685 RETURN(-ENOCHAN,OUT); 03686 } 03687 break; 03688 03689 case EVENT_PROGRESS: 03690 case EVENT_ALERTING: 03691 case EVENT_PROCEEDING: 03692 case EVENT_SETUP_ACKNOWLEDGE: 03693 case EVENT_CONNECT: 03694 if (!stack->nt) 03695 break; 03696 03697 case EVENT_RETRIEVE_ACKNOWLEDGE: 03698 if (stack->nt) { 03699 if (bc->channel <=0 ) { /* else we have the channel already */ 03700 if (find_free_chan_in_stack(stack, bc, 0, 0)<0) { 03701 cb_log(0, stack->port, " No free channel at the moment\n"); 03702 /*FIXME: add disconnect*/ 03703 RETURN(-ENOCHAN,OUT); 03704 } 03705 } 03706 /* Its that i generate channels */ 03707 } 03708 03709 retval=setup_bc(bc); 03710 if (retval == -EINVAL) { 03711 cb_log(0,bc->port,"send_event: setup_bc failed\n"); 03712 } 03713 03714 if (misdn_cap_is_speech(bc->capability)) { 03715 if ((event==EVENT_CONNECT)||(event==EVENT_RETRIEVE_ACKNOWLEDGE)) { 03716 if ( *bc->crypt_key ) { 03717 cb_log(4, stack->port, 03718 " --> ENABLING BLOWFISH channel:%d caller%d:\"%s\" <%s> dialed%d:%s\n", 03719 bc->channel, 03720 bc->caller.number_type, 03721 bc->caller.name, 03722 bc->caller.number, 03723 bc->dialed.number_type, 03724 bc->dialed.number); 03725 03726 manager_ph_control_block(bc, BF_ENABLE_KEY, bc->crypt_key, strlen(bc->crypt_key) ); 03727 } 03728 03729 if (!bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0); 03730 manager_ec_enable(bc); 03731 03732 if (bc->txgain != 0) { 03733 cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain); 03734 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 03735 } 03736 03737 if ( bc->rxgain != 0 ) { 03738 cb_log(4, stack->port, "--> Changing rxgain to %d\n", bc->rxgain); 03739 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 03740 } 03741 } 03742 } 03743 break; 03744 03745 case EVENT_HOLD_ACKNOWLEDGE: 03746 held_bc = malloc(sizeof(struct misdn_bchannel)); 03747 if (!held_bc) { 03748 cb_log(0, bc->port, "Could not allocate held_bc!!!\n"); 03749 RETURN(-1,OUT); 03750 } 03751 03752 /* backup the bc and put it in storage */ 03753 *held_bc = *bc; 03754 held_bc->holded = 1; 03755 held_bc->channel = 0;/* A held call does not have a channel anymore. */ 03756 held_bc->channel_preselected = 0; 03757 held_bc->channel_found = 0; 03758 bc_state_change(held_bc, BCHAN_CLEANED); 03759 stack_holder_add(stack, held_bc); 03760 03761 /* kill the bridge and clean the real b-channel record */ 03762 if (stack->nt) { 03763 if (bc->bc_state == BCHAN_BRIDGED) { 03764 misdn_split_conf(bc,bc->conf_id); 03765 bc2 = find_bc_by_confid(bc->conf_id); 03766 if (!bc2) { 03767 cb_log(0,bc->port,"We have no second bc in bridge???\n"); 03768 } else { 03769 misdn_split_conf(bc2,bc->conf_id); 03770 } 03771 } 03772 03773 channel = bc->channel; 03774 03775 empty_bc(bc); 03776 clean_up_bc(bc); 03777 03778 if (channel>0) 03779 empty_chan_in_stack(stack,channel); 03780 03781 bc->in_use=0; 03782 } 03783 break; 03784 03785 /* finishing the channel eh ? */ 03786 case EVENT_DISCONNECT: 03787 if (!bc->need_disconnect) { 03788 cb_log(0, bc->port, " --> we have already sent DISCONNECT\n"); 03789 RETURN(-1,OUT); 03790 } 03791 03792 bc->need_disconnect=0; 03793 break; 03794 case EVENT_RELEASE: 03795 if (!bc->need_release) { 03796 cb_log(0, bc->port, " --> we have already sent RELEASE\n"); 03797 RETURN(-1,OUT); 03798 } 03799 bc->need_disconnect=0; 03800 bc->need_release=0; 03801 break; 03802 case EVENT_RELEASE_COMPLETE: 03803 if (!bc->need_release_complete) { 03804 cb_log(0, bc->port, " --> we have already sent RELEASE_COMPLETE\n"); 03805 RETURN(-1,OUT); 03806 } 03807 bc->need_disconnect=0; 03808 bc->need_release=0; 03809 bc->need_release_complete=0; 03810 03811 if (!stack->nt) { 03812 /* create cleanup in TE */ 03813 channel = bc->channel; 03814 tmpcause = bc->cause; 03815 tmp_out_cause = bc->out_cause; 03816 03817 empty_bc(bc); 03818 bc->cause=tmpcause; 03819 bc->out_cause=tmp_out_cause; 03820 clean_up_bc(bc); 03821 03822 if (channel>0) 03823 empty_chan_in_stack(stack,channel); 03824 03825 bc->in_use=0; 03826 } 03827 break; 03828 03829 case EVENT_CONNECT_ACKNOWLEDGE: 03830 if ( bc->nt || misdn_cap_is_speech(bc->capability)) { 03831 int retval=setup_bc(bc); 03832 if (retval == -EINVAL){ 03833 cb_log(0,bc->port,"send_event: setup_bc failed\n"); 03834 03835 } 03836 } 03837 03838 if (misdn_cap_is_speech(bc->capability)) { 03839 if ( !bc->nodsp) manager_ph_control(bc, DTMF_TONE_START, 0); 03840 manager_ec_enable(bc); 03841 03842 if ( bc->txgain != 0 ) { 03843 cb_log(4, stack->port, "--> Changing txgain to %d\n", bc->txgain); 03844 manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain); 03845 } 03846 if ( bc->rxgain != 0 ) { 03847 cb_log(4, stack->port, "--> Changing rxgain to %d\n", bc->rxgain); 03848 manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain); 03849 } 03850 } 03851 break; 03852 03853 default: 03854 break; 03855 } 03856 03857 /* Later we should think about sending bchannel data directly to misdn. */ 03858 msg = isdn_msg_build_event(msgs_g, bc, event, stack->nt); 03859 if (!msg) { 03860 /* 03861 * The message was not built. 03862 * 03863 * NOTE: The only time that the message will fail to build 03864 * is because the requested FACILITY message is not supported. 03865 * A failed malloc() results in exit() being called. 03866 */ 03867 RETURN(-1, OUT); 03868 } else { 03869 msg_queue_tail(&stack->downqueue, msg); 03870 sem_post(&glob_mgr->new_msg); 03871 } 03872 03873 OUT: 03874 misdn_send_unlock(bc); 03875 03876 OUT_POST_UNLOCK: 03877 return retval; 03878 }
int misdn_lib_send_restart | ( | int | port, | |
int | channel | |||
) |
Definition at line 4112 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().
04113 { 04114 struct misdn_stack *stack=find_stack_by_port(port); 04115 struct misdn_bchannel dummybc; 04116 /*default is all channels*/ 04117 cb_log(0, port, "Sending Restarts on this port.\n"); 04118 04119 misdn_make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0); 04120 04121 /*default is all channels*/ 04122 if (channel <0) { 04123 dummybc.channel=-1; 04124 cb_log(0, port, "Restarting and all Interfaces\n"); 04125 misdn_lib_send_event(&dummybc, EVENT_RESTART); 04126 04127 return 0; 04128 } 04129 04130 /*if a channel is specified we restart only this one*/ 04131 if (channel >0) { 04132 int cnt; 04133 dummybc.channel=channel; 04134 cb_log(0, port, "Restarting and cleaning channel %d\n",channel); 04135 misdn_lib_send_event(&dummybc, EVENT_RESTART); 04136 /* clean up chan in stack, to be sure we don't think it's 04137 * in use anymore */ 04138 for (cnt=0; cnt<=stack->b_num; cnt++) { 04139 if (stack->bc[cnt].in_use && stack->bc[cnt].channel == channel) { 04140 empty_bc(&stack->bc[cnt]); 04141 clean_up_bc(&stack->bc[cnt]); 04142 stack->bc[cnt].in_use=0; 04143 } 04144 } 04145 } 04146 04147 return 0; 04148 }
void misdn_lib_send_tone | ( | struct misdn_bchannel * | bc, | |
enum tone_e | tone | |||
) |
Definition at line 4764 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().
04765 { 04766 char buf[mISDN_HEADER_LEN + 128] = ""; 04767 iframe_t *frm = (iframe_t*)buf; 04768 04769 switch(tone) { 04770 case TONE_DIAL: 04771 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_DIALTONE); 04772 break; 04773 04774 case TONE_ALERTING: 04775 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_RINGING); 04776 break; 04777 04778 case TONE_HANGUP: 04779 manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_HANGUP); 04780 break; 04781 04782 case TONE_NONE: 04783 default: 04784 manager_ph_control(bc, TONE_PATT_OFF, TONE_GERMAN_HANGUP); 04785 } 04786 04787 frm->prim=DL_DATA|REQUEST; 04788 frm->addr=bc->addr|FLG_MSG_DOWN; 04789 frm->dinfo=0; 04790 frm->len=128; 04791 04792 mISDN_write(glob_mgr->midev, frm, mISDN_HEADER_LEN+frm->len, TIMEOUT_1SEC); 04793 }
void misdn_lib_setup_bc | ( | struct misdn_bchannel * | bc | ) |
Definition at line 1068 of file isdn_lib.c.
References misdn_stack::bc, clean_up_bc(), and setup_bc().
01069 { 01070 clean_up_bc(bc); 01071 setup_bc(bc); 01072 }
void misdn_lib_split_bridge | ( | struct misdn_bchannel * | bc1, | |
struct misdn_bchannel * | bc2 | |||
) |
Definition at line 4919 of file isdn_lib.c.
References bc_state2str(), BCHAN_BRIDGED, cb_log, misdn_bchannel::conf_id, and misdn_split_conf().
Referenced by misdn_bridge().
04920 { 04921 04922 struct misdn_bchannel *bc_list[]={ 04923 bc1,bc2,NULL 04924 }; 04925 struct misdn_bchannel **bc; 04926 04927 for (bc=bc_list; *bc; bc++) { 04928 if ( (*bc)->bc_state == BCHAN_BRIDGED){ 04929 misdn_split_conf( *bc, (*bc)->conf_id); 04930 } else { 04931 cb_log( 2, (*bc)->port, "BC not bridged (state:%s) so not splitting it\n",bc_state2str((*bc)->bc_state)); 04932 } 04933 } 04934 04935 }
void misdn_lib_tone_generator_start | ( | struct misdn_bchannel * | bc | ) |
Definition at line 2342 of file isdn_lib.c.
References misdn_bchannel::generate_tone.
Referenced by misdn_write().
02343 { 02344 bc->generate_tone=1; 02345 }
void misdn_lib_tone_generator_stop | ( | struct misdn_bchannel * | bc | ) |
Definition at line 2347 of file isdn_lib.c.
References misdn_bchannel::generate_tone.
Referenced by start_bc_tones(), and stop_indicate().
02348 { 02349 bc->generate_tone=0; 02350 }
int misdn_lib_tx2misdn_frm | ( | struct misdn_bchannel * | bc, | |
void * | data, | |||
int | len | |||
) |
Definition at line 4548 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().
04549 { 04550 struct misdn_stack *stack=get_stack_by_bc(bc); 04551 char buf[4096 + mISDN_HEADER_LEN]; 04552 iframe_t *frm = (iframe_t*)buf; 04553 04554 switch (bc->bc_state) { 04555 case BCHAN_ACTIVATED: 04556 case BCHAN_BRIDGED: 04557 break; 04558 default: 04559 cb_log(3, bc->port, "BC not yet activated (state:%s)\n",bc_state2str(bc->bc_state)); 04560 return -1; 04561 } 04562 04563 frm->prim = DL_DATA|REQUEST; 04564 frm->dinfo = 0; 04565 frm->addr = bc->addr | FLG_MSG_DOWN ; 04566 04567 frm->len = len; 04568 memcpy(&buf[mISDN_HEADER_LEN], data,len); 04569 04570 if ( misdn_cap_is_speech(bc->capability) ) 04571 flip_buf_bits( &buf[mISDN_HEADER_LEN], len); 04572 else 04573 cb_log(6, stack->port, "Writing %d data bytes\n",len); 04574 04575 cb_log(9, stack->port, "Writing %d bytes 2 mISDN\n",len); 04576 mISDN_write(stack->midev, buf, frm->len + mISDN_HEADER_LEN, TIMEOUT_INFINIT); 04577 return 0; 04578 }
void misdn_make_dummy | ( | struct misdn_bchannel * | dummybc, | |
int | port, | |||
int | l3id, | |||
int | nt, | |||
int | channel | |||
) |
Definition at line 79 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().
00080 { 00081 memset (dummybc,0,sizeof(struct misdn_bchannel)); 00082 dummybc->port=port; 00083 if (l3id==0) 00084 dummybc->l3_id = MISDN_ID_DUMMY; 00085 else 00086 dummybc->l3_id=l3id; 00087 00088 dummybc->nt=nt; 00089 dummybc->dummy=1; 00090 dummybc->channel=channel; 00091 }
enum event_response_e(*) cb_event(enum event_e event, struct misdn_bchannel *bc, void *user_data) |
Definition at line 30 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 32 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().