]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freetdm: Merged arnaldo.sng_isdn branch (changes for win32 port)
authorDavid Yat Sin <dyatsin@sangoma.com>
Mon, 1 Nov 2010 14:24:11 +0000 (12:24 -0200)
committerDavid Yat Sin <dyatsin@sangoma.com>
Mon, 8 Nov 2010 17:18:08 +0000 (12:18 -0500)
12 files changed:
Freeswitch.2008.sln
build/modules.conf.in
conf/autoload_configs/modules.conf.xml
libs/freetdm/cyginstall.sh
libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c
libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h
libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c
libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c
libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c
libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
libs/freetdm/src/include/ftdm_declare.h

index 8e6df5cc57b0de93990aeefc4084f7bb7cdcfde3..5e27743f6ada208433aa2709792b5252e04d51c7 100644 (file)
@@ -48,7 +48,6 @@ EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debug", "Debug", "{6374D55C-FABE-4A02-9CF1-4145308A56C5}"\r
        ProjectSection(SolutionItems) = preProject\r
                debug\conf\freeswitch.xml = debug\conf\freeswitch.xml\r
-               debug\conf\vars.xml = debug\conf\vars.xml\r
        EndProjectSection\r
 EndProject\r
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build System", "{DB1024A8-41BF-4AD7-9AE6-13202230D1F3}"\r
@@ -59,7 +58,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build Sys
                configure.in = configure.in\r
                Makefile.am = Makefile.am\r
                build\modmake.rules.in = build\modmake.rules.in\r
-               build\modules.conf.in = build\modules.conf.in\r
                libs\win32\util.vbs = libs\win32\util.vbs\r
        EndProjectSection\r
 EndProject\r
@@ -92,13 +90,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa
                conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml\r
                conf\autoload_configs\local_stream.conf.xml = conf\autoload_configs\local_stream.conf.xml\r
                conf\autoload_configs\logfile.conf.xml = conf\autoload_configs\logfile.conf.xml\r
-               conf\autoload_configs\modules.conf.xml = conf\autoload_configs\modules.conf.xml\r
                conf\autoload_configs\openmrcp.conf.xml = conf\autoload_configs\openmrcp.conf.xml\r
                conf\autoload_configs\portaudio.conf.xml = conf\autoload_configs\portaudio.conf.xml\r
                conf\autoload_configs\rss.conf.xml = conf\autoload_configs\rss.conf.xml\r
                conf\autoload_configs\sofia.conf.xml = conf\autoload_configs\sofia.conf.xml\r
                conf\autoload_configs\spidermonkey.conf.xml = conf\autoload_configs\spidermonkey.conf.xml\r
-               conf\autoload_configs\switch.conf.xml = conf\autoload_configs\switch.conf.xml\r
                conf\autoload_configs\syslog.conf.xml = conf\autoload_configs\syslog.conf.xml\r
                conf\autoload_configs\voicemail.conf.xml = conf\autoload_configs\voicemail.conf.xml\r
                conf\autoload_configs\wanpipe.conf.xml = conf\autoload_configs\wanpipe.conf.xml\r
@@ -123,7 +119,6 @@ EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}"\r
        ProjectSection(SolutionItems) = preProject\r
                conf\sip_profiles\external.xml = conf\sip_profiles\external.xml\r
-               conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml\r
                conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml\r
        EndProjectSection\r
 EndProject\r
@@ -212,7 +207,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa
 EndProject\r
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{D44DD429-FE98-42AA-B5B7-4B4EBE33AEFD}"\r
        ProjectSection(SolutionItems) = preProject\r
-               debug\conf\dialplan\default.xml = debug\conf\dialplan\default.xml\r
                debug\conf\dialplan\US.conf.xml = debug\conf\dialplan\US.conf.xml\r
        EndProjectSection\r
 EndProject\r
@@ -2213,12 +2207,10 @@ Global
                {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|Any CPU\r
                {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU\r
                {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU\r
-               {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64\r
-               {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64\r
+               {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|Any CPU\r
                {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU\r
                {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU\r
-               {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64\r
-               {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64\r
+               {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|Any CPU\r
                {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32\r
                {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32\r
                {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32\r
index 67e1fe62aefc4c0c417de1196bf385491547edce..35ec1bb8a3849b9362abc381d81093d7a9df3641 100644 (file)
@@ -63,7 +63,7 @@ endpoints/mod_loopback
 #endpoints/mod_skypopen
 #endpoints/mod_h323
 #../../libs/openzap/mod_openzap
-#../../libs/freetdm/mod_freetdm
+../../libs/freetdm/mod_freetdm
 #asr_tts/mod_unimrcp
 #asr_tts/mod_flite
 #asr_tts/mod_pocketsphinx
index d8ae5e1a039ed15ecb506c7e56cda17d7be0f8a4..37e1b2f8917905a4c0a5f2dd96676944809790f3 100644 (file)
 <configuration name="modules.conf" description="Modules">
   <modules>
     
-    <!-- Loggers (I'd load these first) -->
     <load module="mod_console"/>
     <load module="mod_logfile"/>
-    <!-- <load module="mod_syslog"/> -->
-
-    <!--<load module="mod_yaml"/>-->
-
-    <!-- Multi-Faceted -->
-    <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->
-    <load module="mod_enum"/>
-
-    <!-- XML Interfaces -->
-    <!-- <load module="mod_xml_rpc"/> -->
-    <!-- <load module="mod_xml_curl"/> -->
-    <!-- <load module="mod_xml_cdr"/> -->
-
-    <!-- Event Handlers -->
-    <load module="mod_cdr_csv"/>
-    <!-- <load module="mod_event_multicast"/> -->
     <load module="mod_event_socket"/>
-    <!-- <load module="mod_zeroconf"/> -->
-    <!-- <load module="mod_erlang_event"/> -->
-
-    <!-- Directory Interfaces -->
-    <!-- <load module="mod_ldap"/> -->
-
-    <!-- Endpoints -->
-    <!-- <load module="mod_dingaling"/> -->
-    <!-- <load module="mod_portaudio"/> -->
-    <!-- <load module="mod_alsa"/> -->
     <load module="mod_sofia"/>
-    <load module="mod_loopback"/>
-    <!-- <load module="mod_woomera"/> -->
-    <!-- <load module="mod_openzap"/> -->
-    <!-- <load module="mod_unicall"/> -->
-    <!-- <load module="mod_skinny"/> -->
-
-    <!-- Applications -->
     <load module="mod_commands"/>
-    <load module="mod_conference"/>
-    <load module="mod_db"/>
     <load module="mod_dptools"/>
     <load module="mod_expr"/>
-    <load module="mod_fifo"/>
-    <load module="mod_hash"/>
-    <load module="mod_voicemail"/>
-    <!--<load module="mod_directory"/>-->
-    <!--<load module="mod_lcr"/>-->
-    <load module="mod_esf"/>
-    <load module="mod_fsv"/>
-    <load module="mod_cluechoo"/>
-    <load module="mod_valet_parking"/>
-    <!--<load module="mod_spy"/>-->
-
-    <!-- SNOM Module -->
-    <!--<load module="mod_snom"/>-->
-
-    <!-- Dialplan Interfaces -->
-    <!-- <load module="mod_dialplan_directory"/> -->
     <load module="mod_dialplan_xml"/>
-    <load module="mod_dialplan_asterisk"/>
-
-    <!-- Codec Interfaces -->
-    <load module="mod_spandsp"/>
-    <load module="mod_g723_1"/>
-    <load module="mod_g729"/>
-    <load module="mod_amr"/>
-    <load module="mod_ilbc"/>
-    <load module="mod_speex"/>
-    <load module="mod_h26x"/>
-    <load module="mod_siren"/>
-    <!--<load module="mod_celt"/>-->
-
-    <!-- File Format Interfaces -->
     <load module="mod_sndfile"/>
     <load module="mod_native_file"/>
-    <!--For icecast/mp3 streams/files-->
-    <!--<load module="mod_shout"/>-->
-    <!--For local streams (play all the files in a directory)-->
-    <load module="mod_local_stream"/>
-    <load module="mod_tone_stream"/>
-    <load module="mod_file_string"/>
-
-    <!-- Timers -->
-
-    <!-- Languages -->
-    <load module="mod_spidermonkey"/>
-    <!-- <load module="mod_perl"/> -->
-    <!-- <load module="mod_python"/> -->
-    <!-- <load module="mod_java"/> -->
-    <load module="mod_lua"/>
-
-    <!-- ASR /TTS -->
-    <!-- <load module="mod_flite"/> -->
-    <!-- <load module="mod_pocketsphinx"/> -->
-    <!-- <load module="mod_cepstral"/> -->
-    <!-- <load module="mod_tts_commandline"/> -->
-    <!-- <load module="mod_rss"/> -->
-    
-    <!-- Say -->
-    <load module="mod_say_en"/>
-    <load module="mod_say_ru"/>
-    <!-- <load module="mod_say_zh"/> -->
-
-    <!-- Third party modules -->
-    <!--<load module="mod_nibblebill"/>-->
-
   </modules>
 </configuration>
index 93ba624156fd761eaa26b61714d8babbd6790d36..9d486b7dce308d8cfbc6eed2bd3f6bbfcfaac647 100644 (file)
@@ -7,7 +7,7 @@ cp Debug/mod/*.dll $fsdir/Debug/mod/
 cp mod_freetdm/Debug/*.pdb $fsdir/Debug/mod/
 cp Debug/*.dll $fsdir/Debug/
 cp Debug/*.pdb $fsdir/Debug/
-cp Debug/testsangomaboost.exe $fsdir/Debug/
+#cp Debug/testsangomaboost.exe $fsdir/Debug/
 echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS"
 set +x 
 
index 8dbbda7a658a782aba4b2132f587ab48a71e2fb8..396d347e6953b8831a4bb4839f3483ecda4a77e4 100644 (file)
@@ -913,7 +913,8 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init)
        }
        
        /* initalize sng_isdn library */
-       sng_isdn_init(&g_sngisdn_event_interface);
+
+       ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n");      
        return FTDM_SUCCESS;
 }
 
index 7db753e420a52bfbaa8be4b68e12f15ae56eef5c..e84392e22a46878b5cd32e4f5746ec04136b7a72 100644 (file)
@@ -266,15 +266,15 @@ extern ftdm_sngisdn_data_t        g_sngisdn_data;
 ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span);
 
 /* Support functions */
-FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(uint8_t cc_id);
+FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id);
 FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info);
 FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info);
 
 
 void stack_hdr_init(Header *hdr);
 void stack_pst_init(Pst *pst);
-FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data);
-FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data);
+FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data);
+FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data);
 FT_DECLARE_INLINE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail);
 
 /* Outbound Call Control functions */
index 5a3e06ec89de7aeff90ba81ecf617f77b29d55dd..bb46fb7fbaae48c7e9af39cf5b421151fc7bb742 100644 (file)
@@ -198,7 +198,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span)
     L1Mngmt                            cfg;
     Pst                                        pst;
 
-       S32                             d_channel_fd = -1;
+       int32_t d_channel_fd = -1;
        sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data;
 
     /* initalize the post structure */
@@ -227,7 +227,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span)
        for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) {
                ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr);
                if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) {
-                       d_channel_fd = (S32) ftdmchan->sockfd;
+                       d_channel_fd = (int32_t)ftdmchan->sockfd;
                        break;
                }
        }
index 9adcc082961923c31f8881327a4b97d87ba533a6..7ca408538ab45f43f7fc0f7c81e6d5bee8698d1c 100644 (file)
@@ -78,7 +78,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
                                break;
                        }
                        
-                       sngisdn_info->suInstId = get_unique_suInstId((int8_t) suId);
+                       sngisdn_info->suInstId = get_unique_suInstId(suId);
                        sngisdn_info->spInstId = spInstId;
                        
 
@@ -205,7 +205,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
                                sngisdn_set_flag(sngisdn_info, FLAG_DELAYED_REL);
 
                                sngisdn_info->glare.suId = suId;
-                               sngisdn_info->glare.suInstId = get_unique_suInstId((int8_t) suId);
+                               sngisdn_info->glare.suInstId = get_unique_suInstId(suId);
                                sngisdn_info->glare.spInstId = spInstId;
 
                                sngisdn_info->glare.dChan = dChan;
index 39c5693728e4bef468465e0a18f687973fdb85a7..5580f3a950a374f31512511bd48618811ed0aee3 100644 (file)
@@ -112,7 +112,7 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn
        ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Cfm on unconfigured cc\n");
        ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Cfm on unconfigured dchan\n");
 
-       if (get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) {
+       if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) {
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ISDN_FUNC_TRACE_EXIT(__FUNCTION__);
                return;
@@ -156,7 +156,7 @@ void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, C
        ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Cnst Ind on unconfigured cc\n");
        ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Cnst Ind on unconfigured dchan\n");
 
-       if (get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) {
+       if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) {
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ISDN_FUNC_TRACE_EXIT(__FUNCTION__);
                return;
@@ -206,8 +206,8 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D
 
        ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id");
 
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
@@ -240,8 +240,8 @@ void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Re
 
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
        
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                /* It seems that Trillium has a bug where they sometimes send release twice on a call, so do not crash on these for now */
@@ -274,8 +274,8 @@ void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, In
        
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
 
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
@@ -307,8 +307,8 @@ void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, S
 
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
        
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
@@ -341,8 +341,8 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S
 
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
        
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
@@ -374,8 +374,8 @@ void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, R
 
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
        
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
@@ -408,8 +408,8 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R
 
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
        
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
@@ -442,8 +442,8 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St
 
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
        
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-                        !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+                        !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
@@ -476,8 +476,8 @@ void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Fa
 
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
        
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
@@ -510,8 +510,8 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St
 
        ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
        
-       if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
-               !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
+       if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
+               !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
 
                ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
                ftdm_assert(0, "Inconsistent call states\n");
index 5cc17a539a92b2a45eebc12dd67c23f53ee2c3e1..f54f7db61cb7c050105084bc41955027a19dc09a 100644 (file)
@@ -91,9 +91,10 @@ FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info)
 }
 
 
-FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(uint8_t cc_id)
+FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id)
 {
        uint32_t suInstId;
+       ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n");
        ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex);
        suInstId = g_sngisdn_data.ccs[cc_id].last_suInstId;
 
@@ -112,8 +113,9 @@ FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(uint8_t cc_id)
        return 0;
 }
 
-FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data)
+FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data)
 {
+       ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n");
        ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n");
 
        if (g_sngisdn_data.ccs[cc_id].active_suInstIds[suInstId] == NULL) {
@@ -123,8 +125,9 @@ FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_
        return FTDM_SUCCESS;
 }
 
-FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data)
+FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data)
 {
+       ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n");
        ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n");
 
        if (g_sngisdn_data.ccs[cc_id].active_spInstIds[spInstId] == NULL) {
index 86940107e712ef8d7c3f47b1be922af2ef66359a..e2d85f7ea1e1d1f8f1801f2e08eb41524869a6c9 100644 (file)
@@ -1011,6 +1011,16 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms)
        }
        alarms = tdm_api.wp_tdm_cmd.fe_alarms;
 #endif
+#if 1 
+       /* DAVIDY - Temporary fix: in the current trunk of libsangoma, for BRI, 
+               WAN_TE_BIT_ALARM_RED bit is set if the card is in disconnected state, but this has
+               not been ported to Windows-libsangoma yet */
+       if (alarms) {
+               ftdmchan->alarm_flags |= FTDM_ALARM_RED;
+               alarms = 0;
+       }
+#endif
+
        ftdmchan->alarm_flags = FTDM_ALARM_NONE;
 
        if (alarms & WAN_TE_BIT_ALARM_RED) {
index 2985ab4f4545993ceb5411f6ee7eb1ea4eecd226..ab3b5c8966e7f4810910c80308c6ddfc06031874 100644 (file)
@@ -70,7 +70,7 @@ extern "C" {
 #define FT_DECLARE_NONSTD(type)                __declspec(dllimport) type __cdecl
 #define FT_DECLARE_DATA                                __declspec(dllimport)
 #endif
-#define FT_DECLARE_INLINE(type)                type
+#define FT_DECLARE_INLINE(type)                extern __inline__ type /* why extern? see http://support.microsoft.com/kb/123768 */
 #define EX_DECLARE_DATA                                __declspec(dllexport)
 #else
 #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
@@ -82,7 +82,7 @@ extern "C" {
 #define FT_DECLARE_NONSTD(type)        type
 #define FT_DECLARE_DATA
 #endif
-#define FT_DECLARE_INLINE(type)                type __inline__
+#define FT_DECLARE_INLINE(type)                __inline__ type
 #define EX_DECLARE_DATA
 #endif