#include "libsangoma.h"
#include "lib_api.h"
Include dependency graph for sample.c:

Go to the source code of this file.
Classes | |
| struct | sangoma_chan |
Defines | |
| #define | TEST_NUMBER_OF_OBJECTS 1 |
| Number of wait objects to define in object array. | |
Typedefs | |
| typedef sangoma_chan | sangoma_chan_t |
Functions | |
| int __cdecl | main (int argc, char *argv[]) |
| Main function that starts the sample code. | |
| int | open_sangoma_device (void) |
| Open a single span chan device. | |
| void | handle_span_chan (int open_device_counter) |
| Write data buffer into a file. | |
| int | handle_tdm_event (uint32_t dev_index) |
| Read Event buffer from the device. | |
| int | handle_data (uint32_t dev_index, int flags_out) |
| Read data buffer from the device and transmit it back down. | |
| int | read_data (uint32_t dev_index, wp_api_hdr_t *rx_hdr, void *rx_buffer, int rx_buffer_length) |
| int | write_data (uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_buffer) |
| Transmit a data buffer to a device. | |
| int | dtmf_event (sng_fd_t fd, unsigned char digit, unsigned char type, unsigned char port) |
| int | rbs_event (sng_fd_t fd, unsigned char rbs_bits) |
| int | rxhook_event (sng_fd_t fd, unsigned char hook_state) |
| int | rxring_event (sng_fd_t fd, unsigned char ring_state) |
| int | ringtrip_event (sng_fd_t fd, unsigned char ring_state) |
| int | write_data_to_file (unsigned char *data, unsigned int data_length) |
| Write data buffer into a file. | |
| void | cleanup (void) |
| Protperly shutdown single device. | |
| void | TerminateHandler (int) |
| Signal handler for graceful shutdown. | |
| void | print_rxdata (unsigned char *data, int datalen) |
Variables | |
| sangoma_chan_t | sangoma_channels [TEST_NUMBER_OF_OBJECTS] |
| unsigned char | rx_rbs_bits = WAN_RBS_SIG_A |
| FILE * | pRxFile |
| int | application_termination_flag = 0 |
Authors: David Rokhvarg <davidr@sangoma.com> Nenad Corbic <ncorbic@sangoma.com>
Copyright (c) 2007 - 08, Sangoma Technologies All rights reserved.
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Sangoma Technologies nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Sangoma Technologies ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Sangoma Technologies BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ===============================================================================
Definition in file sample.c.
| #define TEST_NUMBER_OF_OBJECTS 1 |
Number of wait objects to define in object array.
Objects are used to wait on file descripotrs. Usually there is one wait object per file descriptor.
In this example there is a single file descriptor and a single wait object.
Definition at line 50 of file sample.c.
Referenced by cleanup(), handle_span_chan(), and main().
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Main function that starts the sample code.
| argc | number of arguments | |
| argv | argument list |
Definition at line 694 of file sample.c.
References _getch, callback_functions, cleanup(), sangoma_interface::CreateSwDtmfTxThread(), DBG_MAIN, sangoma_interface::device_name, sangoma_interface::enable_rbs_monitoring(), EnterCriticalSection, sangoma_interface::flush_operational_stats(), sangoma_interface::fxo_go_off_hook(), sangoma_interface::fxo_go_on_hook(), sangoma_interface::get_adapter_type(), sangoma_interface::get_api_driver_version(), sangoma_interface::get_card_customer_id(), sangoma_interface::get_operational_stats(), sangoma_interface::get_rbs(), sangoma_interface::get_sub_media(), sangoma_interface::get_te1_56k_stat(), handle_span_chan(), INFO_MAIN, init(), InitializeCriticalSection, LeaveCriticalSection, _DRIVER_VERSION::major, MAX_NO_DATA_BYTES_IN_FRAME, _DRIVER_VERSION::minor, _DRIVER_VERSION::minor1, _DRIVER_VERSION::minor2, open_sangoma_device(), PrintCriticalSection, program_settings, pRxFile, sangoma_interface::resetFSKCID(), SANG_STATUS_SUCCESS, SANG_STATUS_TX_TIMEOUT, sangoma_msleep, sangoma_interface::sendCallerID(), sangoma_interface::sendSwDTMF(), sangoma_interface::set_fe_debug_mode(), sangoma_interface::set_lb_modes(), sangoma_interface::set_rbs(), sangoma_interface::set_tx_idle_flag(), start(), sangoma_interface::start_busy_tone(), sangoma_interface::start_congestion_tone(), sangoma_interface::start_dial_tone(), sangoma_interface::start_ring_tone(), sangoma_interface::start_ringing_phone(), stop(), sangoma_interface::stop_all_tones(), sangoma_interface::stop_ringing_phone(), sangoma_interface::tdm_disable_bri_bchan_loopback(), sangoma_interface::tdm_disable_dtmf_events(), sangoma_interface::tdm_disable_ring_detect_events(), sangoma_interface::tdm_disable_ring_trip_detect_events(), sangoma_interface::tdm_disable_rm_dtmf_events(), sangoma_interface::tdm_disable_rxhook_events(), sangoma_interface::tdm_enable_bri_bchan_loopback(), sangoma_interface::tdm_enable_dtmf_events(), sangoma_interface::tdm_enable_ring_detect_events(), sangoma_interface::tdm_enable_ring_trip_detect_events(), sangoma_interface::tdm_enable_rm_dtmf_events(), sangoma_interface::tdm_enable_rxhook_events(), sangoma_interface::tdm_front_end_activate(), sangoma_interface::tdm_front_end_deactivate(), sangoma_interface::tdm_get_front_end_status(), sangoma_interface::tdm_set_user_period(), TdmEventCriticalSection, TerminateHandler(), TEST_NUMBER_OF_OBJECTS, sangoma_interface::transmit(), TRUE, tx_file(), and WAN_BRI_BCHAN1.
00695 { 00696 int proceed, i; 00697 00698 proceed=init_args(argc,argv); 00699 if (proceed != WAN_TRUE){ 00700 usage(argv[0]); 00701 return -1; 00702 } 00703 00704 /* register Ctrl+C handler - we want a clean termination */ 00705 #if defined(__WINDOWS__) 00706 if (!SetConsoleCtrlHandler(TerminateHandler, TRUE)) { 00707 printf("ERROR : Unable to register terminate handler ( %d ).\nProcess terminated.\n", 00708 GetLastError()); 00709 return -1; 00710 } 00711 #else 00712 signal(SIGHUP,TerminateHandler); 00713 signal(SIGTERM,TerminateHandler); 00714 #endif 00715 00716 for(i = 0; i < TEST_NUMBER_OF_OBJECTS; i++){ 00717 sangoma_wait_objects[i] = NULL; 00718 } 00719 00720 poll_events_bitmap = 0; 00721 if(read_enable == 1){ 00722 poll_events_bitmap |= POLLIN; 00723 } 00724 00725 if(write_enable == 1 && rx2tx == 1){ 00726 /* These two options are mutually exclusive because 'rx2tx' option 00727 * indicates "use Reciever as the timing source for Transmitter". */ 00728 write_enable = 0; 00729 } 00730 00731 if(write_enable == 1){ 00732 poll_events_bitmap |= POLLOUT; 00733 } 00734 00735 /* Front End connect/disconnect, and other events, such as DTMF... */ 00736 poll_events_bitmap |= (POLLHUP | POLLPRI); 00737 #if defined(__WINDOWS__) 00738 printf("Enabling Poll Events:\n"); 00739 print_poll_event_bitmap(poll_events_bitmap); 00740 #endif 00741 printf("Connecting to Port/Span: %d, Interface/Chan: %d\n", 00742 wanpipe_port_no, wanpipe_if_no); 00743 00744 00745 if(open_sangoma_device()){ 00746 return -1; 00747 } 00748 00749 printf("********************************\n"); 00750 printf("files_used: 0x%x\n", files_used); 00751 printf("********************************\n"); 00752 if(files_used & RX_FILE_USED){ 00753 pRxFile = fopen( (const char*)&rx_file[0], "wb" ); 00754 if(pRxFile == NULL){ 00755 printf("Can't open Rx file: [%s]!!\n", rx_file); 00756 }else{ 00757 printf("Open Rx file: %s. OK.\n", rx_file); 00758 } 00759 } 00760 00761 handle_span_chan(1 /* handle a single device */); 00762 00763 /* returned from main loop, do the cleanup before exiting: */ 00764 cleanup(); 00765 00766 printf("\nSample application exiting.(press any key)\n"); 00767 _getch(); 00768 return 0; 00769 }
Here is the call graph for this function:

| int open_sangoma_device | ( | void | ) |
Open a single span chan device.
However it can be rewritten to iterate for all spans and chans and try to open all existing wanpipe devices.
For each opened device, a wait object will be initialized. For each device, configure the chunk size for tx/rx enable events such as DTMF/RBS ...etc
Definition at line 581 of file sample.c.
References sangoma_chan::channo, INVALID_HANDLE_VALUE, SANG_STATUS_SUCCESS, sangoma_channels, SANGOMA_DEVICE_WAIT_OBJ, sangoma_get_full_cfg(), sangoma_get_rx_queue_sz(), sangoma_get_tx_queue_sz(), sangoma_open_api_span_chan(), sangoma_set_rx_queue_sz(), sangoma_set_tx_queue_sz(), sangoma_tdm_enable_dtmf_events(), sangoma_tdm_enable_rbs_events(), sangoma_tdm_enable_rm_dtmf_events(), sangoma_tdm_enable_rxhook_events(), sangoma_tdm_set_codec(), sangoma_tdm_set_usr_period(), sangoma_wait_obj_create(), sangoma_wait_obj_set_context(), and sangoma_chan::spanno.
Referenced by main().
00582 { 00583 int span, chan, err = 0, open_dev_cnt = 0; 00584 sangoma_status_t status; 00585 sng_fd_t dev_fd = INVALID_HANDLE_VALUE; 00586 wanpipe_api_t tdm_api; 00587 00588 span = wanpipe_port_no; 00589 chan = wanpipe_if_no; 00590 00591 /* span and chan are 1-based */ 00592 dev_fd = sangoma_open_api_span_chan(span, chan); 00593 if( dev_fd == INVALID_HANDLE_VALUE){ 00594 printf("Warning: Failed to open span %d, chan %d\n", span , chan); 00595 return 1; 00596 }else{ 00597 printf("Successfuly opened span %d, chan %d\n", span , chan); 00598 } 00599 00600 memset(&tdm_api, 0x00, sizeof(tdm_api)); 00601 00602 status = sangoma_wait_obj_create(&sangoma_wait_objects[open_dev_cnt], dev_fd, SANGOMA_DEVICE_WAIT_OBJ); 00603 if(status != SANG_STATUS_SUCCESS){ 00604 printf("Error: Failed to create 'sangoma_wait_object'!\n"); 00605 return 1; 00606 } 00607 sangoma_channels[open_dev_cnt].channo = chan; 00608 sangoma_channels[open_dev_cnt].spanno = span; 00609 sangoma_wait_obj_set_context(sangoma_wait_objects[open_dev_cnt], &sangoma_channels[open_dev_cnt]); 00610 /* open_dev_cnt++; */ 00611 00612 if((err = sangoma_get_full_cfg(dev_fd, &tdm_api))){ 00613 return 1; 00614 } 00615 00616 if(set_codec_slinear){ 00617 printf("Setting SLINEAR codec\n"); 00618 if((err=sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_SLINEAR))){ 00619 return 1; 00620 } 00621 } 00622 00623 if(set_codec_none){ 00624 printf("Disabling codec\n"); 00625 if((err=sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_NONE))){ 00626 return 1; 00627 } 00628 } 00629 00630 if(usr_period){ 00631 printf("Setting user period: %d\n", usr_period); 00632 if((err=sangoma_tdm_set_usr_period(dev_fd, &tdm_api, usr_period))){ 00633 return 1; 00634 } 00635 } 00636 00637 if(set_codec_slinear || usr_period || set_codec_none){ 00638 /* display new configuration AFTER it was changed */ 00639 if((err=sangoma_get_full_cfg(dev_fd, &tdm_api))){ 00640 return 1; 00641 } 00642 } 00643 00644 if(dtmf_enable_octasic == 1){ 00645 poll_events_bitmap |= POLLPRI; 00646 /* enable dtmf detection on Octasic chip */ 00647 if((err=sangoma_tdm_enable_dtmf_events(dev_fd, &tdm_api))){ 00648 return 1; 00649 } 00650 } 00651 00652 if(dtmf_enable_remora == 1){ 00653 poll_events_bitmap |= POLLPRI; 00654 /* enable dtmf detection on Sangoma's Remora SLIC chip (A200 ONLY) */ 00655 if((err=sangoma_tdm_enable_rm_dtmf_events(dev_fd, &tdm_api))){ 00656 return 1; 00657 } 00658 } 00659 00660 if(remora_hook == 1){ 00661 poll_events_bitmap |= POLLPRI; 00662 if((err=sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api))){ 00663 return 1; 00664 } 00665 } 00666 00667 if(rbs_events == 1){ 00668 poll_events_bitmap |= POLLPRI; 00669 if((err=sangoma_tdm_enable_rbs_events(dev_fd, &tdm_api, 20))){ 00670 return 1; 00671 } 00672 } 00673 00674 printf("Device Config RxQ=%i TxQ=%i \n", 00675 sangoma_get_rx_queue_sz(dev_fd,&tdm_api), 00676 sangoma_get_rx_queue_sz(dev_fd,&tdm_api)); 00677 00678 sangoma_set_rx_queue_sz(dev_fd,&tdm_api,20); 00679 sangoma_set_tx_queue_sz(dev_fd,&tdm_api,30); 00680 00681 printf("Device Config RxQ=%i TxQ=%i \n", 00682 sangoma_get_rx_queue_sz(dev_fd,&tdm_api), 00683 sangoma_get_tx_queue_sz(dev_fd,&tdm_api)); 00684 00685 return err; 00686 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void handle_span_chan | ( | int | open_device_counter | ) |
Write data buffer into a file.
| open_device_counter | number of opened devices |
Definition at line 405 of file sample.c.
References application_termination_flag, handle_data(), handle_tdm_event(), SANG_STATUS_APIPOLL_TIMEOUT, SANG_STATUS_SUCCESS, sangoma_waitfor_many(), SDLA_DECODE_SANG_STATUS, and TEST_NUMBER_OF_OBJECTS.
Referenced by main().
00406 { 00407 int iResult, i; 00408 u_int32_t input_flags[TEST_NUMBER_OF_OBJECTS]; 00409 u_int32_t output_flags[TEST_NUMBER_OF_OBJECTS]; 00410 00411 printf("\n\nSpan/Chan Handler: RxEnable=%s, TxEnable=%s, TxCnt=%i, TxLen=%i, rx2tx=%s\n", 00412 (read_enable? "Yes":"No"), (write_enable?"Yes":"No"),tx_cnt,tx_size, (rx2tx?"Yes":"No")); 00413 00414 for (i = 0; i < open_device_counter; i++) { 00415 input_flags[i] = poll_events_bitmap; 00416 } 00417 00418 /* Main Rx/Tx/Event loop */ 00419 while(!application_termination_flag) 00420 { 00421 iResult = sangoma_waitfor_many(sangoma_wait_objects, 00422 input_flags, 00423 output_flags, 00424 open_device_counter /* number of wait objects */, 00425 2000 /* wait timeout, in milliseconds */); 00426 switch(iResult) 00427 { 00428 case SANG_STATUS_APIPOLL_TIMEOUT: 00429 /* timeout (not an error) */ 00430 printf("Timeout\n"); 00431 continue; 00432 00433 case SANG_STATUS_SUCCESS: 00434 for(i = 0; i < open_device_counter; i++){ 00435 00436 /* a wait object was signaled */ 00437 if(output_flags[i] & POLLPRI){ 00438 /* got tdm api event */ 00439 if(handle_tdm_event(i)){ 00440 printf("Error in handle_tdm_event()!\n"); 00441 } 00442 } 00443 00444 if(output_flags[i] & (POLLIN | POLLOUT)){ 00445 /* rx data OR a free tx buffer available */ 00446 if(handle_data(i, output_flags[i])){ 00447 printf("Error in handle_data()!\n"); 00448 } 00449 } 00450 }/* for() */ 00451 break; 00452 00453 default: 00454 /* error */ 00455 printf("Error: iResult: %s (%d)\n", SDLA_DECODE_SANG_STATUS(iResult), iResult); 00456 return; 00457 } 00458 00459 }/* while() */ 00460 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int handle_tdm_event | ( | uint32_t | dev_index | ) |
Read Event buffer from the device.
| dev_index | device index number associated with device file descriptor |
Definition at line 375 of file sample.c.
References sangoma_read_event(), and sangoma_wait_obj_get_fd().
Referenced by handle_span_chan().
00376 { 00377 wanpipe_api_t tdm_api; 00378 sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]); 00379 00380 #if 0 00381 printf("%s(): dev_index: %d, dev_fd: 0x%p\n", __FUNCTION__, dev_index, dev_fd); 00382 #endif 00383 00384 memset(&tdm_api, 0x00, sizeof(tdm_api)); 00385 00386 if(sangoma_read_event(dev_fd, &tdm_api)){ 00387 return 1; 00388 } 00389 00390 decode_api_event(&tdm_api.wp_cmd.event); 00391 return 0; 00392 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int handle_data | ( | uint32_t | dev_index, | |
| int | flags_out | |||
| ) |
Read data buffer from the device and transmit it back down.
| dev_index | device index number associated with device file descriptor |
Definition at line 255 of file sample.c.
References MAX_NO_DATA_BYTES_IN_FRAME, read_data(), and write_data().
Referenced by handle_span_chan().
00256 { 00257 wp_api_hdr_t rxhdr; 00258 00259 memset(&rxhdr, 0, sizeof(rxhdr)); 00260 00261 #if 0 00262 printf("%s(): span: %d, chan: %d\n", __FUNCTION__, 00263 sangoma_wait_objects[dev_index].span, sangoma_wait_objects[dev_index].chan); 00264 #endif 00265 00266 if(flags_out & POLLIN){ 00267 if(read_data(dev_index, &rxhdr, rxdata, MAX_NO_DATA_BYTES_IN_FRAME) == 0){ 00268 if(rx2tx){ 00269 /* Send back received data (create a "software loopback"), just a test. */ 00270 return write_data(dev_index, &rxhdr, rxdata); 00271 } 00272 } 00273 } 00274 00275 if( (flags_out & POLLOUT) && write_enable ){ 00276 00277 wp_api_hdr_t txhdr; 00278 static unsigned char tx_test_byte = 0; 00279 00280 memset(&txhdr, 0, sizeof(txhdr)); 00281 txhdr.data_length = (unsigned short)tx_size;/* use '-txsize' command line option to change 'tx_size' */ 00282 00283 /* set data which will be transmitted */ 00284 memset(txdata, tx_test_byte, txhdr.data_length); 00285 00286 if(write_data(dev_index, &txhdr, txdata) == 0){ 00287 tx_test_byte++; 00288 } 00289 } 00290 return 0; 00291 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int write_data | ( | uint32_t | dev_index, | |
| wp_api_hdr_t * | tx_hdr, | |||
| void * | tx_data | |||
| ) |
Transmit a data buffer to a device.
| dev_index | device index number associated with device file descriptor | |
| tx_hdr | pointer to a wp_api_hdr_t | |
| tx_data | pointer to a data buffer |
Definition at line 202 of file sample.c.
References sangoma_chan::channo, sangoma_wait_obj_get_context(), sangoma_wait_obj_get_fd(), sangoma_writemsg(), and sangoma_chan::spanno.
Referenced by handle_data().
00203 { 00204 sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]); 00205 sangoma_chan_t *chan = sangoma_wait_obj_get_context(sangoma_wait_objects[dev_index]); 00206 int err; 00207 static int Tx_count = 0; 00208 00209 /* write a message */ 00210 err = sangoma_writemsg( 00211 dev_fd, 00212 tx_hdr, /* header buffer */ 00213 sizeof(wp_api_hdr_t), /* header size */ 00214 tx_buffer, /* data buffer */ 00215 tx_hdr->data_length, /* DATA size */ 00216 0); 00217 00218 if (err <= 0){ 00219 printf("Span: %d, Chan: %d: Failed to send!\n", 00220 chan->spanno, 00221 chan->channo); 00222 return -1; 00223 } 00224 00225 Tx_count++; 00226 if (verbose){ 00227 printf("Packet sent: counter: %i, len: %i\n", Tx_count, err); 00228 }else{ 00229 if(Tx_count && (!(Tx_count % 1000))){ 00230 printf("Packet sent: counter: %i, len: %i\n", Tx_count, err); 00231 } 00232 } 00233 00234 #if 0 00235 if(Tx_count >= tx_cnt){ 00236 write_enable=0; 00237 printf("Disabling POLLOUT...\n"); 00238 /* No need for POLLOUT, turn it off!! If not turned off, and we 00239 * have nothing for transmission, sangoma_socket_waitfor() will return 00240 * immediately, creating a busy loop. */ 00241 sangoma_wait_objects[dev_index].flags_in &= (~POLLOUT); 00242 } 00243 #endif 00244 return 0; 00245 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int write_data_to_file | ( | unsigned char * | data, | |
| unsigned int | data_length | |||
| ) |
Write data buffer into a file.
| data | data buffer | |
| data_length | length of a data buffer |
Definition at line 470 of file sample.c.
References pRxFile.
Referenced by read_data().
00471 { 00472 if(pRxFile == NULL){ 00473 return 1; 00474 } 00475 00476 return fwrite(data, 1, data_length, pRxFile); 00477 }
Here is the caller graph for this function:

| void cleanup | ( | void | ) |
Protperly shutdown single device.
| dev_no | device index number |
Definition at line 518 of file sample.c.
References sangoma_chan::channo, sangoma_close(), sangoma_tdm_disable_dtmf_events(), sangoma_tdm_disable_rbs_events(), sangoma_tdm_disable_rm_dtmf_events(), sangoma_tdm_disable_rxhook_events(), sangoma_wait_obj_delete(), sangoma_wait_obj_get_context(), sangoma_wait_obj_get_fd(), sangoma_chan::spanno, and TEST_NUMBER_OF_OBJECTS.
Referenced by main(), and TerminateHandler().
00519 { 00520 int dev_no; 00521 sng_fd_t fd; 00522 sangoma_chan_t *chan; 00523 sangoma_wait_obj_t *sng_wait_object; 00524 wanpipe_api_t tdm_api; 00525 00526 /* do the cleanup before exiting: */ 00527 for(dev_no = 0; dev_no < TEST_NUMBER_OF_OBJECTS; dev_no++){ 00528 00529 sng_wait_object = sangoma_wait_objects[dev_no]; 00530 if(!sng_wait_object){ 00531 continue; 00532 } 00533 chan = sangoma_wait_obj_get_context(sng_wait_object); 00534 printf("%s(): span: %d, chan: %d ...\n", __FUNCTION__, 00535 chan->channo, 00536 chan->spanno); 00537 00538 fd = sangoma_wait_obj_get_fd(sng_wait_object); 00539 memset(&tdm_api, 0x00, sizeof(tdm_api)); 00540 00541 if(dtmf_enable_octasic == 1){ 00542 /* Disable dtmf detection on Octasic chip */ 00543 sangoma_tdm_disable_dtmf_events(fd, &tdm_api); 00544 } 00545 00546 if(dtmf_enable_remora == 1){ 00547 /* Disable dtmf detection on Sangoma's Remora SLIC chip */ 00548 sangoma_tdm_disable_rm_dtmf_events(fd, &tdm_api); 00549 } 00550 00551 if(remora_hook == 1){ 00552 sangoma_tdm_disable_rxhook_events(fd, &tdm_api); 00553 } 00554 00555 if(rbs_events == 1){ 00556 sangoma_tdm_disable_rbs_events(fd, &tdm_api); 00557 } 00558 00559 sangoma_wait_obj_delete(&sng_wait_object); 00560 00561 sangoma_close(&fd); 00562 00563 } 00564 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void TerminateHandler | ( | int | sig | ) |
Signal handler for graceful shutdown.
| sig | signal |
Definition at line 500 of file sample.c.
References application_termination_flag, and cleanup().
Referenced by main().
00501 { 00502 printf("\nProcess terminated by user request.\n"); 00503 application_termination_flag = 1; 00504 /* do the cleanup before exiting: */ 00505 cleanup(); 00506 return; 00507 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7