FS-4659 gsmopen: give error and abort call when dialing was not through correctly (eg: get back OK). Also, grow the default timeout when expecting a string back from the modem to half a second - 500000 usec - so to avoid false negatives

This commit is contained in:
Giovanni Maruzzelli 2012-11-06 11:34:34 +01:00
parent 648ce206c6
commit 65bc765846
2 changed files with 11 additions and 4 deletions

View 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)

View 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;
}