Commit d1f7e4d1 authored by yanmorin's avatar yanmorin

IAX Gui interface configuration

Patch for libosip2 3.0.
parent f3780c76
2006-12-07 Yan Morin
* First implementation of IAX account in QT Gui
* First implementation of sending sound (very unstable!) in iax
* Handling incompatibilities in libosip2 ABI (2.2.2 -> 3.0.1)
Quick patch that should be remove after 3.0.1 is very stable and in
distribution
2006-11-30 Yan Morin 2006-11-30 Yan Morin
* Fix .spec problem on fedora core 6 * Fix .spec problem on fedora core 6
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
SUBDIRS = libs src ringtones skins SUBDIRS = libs src ringtones skins
EXTRA_DIST = m4/*.m4 tools/*.sh platform/* images/* EXTRA_DIST = m4/*.m4 tools/*.sh platform/* images/* README.gentoo
...@@ -142,6 +142,12 @@ dnl AM_CONDITIONAL(USE_SAMPLERATE, test x$with_samplerate = xyes) ...@@ -142,6 +142,12 @@ dnl AM_CONDITIONAL(USE_SAMPLERATE, test x$with_samplerate = xyes)
dnl Check for GNU ccRTP dnl Check for GNU ccRTP
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
LIBOSIP2_OSIPLISTNOPOINTER_MIN_VERSION=3.0.0
PKG_CHECK_MODULES([libosip2], [libosip2 >= ${LIBOSIP2_OSIPLISTNOPOINTER_MIN_VERSION}],
[LIBOSIP2_CFLAGS=""], [LIBOSIP2_CFLAGS="-DLIBOSIP2_WITHPOINTER"])
SIP_CFLAGS="$SIP_CFLAGS $LIBOSIP2_CFLAGS";
AC_SUBST(SIP_CFLAGS)
LIBSAMPLERATE_MIN_VERSION=0.1.1 LIBSAMPLERATE_MIN_VERSION=0.1.1
PKG_CHECK_MODULES(samplerate, samplerate >= ${LIBSAMPLERATE_MIN_VERSION}) PKG_CHECK_MODULES(samplerate, samplerate >= ${LIBSAMPLERATE_MIN_VERSION})
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $samplerate_CFLAGS" SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $samplerate_CFLAGS"
......
...@@ -33,7 +33,7 @@ sflphoned_SOURCES = eventthread.cpp main.cpp voIPLink.cpp \ ...@@ -33,7 +33,7 @@ sflphoned_SOURCES = eventthread.cpp main.cpp voIPLink.cpp \
sipvoiplink.cpp call.cpp sipcall.cpp \ sipvoiplink.cpp call.cpp sipcall.cpp \
$(IAXSOURCES) $(IAXSOURCES)
sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(ZEROCONFFLAGS) $(IAX_FLAGS) $(SFLPHONE_CFLAGS) sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(ZEROCONFFLAGS) $(IAX_FLAGS) $(SFLPHONE_CFLAGS) $(SIP_CFLAGS)
#sflphoned_LDFLAGS = -static #sflphoned_LDFLAGS = -static
sflphoned_LDADD = ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS) sflphoned_LDADD = ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS)
......
...@@ -230,11 +230,9 @@ ...@@ -230,11 +230,9 @@
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="QLabel" row="0" column="0"> <widget class="QLabel" row="0" column="0">
<property name="name"> <property name="name"><cstring>lblAuthorizationUser</cstring></property>
<cstring>lblAuthorizationUsre</cstring>
</property>
<property name="text"> <property name="text">
<string>Authorization user</string> <string>Authorization user</string>
</property> </property>
</widget> </widget>
<widget class="QLineEdit" row="1" column="0"> <widget class="QLineEdit" row="1" column="0">
...@@ -330,7 +328,7 @@ ...@@ -330,7 +328,7 @@
</spacer> </spacer>
<widget class="QPushButton"> <widget class="QPushButton">
<property name="name"> <property name="name">
<cstring>buttonRegister</cstring> <cstring>buttonSIPRegister</cstring>
</property> </property>
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
...@@ -478,6 +476,126 @@ ...@@ -478,6 +476,126 @@
</vbox> </vbox>
</widget> </widget>
</widget> </widget>
<widget class="QWidget">
<property name="name"><cstring>IAXPage</cstring></property>
<attribute name="title"><string>IAX Authentication</string></attribute>
<widget class="QLayoutWidget">
<property name="name"><cstring>IAXLayoutMain</cstring></property>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>410</width>
<height>393</height>
</rect>
</property>
<vbox>
<property name="name"><cstring>IAXvboxName</cstring></property>
<property name="margin"><number>0</number></property>
<widget class="QGroupBox">
<property name="name"><cstring>IAXgroupBoxName</cstring></property>
<property name="margin"><number>0</number></property>
<property name="title"><string></string></property>
<grid>
<property name="name"><cstring>unnamed</cstring></property>
<widget class="QComboBox" rows="0" column="0" rowspan="1" colspan="2">
<property name="name"><cstring>cboIAXAccount</cstring></property>
<property name="currentItem"><number>0</number></property>
</widget>
<widget class="QLineEdit" row="0" column="2" rowspan="1" colspan="1">
<property name="name"><cstring>IAXalias</cstring></property>
</widget>
</grid>
</widget>
<widget class="QGroupBox">
<property name="name"><cstring>IAXgroupBoxAuth</cstring></property>
<property name="margin"><number>0</number></property>
<property name="title"><string></string></property>
<grid>
<property name="name"><cstring>unnamed</cstring></property>
<widget class="QLabel" row="0" column="0">
<property name="name"><cstring>lblIAXhost</cstring></property>
<property name="text"><string>Host (ie: asterisk.domain.com)</string></property>
</widget>
<widget class="QLineEdit" row="1" column="0">
<property name="name"><cstring>IAXhost</cstring></property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name"><cstring>lblIAXuser</cstring></property>
<property name="text"><string>Authorization user</string></property>
</widget>
<widget class="QLineEdit" row="3" column="0">
<property name="name"><cstring>IAXuser</cstring></property>
</widget>
<widget class="QLabel" row="4" column="0">
<property name="name"><cstring>lblIAXPass</cstring></property>
<property name="text"><string>Password</string></property>
</widget>
<widget class="QLineEdit" row="5" column="0">
<property name="name"><cstring>IAXpass</cstring></property>
<property name="echoMode"><enum>Password</enum></property>
</widget>
</grid>
</widget>
<widget class="QLayoutWidget">
<property name="name"><cstring>IAXLayoutChk</cstring></property>
<vbox>
<property name="name"><cstring>IAXvboxChk</cstring></property>
<widget class="QLayoutWidget">
<property name="name"><cstring>IAXLayoutChk2</cstring></property>
<hbox>
<property name="name"><cstring>IAXhboxChk</cstring></property>
<widget class="QCheckBox">
<property name="name"><cstring>chkIAXAutoregister</cstring></property>
<property name="text"><string>Auto-register</string></property>
<property name="checked"><bool>true</bool></property>
</widget>
<widget class="QCheckBox">
<property name="name"><cstring>chkIAXEnable</cstring></property>
<property name="text"><string>Enable</string></property>
<property name="checked"><bool>true</bool></property>
</widget>
<spacer>
<property name="name"><cstring>unnamed</cstring></property>
<property name="orientation"><enum>Horizontal</enum></property>
<property name="sizeType"><enum>Expanding</enum></property>
<property name="sizeHint">
<size>
<width>201</width>
<height>21</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name"><cstring>buttonIAXRegister</cstring></property>
<property name="enabled"><bool>true</bool></property>
<property name="text"><string>IAXRegister</string></property>
</widget>
</hbox>
</widget>
<widget class="QLabel">
<property name="name"><cstring>lblIAXError</cstring></property>
<property name="text"><string></string></property>
<property name="paletteForegroundColor">
<color><red>255</red><green>0</green><blue>0</blue></color>
</property>
</widget>
<spacer>
<property name="name"><cstring>unnamed</cstring></property>
<property name="orientation"><enum>Vertical</enum></property>
<property name="sizeType"><enum>Expanding</enum></property>
<property name="sizeHint">
<size>
<width>20</width>
<height>21</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</vbox>
</widget>
</widget>
<widget class="QWidget"> <widget class="QWidget">
<property name="name"> <property name="name">
<cstring>DTMFPage</cstring> <cstring>DTMFPage</cstring>
...@@ -1453,6 +1571,12 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string> ...@@ -1453,6 +1571,12 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string>
<receiver>ConfigurationPanel</receiver> <receiver>ConfigurationPanel</receiver>
<slot>slotSIPAccountChange(int)</slot> <slot>slotSIPAccountChange(int)</slot>
</connection> </connection>
<connection>
<sender>cboIAXAccount</sender>
<signal>activated(int)</signal>
<receiver>ConfigurationPanel</receiver>
<slot>slotIAXAccountChange(int)</slot>
</connection>
<connection> <connection>
<sender>buttonOk</sender> <sender>buttonOk</sender>
<signal>clicked()</signal> <signal>clicked()</signal>
...@@ -1466,10 +1590,16 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string> ...@@ -1466,10 +1590,16 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string>
<slot>changeTabSlot()</slot> <slot>changeTabSlot()</slot>
</connection> </connection>
<connection> <connection>
<sender>buttonRegister</sender> <sender>buttonSIPRegister</sender>
<signal>clicked()</signal>
<receiver>ConfigurationPanel</receiver>
<slot>slotSIPRegister()</slot>
</connection>
<connection>
<sender>buttonIAXRegister</sender>
<signal>clicked()</signal> <signal>clicked()</signal>
<receiver>ConfigurationPanel</receiver> <receiver>ConfigurationPanel</receiver>
<slot>slotRegister()</slot> <slot>slotIAXRegister()</slot>
</connection> </connection>
<connection> <connection>
<sender>buttonTestSoundDriver</sender> <sender>buttonTestSoundDriver</sender>
...@@ -1525,7 +1655,15 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string> ...@@ -1525,7 +1655,15 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string>
<tabstop>sipproxy</tabstop> <tabstop>sipproxy</tabstop>
<tabstop>chkAutoregister</tabstop> <tabstop>chkAutoregister</tabstop>
<tabstop>chkEnable</tabstop> <tabstop>chkEnable</tabstop>
<tabstop>buttonRegister</tabstop> <tabstop>buttonSIPRegister</tabstop>
<tabstop>cboIAXAccount</tabstop>
<tabstop>IAXalias</tabstop>
<tabstop>IAXhost</tabstop>
<tabstop>IAXuser</tabstop>
<tabstop>IAXpass</tabstop>
<tabstop>chkIAXAutoregister</tabstop>
<tabstop>chkIAXEnable</tabstop>
<tabstop>buttonIAXRegister</tabstop>
<tabstop>buttonOk</tabstop> <tabstop>buttonOk</tabstop>
<tabstop>buttonCancel</tabstop> <tabstop>buttonCancel</tabstop>
<tabstop>Tab_Signalisations</tabstop> <tabstop>Tab_Signalisations</tabstop>
...@@ -1559,7 +1697,9 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string> ...@@ -1559,7 +1697,9 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string>
<slots> <slots>
<slot>generate()</slot> <slot>generate()</slot>
<slot>slotSIPAccountChange(int)</slot> <slot>slotSIPAccountChange(int)</slot>
<slot>slotRegister()</slot> <slot>slotIAXAccountChange(int)</slot>
<slot>slotSIPRegister()</slot>
<slot>slotIAXRegister()</slot>
<slot>slotRegisterReturn( bool, QString )</slot> <slot>slotRegisterReturn( bool, QString )</slot>
<slot>slotTestSoundDriver()</slot> <slot>slotTestSoundDriver()</slot>
<slot>slotReloadSoundDriver()</slot> <slot>slotReloadSoundDriver()</slot>
...@@ -1580,9 +1720,12 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string> ...@@ -1580,9 +1720,12 @@ Montreal, Quebec H2T 1S6, Canada&lt;/p&gt;</string>
<function access="private" specifier="non virtual">init()</function> <function access="private" specifier="non virtual">init()</function>
<function access="private" specifier="non virtual">loadSIPAccount(int number)</function> <function access="private" specifier="non virtual">loadSIPAccount(int number)</function>
<function access="private" specifier="non virtual">saveSIPAccount(int number)</function> <function access="private" specifier="non virtual">saveSIPAccount(int number)</function>
<function access="private" specifier="non virtual">loadIAXAccount(int number)</function>
<function access="private" specifier="non virtual">saveIAXAccount(int number)</function>
</functions> </functions>
<variables> <variables>
<variable access="private">int lastSIPAccount;</variable> <variable access="private">int lastSIPAccount;</variable>
<variable access="private">int lastIAXAccount;</variable>
<variable access="private">int _cutStringCombo;</variable> <variable access="private">int _cutStringCombo;</variable>
<variable access="private">std::map &lt; int, int &gt; _deviceInMap</variable> <variable access="private">std::map &lt; int, int &gt; _deviceInMap</variable>
<variable access="private">std::map &lt; int, int &gt; _deviceOutMap</variable> <variable access="private">std::map &lt; int, int &gt; _deviceOutMap</variable>
......
...@@ -56,6 +56,7 @@ void ConfigurationPanel::init() ...@@ -56,6 +56,7 @@ void ConfigurationPanel::init()
_cutStringCombo = 30; _cutStringCombo = 30;
//DebugOutput::instance() << "ConfigurationPanel::init()\n"; //DebugOutput::instance() << "ConfigurationPanel::init()\n";
lblError->hide(); lblError->hide();
lblIAXError->hide();
Tab_Signalisations->show(); Tab_Signalisations->show();
Tab_Audio->hide(); Tab_Audio->hide();
Tab_Preferences->hide(); Tab_Preferences->hide();
...@@ -126,11 +127,15 @@ ConfigurationPanel::generate() ...@@ -126,11 +127,15 @@ ConfigurationPanel::generate()
ringsChoice->setCurrentText(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_RINGTONE)); ringsChoice->setCurrentText(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_RINGTONE));
// For signalisations tab // For signalisations tab
// Account
QComboBox* cbo = 0;
int nbItem = 0;
// Load account // Load account
QComboBox* cbo = cboSIPAccount; cbo = cboSIPAccount;
cbo->clear(); cbo->clear();
int nbItem = 4; nbItem = 4;
for (int iItem = 0; iItem < nbItem; iItem++) { for (int iItem = 0; iItem < nbItem; iItem++) {
QString accountId = "SIP" + QString::number(iItem); QString accountId = "SIP" + QString::number(iItem);
QString aliasName = ConfigurationManager::instance().get(accountId, ACCOUNT_ALIAS); QString aliasName = ConfigurationManager::instance().get(accountId, ACCOUNT_ALIAS);
...@@ -147,6 +152,28 @@ ConfigurationPanel::generate() ...@@ -147,6 +152,28 @@ ConfigurationPanel::generate()
} }
loadSIPAccount(0); loadSIPAccount(0);
// Load IAX Account
cbo = cboIAXAccount;
cbo->clear();
nbItem = 1;
for (int iItem = 0; iItem < nbItem; iItem++) {
QString accountId = "IAX" + QString::number(iItem);
QString aliasName = ConfigurationManager::instance().get(accountId, ACCOUNT_ALIAS);
if (aliasName != "") {
QString accountName;
if (aliasName.isEmpty()) {
accountName = QObject::tr("IAX Account #%1").arg(iItem+1);
} else {
if (aliasName.length() > 30) {
aliasName = aliasName.left(30) + "...";
}
accountName = aliasName + " (" + QObject::tr("IAX Account #%1").arg(iItem+1) + ")";
}
cbo->insertItem(accountName,iItem);
}
}
loadIAXAccount(0);
sendDTMFas->setCurrentItem(ConfigurationManager::instance().get(SIGNALISATION_SECTION, sendDTMFas->setCurrentItem(ConfigurationManager::instance().get(SIGNALISATION_SECTION,
SIGNALISATION_SEND_DTMF_AS).toUInt()); SIGNALISATION_SEND_DTMF_AS).toUInt());
playTones->setChecked(ConfigurationManager::instance().get(SIGNALISATION_SECTION, playTones->setChecked(ConfigurationManager::instance().get(SIGNALISATION_SECTION,
...@@ -201,6 +228,7 @@ ConfigurationPanel::generate() ...@@ -201,6 +228,7 @@ ConfigurationPanel::generate()
void ConfigurationPanel::saveSlot() void ConfigurationPanel::saveSlot()
{ {
saveSIPAccount(cboSIPAccount->currentItem()); saveSIPAccount(cboSIPAccount->currentItem());
saveIAXAccount(cboIAXAccount->currentItem());
ConfigurationManager::instance().set(SIGNALISATION_SECTION, ConfigurationManager::instance().set(SIGNALISATION_SECTION,
SIGNALISATION_PULSE_LENGTH, SIGNALISATION_PULSE_LENGTH,
...@@ -396,23 +424,36 @@ ConfigurationPanel::SkinChoice_selected( const QString & ) ...@@ -396,23 +424,36 @@ ConfigurationPanel::SkinChoice_selected( const QString & )
} }
void void
ConfigurationPanel::slotRegister() ConfigurationPanel::slotSIPRegister()
{ {
saveSIPAccount(cboSIPAccount->currentItem()); saveSIPAccount(cboSIPAccount->currentItem());
emit needRegister("SIP" + QString::number(cboSIPAccount->currentItem())); emit needRegister("SIP" + QString::number(cboSIPAccount->currentItem()));
} }
void
ConfigurationPanel::slotIAXRegister()
{
saveIAXAccount(cboIAXAccount->currentItem());
emit needRegister("IAX" + QString::number(cboIAXAccount->currentItem()));
}
void void
ConfigurationPanel::slotRegisterReturn( bool hasError, QString ) ConfigurationPanel::slotRegisterReturn( bool hasError, QString )
{ {
// here we check the current page...
if (hasError) { if (hasError) {
lblError->setPaletteForegroundColor(red); // red lblError->setPaletteForegroundColor(red); // red
lblError->setText(QObject::tr("Register failed")); lblError->setText(QObject::tr("Register failed"));
lblIAXError->setPaletteForegroundColor(red); // red
lblIAXError->setText(QObject::tr("Register failed"));
} else { } else {
lblError->setPaletteForegroundColor(black); // black lblError->setPaletteForegroundColor(black); // black
lblError->setText(QObject::tr("Register Succeed")); lblError->setText(QObject::tr("Register Succeed"));
lblIAXError->setPaletteForegroundColor(black); // black
lblIAXError->setText(QObject::tr("Register Succeed"));
} }
lblError->show(); lblError->show();
lblIAXError->show();
} }
/** /**
...@@ -558,3 +599,64 @@ ConfigurationPanel::saveSIPAccount(int number) ...@@ -558,3 +599,64 @@ ConfigurationPanel::saveSIPAccount(int number)
SIGNALISATION_STUN_SERVER, SIGNALISATION_STUN_SERVER,
STUNserver->text()); STUNserver->text());
} }
void
ConfigurationPanel::slotIAXAccountChange(int index)
{
if (lastIAXAccount!=index) {
QString account = "IAX" + QString::number(index);
saveIAXAccount(lastIAXAccount);
loadIAXAccount(index);
lblIAXError->setText("");
}
}
void
ConfigurationPanel::loadIAXAccount(int number)
{
QString account = "IAX" + QString::number(number);
QString type = ConfigurationManager::instance().get(account, ACCOUNT_TYPE);
chkIAXAutoregister->setChecked(ConfigurationManager::instance()
.get(account,ACCOUNT_AUTO_REGISTER).toUInt());
chkIAXEnable->setChecked(ConfigurationManager::instance()
.get(account,ACCOUNT_ENABLE).toUInt());
QString aliasName = ConfigurationManager::instance().get(account, ACCOUNT_ALIAS);
IAXalias->setText(aliasName);
IAXuser->setText(ConfigurationManager::instance().get(account,SIGNALISATION_IAXUSER));
IAXpass->setText(ConfigurationManager::instance().get(account,SIGNALISATION_IAXPASS));
IAXhost->setText(ConfigurationManager::instance().get(account,SIGNALISATION_IAXHOST));
lastIAXAccount = number;
}
void
ConfigurationPanel::saveIAXAccount(int number)
{
QString account = "IAX" + QString::number(number);
QString aliasName = IAXalias->text();
ConfigurationManager::instance().set(account, ACCOUNT_ALIAS, aliasName);
QString accountName;
if (aliasName.isEmpty()) {
accountName = QObject::tr("IAX Account #%1").arg(number+1);
} else {
if (aliasName.length() > 30) {
aliasName = aliasName.left(30) + "...";
}
accountName = aliasName + " (" + QObject::tr("IAX Account #%1").arg(number+1) + ")";
}
cboIAXAccount->changeItem(accountName, number);
ConfigurationManager::instance().set(account, SIGNALISATION_IAXUSER, IAXuser->text());
ConfigurationManager::instance().set(account, SIGNALISATION_IAXPASS, IAXpass->text());
ConfigurationManager::instance().set(account, SIGNALISATION_IAXHOST, IAXhost->text());
ConfigurationManager::instance().set(account,
ACCOUNT_AUTO_REGISTER,
QString::number(chkAutoregister->isChecked()));
ConfigurationManager::instance().set(account,
ACCOUNT_ENABLE,
QString::number(chkEnable->isChecked()));
}
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
#define SIGNALISATION_PLAY_TONES "DTMF.playTones" #define SIGNALISATION_PLAY_TONES "DTMF.playTones"
#define SIGNALISATION_PULSE_LENGTH "DTMF.pulseLength" #define SIGNALISATION_PULSE_LENGTH "DTMF.pulseLength"
#define SIGNALISATION_SEND_DTMF_AS "DTMF.sendDTMFas" #define SIGNALISATION_SEND_DTMF_AS "DTMF.sendDTMFas"
#define SIGNALISATION_IAXHOST "IAX.host"
#define SIGNALISATION_IAXPASS "IAX.pass"
#define SIGNALISATION_IAXUSER "IAX.user"
#define ACCOUNT_DEFAULT_NAME "SIP0" #define ACCOUNT_DEFAULT_NAME "SIP0"
#define ACCOUNT_TYPE "Account.type" #define ACCOUNT_TYPE "Account.type"
......
...@@ -210,6 +210,19 @@ IAXVoIPLink::getEvent() ...@@ -210,6 +210,19 @@ IAXVoIPLink::getEvent()
} }
iax_event_free(event); iax_event_free(event);
} }
// send sound here
if(_currentCall != 0 && audiolayer != 0) {
int samples = audiolayer->canGetMic();
if (samples != 0) {
int datalen = audiolayer->getMic(_sendDataEncoded, samples);
_debug("iax_send_voice(%p, %d, ,%d, %d)\n", _currentCall->getSession(), _currentCall->getFormat(), datalen, samples);
//if ( iax_send_voice(_currentCall->getSession(), _currentCall->getFormat(), (char*)_sendDataEncoded, datalen, samples) == -1) {
// // error sending voice
//}
}
}
// unlock mutex here // unlock mutex here
_mutexIAX.leaveMutex(); _mutexIAX.leaveMutex();
//iaxRefreshRegistrations(); //iaxRefreshRegistrations();
...@@ -458,6 +471,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call) ...@@ -458,6 +471,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
case IAX_EVENT_HANGUP: case IAX_EVENT_HANGUP:
Manager::instance().peerHungupCall(id); Manager::instance().peerHungupCall(id);
if (Manager::instance().isCurrentCall(id)) { if (Manager::instance().isCurrentCall(id)) {
_currentCall = 0;
audiolayer->stopStream(); audiolayer->stopStream();
// stop audio // stop audio
} }
...@@ -468,6 +482,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call) ...@@ -468,6 +482,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
Manager::instance().peerHungupCall(id); Manager::instance().peerHungupCall(id);
if (Manager::instance().isCurrentCall(id)) { if (Manager::instance().isCurrentCall(id)) {
// stop audio // stop audio
_currentCall = 0;
audiolayer->stopStream(); audiolayer->stopStream();
} }
removeCall(id); removeCall(id);
...@@ -487,6 +502,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call) ...@@ -487,6 +502,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
call->setFormat(event->ies.format); call->setFormat(event->ies.format);
Manager::instance().peerAnsweredCall(id); Manager::instance().peerAnsweredCall(id);
_currentCall = call;
audiolayer->startStream(); audiolayer->startStream();
// start audio here? // start audio here?
} else { } else {
...@@ -539,19 +555,19 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call) ...@@ -539,19 +555,19 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
nbSample = ( src_data.output_frames_gen > IAX__20S_48KHZ_MAX) ? IAX__20S_48KHZ_MAX : src_data.output_frames_gen; nbSample = ( src_data.output_frames_gen > IAX__20S_48KHZ_MAX) ? IAX__20S_48KHZ_MAX : src_data.output_frames_gen;
#ifdef DATAFORMAT_IS_FLOAT #ifdef DATAFORMAT_IS_FLOAT
toAudioLayer = _floatBuffer48000; toAudioLayer = _floatBuffer48000;
#else