]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix MODENDP-82
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 26 Feb 2008 22:30:54 +0000 (22:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 26 Feb 2008 22:30:54 +0000 (22:30 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@408 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/mod_openzap/mod_openzap.c
libs/freetdm/src/zap_analog.c

index 3de436c24f10979290d47176e66b07f6ba5c27df..437e3204c84d78e323cced3de665a0e5e8782b1f 100644 (file)
@@ -752,21 +752,21 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
        tech_pvt = (private_t *) switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
 
-       switch_mutex_lock(tech_pvt->flag_mutex);
-
        switch (tech_pvt->zchan->type) {
        case ZAP_CHAN_TYPE_FXS:
                status = channel_receive_message_fxs(session, msg);
+               break;
        case ZAP_CHAN_TYPE_FXO:
                status = channel_receive_message_fxo(session, msg);
+               break;
        case ZAP_CHAN_TYPE_B:
                status = channel_receive_message_b(session, msg);
+               break;
        default:
                status = SWITCH_STATUS_FALSE;
+               break;
        }
 
-       switch_mutex_unlock(tech_pvt->flag_mutex);
-
        return status;
 
 }
index ce01ffaa68646f75ac970045900fe7d928215b0a..63e360df10aa31d1268b2695eefba707528f585d 100644 (file)
@@ -284,7 +284,8 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
                                                        zap_channel_command(zchan, ZAP_COMMAND_GENERATE_RING_OFF, NULL);
                                                }
                                                
-                                               if (zap_test_flag(zchan, ZAP_CHANNEL_OFFHOOK) && zchan->last_state >= ZAP_CHANNEL_STATE_IDLE) {
+                                               if (zap_test_flag(zchan, ZAP_CHANNEL_OFFHOOK) && 
+                                                       (zchan->last_state == ZAP_CHANNEL_STATE_RING || zchan->last_state >= ZAP_CHANNEL_STATE_IDLE)) {
                                                        zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_BUSY);
                                                } else {
                                                        zchan->caller_data.hangup_cause = ZAP_CAUSE_NORMAL_CLEARING;