| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Chan_Misdn -- Channel Driver for Asterisk | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Interface to mISDN | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2004, Christian Richter | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Christian Richter <crich@beronet.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software, distributed under the terms of | 
					
						
							|  |  |  |  * the GNU General Public License | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | /*! \file
 | 
					
						
							|  |  |  |  * \brief Interface to mISDN | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \author Christian Richter <crich@beronet.com> | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | #ifndef TE_LIB
 | 
					
						
							|  |  |  | #define TE_LIB
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-15 16:49:26 +00:00
										 |  |  | #include <mISDNuser/suppserv.h>
 | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | /** For initialization usage **/ | 
					
						
							|  |  |  | /* typedef int ie_nothing_t ;*/ | 
					
						
							|  |  |  | /** end of init usage **/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-06 12:50:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2006-10-06 12:50:25 +00:00
										 |  |  |  * uncomment the following to make chan_misdn create | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  |  * record files in /tmp/misdn-{rx|tx}-PortChannel format | 
					
						
							| 
									
										
										
										
											2006-10-06 12:50:25 +00:00
										 |  |  |  * */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*#define MISDN_SAVE_DATA*/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-03 16:38:00 +00:00
										 |  |  | #ifdef WITH_BEROEC
 | 
					
						
							|  |  |  | typedef int beroec_t; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum beroec_type { | 
					
						
							|  |  |  | 	BEROEC_FULLBAND=0, | 
					
						
							|  |  |  | 	BEROEC_SUBBAND, | 
					
						
							|  |  |  | 	BEROEC_FASTSUBBAND | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void beroec_init(void); | 
					
						
							|  |  |  | void beroec_exit(void); | 
					
						
							|  |  |  | beroec_t *beroec_new(int tail, enum beroec_type type, int anti_howl, | 
					
						
							|  |  |  | 		     int tonedisable, int zerocoeff, int adapt, int nlp); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void beroec_destroy(beroec_t *ec); | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | int beroec_cancel_alaw_chunk(beroec_t *ec, | 
					
						
							|  |  |  | 	char *send, | 
					
						
							|  |  |  | 	char *receive, | 
					
						
							| 
									
										
										
										
											2006-08-03 16:38:00 +00:00
										 |  |  | 	int len); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int beroec_version(void); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-18 19:09:32 +00:00
										 |  |  | enum tone_e { | 
					
						
							|  |  |  | 	TONE_NONE=0, | 
					
						
							|  |  |  | 	TONE_DIAL, | 
					
						
							|  |  |  | 	TONE_ALERTING, | 
					
						
							|  |  |  | 	TONE_FAR_ALERTING, | 
					
						
							|  |  |  | 	TONE_BUSY, | 
					
						
							|  |  |  | 	TONE_HANGUP, | 
					
						
							|  |  |  | 	TONE_CUSTOM, | 
					
						
							|  |  |  | 	TONE_FILE | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-28 11:03:05 +00:00
										 |  |  | #define MAX_BCHANS 31
 | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | enum bchannel_state { | 
					
						
							|  |  |  | 	BCHAN_CLEANED=0, | 
					
						
							|  |  |  | 	BCHAN_EMPTY, | 
					
						
							|  |  |  | 	BCHAN_SETUP, | 
					
						
							|  |  |  | 	BCHAN_SETUPED, | 
					
						
							|  |  |  | 	BCHAN_ACTIVE, | 
					
						
							|  |  |  | 	BCHAN_ACTIVATED, | 
					
						
							|  |  |  | 	BCHAN_BRIDGE, | 
					
						
							|  |  |  | 	BCHAN_BRIDGED, | 
					
						
							|  |  |  | 	BCHAN_RELEASE, | 
					
						
							|  |  |  | 	BCHAN_RELEASED, | 
					
						
							|  |  |  | 	BCHAN_CLEAN, | 
					
						
							| 
									
										
										
										
											2006-06-17 10:37:35 +00:00
										 |  |  | 	BCHAN_CLEAN_REQUEST, | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | 	BCHAN_ERROR | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | enum misdn_err_e { | 
					
						
							|  |  |  | 	ENOCHAN=1 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum mISDN_NUMBER_PLAN { | 
					
						
							|  |  |  | 	NUMPLAN_UNINITIALIZED=-1, | 
					
						
							|  |  |  | 	NUMPLAN_INTERNATIONAL=0x1, | 
					
						
							|  |  |  | 	NUMPLAN_NATIONAL=0x2, | 
					
						
							|  |  |  | 	NUMPLAN_SUBSCRIBER=0x4, | 
					
						
							|  |  |  | 	NUMPLAN_UNKNOWN=0x0 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum event_response_e { | 
					
						
							|  |  |  | 	RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE, | 
					
						
							|  |  |  | 	RESPONSE_IGNORE_SETUP, | 
					
						
							| 
									
										
										
										
											2006-10-06 12:50:25 +00:00
										 |  |  | 	RESPONSE_RELEASE_SETUP, | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	RESPONSE_ERR, | 
					
						
							|  |  |  | 	RESPONSE_OK | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum event_e { | 
					
						
							|  |  |  | 	EVENT_NOTHING, | 
					
						
							| 
									
										
										
										
											2006-02-02 21:15:34 +00:00
										 |  |  | 	EVENT_TONE_GENERATE, | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	EVENT_BCHAN_DATA, | 
					
						
							| 
									
										
										
										
											2006-02-02 21:15:34 +00:00
										 |  |  | 	EVENT_BCHAN_ACTIVATED, | 
					
						
							| 
									
										
										
										
											2006-10-27 10:03:23 +00:00
										 |  |  | 	EVENT_BCHAN_ERROR, | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	EVENT_CLEANUP, | 
					
						
							|  |  |  | 	EVENT_PROCEEDING, | 
					
						
							|  |  |  | 	EVENT_PROGRESS, | 
					
						
							|  |  |  | 	EVENT_SETUP, | 
					
						
							|  |  |  | 	EVENT_ALERTING, | 
					
						
							|  |  |  | 	EVENT_CONNECT, | 
					
						
							|  |  |  | 	EVENT_SETUP_ACKNOWLEDGE, | 
					
						
							|  |  |  | 	EVENT_CONNECT_ACKNOWLEDGE , | 
					
						
							|  |  |  | 	EVENT_USER_INFORMATION, | 
					
						
							|  |  |  | 	EVENT_SUSPEND_REJECT, | 
					
						
							|  |  |  | 	EVENT_RESUME_REJECT, | 
					
						
							|  |  |  | 	EVENT_HOLD, | 
					
						
							|  |  |  | 	EVENT_SUSPEND, | 
					
						
							|  |  |  | 	EVENT_RESUME, | 
					
						
							|  |  |  | 	EVENT_HOLD_ACKNOWLEDGE, | 
					
						
							|  |  |  | 	EVENT_SUSPEND_ACKNOWLEDGE, | 
					
						
							|  |  |  | 	EVENT_RESUME_ACKNOWLEDGE, | 
					
						
							|  |  |  | 	EVENT_HOLD_REJECT, | 
					
						
							|  |  |  | 	EVENT_RETRIEVE, | 
					
						
							|  |  |  | 	EVENT_RETRIEVE_ACKNOWLEDGE, | 
					
						
							|  |  |  | 	EVENT_RETRIEVE_REJECT, | 
					
						
							|  |  |  | 	EVENT_DISCONNECT, | 
					
						
							|  |  |  | 	EVENT_RESTART, | 
					
						
							|  |  |  | 	EVENT_RELEASE, | 
					
						
							|  |  |  | 	EVENT_RELEASE_COMPLETE, | 
					
						
							|  |  |  | 	EVENT_FACILITY, | 
					
						
							|  |  |  | 	EVENT_NOTIFY, | 
					
						
							|  |  |  | 	EVENT_STATUS_ENQUIRY, | 
					
						
							|  |  |  | 	EVENT_INFORMATION, | 
					
						
							|  |  |  | 	EVENT_STATUS, | 
					
						
							|  |  |  | 	EVENT_TIMEOUT, | 
					
						
							|  |  |  | 	EVENT_DTMF_TONE, | 
					
						
							|  |  |  | 	EVENT_NEW_L3ID, | 
					
						
							|  |  |  | 	EVENT_NEW_BC, | 
					
						
							| 
									
										
										
										
											2006-08-03 16:38:00 +00:00
										 |  |  | 	EVENT_PORT_ALARM, | 
					
						
							| 
									
										
										
										
											2006-05-24 23:21:03 +00:00
										 |  |  | 	EVENT_NEW_CHANNEL, | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	EVENT_UNKNOWN | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum ie_name_e { | 
					
						
							|  |  |  | 	IE_DUMMY, | 
					
						
							|  |  |  | 	IE_LAST | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum { /* bearer capability */ | 
					
						
							|  |  |  | 	INFO_CAPABILITY_SPEECH=0, | 
					
						
							|  |  |  | 	INFO_CAPABILITY_AUDIO_3_1K=0x10 , | 
					
						
							|  |  |  | 	INFO_CAPABILITY_AUDIO_7K=0x11 , | 
					
						
							|  |  |  | 	INFO_CAPABILITY_VIDEO =0x18, | 
					
						
							|  |  |  | 	INFO_CAPABILITY_DIGITAL_UNRESTRICTED =0x8, | 
					
						
							|  |  |  | 	INFO_CAPABILITY_DIGITAL_RESTRICTED =0x09, | 
					
						
							|  |  |  | 	INFO_CAPABILITY_DIGITAL_UNRESTRICTED_TONES | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum { /* progress indicators */ | 
					
						
							|  |  |  | 	INFO_PI_CALL_NOT_E2E_ISDN =0x01, | 
					
						
							|  |  |  | 	INFO_PI_CALLED_NOT_ISDN =0x02, | 
					
						
							|  |  |  | 	INFO_PI_CALLER_NOT_ISDN =0x03, | 
					
						
							|  |  |  | 	INFO_PI_CALLER_RETURNED_TO_ISDN =0x04, | 
					
						
							|  |  |  | 	INFO_PI_INBAND_AVAILABLE =0x08, | 
					
						
							|  |  |  | 	INFO_PI_DELAY_AT_INTERF =0x0a, | 
					
						
							|  |  |  | 	INFO_PI_INTERWORKING_WITH_PUBLIC =0x10, | 
					
						
							|  |  |  | 	INFO_PI_INTERWORKING_NO_RELEASE =0x11, | 
					
						
							|  |  |  | 	INFO_PI_INTERWORKING_NO_RELEASE_PRE_ANSWER =0x12, | 
					
						
							|  |  |  | 	INFO_PI_INTERWORKING_NO_RELEASE_POST_ANSWER =0x13 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum { /*CODECS*/ | 
					
						
							|  |  |  | 	INFO_CODEC_ULAW=2, | 
					
						
							|  |  |  | 	INFO_CODEC_ALAW=3 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum layer_e { | 
					
						
							|  |  |  | 	L3, | 
					
						
							|  |  |  | 	L2, | 
					
						
							|  |  |  | 	L1, | 
					
						
							|  |  |  | 	UNKNOWN | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | struct misdn_bchannel { | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief B channel send locking structure */ | 
					
						
							| 
									
										
										
										
											2007-05-03 14:36:32 +00:00
										 |  |  | 	struct send_lock *send_lock; | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if this is a dummy BC record */ | 
					
						
							| 
									
										
										
										
											2007-07-02 08:27:19 +00:00
										 |  |  | 	int dummy; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if NT side of protocol (TE otherwise) */ | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | 	int nt; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if ISDN-PRI (ISDN-BRI otherwise) */ | 
					
						
							| 
									
										
										
										
											2007-06-22 15:32:54 +00:00
										 |  |  | 	int pri; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief Logical Layer 1 port associated with this B channel */ | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | 	int port; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	/** init stuff **/ | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief B Channel mISDN driver stack ID */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int b_stid; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	/* int b_addr; */ | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief B Channel mISDN driver layer ID from mISDN_new_layer() */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int layer_id; | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief B channel layer; set to 3 or 4 */ | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 	int layer; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* state stuff */ | 
					
						
							|  |  |  | 	/*! \brief TRUE if DISCONNECT needs to be sent to clear a call */ | 
					
						
							| 
									
										
										
										
											2006-07-06 15:11:40 +00:00
										 |  |  | 	int need_disconnect; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if RELEASE needs to be sent to clear a call */ | 
					
						
							| 
									
										
										
										
											2006-07-06 15:11:40 +00:00
										 |  |  | 	int need_release; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if RELEASE_COMPLETE needs to be sent to clear a call */ | 
					
						
							| 
									
										
										
										
											2006-07-06 15:11:40 +00:00
										 |  |  | 	int need_release_complete; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if allocate higher B channels first */ | 
					
						
							| 
									
										
										
										
											2007-03-20 13:16:06 +00:00
										 |  |  | 	int dec; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* var stuff */ | 
					
						
							|  |  |  | 	/*! \brief Layer 3 process ID */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int l3_id; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief B channel process ID (1-5000) */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int pid; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Not used. Saved mISDN stack CONNECT_t ces value */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int ces; | 
					
						
							| 
									
										
										
										
											2006-06-01 12:51:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief B channel to restart if received a RESTART message */ | 
					
						
							| 
									
										
										
										
											2006-06-01 12:51:41 +00:00
										 |  |  | 	int restart_channel; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Assigned B channel number B1, B2... 0 if not assigned */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int channel; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if the B channel number is preselected */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int channel_preselected; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if B channel record is in use */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int in_use; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Time when empty_bc() last called on this record */ | 
					
						
							| 
									
										
										
										
											2008-06-02 08:35:28 +00:00
										 |  |  | 	struct timeval last_used; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if call waiting */ | 
					
						
							| 
									
										
										
										
											2006-10-06 12:50:25 +00:00
										 |  |  | 	int cw; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief B Channel mISDN driver layer ID from mISDN_get_layerid() */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int addr; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief B channel speech sample data buffer */ | 
					
						
							|  |  |  | 	char *bframe; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief B channel speech sample data buffer size */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int bframe_len; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	int time_usec;	/* Not used */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Not used. Contents are setup but not used. */ | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | 	void *astbuf; | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	void *misdnbuf;	/* Not used */ | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if the TE side should choose the B channel to use
 | 
					
						
							|  |  |  | 	 * \note This value is user configurable in /etc/asterisk/misdn.conf | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | 	int te_choose_channel; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if the call progress indicators can indicate an inband audio message for the user to listen to
 | 
					
						
							|  |  |  | 	 * \note This value is user configurable in /etc/asterisk/misdn.conf | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 	int early_bconnect; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Last decoded DTMF digit from mISDN driver */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int dtmf; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if we should produce DTMF tones ourselves
 | 
					
						
							|  |  |  | 	 * \note This value is user configurable in /etc/asterisk/misdn.conf | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int send_dtmf; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if we send SETUP_ACKNOWLEDGE on incoming calls anyway (instead of PROCEEDING).
 | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * This requests additional INFORMATION messages, so we can | 
					
						
							|  |  |  | 	 * wait for digits without issues. | 
					
						
							|  |  |  | 	 * \note This value is user configurable in /etc/asterisk/misdn.conf | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-02-02 21:15:34 +00:00
										 |  |  | 	int need_more_infos; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if all digits necessary to complete the call are available.
 | 
					
						
							|  |  |  | 	 * No more INFORMATION messages are needed. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-06-01 12:51:41 +00:00
										 |  |  | 	int sending_complete; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if we will not use jollys dsp */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int nodsp; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if we will not use the jitter buffer system */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int nojitter; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Type-of-number in ISDN terms for the dialed/called number
 | 
					
						
							|  |  |  | 	 * \note This value is set to "dialplan" in /etc/asterisk/misdn.conf for outgoing calls | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	enum mISDN_NUMBER_PLAN dnumplan; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Type-of-number in ISDN terms for the redirecting number which a call diversion or transfer was invoked.
 | 
					
						
							|  |  |  | 	 * \note Collected from the incoming SETUP message but not used. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	enum mISDN_NUMBER_PLAN rnumplan; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Type-of-number in ISDN terms for the originating/calling number (Caller-ID)
 | 
					
						
							|  |  |  | 	 * \note This value is set to "localdialplan" in /etc/asterisk/misdn.conf for outgoing calls | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	enum mISDN_NUMBER_PLAN onumplan; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Type-of-number in ISDN terms for the connected party number
 | 
					
						
							|  |  |  | 	 * \note This value is set to "cpndialplan" in /etc/asterisk/misdn.conf for outgoing calls | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-03-09 18:01:27 +00:00
										 |  |  | 	enum mISDN_NUMBER_PLAN cpnnumplan; | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief Progress Indicator IE coding standard field.
 | 
					
						
							|  |  |  | 	 * \note Collected from the incoming messages but not used. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int progress_coding; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Progress Indicator IE location field.
 | 
					
						
							|  |  |  | 	 * \note Collected from the incoming messages but not used. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int progress_location; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Progress Indicator IE progress description field.
 | 
					
						
							|  |  |  | 	 * Used to determine if there is an inband audio message present. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int progress_indicator; | 
					
						
							| 
									
										
										
										
											2006-08-15 16:49:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief Inbound FACILITY message function type and contents */ | 
					
						
							| 
									
										
										
										
											2006-08-16 13:19:54 +00:00
										 |  |  | 	struct FacParm fac_in; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Outbound FACILITY message function type and contents.
 | 
					
						
							|  |  |  | 	 * \note Filled in by misdn facility commands before FACILITY message sent. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-08-16 13:19:54 +00:00
										 |  |  | 	struct FacParm fac_out; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* storing the current AOCD info here */ | 
					
						
							|  |  |  | 	enum FacFunction AOCDtype; | 
					
						
							|  |  |  | 	union { | 
					
						
							|  |  |  | 		struct FacAOCDCurrency currency; | 
					
						
							|  |  |  | 		struct FacAOCDChargingUnit chargingUnit; | 
					
						
							|  |  |  | 	} AOCD; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Event waiting for Layer 1 to come up */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	enum event_e evq; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	/*** CRYPTING STUFF ***/ | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	int crypt;		/* Initialized, Not used */ | 
					
						
							|  |  |  | 	int curprx;		/* Initialized, Not used */ | 
					
						
							|  |  |  | 	int curptx;		/* Initialized, Not used */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Blowfish encryption key string (secret) */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	char crypt_key[255]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	int crypt_state;	/* Not used */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	/*** CRYPTING STUFF END***/ | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Seems to have been intended for something to do with the jitter buffer.
 | 
					
						
							|  |  |  | 	 * \note Used as a boolean.  Only initialized to 0 and referenced in a couple places | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int active; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	int upset;	/* Not used */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if tone generator allowed to start */ | 
					
						
							| 
									
										
										
										
											2006-02-02 21:15:34 +00:00
										 |  |  | 	int generate_tone; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Number of tone samples to generate */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int tone_cnt; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Current B Channel state */ | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | 	enum bchannel_state bc_state; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief This is used as a pending bridge join request for when bc_state becomes BCHAN_ACTIVATED */ | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | 	enum bchannel_state next_bc_state; | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief Bridging conference ID */ | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | 	int conf_id; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if this channel is on hold */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int holded; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if this channel is on the misdn_stack->holding list
 | 
					
						
							|  |  |  | 	 * \note If TRUE this implies that the structure is also malloced. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int stack_holder; | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief Caller ID presentation restriction code
 | 
					
						
							|  |  |  | 	 * 0=Allowed, 1=Restricted, 2=Unavailable | 
					
						
							|  |  |  | 	 * \note It is settable by the misdn_set_opt() application. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int pres; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Caller ID screening code
 | 
					
						
							|  |  |  | 	 * 0=Unscreened, 1=Passed Screen, 2=Failed Screen, 3=Network Number | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-11-15 20:20:45 +00:00
										 |  |  | 	int screen; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief SETUP message bearer capability field code value */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int capability; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Companding ALaw/uLaw encoding (INFO_CODEC_ALAW / INFO_CODEC_ULAW) */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int law; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* V110 Stuff */ | 
					
						
							|  |  |  | 	/*! \brief Q.931 Bearer Capability IE Information Transfer Rate field. Initialized to 0x10 (64kbit). Altered by incoming SETUP messages. */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int rate; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Q.931 Bearer Capability IE Transfer Mode field. Initialized to 0 (Circuit). Altered by incoming SETUP messages. */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int mode; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief Q.931 Bearer Capability IE User Information Layer 1 Protocol field code.
 | 
					
						
							|  |  |  | 	 * \note Collected from the incoming SETUP message but not used. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int user1; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Q.931 Bearer Capability IE Layer 1 User Rate field.
 | 
					
						
							|  |  |  | 	 * \note Collected from the incoming SETUP message and exported to Asterisk variable MISDN_URATE. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int urate; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if call made in digital HDLC mode
 | 
					
						
							|  |  |  | 	 * \note This value is user configurable in /etc/asterisk/misdn.conf. | 
					
						
							|  |  |  | 	 * It is also settable by the misdn_set_opt() application. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-02-02 21:15:34 +00:00
										 |  |  | 	int hdlc; | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	/* V110 */ | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Display message that can be displayed by the user phone.
 | 
					
						
							|  |  |  | 	 * \note Maximum displayable length is 34 or 82 octets. | 
					
						
							|  |  |  | 	 * It is also settable by the misdn_set_opt() application. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char display[84]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Not used. Contents are setup but not used. */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char msn[32]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Originating/Calling Phone Number (Address)
 | 
					
						
							|  |  |  | 	 * \note This value can be set to "callerid" in /etc/asterisk/misdn.conf for outgoing calls | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char oad[32]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Redirecting Phone Number (Address) where a call diversion or transfer was invoked */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char rad[32]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Dialed/Called Phone Number (Address) */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char dad[32]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Connected Party/Line Phone Number (Address) */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char cad[32]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Original Dialed/Called Phone Number (Address) before national/international dialing prefix added.
 | 
					
						
							|  |  |  | 	 * \note Not used. Contents are setup but not used. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char orig_dad[32]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Q.931 Keypad Facility IE contents
 | 
					
						
							|  |  |  | 	 * \note Contents exported and imported to Asterisk variable MISDN_KEYPAD | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char keypad[32]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief Current overlap dialing digits to/from INFORMATION messages */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char info_dad[64]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Collected digits to go into info_dad[] while waiting for a SETUP_ACKNOWLEDGE to come in. */ | 
					
						
							| 
									
										
										
										
											2006-08-09 09:24:21 +00:00
										 |  |  | 	char infos_pending[64]; | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* 	unsigned char info_keypad[32]; */ | 
					
						
							|  |  |  | /* 	unsigned char clisub[24]; */ | 
					
						
							|  |  |  | /* 	unsigned char cldsub[24]; */ | 
					
						
							| 
									
										
										
										
											2007-03-12 12:43:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief User-User information string.
 | 
					
						
							|  |  |  | 	 * \note Contents exported and imported to Asterisk variable MISDN_USERUSER | 
					
						
							|  |  |  | 	 * \note We only support ASCII strings (IA5 characters). | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2007-03-12 12:43:24 +00:00
										 |  |  |  	char uu[256]; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief User-User information string length in uu[] */ | 
					
						
							| 
									
										
										
										
											2007-03-12 12:43:24 +00:00
										 |  |  | 	int uulen; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Q.931 Cause for disconnection code (received)
 | 
					
						
							|  |  |  | 	 * \note Need to use the AST_CAUSE_xxx code definitions in causes.h | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int cause; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Q.931 Cause for disconnection code (sent)
 | 
					
						
							|  |  |  | 	 * \note Need to use the AST_CAUSE_xxx code definitions in causes.h | 
					
						
							|  |  |  | 	 * \note -1 is used to suppress including the cause code in the RELEASE message. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int out_cause; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	/* struct misdn_bchannel hold_bc; */ | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	/** list stuf **/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-26 15:25:53 +00:00
										 |  |  | #ifdef MISDN_1_2
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief The configuration string for the mISDN dsp pipeline in /etc/asterisk/misdn.conf. */ | 
					
						
							| 
									
										
										
										
											2007-03-26 15:25:53 +00:00
										 |  |  | 	char pipeline[128]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief TRUE if the echo cancellor is enabled */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int ec_enable; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Number of taps in the echo cancellor when enabled.
 | 
					
						
							|  |  |  | 	 * \note This value is user configurable in /etc/asterisk/misdn.conf (echocancel) | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int ec_deftaps; | 
					
						
							| 
									
										
										
										
											2007-03-26 15:25:53 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief TRUE if the channel was allocated from the available B channels */ | 
					
						
							| 
									
										
										
										
											2007-07-02 08:14:43 +00:00
										 |  |  | 	int channel_found; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Who originated the call (ORG_AST, ORG_MISDN)
 | 
					
						
							|  |  |  | 	 * \note Set but not used when the misdn_set_opt() application enables echo cancellation. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int orig; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	/*! \brief Tx gain setting (range -8 to 8)
 | 
					
						
							|  |  |  | 	 * \note This value is user configurable in /etc/asterisk/misdn.conf. | 
					
						
							|  |  |  | 	 * It is also settable by the misdn_set_opt() application. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int txgain; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Rx gain setting (range -8 to 8)
 | 
					
						
							|  |  |  | 	 * \note This value is user configurable in /etc/asterisk/misdn.conf. | 
					
						
							|  |  |  | 	 * It is also settable by the misdn_set_opt() application. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	int rxgain; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*! \brief Next node in the misdn_stack.holding list */ | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 	struct misdn_bchannel *next; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data); | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | void (*cb_log) (int level, int port, char *tmpl, ...) | 
					
						
							|  |  |  | 	__attribute__ ((format (printf, 3, 4))); | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct misdn_lib_iface { | 
					
						
							|  |  |  | 	enum event_response_e (*cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data); | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 	void (*cb_log)(int level, int port, char *tmpl, ...) | 
					
						
							|  |  |  | 		__attribute__ ((format (printf, 3, 4))); | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 	int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /***** USER IFACE **********/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-12 09:45:36 +00:00
										 |  |  | void misdn_lib_nt_keepcalls(int kc); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-29 20:12:19 +00:00
										 |  |  | void misdn_lib_nt_debug_init( int flags, char *file ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | int misdn_lib_init(char *portlist, struct misdn_lib_iface* iface, void *user_data); | 
					
						
							|  |  |  | int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event ); | 
					
						
							|  |  |  | void misdn_lib_destroy(void); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-07-11 19:30:35 +00:00
										 |  |  | void misdn_lib_isdn_l1watcher(int port); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | void misdn_lib_log_ies(struct misdn_bchannel *bc); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *manager_isdn_get_info(enum event_e event); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void misdn_lib_transfer(struct misdn_bchannel* holded_bc); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-20 13:16:06 +00:00
										 |  |  | struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel, int inout, int dec); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | void manager_bchannel_activate(struct misdn_bchannel *bc); | 
					
						
							|  |  |  | void manager_bchannel_deactivate(struct misdn_bchannel * bc); | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | int misdn_lib_tx2misdn_frm(struct misdn_bchannel *bc, void *data, int len); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-01 16:41:07 +00:00
										 |  |  | void manager_ph_control(struct misdn_bchannel *bc, int c1, int c2); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-08 18:13:40 +00:00
										 |  |  | void isdn_lib_update_rxgain (struct misdn_bchannel *bc); | 
					
						
							|  |  |  | void isdn_lib_update_txgain (struct misdn_bchannel *bc); | 
					
						
							|  |  |  | void isdn_lib_update_ec (struct misdn_bchannel *bc); | 
					
						
							|  |  |  | void isdn_lib_stop_dtmf (struct misdn_bchannel *bc); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | int misdn_lib_port_restart(int port); | 
					
						
							| 
									
										
											  
											
												Merged revisions 48319,48321,48467,48552,48576,49135,49303 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r48319 | crichter | 2006-12-06 15:35:25 +0100 (Mi, 06 Dez 2006) | 1 line
changed a few debugs to higher debug levels
........
r48321 | crichter | 2006-12-06 16:48:45 +0100 (Mi, 06 Dez 2006) | 1 line
added the export and import of the MISDN_ADDRESS_COMPLETE Variable to inidcate wether the extension is already completely dialed or if there might come additional digits by information elements. also added some docs for that.
........
r48467 | crichter | 2006-12-14 14:03:49 +0100 (Do, 14 Dez 2006) | 1 line
removed FIXUP state. added check for channel allocation conflict when we create a setup while the other site creates a setup on the same channel, besides the check we resolve this conflict.
........
r48552 | crichter | 2006-12-18 11:19:39 +0100 (Mo, 18 Dez 2006) | 1 line
when our PTP Partner sends us a SETUP with a preselected channel we just accept it, even when we're NT. added some checks for segfaults.
........
r48576 | crichter | 2006-12-19 14:08:51 +0100 (Di, 19 Dez 2006) | 1 line
when we reject a channel, because it's in use already, we shouldn't process the setup anymore. made the channel allocation a bit easier and more understandable, removed a few unused lines
........
r49135 | crichter | 2007-01-02 11:07:22 +0100 (Di, 02 Jan 2007) | 1 line
added check for channel ranges in the set/empty channel functions. set pmp_l1_check default to no. added misdn restart pid cli command. added cleaning of channel when we send a RELEASE_COMPLETE. 
........
r49303 | crichter | 2007-01-03 09:24:00 +0100 (Mi, 03 Jan 2007) | 9 lines
* Added check for bridging in misdn_call to avoid setting echocancellation
  when 2 mISDN channels are involved and when bridging is set. That lead
  to a kernel panic before under different situations, because we switched 
  about 2 times between hardware bridging and echocancelation
* readded MISDN_URATE variable which got lost before, this should make app_v110
  work again
* fixed typo
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@49313 65c4cc65-6c06-0410-ace0-fbb531ad65f3
											
										 
											2007-01-03 09:06:50 +00:00
										 |  |  | int misdn_lib_pid_restart(int pid); | 
					
						
							| 
									
										
										
										
											2007-06-11 10:29:18 +00:00
										 |  |  | int misdn_lib_send_restart(int port, int channel); | 
					
						
							| 
									
										
											  
											
												Merged revisions 48319,48321,48467,48552,48576,49135,49303 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r48319 | crichter | 2006-12-06 15:35:25 +0100 (Mi, 06 Dez 2006) | 1 line
changed a few debugs to higher debug levels
........
r48321 | crichter | 2006-12-06 16:48:45 +0100 (Mi, 06 Dez 2006) | 1 line
added the export and import of the MISDN_ADDRESS_COMPLETE Variable to inidcate wether the extension is already completely dialed or if there might come additional digits by information elements. also added some docs for that.
........
r48467 | crichter | 2006-12-14 14:03:49 +0100 (Do, 14 Dez 2006) | 1 line
removed FIXUP state. added check for channel allocation conflict when we create a setup while the other site creates a setup on the same channel, besides the check we resolve this conflict.
........
r48552 | crichter | 2006-12-18 11:19:39 +0100 (Mo, 18 Dez 2006) | 1 line
when our PTP Partner sends us a SETUP with a preselected channel we just accept it, even when we're NT. added some checks for segfaults.
........
r48576 | crichter | 2006-12-19 14:08:51 +0100 (Di, 19 Dez 2006) | 1 line
when we reject a channel, because it's in use already, we shouldn't process the setup anymore. made the channel allocation a bit easier and more understandable, removed a few unused lines
........
r49135 | crichter | 2007-01-02 11:07:22 +0100 (Di, 02 Jan 2007) | 1 line
added check for channel ranges in the set/empty channel functions. set pmp_l1_check default to no. added misdn restart pid cli command. added cleaning of channel when we send a RELEASE_COMPLETE. 
........
r49303 | crichter | 2007-01-03 09:24:00 +0100 (Mi, 03 Jan 2007) | 9 lines
* Added check for bridging in misdn_call to avoid setting echocancellation
  when 2 mISDN channels are involved and when bridging is set. That lead
  to a kernel panic before under different situations, because we switched 
  about 2 times between hardware bridging and echocancelation
* readded MISDN_URATE variable which got lost before, this should make app_v110
  work again
* fixed typo
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@49313 65c4cc65-6c06-0410-ace0-fbb531ad65f3
											
										 
											2007-01-03 09:06:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | int misdn_lib_get_port_info(int port); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-08 09:19:06 +00:00
										 |  |  | int misdn_lib_is_port_blocked(int port); | 
					
						
							| 
									
										
										
										
											2006-08-03 16:38:00 +00:00
										 |  |  | int misdn_lib_port_block(int port); | 
					
						
							|  |  |  | int misdn_lib_port_unblock(int port); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-07 09:09:17 +00:00
										 |  |  | int misdn_lib_port_is_pri(int port); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-15 19:32:45 +00:00
										 |  |  | int misdn_lib_port_up(int port, int notcheck); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-03-07 11:16:56 +00:00
										 |  |  | int misdn_lib_get_port_down(int port); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | int misdn_lib_get_port_up (int port) ; | 
					
						
							| 
									
										
										
										
											2008-09-30 23:55:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | int misdn_lib_maxports_get(void) ; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void misdn_lib_release(struct misdn_bchannel *bc); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int misdn_cap_is_speech(int cap); | 
					
						
							|  |  |  | int misdn_inband_avail(struct misdn_bchannel *bc); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | void manager_ec_enable(struct misdn_bchannel *bc); | 
					
						
							|  |  |  | void manager_ec_disable(struct misdn_bchannel *bc); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-18 19:09:32 +00:00
										 |  |  | void misdn_lib_send_tone(struct misdn_bchannel *bc, enum tone_e tone); | 
					
						
							| 
									
										
										
										
											2005-12-09 11:01:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | void get_show_stack_details(int port, char *buf); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-02 21:15:34 +00:00
										 |  |  | void misdn_lib_tone_generator_start(struct misdn_bchannel *bc); | 
					
						
							|  |  |  | void misdn_lib_tone_generator_stop(struct misdn_bchannel *bc); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-15 20:20:45 +00:00
										 |  |  | void misdn_lib_setup_bc(struct misdn_bchannel *bc); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2); | 
					
						
							|  |  |  | void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-05-05 16:38:15 +00:00
										 |  |  | void misdn_lib_echo(struct misdn_bchannel *bc, int onoff); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-01 22:04:14 +00:00
										 |  |  | int misdn_lib_is_ptp(int port); | 
					
						
							| 
									
										
										
										
											2006-06-26 17:37:11 +00:00
										 |  |  | int misdn_lib_get_maxchans(int port); | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-30 14:05:42 +00:00
										 |  |  | void misdn_lib_reinit_nt_stack(int port); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | #define PRI_TRANS_CAP_SPEECH                                    0x0
 | 
					
						
							|  |  |  | #define PRI_TRANS_CAP_DIGITAL                                   0x08
 | 
					
						
							|  |  |  | #define PRI_TRANS_CAP_RESTRICTED_DIGITAL                        0x09
 | 
					
						
							|  |  |  | #define PRI_TRANS_CAP_3_1K_AUDIO                                0x10
 | 
					
						
							|  |  |  | #define PRI_TRANS_CAP_7K_AUDIO                                  0x11
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *bc_state2str(enum bchannel_state state); | 
					
						
							|  |  |  | void bc_state_change(struct misdn_bchannel *bc, enum bchannel_state state); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-22 22:44:42 +00:00
										 |  |  | void misdn_dump_chanlist(void); | 
					
						
							| 
									
										
										
										
											2006-04-03 19:17:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-31 23:30:09 +00:00
										 |  |  | #endif
 |