]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Merge branch 'smgmaster' into releases.3.4.experimental_head
authorMoises Silva <moy@sangoma.com>
Sat, 17 Dec 2011 22:42:34 +0000 (17:42 -0500)
committerMoises Silva <moy@sangoma.com>
Sat, 17 Dec 2011 22:42:34 +0000 (17:42 -0500)
Conflicts:
libs/freetdm/mod_freetdm/mod_freetdm.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

1  2 
libs/freetdm/mod_freetdm/mod_freetdm.c
libs/freetdm/src/ftdm_io.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c
libs/freetdm/src/include/freetdm.h
src/switch.c

index 003be91b17c8d49d8b2f52c50925b54c3c42c23b,0fc7906331c980aead367457eee2364e2df5b577..ab4639485a311234137602258cf8a94ff41416f3
@@@ -511,45 -519,64 +519,92 @@@ static switch_status_t channel_on_hangu
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
  
-        /* ignore any further I/O requests, we're hanging up already! */
-     switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+       /* ignore any further I/O requests, we're hanging up already! */
+       switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+       
+       name = switch_channel_get_name(channel);
+       span_id = tech_pvt->ftdmchan ? ftdm_channel_get_span_id(tech_pvt->ftdmchan) : 0;
+       chan_id = tech_pvt->ftdmchan ? ftdm_channel_get_id(tech_pvt->ftdmchan) : 0;
  
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%d:%d] %s CHANNEL HANGUP ENTER\n", span_id, chan_id, name);
  
+       /* First verify this call has a device attached */
        if (!tech_pvt->ftdmchan) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s does not have any ftdmchan attached\n", name);
                goto end;
-       } 
+       }
+       /* Now verify the device is still attached to this call :-) 
+        * Sometimes the FS core takes too long (more than 3 seconds) in calling
+        * channel_on_hangup() and the FreeTDM core decides to take the brute
+        * force approach and hangup and detach themselves from the call. Later
+        * when FS finally comes around, we might end up hanging up the device
+        * attached to another call, this verification avoids that. */
+       uuid = switch_core_session_get_uuid(session);
+       tokencnt = ftdm_channel_get_token_count(tech_pvt->ftdmchan);
+       for (t = 0; t < tokencnt; t++) {
+               token = ftdm_channel_get_token(tech_pvt->ftdmchan, t);
+               if (!zstr(token) && !strcasecmp(uuid, token)) {
+                       uuid_found = 1;
+                       break;
+               }
+       }
+       if (!uuid_found) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Device [%d:%d] is no longer attached to %s. Nothing to do.\n", span_id, chan_id, name);
+               goto end;
+       }
+ #ifdef CUDATEL_DEBUG
+       {
+               pid_t tid = 0;
+               size_t size = 0;
+               char **symbols = NULL;
+               void *stacktrace[50];
+               int si = 0;
+               size = backtrace(stacktrace, ftdm_array_len(stacktrace));
+               symbols = backtrace_symbols(stacktrace, size);
+               tid = syscall(SYS_gettid);
+               for (si = 0; si < size; si++) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%d:%d][tid:%d] %s -> %s\n",
+                                       span_id, chan_id, tid, name, symbols[si]);
+               }
+               free(symbols);
+       }
+ #endif
  
 +      name = switch_channel_get_name(channel);
 +
 +      span_id = tech_pvt->ftdmchan ? ftdm_channel_get_span_id(tech_pvt->ftdmchan) : 0;
 +      chan_id = tech_pvt->ftdmchan ? ftdm_channel_get_id(tech_pvt->ftdmchan) : 0;
 +
 +
 +    /* Now verify the device is still attached to this call :-)
 +     * Sometimes the FS core takes too long (more than 3 seconds) in calling
 +     * channel_on_hangup() and the FreeTDM core decides to take the brute
 +     * force approach and hangup and detach themselves from the call. Later
 +     * when FS finally comes around, we might end up hanging up the device
 +     * attached to another call, this verification avoids that. */
 +    uuid = switch_core_session_get_uuid(session);
 +    tokencnt = ftdm_channel_get_token_count(tech_pvt->ftdmchan);
 +    for (t = 0; t < tokencnt; t++) {
 +        token = ftdm_channel_get_token(tech_pvt->ftdmchan, t);
 +        if (!zstr(token) && !strcasecmp(uuid, token)) {
 +            uuid_found = 1;
 +            break;
 +        }
 +    }
 +
 +    if (!uuid_found) {
 +        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Device [%d:%d] is no longer attached to %s. Nothing to do.\n", span_id, chan_id, name);
 +        goto end;
 +    }
 +      
 +
        ftdm_channel_clear_token(tech_pvt->ftdmchan, switch_core_session_get_uuid(session));
  
-       chantype = ftdm_channel_get_type(tech_pvt->ftdmchan);   
+       chantype = ftdm_channel_get_type(tech_pvt->ftdmchan);
        switch (chantype) {
        case FTDM_CHAN_TYPE_FXO:
        case FTDM_CHAN_TYPE_EM:
Simple merge
index 0497955059677455fa31dfc7ba0ed35fa919f440,dab2035450b574148b0deb410b92607ef998cc53..b8154f96e8ea24765abf6b7d3fb2a659ccbf8c5d
@@@ -221,34 -213,37 +221,62 @@@ ftdm_status_t handle_con_ind(uint32_t s
                        sprintf(var, "%d", siConEvnt->cgPtyNum.natAddrInd.val);
                        sngss7_add_var(sngss7_info, "ss7_clg_nadi", var);
  
 -                      sprintf(var, "%d", siConEvnt->cdPtyNum.natAddrInd.val);
 -                      sngss7_add_var(sngss7_info, "ss7_cld_nadi", var);
 +                      /* Retrieve the Location Number if present (see ITU Q.763, 3.30) */
 +                      if (siConEvnt->cgPtyNum1.eh.pres) {
 +                              if (siConEvnt->cgPtyNum1.addrSig.pres) {
 +                                      /* fill in the ss7 location address number */
 +                                      copy_tknStr_from_sngss7(siConEvnt->cgPtyNum1.addrSig, var, siConEvnt->cgPtyNum1.oddEven);
 +                                      sngss7_add_var(sngss7_info, "ss7_loc_digits", var);
 +                              }
 +
 +                              if (siConEvnt->cgPtyNum1.scrnInd.pres) {
 +                                      /* fill in the screening indication value */
 +                                      sprintf(var, "%d", siConEvnt->cgPtyNum1.scrnInd.val);
 +                                      sngss7_add_var(sngss7_info, "ss7_loc_screen_ind", var);
 +                              }
 +
 +                              if (siConEvnt->cgPtyNum1.presRest.pres) {
 +                                      /* fill in the presentation value */
 +                                      sprintf(var, "%d", siConEvnt->cgPtyNum1.presRest.val);
 +                                      sngss7_add_var(sngss7_info, "ss7_loc_pres_ind", var);
 +                              }
 +
 +                              if (siConEvnt->cgPtyNum1.natAddrInd.pres) {
 +                                      sprintf(var, "%d", siConEvnt->cgPtyNum1.natAddrInd.val);
 +                                      sngss7_add_var(sngss7_info, "ss7_loc_nadi", var);
 +                              }
 +                      } else {
 +                              SS7_DEBUG_CHAN(ftdmchan, "No Location Number information in IAM%s\n", " ");
 +                      }
  
+                       /* Retrieve the Location Number if present (see ITU Q.763, 3.30) */
+                       if (siConEvnt->cgPtyNum1.eh.pres) {
+                               if (siConEvnt->cgPtyNum1.addrSig.pres) {
+                                       /* fill in the ss7 location address number */
+                                       copy_tknStr_from_sngss7(siConEvnt->cgPtyNum1.addrSig, var, siConEvnt->cgPtyNum1.oddEven);
+                                       sngss7_add_var(sngss7_info, "ss7_loc_digits", var);
+                               }
+                               if (siConEvnt->cgPtyNum1.scrnInd.pres) {
+                                       /* fill in the screening indication value */
+                                       sprintf(var, "%d", siConEvnt->cgPtyNum1.scrnInd.val);
+                                       sngss7_add_var(sngss7_info, "ss7_loc_screen_ind", var);
+                               }
+                               if (siConEvnt->cgPtyNum1.presRest.pres) {
+                                       /* fill in the presentation value */
+                                       sprintf(var, "%d", siConEvnt->cgPtyNum1.presRest.val);
+                                       sngss7_add_var(sngss7_info, "ss7_loc_pres_ind", var);
+                               }
+                               if (siConEvnt->cgPtyNum1.natAddrInd.pres) {
+                                       sprintf(var, "%d", siConEvnt->cgPtyNum1.natAddrInd.val);
+                                       sngss7_add_var(sngss7_info, "ss7_loc_nadi", var);
+                               }
+                       } else {
+                               SS7_DEBUG_CHAN(ftdmchan, "No Location Number information in IAM%s\n", " ");
+                       }
                        sprintf(var, "%d", sngss7_info->circuit->cic);
                        sngss7_add_var(sngss7_info, "ss7_cic", var);
  
Simple merge
diff --cc src/switch.c
Simple merge