Fix segv when switching from a call that was previously hungup.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16432 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
João Mesquita 2010-01-21 05:44:42 +00:00
parent 0ecda2f00a
commit 7793426059
3 changed files with 22 additions and 1 deletions

View File

@ -49,6 +49,7 @@ class Call {
public: public:
Call(); Call();
Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid); Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid);
/*~Call() { qDebug() << "I am being freed uuid: " << _uuid; }*/
QString getCidName(void) { return _cid_name; } QString getCidName(void) { return _cid_name; }
QString getCidNumber(void) { return _cid_number; } QString getCidNumber(void) { return _cid_number; }
int getCallID(void) { return _call_id; } int getCallID(void) { return _call_id; }

View File

@ -162,6 +162,15 @@ switch_status_t FSHost::processAlegEvent(switch_event_t * event, QString uuid)
{ {
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
QSharedPointer<Call> call = _active_calls.value(uuid); QSharedPointer<Call> call = _active_calls.value(uuid);
if (call.isNull())
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "We don't have a call object for A leg on event %s.\n", switch_event_name(event->event_id));
qDebug() << _active_calls.keys();
printEventHeaders(event);
return SWITCH_STATUS_FALSE;
}
/* Inbound call */ /* Inbound call */
if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND) if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
{ {
@ -226,6 +235,15 @@ switch_status_t FSHost::processBlegEvent(switch_event_t * event, QString buuid)
QString uuid = _bleg_uuids.value(buuid); QString uuid = _bleg_uuids.value(buuid);
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
QSharedPointer<Call> call = _active_calls.value(uuid); QSharedPointer<Call> call = _active_calls.value(uuid);
if (call.isNull())
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "We don't have a call object for B leg on event %s.\n", switch_event_name(event->event_id));
qDebug() << _active_calls.keys();
printEventHeaders(event);
return SWITCH_STATUS_FALSE;
}
/* Inbound call */ /* Inbound call */
if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND) if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
{ {

View File

@ -211,7 +211,9 @@ void MainWindow::callTableDoubleClick(QTableWidgetItem *item)
return; return;
} }
ui->hangupBtn->setEnabled(true); ui->hangupBtn->setEnabled(true);
lastCall.data()->setActive(false); /* Last call was hungup and we are switching */
if (!lastCall.isNull())
lastCall.data()->setActive(false);
call.data()->setActive(true); call.data()->setActive(true);
} }