| r2chan.h | | r2chan.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| * GNU General Public License for more details. | | * GNU General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public License | | * You should have received a copy of the GNU Lesser General Public License | |
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENR2_CHAN_H_ | | #ifndef _OPENR2_CHAN_H_ | |
| #define _OPENR2_CHAN_H_ | | #define _OPENR2_CHAN_H_ | |
| | | | |
|
| #include <stdio.h> | | #include <stdarg.h> | |
| #include <sys/time.h> | | | |
| #include "r2proto.h" | | #include "r2proto.h" | |
| #include "r2log.h" | | #include "r2log.h" | |
| #include "r2context.h" | | #include "r2context.h" | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| #ifdef __OR2_COMPILING_LIBRARY__ | | #ifdef __OR2_COMPILING_LIBRARY__ | |
| struct openr2_chan_s; | | struct openr2_chan_s; | |
| | | | |
| skipping to change at line 59 | | skipping to change at line 58 | |
| #define OR2_CHAN_READ_SIZE 160 | | #define OR2_CHAN_READ_SIZE 160 | |
| /* callback for logging channel related info */ | | /* callback for logging channel related info */ | |
| typedef void (*openr2_logging_func_t)(openr2_chan_t *r2chan, openr2_log_lev
el_t level, const char *fmt, va_list ap); | | typedef void (*openr2_logging_func_t)(openr2_chan_t *r2chan, openr2_log_lev
el_t level, const char *fmt, va_list ap); | |
| | | | |
| openr2_chan_t *openr2_chan_new(openr2_context_t *r2context, int channo, voi
d *mf_write_handle, void *mf_read_handle); | | openr2_chan_t *openr2_chan_new(openr2_context_t *r2context, int channo, voi
d *mf_write_handle, void *mf_read_handle); | |
| openr2_chan_t *openr2_chan_new_from_fd(openr2_context_t *r2context, int cha
nfd, void *mf_write_handle, void *mf_read_handle); | | openr2_chan_t *openr2_chan_new_from_fd(openr2_context_t *r2context, int cha
nfd, void *mf_write_handle, void *mf_read_handle); | |
| void openr2_chan_delete(openr2_chan_t *r2chan); | | void openr2_chan_delete(openr2_chan_t *r2chan); | |
| int openr2_chan_process_event(openr2_chan_t *r2chan); | | int openr2_chan_process_event(openr2_chan_t *r2chan); | |
| int openr2_chan_accept_call(openr2_chan_t *r2chan, openr2_call_mode_t accep
t); | | int openr2_chan_accept_call(openr2_chan_t *r2chan, openr2_call_mode_t accep
t); | |
| int openr2_chan_answer_call(openr2_chan_t *r2chan); | | int openr2_chan_answer_call(openr2_chan_t *r2chan); | |
|
| | | int openr2_chan_answer_call_with_mode(openr2_chan_t *r2chan, openr2_answer_
mode_t mode); | |
| int openr2_chan_disconnect_call(openr2_chan_t *r2chan, openr2_call_disconne
ct_cause_t cause); | | int openr2_chan_disconnect_call(openr2_chan_t *r2chan, openr2_call_disconne
ct_cause_t cause); | |
| int openr2_chan_make_call(openr2_chan_t *r2chan, const char *ani, const cha
r *dnid, openr2_calling_party_category_t category); | | int openr2_chan_make_call(openr2_chan_t *r2chan, const char *ani, const cha
r *dnid, openr2_calling_party_category_t category); | |
| openr2_direction_t openr2_chan_get_direction(openr2_chan_t *r2chan); | | openr2_direction_t openr2_chan_get_direction(openr2_chan_t *r2chan); | |
| int openr2_chan_write(openr2_chan_t *r2chan, const unsigned char *buf, int
len); | | int openr2_chan_write(openr2_chan_t *r2chan, const unsigned char *buf, int
len); | |
| void openr2_chan_set_logging_func(openr2_chan_t *r2chan, openr2_logging_fun
c_t logcallback); | | void openr2_chan_set_logging_func(openr2_chan_t *r2chan, openr2_logging_fun
c_t logcallback); | |
| int openr2_chan_get_fd(openr2_chan_t *r2chan); | | int openr2_chan_get_fd(openr2_chan_t *r2chan); | |
| int openr2_chan_get_number(openr2_chan_t *r2chan); | | int openr2_chan_get_number(openr2_chan_t *r2chan); | |
| openr2_context_t *openr2_chan_get_context(openr2_chan_t *r2chan); | | openr2_context_t *openr2_chan_get_context(openr2_chan_t *r2chan); | |
| void openr2_chan_set_client_data(openr2_chan_t *r2chan, void *data); | | void openr2_chan_set_client_data(openr2_chan_t *r2chan, void *data); | |
| void *openr2_chan_get_client_data(openr2_chan_t *r2chan); | | void *openr2_chan_get_client_data(openr2_chan_t *r2chan); | |
| | | | |
| skipping to change at line 91 | | skipping to change at line 91 | |
| int openr2_chan_set_blocked(openr2_chan_t *r2chan); | | int openr2_chan_set_blocked(openr2_chan_t *r2chan); | |
| int openr2_chan_handle_cas(openr2_chan_t *r2chan); | | int openr2_chan_handle_cas(openr2_chan_t *r2chan); | |
| const char *openr2_chan_get_rx_cas_string(openr2_chan_t *r2chan); | | const char *openr2_chan_get_rx_cas_string(openr2_chan_t *r2chan); | |
| const char *openr2_chan_get_tx_cas_string(openr2_chan_t *r2chan); | | const char *openr2_chan_get_tx_cas_string(openr2_chan_t *r2chan); | |
| const char *openr2_chan_get_call_state_string(openr2_chan_t *r2chan); | | const char *openr2_chan_get_call_state_string(openr2_chan_t *r2chan); | |
| const char *openr2_chan_get_r2_state_string(openr2_chan_t *r2chan); | | const char *openr2_chan_get_r2_state_string(openr2_chan_t *r2chan); | |
| const char *openr2_chan_get_mf_state_string(openr2_chan_t *r2chan); | | const char *openr2_chan_get_mf_state_string(openr2_chan_t *r2chan); | |
| const char *openr2_chan_get_mf_group_string(openr2_chan_t *r2chan); | | const char *openr2_chan_get_mf_group_string(openr2_chan_t *r2chan); | |
| int openr2_chan_get_tx_mf_signal(openr2_chan_t *r2chan); | | int openr2_chan_get_tx_mf_signal(openr2_chan_t *r2chan); | |
| int openr2_chan_get_rx_mf_signal(openr2_chan_t *r2chan); | | int openr2_chan_get_rx_mf_signal(openr2_chan_t *r2chan); | |
|
| | | int openr2_chan_set_dtmf_write_handle(openr2_chan_t *r2chan, void *dtmf_wri
te_handle); | |
| | | | |
| #ifdef __OR2_COMPILING_LIBRARY__ | | #ifdef __OR2_COMPILING_LIBRARY__ | |
| #undef openr2_chan_t | | #undef openr2_chan_t | |
| #undef openr2_context_t | | #undef openr2_context_t | |
| #endif | | #endif | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| } /* endif extern "C" */ | | } /* endif extern "C" */ | |
| #endif | | #endif | |
| | | | |
| #endif /* endif defined _OPENR2_CHAN_H_ */ | | #endif /* endif defined _OPENR2_CHAN_H_ */ | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 3 lines changed or added | |
|
| r2context.h | | r2context.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| * GNU General Public License for more details. | | * GNU General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public License | | * You should have received a copy of the GNU Lesser General Public License | |
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENR2_CONTEXT_H_ | | #ifndef _OPENR2_CONTEXT_H_ | |
| #define _OPENR2_CONTEXT_H_ | | #define _OPENR2_CONTEXT_H_ | |
| | | | |
|
| #include <pthread.h> | | | |
| #include <inttypes.h> | | #include <inttypes.h> | |
| #include <stdarg.h> | | #include <stdarg.h> | |
| #include "r2proto.h" | | #include "r2proto.h" | |
| #include "r2log.h" | | #include "r2log.h" | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| #ifdef __OR2_COMPILING_LIBRARY__ | | #ifdef __OR2_COMPILING_LIBRARY__ | |
| | | | |
| skipping to change at line 163 | | skipping to change at line 162 | |
| /* Transcoding interface. Users should provide this interface | | /* Transcoding interface. Users should provide this interface | |
| to provide transcoding services from linear to alaw and | | to provide transcoding services from linear to alaw and | |
| viceversa */ | | viceversa */ | |
| typedef int16_t (*openr2_alaw_to_linear_func)(uint8_t alaw); | | typedef int16_t (*openr2_alaw_to_linear_func)(uint8_t alaw); | |
| typedef uint8_t (*openr2_linear_to_alaw_func)(int linear); | | typedef uint8_t (*openr2_linear_to_alaw_func)(int linear); | |
| typedef struct { | | typedef struct { | |
| openr2_alaw_to_linear_func alaw_to_linear; | | openr2_alaw_to_linear_func alaw_to_linear; | |
| openr2_linear_to_alaw_func linear_to_alaw; | | openr2_linear_to_alaw_func linear_to_alaw; | |
| } openr2_transcoder_interface_t; | | } openr2_transcoder_interface_t; | |
| | | | |
|
| | | /* DTMF transmitter interface */ | |
| | | typedef void *(*openr2_dtmf_tx_init_func)(void *dtmf_write_handle); | |
| | | typedef void (*openr2_dtmf_tx_set_timing_func)(void *dtmf_write_handle, int | |
| | | on_time, int off_time); | |
| | | typedef int (*openr2_dtmf_tx_put_func)(void *dtmf_write_handle, const char | |
| | | *digits, int len); | |
| | | typedef int (*openr2_dtmf_tx_func)(void *dtmf_write_handle, int16_t amp[], | |
| | | int max_samples); | |
| | | | |
| | | typedef struct { | |
| | | openr2_dtmf_tx_init_func dtmf_tx_init; | |
| | | openr2_dtmf_tx_set_timing_func dtmf_tx_set_timing; | |
| | | openr2_dtmf_tx_put_func dtmf_tx_put; | |
| | | openr2_dtmf_tx_func dtmf_tx; | |
| | | } openr2_dtmf_interface_t; | |
| | | | |
| /* Library errors */ | | /* Library errors */ | |
| typedef enum { | | typedef enum { | |
| /* Failed system call */ | | /* Failed system call */ | |
| OR2_LIBERR_SYSCALL_FAILED, | | OR2_LIBERR_SYSCALL_FAILED, | |
| /* Invalid channel signaling when creating it */ | | /* Invalid channel signaling when creating it */ | |
| OR2_LIBERR_INVALID_CHAN_SIGNALING, | | OR2_LIBERR_INVALID_CHAN_SIGNALING, | |
| /* cannot set to IDLE the channel when creating it */ | | /* cannot set to IDLE the channel when creating it */ | |
| OR2_LIBERR_CANNOT_SET_IDLE | | OR2_LIBERR_CANNOT_SET_IDLE | |
| } openr2_liberr_t; | | } openr2_liberr_t; | |
| | | | |
| | | | |
| skipping to change at line 184 | | skipping to change at line 196 | |
| openr2_context_t *openr2_context_new(openr2_mflib_interface_t *mflib, openr
2_event_interface_t *callmgmt, | | openr2_context_t *openr2_context_new(openr2_mflib_interface_t *mflib, openr
2_event_interface_t *callmgmt, | |
| openr2_transcoder_interface_t *transcoder, ope
nr2_variant_t variant, int max_ani, int max_dnis); | | openr2_transcoder_interface_t *transcoder, ope
nr2_variant_t variant, int max_ani, int max_dnis); | |
| void openr2_context_delete(openr2_context_t *r2context); | | void openr2_context_delete(openr2_context_t *r2context); | |
| openr2_liberr_t openr2_context_get_last_error(openr2_context_t *r2context); | | openr2_liberr_t openr2_context_get_last_error(openr2_context_t *r2context); | |
| const char *openr2_context_error_string(openr2_liberr_t error); | | const char *openr2_context_error_string(openr2_liberr_t error); | |
| openr2_variant_t openr2_context_get_variant(openr2_context_t *r2context); | | openr2_variant_t openr2_context_get_variant(openr2_context_t *r2context); | |
| int openr2_context_get_max_ani(openr2_context_t *r2context); | | int openr2_context_get_max_ani(openr2_context_t *r2context); | |
| int openr2_context_get_max_dnis(openr2_context_t *r2context); | | int openr2_context_get_max_dnis(openr2_context_t *r2context); | |
| void openr2_context_set_ani_first(openr2_context_t *r2context, int ani_firs
t); | | void openr2_context_set_ani_first(openr2_context_t *r2context, int ani_firs
t); | |
| int openr2_context_get_ani_first(openr2_context_t *r2context); | | int openr2_context_get_ani_first(openr2_context_t *r2context); | |
|
| | | void openr2_context_set_skip_category_request(openr2_context_t *r2context, | |
| | | int skipcategory); | |
| | | int openr2_context_get_skip_category_request(openr2_context_t *r2context); | |
| void openr2_context_set_immediate_accept(openr2_context_t *r2context, int i
mmediate_accept); | | void openr2_context_set_immediate_accept(openr2_context_t *r2context, int i
mmediate_accept); | |
| int openr2_context_get_immediate_accept(openr2_context_t *r2context); | | int openr2_context_get_immediate_accept(openr2_context_t *r2context); | |
| void openr2_context_set_log_level(openr2_context_t *r2context, openr2_log_l
evel_t level); | | void openr2_context_set_log_level(openr2_context_t *r2context, openr2_log_l
evel_t level); | |
| openr2_log_level_t openr2_context_get_log_level(openr2_context_t *r2context
); | | openr2_log_level_t openr2_context_get_log_level(openr2_context_t *r2context
); | |
| void openr2_context_set_mf_threshold(openr2_context_t *r2context, int thres
hold); | | void openr2_context_set_mf_threshold(openr2_context_t *r2context, int thres
hold); | |
| int openr2_context_get_mf_threshold(openr2_context_t *r2context); | | int openr2_context_get_mf_threshold(openr2_context_t *r2context); | |
| int openr2_context_set_log_directory(openr2_context_t *r2context, char *dir
ectory); | | int openr2_context_set_log_directory(openr2_context_t *r2context, char *dir
ectory); | |
| char *openr2_context_get_log_directory(openr2_context_t *r2context, char *d
irectory, int len); | | char *openr2_context_get_log_directory(openr2_context_t *r2context, char *d
irectory, int len); | |
| void openr2_context_set_mf_back_timeout(openr2_context_t *r2context, int ms
); | | void openr2_context_set_mf_back_timeout(openr2_context_t *r2context, int ms
); | |
| int openr2_context_get_mf_back_timeout(openr2_context_t *r2context); | | int openr2_context_get_mf_back_timeout(openr2_context_t *r2context); | |
| void openr2_context_set_metering_pulse_timeout(openr2_context_t *r2context,
int ms); | | void openr2_context_set_metering_pulse_timeout(openr2_context_t *r2context,
int ms); | |
| int openr2_context_get_metering_pulse_timeout(openr2_context_t *r2context); | | int openr2_context_get_metering_pulse_timeout(openr2_context_t *r2context); | |
| void openr2_context_set_double_answer(openr2_context_t *r2context, int enab
le); | | void openr2_context_set_double_answer(openr2_context_t *r2context, int enab
le); | |
| int openr2_context_get_double_answer(openr2_context_t *r2context); | | int openr2_context_get_double_answer(openr2_context_t *r2context); | |
| int openr2_context_configure_from_advanced_file(openr2_context_t *r2context
, const char *filename); | | int openr2_context_configure_from_advanced_file(openr2_context_t *r2context
, const char *filename); | |
|
| | | void openr2_context_set_dtmf_dialing(openr2_context_t *r2context, int enabl | |
| | | e, int dtmf_on, int dtmf_off); | |
| | | int openr2_context_get_dtmf_dialing(openr2_context_t *r2context, int *dtmf_ | |
| | | on, int *dtmf_off); | |
| | | int openr2_context_set_dtmf_interface(openr2_context_t *r2context, openr2_d | |
| | | tmf_interface_t *dtmf_interface); | |
| | | | |
| #ifdef __OR2_COMPILING_LIBRARY__ | | #ifdef __OR2_COMPILING_LIBRARY__ | |
| #undef openr2_chan_t | | #undef openr2_chan_t | |
| #undef openr2_context_t | | #undef openr2_context_t | |
| #endif | | #endif | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| } /* endif extern "C" */ | | } /* endif extern "C" */ | |
| #endif | | #endif | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 25 lines changed or added | |
|
| r2proto.h | | r2proto.h | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| #else | | #else | |
| #ifndef OR2_CHAN_AND_CONTEXT_DEFINED | | #ifndef OR2_CHAN_AND_CONTEXT_DEFINED | |
| #define OR2_CHAN_AND_CONTEXT_DEFINED | | #define OR2_CHAN_AND_CONTEXT_DEFINED | |
| typedef void* openr2_chan_t; | | typedef void* openr2_chan_t; | |
| typedef void* openr2_context_t; | | typedef void* openr2_context_t; | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| #define OR2_MAX_ANI 80 | | #define OR2_MAX_ANI 80 | |
| #define OR2_MAX_DNIS 80 | | #define OR2_MAX_DNIS 80 | |
|
| | | #define OR2_DEFAULT_DTMF_ON 50 | |
| | | #define OR2_DEFAULT_DTMF_OFF 100 | |
| | | | |
| /* | | /* | |
| This are known as Multi Frequency signals ( MF signals). the same 15 int
er-register signals | | This are known as Multi Frequency signals ( MF signals). the same 15 int
er-register signals | |
| are used for the distinct groups with distinct meanings for each group. | | are used for the distinct groups with distinct meanings for each group. | |
| | | | |
| Group A, B and C are the Backward groups, that is, the possible groups w
here the state machine | | Group A, B and C are the Backward groups, that is, the possible groups w
here the state machine | |
| of the callee can be at. | | of the callee can be at. | |
| | | | |
| Groups I, II and III are the Forward groups, that is, the possible group
s where the state machine | | Groups I, II and III are the Forward groups, that is, the possible group
s where the state machine | |
| of the caller can be at. | | of the caller can be at. | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 131 | |
| } openr2_direction_t; | | } openr2_direction_t; | |
| | | | |
| /* Call modes */ | | /* Call modes */ | |
| typedef enum { | | typedef enum { | |
| OR2_CALL_WITH_CHARGE, | | OR2_CALL_WITH_CHARGE, | |
| OR2_CALL_NO_CHARGE, | | OR2_CALL_NO_CHARGE, | |
| OR2_CALL_SPECIAL, | | OR2_CALL_SPECIAL, | |
| OR2_CALL_UNKNOWN | | OR2_CALL_UNKNOWN | |
| } openr2_call_mode_t; | | } openr2_call_mode_t; | |
| | | | |
|
| | | /* Answer modes */ | |
| | | typedef enum { | |
| | | OR2_ANSWER_SIMPLE, | |
| | | OR2_ANSWER_DOUBLE | |
| | | } openr2_answer_mode_t; | |
| | | | |
| /* Disconnect causes */ | | /* Disconnect causes */ | |
| typedef enum { | | typedef enum { | |
| OR2_CAUSE_BUSY_NUMBER, | | OR2_CAUSE_BUSY_NUMBER, | |
| OR2_CAUSE_NETWORK_CONGESTION, | | OR2_CAUSE_NETWORK_CONGESTION, | |
| OR2_CAUSE_UNALLOCATED_NUMBER, | | OR2_CAUSE_UNALLOCATED_NUMBER, | |
| OR2_CAUSE_OUT_OF_ORDER, | | OR2_CAUSE_OUT_OF_ORDER, | |
| OR2_CAUSE_UNSPECIFIED, | | OR2_CAUSE_UNSPECIFIED, | |
| OR2_CAUSE_NO_ANSWER, | | OR2_CAUSE_NO_ANSWER, | |
| OR2_CAUSE_NORMAL_CLEARING, | | OR2_CAUSE_NORMAL_CLEARING, | |
| OR2_CAUSE_COLLECT_CALL_REJECTED, | | OR2_CAUSE_COLLECT_CALL_REJECTED, | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 8 lines changed or added | |
|