| r2chan.h | | r2chan.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * | | * | |
| * 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 <stdarg.h> | | #include <stdarg.h> | |
|
| | | #include "r2declare.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__ | | #include "r2exports.h" | |
| struct openr2_chan_s; | | | |
| #define openr2_chan_t struct openr2_chan_s | | | |
| struct openr2_context_s; | | | |
| #define openr2_context_t struct openr2_context_s | | | |
| #else | | | |
| #ifndef OR2_CHAN_AND_CONTEXT_DEFINED | | | |
| #define OR2_CHAN_AND_CONTEXT_DEFINED | | | |
| typedef void* openr2_chan_t; | | | |
| typedef void* openr2_context_t; | | | |
| #endif | | | |
| #endif | | | |
| | | | |
|
| | | /* TODO: this should be set through an API, openr2_chan_set_period or openr | |
| | | 2_chan_set_read_size */ | |
| | | /*! \brief How many bytes to read each time at once from the channel */ | |
| #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 | | typedef void (*openr2_chan_logging_func_t)(openr2_chan_t *r2chan, const cha | |
| el_t level, const char *fmt, va_list ap); | | r *file, const char *function, unsigned int line, openr2_log_level_t level, | |
| | | const char *fmt, va_list ap); | |
| | | | |
| | | /*! \brief allocate and initialize a new channel openning the underlying ha | |
| | | rdware channel number */ | |
| | | OR2_DECLARE(openr2_chan_t *) openr2_chan_new(openr2_context_t *r2context, i | |
| | | nt channo); | |
| | | | |
| | | /*! \brief allocate and initialize a new channel and associates the given I | |
| | | /O descriptor to it */ | |
| | | OR2_DECLARE(openr2_chan_t *) openr2_chan_new_from_fd(openr2_context_t *r2co | |
| | | ntext, openr2_io_fd_t chanfd, int channo); | |
| | | | |
| | | /*! \brief destroys the memory allocated when creating the channel | |
| | | * no need to call this function if the channel is already associated to a | |
| | | context, | |
| | | * the context destruction will delete the channels associated to it | |
| | | */ | |
| | | OR2_DECLARE(void) openr2_chan_delete(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief Accepts an offered call on the given channel */ | |
| | | OR2_DECLARE(int) openr2_chan_accept_call(openr2_chan_t *r2chan, openr2_call | |
| | | _mode_t accept); | |
| | | | |
| | | /*! \brief Answers the call on the channel, the call must have been already | |
| | | accepted */ | |
| | | OR2_DECLARE(int) openr2_chan_answer_call(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief Answers the call on the channel with the given mode, the call mu | |
| | | st have been already accepted */ | |
| | | OR2_DECLARE(int) openr2_chan_answer_call_with_mode(openr2_chan_t *r2chan, o | |
| | | penr2_answer_mode_t mode); | |
| | | | |
| | | /*! \brief Disconnects the call or acnowledges a disconnect on the channel | |
| | | with the given reason | |
| | | the reason is ignored if its an acknowledge of hangup */ | |
| | | OR2_DECLARE(int) openr2_chan_disconnect_call(openr2_chan_t *r2chan, openr2_ | |
| | | call_disconnect_cause_t cause); | |
| | | | |
| | | /*! \brief Makes a call with the given ani, dnis and category */ | |
| | | OR2_DECLARE(int) openr2_chan_make_call(openr2_chan_t *r2chan, const char *a | |
| | | ni, const char *dnis, | |
| | | openr2_calling_party_category_t category, int ani_restricted | |
| | | ); | |
| | | | |
| | | /*! \brief Return the direction of the call in the given channel */ | |
| | | OR2_DECLARE(openr2_direction_t) openr2_chan_get_direction(openr2_chan_t *r2 | |
| | | chan); | |
| | | | |
| | | /*! \brief writes the given buffer to the channel using the underlying I/O | |
| | | callbacks or default I/O implementation */ | |
| | | OR2_DECLARE(int) openr2_chan_write(openr2_chan_t *r2chan, const unsigned ch | |
| | | ar *buf, int len); | |
| | | | |
| | | /*! \brief Set the callback to call when logging */ | |
| | | OR2_DECLARE(void) openr2_chan_set_logging_func(openr2_chan_t *r2chan, openr | |
| | | 2_chan_logging_func_t logcallback); | |
| | | | |
| | | /*! \brief Return the I/O descriptor associated to the channel */ | |
| | | OR2_DECLARE(openr2_io_fd_t) openr2_chan_get_fd(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief Get the channel number */ | |
| | | OR2_DECLARE(int) openr2_chan_get_number(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief Get the context associated to the channel */ | |
| | | OR2_DECLARE(openr2_context_t *) openr2_chan_get_context(openr2_chan_t *r2ch | |
| | | an); | |
| | | | |
| | | /*! \brief Associate an opaque pointer to the channel */ | |
| | | OR2_DECLARE(void) openr2_chan_set_client_data(openr2_chan_t *r2chan, void * | |
| | | data); | |
| | | | |
| | | /*! \brief Return the opaque pointer associated to the channel */ | |
| | | OR2_DECLARE(void *) openr2_chan_get_client_data(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief Return the number of milliseconds left for the next scheduled ev | |
| | | ent in the channel */ | |
| | | OR2_DECLARE(int) openr2_chan_get_time_to_next_event(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief Set the logging level for the channel */ | |
| | | OR2_DECLARE(openr2_log_level_t) openr2_chan_set_log_level(openr2_chan_t *r2 | |
| | | chan, openr2_log_level_t level); | |
| | | | |
| | | /*! \brief Return the logging level for the channel */ | |
| | | OR2_DECLARE(openr2_log_level_t) openr2_chan_get_log_level(openr2_chan_t *r2 | |
| | | chan); | |
| | | | |
| | | /*! \brief Enable the media reading for the channel, the stack will call th | |
| | | e I/O read operation when needed */ | |
| | | OR2_DECLARE(void) openr2_chan_enable_read(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief Disable the media reading for the channel, the stack will NOT ca | |
| | | ll the I/O read operation when needed */ | |
| | | OR2_DECLARE(void) openr2_chan_disable_read(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief Return non-zero if the reading of media is enabled for the chann | |
| | | el */ | |
| | | OR2_DECLARE(int) openr2_chan_get_read_enabled(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief enable the call debugging files for this channel */ | |
| | | OR2_DECLARE(void) openr2_chan_enable_call_files(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief disable the call debugging files for this channel */ | |
| | | OR2_DECLARE(void) openr2_chan_disable_call_files(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief return non-zero if the call debugging files are enabled for this | |
| | | channel */ | |
| | | OR2_DECLARE(int) openr2_chan_get_call_files_enabled(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief get the DNIS in the channel */ | |
| | | OR2_DECLARE(const char *) openr2_chan_get_dnis(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief get the ANI in the channel */ | |
| | | OR2_DECLARE(const char *) openr2_chan_get_ani(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief set the channel CAS in the idle state */ | |
| | | OR2_DECLARE(int) openr2_chan_set_idle(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief set the channel CAS in the blocked state */ | |
| | | OR2_DECLARE(int) openr2_chan_set_blocked(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief check for out of band events and process them if any change occu | |
| | | red (CAS signaling and hardware Alarms) */ | |
| | | OR2_DECLARE(int) openr2_chan_process_oob_events(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief check for CAS signaling changes and process them if any change o | |
| | | ccured */ | |
| | | OR2_DECLARE(int) openr2_chan_process_cas_signaling(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief check for MF signaling changes and process them if any change oc | |
| | | cured */ | |
| | | OR2_DECLARE(int) openr2_chan_process_mf_signaling(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief check for any signaling change and process them if any change oc | |
| | | cured */ | |
| | | OR2_DECLARE(int) openr2_chan_process_signaling(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief check if there is any expired timer and execute the timeout call | |
| | | backs if needed */ | |
| | | OR2_DECLARE(int) openr2_chan_run_schedule(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief return the last CAS bits received */ | |
| | | OR2_DECLARE(openr2_cas_signal_t) openr2_chan_get_rx_cas(openr2_chan_t *r2ch | |
| | | an); | |
| | | | |
| | | /*! \brief return the last CAS bits transmitted */ | |
| | | OR2_DECLARE(openr2_cas_signal_t) openr2_chan_get_tx_cas(openr2_chan_t *r2ch | |
| | | an); | |
| | | | |
| | | /*! \brief save the channel's last received and transmitted bits, respectiv | |
| | | ely, to rxcas and txcas */ | |
| | | OR2_DECLARE(void) openr2_chan_get_cas(openr2_chan_t *r2chan, openr2_cas_sig | |
| | | nal_t *rxcas, openr2_cas_signal_t *txcas); | |
| | | | |
| | | /*! \brief return a meaningful string for the last CAS bits received */ | |
| | | OR2_DECLARE(const char *) openr2_chan_get_rx_cas_string(openr2_chan_t *r2ch | |
| | | an); | |
| | | | |
| | | /*! \brief return a meaningful string for the last CAS bits transmitted */ | |
| | | OR2_DECLARE(const char *) openr2_chan_get_tx_cas_string(openr2_chan_t *r2ch | |
| | | an); | |
| | | | |
| | | /*! \brief return a meaningful string for the current call state */ | |
| | | OR2_DECLARE(const char *) openr2_chan_get_call_state_string(openr2_chan_t * | |
| | | r2chan); | |
| | | | |
| | | /*! \brief return a meaningful string for the current call state */ | |
| | | OR2_DECLARE(const char *) openr2_chan_get_r2_state_string(openr2_chan_t *r2 | |
| | | chan); | |
| | | | |
| | | /*! \brief return a meaningful string for the current MF state */ | |
| | | OR2_DECLARE(const char *) openr2_chan_get_mf_state_string(openr2_chan_t *r2 | |
| | | chan); | |
| | | | |
| | | /*! \brief return a meaningful string for the current MF group */ | |
| | | OR2_DECLARE(const char *) openr2_chan_get_mf_group_string(openr2_chan_t *r2 | |
| | | chan); | |
| | | | |
| | | /*! \brief return the ASCII code for the last transmitted MF signal */ | |
| | | OR2_DECLARE(int) openr2_chan_get_tx_mf_signal(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief return the ASCII code for the last received MF signal */ | |
| | | OR2_DECLARE(int) openr2_chan_get_rx_mf_signal(openr2_chan_t *r2chan); | |
| | | | |
| | | /*! \brief set the opaque handle that will be passed back to the DTMF callb | |
| | | acks */ | |
| | | OR2_DECLARE(int) openr2_chan_set_dtmf_handles(openr2_chan_t *r2chan, void * | |
| | | dtmf_read_handle, void *dtmf_write_handle); | |
| | | | |
| | | /*! \brief set the opaque handles that will be passed back to the MF genera | |
| | | tion and detection callbacks */ | |
| | | OR2_DECLARE(int) openr2_chan_set_mflib_handles(openr2_chan_t *r2chan, void | |
| | | *mf_write_handle, void *mf_read_handle); | |
| | | | |
|
| openr2_chan_t *openr2_chan_new(openr2_context_t *r2context, int channo, voi | | /*! \brief set channel's span_id */ | |
| d *mf_write_handle, void *mf_read_handle); | | OR2_DECLARE(void) openr2_chan_set_span_id(openr2_chan_t *r2chan, int span_i | |
| openr2_chan_t *openr2_chan_new_from_fd(openr2_context_t *r2context, int cha | | d); | |
| nfd, void *mf_write_handle, void *mf_read_handle); | | | |
| void openr2_chan_delete(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_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_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); | | | |
| 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); | | | |
| int openr2_chan_get_fd(openr2_chan_t *r2chan); | | | |
| int openr2_chan_get_number(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_get_client_data(openr2_chan_t *r2chan); | | | |
| int openr2_chan_get_time_to_next_event(openr2_chan_t *r2chan); | | | |
| openr2_log_level_t openr2_chan_set_log_level(openr2_chan_t *r2chan, openr2_ | | | |
| log_level_t level); | | | |
| openr2_log_level_t openr2_chan_get_log_level(openr2_chan_t *r2chan); | | | |
| void openr2_chan_enable_read(openr2_chan_t *r2chan); | | | |
| void openr2_chan_disable_read(openr2_chan_t *r2chan); | | | |
| int openr2_chan_get_read_enabled(openr2_chan_t *r2chan); | | | |
| void openr2_chan_enable_call_files(openr2_chan_t *r2chan); | | | |
| void openr2_chan_disable_call_files(openr2_chan_t *r2chan); | | | |
| int openr2_chan_get_call_files_enabled(openr2_chan_t *r2chan); | | | |
| const char *openr2_chan_get_dnis(openr2_chan_t *r2chan); | | | |
| const char *openr2_chan_get_ani(openr2_chan_t *r2chan); | | | |
| int openr2_chan_set_idle(openr2_chan_t *r2chan); | | | |
| int openr2_chan_set_blocked(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_tx_cas_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_mf_state_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_rx_mf_signal(openr2_chan_t *r2chan); | | | |
| int openr2_chan_set_dtmf_handles(openr2_chan_t *r2chan, void *dtmf_read_han | | | |
| dle, void *dtmf_write_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. 6 change blocks. |
| 64 lines changed or deleted | | 203 lines changed or added | |
|
| r2context.h | | r2context.h | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| | | | |
| #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__ | | #include "r2exports.h" | |
| struct openr2_chan_s; | | | |
| #define openr2_chan_t struct openr2_chan_s | | | |
| struct openr2_context_s; | | | |
| #define openr2_context_t struct openr2_context_s | | | |
| #else | | | |
| #ifndef OR2_CHAN_AND_CONTEXT_DEFINED | | | |
| #define OR2_CHAN_AND_CONTEXT_DEFINED | | | |
| typedef void* openr2_chan_t; | | | |
| typedef void* openr2_context_t; | | | |
| #endif | | | |
| #endif | | | |
| | | | |
| #define OR2_MAX_PATH 255 | | #define OR2_MAX_PATH 255 | |
| | | | |
| /* MF interface */ | | /* MF interface */ | |
| typedef void *(*openr2_mf_read_init_func)(void *read_handle, int forward_si
gnals); | | typedef void *(*openr2_mf_read_init_func)(void *read_handle, int forward_si
gnals); | |
| typedef void *(*openr2_mf_write_init_func)(void *write_handle, int forward_
signals); | | typedef void *(*openr2_mf_write_init_func)(void *write_handle, int forward_
signals); | |
| typedef int (*openr2_mf_detect_tone_func)(void *read_handle, const int16_t
buffer[], int samples); | | typedef int (*openr2_mf_detect_tone_func)(void *read_handle, const int16_t
buffer[], int samples); | |
| typedef int (*openr2_mf_generate_tone_func)(void *write_handle, int16_t buf
fer[], int samples); | | typedef int (*openr2_mf_generate_tone_func)(void *write_handle, int16_t buf
fer[], int samples); | |
| typedef int (*openr2_mf_select_tone_func)(void *write_handle, char signal); | | typedef int (*openr2_mf_select_tone_func)(void *write_handle, char signal); | |
| typedef int (*openr2_mf_want_generate_func)(void *write_handle, int signal)
; | | typedef int (*openr2_mf_want_generate_func)(void *write_handle, int signal)
; | |
| | | | |
| skipping to change at line 82 | | skipping to change at line 71 | |
| openr2_mf_want_generate_func mf_want_generate; | | openr2_mf_want_generate_func mf_want_generate; | |
| | | | |
| /* routines to dispose resources allocated by handles. (optional) */ | | /* routines to dispose resources allocated by handles. (optional) */ | |
| openr2_mf_read_dispose_func mf_read_dispose; | | openr2_mf_read_dispose_func mf_read_dispose; | |
| openr2_mf_write_dispose_func mf_write_dispose; | | openr2_mf_write_dispose_func mf_write_dispose; | |
| } openr2_mflib_interface_t; | | } openr2_mflib_interface_t; | |
| | | | |
| /* Event Management interface. Users should provide | | /* Event Management interface. Users should provide | |
| this interface to handle library events like call starting, new call, re
ad audio etc. */ | | this interface to handle library events like call starting, new call, re
ad audio etc. */ | |
| typedef void (*openr2_handle_new_call_func)(openr2_chan_t *r2chan); | | typedef void (*openr2_handle_new_call_func)(openr2_chan_t *r2chan); | |
|
| typedef void (*openr2_handle_call_offered_func)(openr2_chan_t *r2chan, cons | | typedef void (*openr2_handle_call_proceed_func)(openr2_chan_t *r2chan); | |
| t char *ani, const char *dnis, openr2_calling_party_category_t category); | | typedef void (*openr2_handle_call_offered_func)(openr2_chan_t *r2chan, cons | |
| | | t char *ani, const char *dnis, | |
| | | openr2_calling_party_category_t category, int ani_restricted | |
| | | ); | |
| typedef void (*openr2_handle_call_accepted_func)(openr2_chan_t *r2chan, ope
nr2_call_mode_t mode); | | typedef void (*openr2_handle_call_accepted_func)(openr2_chan_t *r2chan, ope
nr2_call_mode_t mode); | |
| typedef void (*openr2_handle_call_answered_func)(openr2_chan_t *r2chan); | | typedef void (*openr2_handle_call_answered_func)(openr2_chan_t *r2chan); | |
| typedef void (*openr2_handle_call_disconnect_func)(openr2_chan_t *r2chan, o
penr2_call_disconnect_cause_t cause); | | typedef void (*openr2_handle_call_disconnect_func)(openr2_chan_t *r2chan, o
penr2_call_disconnect_cause_t cause); | |
| typedef void (*openr2_handle_call_end_func)(openr2_chan_t *r2chan); | | typedef void (*openr2_handle_call_end_func)(openr2_chan_t *r2chan); | |
| typedef void (*openr2_handle_call_read_func)(openr2_chan_t *r2chan, const u
nsigned char *buf, int buflen); | | typedef void (*openr2_handle_call_read_func)(openr2_chan_t *r2chan, const u
nsigned char *buf, int buflen); | |
| typedef void (*openr2_handle_os_error_func)(openr2_chan_t *r2chan, int oser
rorcode); | | typedef void (*openr2_handle_os_error_func)(openr2_chan_t *r2chan, int oser
rorcode); | |
| typedef void (*openr2_handle_hardware_alarm_func)(openr2_chan_t *r2chan, in
t alarm); | | typedef void (*openr2_handle_hardware_alarm_func)(openr2_chan_t *r2chan, in
t alarm); | |
| typedef void (*openr2_handle_protocol_error_func)(openr2_chan_t *r2chan, op
enr2_protocol_error_t error); | | typedef void (*openr2_handle_protocol_error_func)(openr2_chan_t *r2chan, op
enr2_protocol_error_t error); | |
| typedef void (*openr2_handle_line_blocked_func)(openr2_chan_t *r2chan); | | typedef void (*openr2_handle_line_blocked_func)(openr2_chan_t *r2chan); | |
| typedef void (*openr2_handle_line_idle_func)(openr2_chan_t *r2chan); | | typedef void (*openr2_handle_line_idle_func)(openr2_chan_t *r2chan); | |
| typedef void (*openr2_handle_billing_pulse_received_func)(openr2_chan_t *r2
chan); | | typedef void (*openr2_handle_billing_pulse_received_func)(openr2_chan_t *r2
chan); | |
|
| | | typedef void (*openr2_handle_call_log_created_func)(openr2_chan_t *r2chan,
const char *name); | |
| typedef int (*openr2_handle_dnis_digit_received_func)(openr2_chan_t *r2chan
, char digit); | | typedef int (*openr2_handle_dnis_digit_received_func)(openr2_chan_t *r2chan
, char digit); | |
| typedef void (*openr2_handle_ani_digit_received_func)(openr2_chan_t *r2chan
, char digit); | | typedef void (*openr2_handle_ani_digit_received_func)(openr2_chan_t *r2chan
, char digit); | |
|
| typedef void (*openr2_handle_context_logging_func)(openr2_context_t *r2cont
ext, openr2_log_level_t level, const char *fmt, va_list ap); | | typedef void (*openr2_handle_context_logging_func)(openr2_context_t *r2cont
ext, const char *file, const char *function, unsigned int line, openr2_log_
level_t level, const char *fmt, va_list ap); | |
| typedef struct { | | typedef struct { | |
| /* A new call has just started. We will start to | | /* A new call has just started. We will start to | |
| receive the ANI and DNIS */ | | receive the ANI and DNIS */ | |
| openr2_handle_new_call_func on_call_init; | | openr2_handle_new_call_func on_call_init; | |
| | | | |
|
| | | /* Call is proceeding */ | |
| | | openr2_handle_call_proceed_func on_call_proceed; | |
| | | | |
| /* New call is ready to be accepted or rejected */ | | /* New call is ready to be accepted or rejected */ | |
| openr2_handle_call_offered_func on_call_offered; | | openr2_handle_call_offered_func on_call_offered; | |
| | | | |
| /* Call has been accepted */ | | /* Call has been accepted */ | |
| openr2_handle_call_accepted_func on_call_accepted; | | openr2_handle_call_accepted_func on_call_accepted; | |
| | | | |
| /* Call has been answered */ | | /* Call has been answered */ | |
| openr2_handle_call_answered_func on_call_answered; | | openr2_handle_call_answered_func on_call_answered; | |
| | | | |
| /* The far end has sent a disconnect signal */ | | /* The far end has sent a disconnect signal */ | |
| | | | |
| skipping to change at line 150 | | skipping to change at line 145 | |
| /* New DNIS digit arrived. If the user return any non zero | | /* New DNIS digit arrived. If the user return any non zero | |
| value OpenR2 will request more DNIS (if max DNIS still not reache
d), | | value OpenR2 will request more DNIS (if max DNIS still not reache
d), | |
| if 0 is returned no more dnis will be requested regardless of the
max DNIS limit*/ | | if 0 is returned no more dnis will be requested regardless of the
max DNIS limit*/ | |
| openr2_handle_dnis_digit_received_func on_dnis_digit_received; | | openr2_handle_dnis_digit_received_func on_dnis_digit_received; | |
| | | | |
| /* New ANI digit arrived */ | | /* New ANI digit arrived */ | |
| openr2_handle_ani_digit_received_func on_ani_digit_received; | | openr2_handle_ani_digit_received_func on_ani_digit_received; | |
| | | | |
| /* Billing pulse arrived */ | | /* Billing pulse arrived */ | |
| openr2_handle_billing_pulse_received_func on_billing_pulse_received; | | openr2_handle_billing_pulse_received_func on_billing_pulse_received; | |
|
| | | | |
| | | /* New call log was created */ | |
| | | openr2_handle_call_log_created_func on_call_log_created; | |
| } openr2_event_interface_t; | | } openr2_event_interface_t; | |
| | | | |
|
| | | typedef openr2_io_fd_t (*openr2_io_open_func)(openr2_context_t* r2context, | |
| | | int channo); | |
| | | typedef int (*openr2_io_close_func)(openr2_chan_t *r2chan); | |
| | | typedef int (*openr2_io_set_cas_func)(openr2_chan_t *r2chan, int cas); | |
| | | typedef int (*openr2_io_get_cas_func)(openr2_chan_t *r2chan, int *cas); | |
| | | typedef int (*openr2_io_flush_write_buffers_func)(openr2_chan_t *r2chan); | |
| | | typedef int (*openr2_io_write_func)(openr2_chan_t *r2chan, const void *buf, | |
| | | int size); | |
| | | typedef int (*openr2_io_read_func)(openr2_chan_t *r2chan, const void *buf, | |
| | | int size); | |
| | | typedef int (*openr2_io_setup_func)(openr2_chan_t *r2chan); | |
| | | typedef int (*openr2_io_wait_func)(openr2_chan_t *r2chan, int *flags, int b | |
| | | lock); | |
| | | typedef int (*openr2_io_get_oob_event_func)(openr2_chan_t *r2chan, openr2_o | |
| | | ob_event_t *event); | |
| | | typedef int (*openr2_io_get_alarm_state_func)(openr2_chan_t *r2chan, int *a | |
| | | larm); | |
| | | typedef struct { | |
| | | openr2_io_open_func open; | |
| | | openr2_io_close_func close; | |
| | | openr2_io_set_cas_func set_cas; | |
| | | openr2_io_get_cas_func get_cas; | |
| | | openr2_io_flush_write_buffers_func flush_write_buffers; | |
| | | openr2_io_write_func write; | |
| | | openr2_io_read_func read; | |
| | | openr2_io_setup_func setup; | |
| | | openr2_io_wait_func wait; | |
| | | openr2_io_get_oob_event_func get_oob_event; | |
| | | openr2_io_get_alarm_state_func get_alarm_state; | |
| | | } openr2_io_interface_t; | |
| | | | |
| | | typedef enum { | |
| | | OR2_IO_DEFAULT = 0, /* Default is Zaptel */ | |
| | | /* OR2_IO_OPENZAP (libopenzap I/O) */ | |
| | | /* OR2_IO_SANGOMA (libsangoma I/O) */ | |
| | | OR2_IO_ZT, /* Zaptel or DAHDI I/O */ | |
| | | OR2_IO_CUSTOM = 9 /* any unsupported vendor I/O (pika, digivoice, ko | |
| | | hmp etc) */ | |
| | | } openr2_io_type_t; | |
| | | | |
| /* 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; | |
| | | | |
| | | | |
| skipping to change at line 194 | | skipping to change at line 225 | |
| openr2_dtmf_rx_func dtmf_rx; | | openr2_dtmf_rx_func dtmf_rx; | |
| } openr2_dtmf_interface_t; | | } 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, | |
| | | /* No I/O interface is available */ | |
| | | OR2_LIBERR_NO_IO_IFACE_AVAILABLE, | |
| | | /* Invalid channel number provided */ | |
| | | OR2_LIBERR_INVALID_CHAN_NUMBER, | |
| | | /* Out of memory */ | |
| | | OR2_LIBERR_OUT_OF_MEMORY, | |
| | | /* Invalid interface provided */ | |
| | | OR2_LIBERR_INVALID_INTERFACE | |
| } openr2_liberr_t; | | } openr2_liberr_t; | |
| | | | |
|
| int openr2_context_get_time_to_next_event(openr2_context_t *r2context); | | OR2_DECLARE(int) openr2_context_get_time_to_next_event(openr2_context_t *r2 | |
| openr2_context_t *openr2_context_new(openr2_mflib_interface_t *mflib, openr | | context); | |
| 2_event_interface_t *callmgmt, | | OR2_DECLARE(openr2_context_t *) openr2_context_new(openr2_variant_t variant | |
| openr2_transcoder_interface_t *transcoder, ope | | , openr2_event_interface_t *callmgmt, int max_ani, int max_dnis); | |
| nr2_variant_t variant, int max_ani, int max_dnis); | | OR2_DECLARE(void) openr2_context_delete(openr2_context_t *r2context); | |
| void openr2_context_delete(openr2_context_t *r2context); | | OR2_DECLARE(openr2_liberr_t) openr2_context_get_last_error(openr2_context_t | |
| openr2_liberr_t openr2_context_get_last_error(openr2_context_t *r2context); | | *r2context); | |
| const char *openr2_context_error_string(openr2_liberr_t error); | | OR2_DECLARE(const char *) openr2_context_error_string(openr2_liberr_t error | |
| openr2_variant_t openr2_context_get_variant(openr2_context_t *r2context); | | ); | |
| int openr2_context_get_max_ani(openr2_context_t *r2context); | | OR2_DECLARE(openr2_variant_t) openr2_context_get_variant(openr2_context_t * | |
| int openr2_context_get_max_dnis(openr2_context_t *r2context); | | r2context); | |
| void openr2_context_set_ani_first(openr2_context_t *r2context, int ani_firs | | OR2_DECLARE(int) openr2_context_get_max_ani(openr2_context_t *r2context); | |
| t); | | OR2_DECLARE(int) openr2_context_get_max_dnis(openr2_context_t *r2context); | |
| int openr2_context_get_ani_first(openr2_context_t *r2context); | | OR2_DECLARE(void) openr2_context_set_ani_first(openr2_context_t *r2context, | |
| void openr2_context_set_skip_category_request(openr2_context_t *r2context, | | int ani_first); | |
| int skipcategory); | | OR2_DECLARE(int) openr2_context_get_ani_first(openr2_context_t *r2context); | |
| int openr2_context_get_skip_category_request(openr2_context_t *r2context); | | OR2_DECLARE(void) openr2_context_set_skip_category_request(openr2_context_t | |
| void openr2_context_set_immediate_accept(openr2_context_t *r2context, int i | | *r2context, int skipcategory); | |
| mmediate_accept); | | OR2_DECLARE(int) openr2_context_get_skip_category_request(openr2_context_t | |
| int openr2_context_get_immediate_accept(openr2_context_t *r2context); | | *r2context); | |
| void openr2_context_set_log_level(openr2_context_t *r2context, openr2_log_l | | OR2_DECLARE(void) openr2_context_set_immediate_accept(openr2_context_t *r2c | |
| evel_t level); | | ontext, int immediate_accept); | |
| openr2_log_level_t openr2_context_get_log_level(openr2_context_t *r2context | | OR2_DECLARE(int) openr2_context_get_immediate_accept(openr2_context_t *r2co | |
| ); | | ntext); | |
| void openr2_context_set_mf_threshold(openr2_context_t *r2context, int thres | | OR2_DECLARE(void) openr2_context_set_log_level(openr2_context_t *r2context, | |
| hold); | | openr2_log_level_t level); | |
| int openr2_context_get_mf_threshold(openr2_context_t *r2context); | | OR2_DECLARE(openr2_log_level_t) openr2_context_get_log_level(openr2_context | |
| int openr2_context_set_log_directory(openr2_context_t *r2context, char *dir | | _t *r2context); | |
| ectory); | | OR2_DECLARE(void) openr2_context_set_mf_threshold(openr2_context_t *r2conte | |
| char *openr2_context_get_log_directory(openr2_context_t *r2context, char *d | | xt, int threshold); | |
| irectory, int len); | | OR2_DECLARE(int) openr2_context_get_mf_threshold(openr2_context_t *r2contex | |
| void openr2_context_set_mf_back_timeout(openr2_context_t *r2context, int ms | | t); | |
| ); | | OR2_DECLARE(int) openr2_context_set_log_directory(openr2_context_t *r2conte | |
| int openr2_context_get_mf_back_timeout(openr2_context_t *r2context); | | xt, char *directory); | |
| void openr2_context_set_metering_pulse_timeout(openr2_context_t *r2context, | | OR2_DECLARE(char *) openr2_context_get_log_directory(openr2_context_t *r2co | |
| int ms); | | ntext, char *directory, int len); | |
| int openr2_context_get_metering_pulse_timeout(openr2_context_t *r2context); | | OR2_DECLARE(void) openr2_context_set_mf_back_timeout(openr2_context_t *r2co | |
| void openr2_context_set_double_answer(openr2_context_t *r2context, int enab | | ntext, int ms); | |
| le); | | OR2_DECLARE(int) openr2_context_get_mf_back_timeout(openr2_context_t *r2con | |
| int openr2_context_get_double_answer(openr2_context_t *r2context); | | text); | |
| int openr2_context_configure_from_advanced_file(openr2_context_t *r2context | | OR2_DECLARE(void) openr2_context_set_metering_pulse_timeout(openr2_context_ | |
| , const char *filename); | | t *r2context, int ms); | |
| void openr2_context_set_dtmf_detection(openr2_context_t *r2context, int ena | | OR2_DECLARE(int) openr2_context_get_metering_pulse_timeout(openr2_context_t | |
| ble); | | *r2context); | |
| int openr2_context_get_dtmf_detection(openr2_context_t *r2context); | | OR2_DECLARE(void) openr2_context_set_double_answer(openr2_context_t *r2cont | |
| void openr2_context_set_dtmf_detection_end_timeout(openr2_context_t *r2cont | | ext, int enable); | |
| ext, int dtmf_end); | | OR2_DECLARE(int) openr2_context_get_double_answer(openr2_context_t *r2conte | |
| int openr2_context_get_dtmf_detection_end_timeout(openr2_context_t *r2conte | | xt); | |
| xt); | | OR2_DECLARE(int) openr2_context_configure_from_advanced_file(openr2_context | |
| void openr2_context_set_dtmf_dialing(openr2_context_t *r2context, int enabl | | _t *r2context, const char *filename); | |
| e, int dtmf_on, int dtmf_off); | | OR2_DECLARE(int) openr2_context_set_io_type(openr2_context_t *r2context, op | |
| int openr2_context_get_dtmf_dialing(openr2_context_t *r2context, int *dtmf_ | | enr2_io_type_t io_type, openr2_io_interface_t *io_interface); | |
| on, int *dtmf_off); | | OR2_DECLARE(void) openr2_context_set_dtmf_detection(openr2_context_t *r2con | |
| int openr2_context_set_dtmf_interface(openr2_context_t *r2context, openr2_d | | text, int enable); | |
| tmf_interface_t *dtmf_interface); | | OR2_DECLARE(int) openr2_context_get_dtmf_detection(openr2_context_t *r2cont | |
| | | ext); | |
| | | OR2_DECLARE(void) openr2_context_set_dtmf_dialing(openr2_context_t *r2conte | |
| | | xt, int enable, int dtmf_on, int dtmf_off); | |
| | | OR2_DECLARE(int) openr2_context_get_dtmf_dialing(openr2_context_t *r2contex | |
| | | t, int *dtmf_on, int *dtmf_off); | |
| | | OR2_DECLARE(int) openr2_context_set_dtmf_interface(openr2_context_t *r2cont | |
| | | ext, openr2_dtmf_interface_t *dtmf_interface); | |
| | | OR2_DECLARE(int) openr2_context_set_mflib_interface(openr2_context_t *r2con | |
| | | text, openr2_mflib_interface_t *mflib); | |
| | | OR2_DECLARE(int) openr2_context_set_transcoder_interface(openr2_context_t * | |
| | | r2context, openr2_transcoder_interface_t *transcoder); | |
| | | | |
| #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. 9 change blocks. |
| 71 lines changed or deleted | | 129 lines changed or added | |
|
| r2proto.h | | r2proto.h | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENR2_PROTO_H_ | | #ifndef _OPENR2_PROTO_H_ | |
| #define _OPENR2_PROTO_H_ | | #define _OPENR2_PROTO_H_ | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
|
| #ifdef __OR2_COMPILING_LIBRARY__ | | #include "r2declare.h" | |
| struct openr2_chan_s; | | #include "r2exports.h" | |
| #define openr2_chan_t struct openr2_chan_s | | | |
| struct openr2_context_s; | | | |
| #define openr2_context_t struct openr2_context_s | | | |
| #else | | | |
| #ifndef OR2_CHAN_AND_CONTEXT_DEFINED | | | |
| #define OR2_CHAN_AND_CONTEXT_DEFINED | | | |
| typedef void* openr2_chan_t; | | | |
| typedef void* openr2_context_t; | | | |
| #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_ON 50 | |
| #define OR2_DEFAULT_DTMF_OFF 100 | | #define OR2_DEFAULT_DTMF_OFF 100 | |
| | | | |
|
| | | #define OR2_STOP_DNIS_REQUEST 0 | |
| | | #define OR2_CONTINUE_DNIS_REQUEST 1 | |
| | | | |
| | | #define OR2_IO_READ (1 << 0) | |
| | | #define OR2_IO_WRITE (1 << 1) | |
| | | #define OR2_IO_OOB_EVENT (1 << 2) | |
| | | | |
| | | /* Out of Band events */ | |
| | | typedef enum { | |
| | | OR2_OOB_EVENT_NONE, | |
| | | OR2_OOB_EVENT_CAS_CHANGE, | |
| | | OR2_OOB_EVENT_ALARM_ON, | |
| | | OR2_OOB_EVENT_ALARM_OFF | |
| | | } openr2_oob_event_t; | |
| | | | |
| /* | | /* | |
| 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 100 | | skipping to change at line 105 | |
| } openr2_mf_tone_t; | | } openr2_mf_tone_t; | |
| | | | |
| /* MFC/R2 variants */ | | /* MFC/R2 variants */ | |
| typedef enum { | | typedef enum { | |
| OR2_VAR_ARGENTINA = 0, | | OR2_VAR_ARGENTINA = 0, | |
| OR2_VAR_BRAZIL = 20, | | OR2_VAR_BRAZIL = 20, | |
| OR2_VAR_CHINA = 40, | | OR2_VAR_CHINA = 40, | |
| OR2_VAR_CZECH = 60, | | OR2_VAR_CZECH = 60, | |
| OR2_VAR_COLOMBIA = 70, | | OR2_VAR_COLOMBIA = 70, | |
| OR2_VAR_ECUADOR = 80, | | OR2_VAR_ECUADOR = 80, | |
|
| OR2_VAR_INDONESIA = 90, | | | |
| OR2_VAR_ITU = 100, | | OR2_VAR_ITU = 100, | |
| OR2_VAR_MEXICO = 120, | | OR2_VAR_MEXICO = 120, | |
| OR2_VAR_PHILIPPINES = 140, | | OR2_VAR_PHILIPPINES = 140, | |
| OR2_VAR_VENEZUELA = 160, | | OR2_VAR_VENEZUELA = 160, | |
| OR2_VAR_UNKNOWN = 999 | | OR2_VAR_UNKNOWN = 999 | |
| } openr2_variant_t; | | } openr2_variant_t; | |
| | | | |
| /* Variant configuration function and variant table entry */ | | /* Variant configuration function and variant table entry */ | |
| typedef void (*openr2_variant_config_func)(openr2_context_t *); | | typedef void (*openr2_variant_config_func)(openr2_context_t *); | |
| typedef struct { | | typedef struct { | |
| | | | |
| skipping to change at line 147 | | skipping to change at line 151 | |
| | | | |
| /* 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_FORCED_RELEASE, | | OR2_CAUSE_FORCED_RELEASE, | |
|
| OR2_CAUSE_NUMBER_CHANGED | | OR2_CAUSE_NUMBER_CHANGED, | |
| | | OR2_CAUSE_GLARE | |
| } openr2_call_disconnect_cause_t; | | } openr2_call_disconnect_cause_t; | |
| | | | |
| /* possible causes of protocol error */ | | /* possible causes of protocol error */ | |
| typedef enum { | | typedef enum { | |
| OR2_INVALID_CAS_BITS, | | OR2_INVALID_CAS_BITS, | |
| OR2_INVALID_MF_TONE, | | OR2_INVALID_MF_TONE, | |
| OR2_BACK_MF_TIMEOUT, | | OR2_BACK_MF_TIMEOUT, | |
| OR2_SEIZE_TIMEOUT, | | OR2_SEIZE_TIMEOUT, | |
| OR2_FWD_SAFETY_TIMEOUT, | | OR2_FWD_SAFETY_TIMEOUT, | |
| OR2_BROKEN_MF_SEQUENCE, | | OR2_BROKEN_MF_SEQUENCE, | |
| OR2_ANSWER_TIMEOUT, | | OR2_ANSWER_TIMEOUT, | |
| OR2_INVALID_R2_STATE, | | OR2_INVALID_R2_STATE, | |
| OR2_INVALID_MF_STATE, | | OR2_INVALID_MF_STATE, | |
| OR2_INVALID_MF_GROUP, | | OR2_INVALID_MF_GROUP, | |
| OR2_LIBRARY_BUG, | | OR2_LIBRARY_BUG, | |
|
| OR2_INTERNAL_ERROR | | OR2_INTERNAL_ERROR, | |
| | | OR2_ALARM_RAISED | |
| } openr2_protocol_error_t; | | } openr2_protocol_error_t; | |
| | | | |
| /* possible calling party categories */ | | /* possible calling party categories */ | |
| typedef enum { | | typedef enum { | |
| OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER = 0, | | OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER = 0, | |
| OR2_CALLING_PARTY_CATEGORY_NATIONAL_PRIORITY_SUBSCRIBER, | | OR2_CALLING_PARTY_CATEGORY_NATIONAL_PRIORITY_SUBSCRIBER, | |
| OR2_CALLING_PARTY_CATEGORY_INTERNATIONAL_SUBSCRIBER, | | OR2_CALLING_PARTY_CATEGORY_INTERNATIONAL_SUBSCRIBER, | |
| OR2_CALLING_PARTY_CATEGORY_INTERNATIONAL_PRIORITY_SUBSCRIBER, | | OR2_CALLING_PARTY_CATEGORY_INTERNATIONAL_PRIORITY_SUBSCRIBER, | |
| OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL, | | OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL, | |
|
| | | OR2_CALLING_PARTY_CATEGORY_TEST_EQUIPMENT, | |
| | | OR2_CALLING_PARTY_CATEGORY_PAY_PHONE, | |
| OR2_CALLING_PARTY_CATEGORY_UNKNOWN, | | OR2_CALLING_PARTY_CATEGORY_UNKNOWN, | |
|
| OR2_CALLING_PARTY_CATEGORY_TEST_EQUIPMENT | | | |
| } openr2_calling_party_category_t; | | } openr2_calling_party_category_t; | |
| | | | |
|
| const char *openr2_proto_get_error(openr2_protocol_error_t reason); | | /* Number of CAS signals. CAS signaling is | |
| const char *openr2_proto_get_disconnect_string(openr2_call_disconnect_cause | | known as line supervisory signaling | |
| _t cause); | | | |
| const char *openr2_proto_get_category_string(openr2_calling_party_category_ | | WATCH OUT!! | |
| t category); | | This number MUST match the number of | |
| openr2_calling_party_category_t openr2_proto_get_category(const char *categ | | enums AND r2proto.c standard_cas_signals | |
| ory); | | and cas_names arrays!! | |
| const char *openr2_proto_get_variant_string(openr2_variant_t variant); | | */ | |
| openr2_variant_t openr2_proto_get_variant(const char *variant); | | #define OR2_NUM_CAS_SIGNALS 8 | |
| const char *openr2_proto_get_call_mode_string(openr2_call_mode_t mode); | | | |
| const openr2_variant_entry_t *openr2_proto_get_variant_list(int *numvariant | | /* | |
| s); | | WATCH OUT!! | |
| | | Each value of this enum should correspond to the | |
| | | proper index in standard_cas_signals and cas_names arrays!! | |
| | | */ | |
| | | typedef enum { | |
| | | /* Invalid signal */ | |
| | | OR2_CAS_INVALID = -1, | |
| | | /* The line is ready to receive or make calls */ | |
| | | OR2_CAS_IDLE = 0, | |
| | | /* The line is not ready to receive or make calls */ | |
| | | OR2_CAS_BLOCK, | |
| | | /* We set to this state our CAS bits when we want to let know | |
| | | the other side that we want to start a new call */ | |
| | | OR2_CAS_SEIZE, | |
| | | /* We answer with this CAS bits when we are sized and we want to pro | |
| | | ceed | |
| | | with the MF signaling. After setting the bits to this state, the | |
| | | other end | |
| | | will start sending MF signaling */ | |
| | | OR2_CAS_SEIZE_ACK, | |
| | | /* We want to HANGUP the call */ | |
| | | OR2_CAS_CLEAR_BACK, | |
| | | /* Hangup immediately. I have only seen this in Brazil, where the ce | |
| | | ntral | |
| | | waits several seconds (30?) after Clear Back to release the line, | |
| | | with | |
| | | this signal no waiting will be done. When receiving this signal o | |
| | | penr2 | |
| | | behaves the same as with clear back, no waiting is done with clea | |
| | | r back | |
| | | anyway, should we? */ | |
| | | OR2_CAS_FORCED_RELEASE, | |
| | | /* They want to HANGUP the call */ | |
| | | OR2_CAS_CLEAR_FORWARD, | |
| | | /* We set this to let know the other end we are ANSWERing the call a | |
| | | nd the | |
| | | speech path is open */ | |
| | | OR2_CAS_ANSWER, | |
| | | } openr2_cas_signal_t; | |
| | | | |
| | | OR2_DECLARE(const char *) openr2_proto_get_error(openr2_protocol_error_t re | |
| | | ason); | |
| | | OR2_DECLARE(const char *) openr2_proto_get_disconnect_string(openr2_call_di | |
| | | sconnect_cause_t cause); | |
| | | OR2_DECLARE(const char *) openr2_proto_get_category_string(openr2_calling_p | |
| | | arty_category_t category); | |
| | | OR2_DECLARE(openr2_calling_party_category_t) openr2_proto_get_category(con | |
| | | st char *category); | |
| | | OR2_DECLARE(const char *) openr2_proto_get_variant_string(openr2_variant_t | |
| | | variant); | |
| | | OR2_DECLARE(openr2_variant_t) openr2_proto_get_variant(const char *variant) | |
| | | ; | |
| | | OR2_DECLARE(const char *) openr2_proto_get_call_mode_string(openr2_call_mod | |
| | | e_t mode); | |
| | | OR2_DECLARE(const openr2_variant_entry_t *) openr2_proto_get_variant_list(i | |
| | | nt *numvariants); | |
| | | | |
| #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. 9 change blocks. |
| 29 lines changed or deleted | | 90 lines changed or added | |
|