freetdm: lock the channel when placing call

This commit is contained in:
Moises Silva 2010-08-23 16:08:06 -04:00
parent fcd8df0af7
commit 705dd237de
1 changed files with 11 additions and 7 deletions

View File

@ -2126,24 +2126,28 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch
FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan)
{ {
ftdm_status_t status; ftdm_status_t status = FTDM_FAIL;
ftdm_assert(ftdmchan != NULL, "null channel"); ftdm_assert(ftdmchan != NULL, "null channel");
ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OUTBOUND);
ftdm_channel_lock(ftdmchan);
if (ftdmchan->span->outgoing_call) { if (ftdmchan->span->outgoing_call) {
if ((status = ftdmchan->span->outgoing_call(ftdmchan)) == FTDM_SUCCESS) { status = ftdmchan->span->outgoing_call(ftdmchan);
ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND);
}
return status;
} else { } else {
status = FTDM_NOTIMPL;
ftdm_log(FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); ftdm_log(FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n");
} }
#ifdef __WINDOWS__ #ifdef __WINDOWS__
UNREFERENCED_PARAMETER(file); UNREFERENCED_PARAMETER(file);
UNREFERENCED_PARAMETER(func); UNREFERENCED_PARAMETER(func);
UNREFERENCED_PARAMETER(line); UNREFERENCED_PARAMETER(line);
#endif #endif
return FTDM_FAIL;
ftdm_channel_unlock(ftdmchan);
return status;
} }
FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t sigstatus) FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t sigstatus)