]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4659 gsmopen: give error and abort call when dialing was not through correctly...
authorGiovanni Maruzzelli <gmaruzz@gmail.com>
Tue, 6 Nov 2012 10:34:34 +0000 (11:34 +0100)
committerGiovanni Maruzzelli <gmaruzz@gmail.com>
Tue, 6 Nov 2012 10:34:34 +0000 (11:34 +0100)
src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp

index 5bdda08f81edb2df95e51487560fdae2cfdffbb2..81d1192307d2edb75c60b33996964e898d0ddcf4 100644 (file)
@@ -2189,7 +2189,7 @@ int gsmopen_serial_write_AT_expect1(private_t *tech_pvt, const char *data, const
                return -1;
        }
 
-       at_result = gsmopen_serial_read_AT(tech_pvt, 1, 100000, seconds, expected_string, expect_crlf); // minimum 1/10th sec timeout
+       at_result = gsmopen_serial_read_AT(tech_pvt, 1, 500000, seconds, expected_string, expect_crlf); // minimum half a sec timeout
        UNLOCKA(tech_pvt->controldev_lock);
        POPPA_UNLOCKA(tech_pvt->controldev_lock);
 
@@ -2700,6 +2700,8 @@ int gsmopen_hangup(private_t *tech_pvt)
 int gsmopen_call(private_t *tech_pvt, char *rdest, int timeout)
 {
 
+       int result;
+
        //gsmopen_sleep(5000);
        DEBUGA_GSMOPEN("Calling GSM, rdest is: %s\n", GSMOPEN_P_LOG, rdest);
        //gsmopen_signaling_write(tech_pvt, "SET AGC OFF");
@@ -2707,11 +2709,11 @@ int gsmopen_call(private_t *tech_pvt, char *rdest, int timeout)
        //gsmopen_signaling_write(tech_pvt, "SET AEC OFF");
        //gsmopen_sleep(10000);
 
-       gsmopen_serial_call(tech_pvt, rdest);
+       result=gsmopen_serial_call(tech_pvt, rdest);
        //ERRORA("failed to communicate with GSM client, now exit\n", GSMOPEN_P_LOG);
        //return -1;
        //}
-       return 0;
+       return result;
 }
 
 int gsmopen_senddigit(private_t *tech_pvt, char digit)
index 62f5cdd20f285419dc35c160389720daff16c4a3..18451d8cf27b789f596c083a0b04ecdb4a6025bd 100644 (file)
@@ -1054,6 +1054,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                                                                                                        switch_call_cause_t *cancel_cause)
 {
        private_t *tech_pvt = NULL;
+       int result;
+
        if ((*new_session = switch_core_session_request(gsmopen_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) {
                switch_channel_t *channel = NULL;
                switch_caller_profile_t *caller_profile;
@@ -1171,8 +1173,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                switch_set_flag(tech_pvt, TFLAG_OUTBOUND);
                switch_mutex_unlock(tech_pvt->flag_mutex);
                switch_channel_set_state(channel, CS_INIT);
-               gsmopen_call(tech_pvt, rdest, 30);
+               result=gsmopen_call(tech_pvt, rdest, 30);
                switch_mutex_unlock(globals.mutex);
+               if(result != 0){
+                       return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+               }
                return SWITCH_CAUSE_SUCCESS;
        }