mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
IAX Gui interface configuration
Patch for libosip2 3.0.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
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
|
||||
|
||||
* Fix .spec problem on fedora core 6
|
||||
|
@ -3,6 +3,6 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
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)
|
||||
dnl Check for GNU ccRTP
|
||||
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
|
||||
PKG_CHECK_MODULES(samplerate, samplerate >= ${LIBSAMPLERATE_MIN_VERSION})
|
||||
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $samplerate_CFLAGS"
|
||||
|
@ -33,7 +33,7 @@ sflphoned_SOURCES = eventthread.cpp main.cpp voIPLink.cpp \
|
||||
sipvoiplink.cpp call.cpp sipcall.cpp \
|
||||
$(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_LDADD = ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS)
|
||||
|
@ -230,11 +230,9 @@
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>lblAuthorizationUsre</cstring>
|
||||
</property>
|
||||
<property name="name"><cstring>lblAuthorizationUser</cstring></property>
|
||||
<property name="text">
|
||||
<string>Authorization user</string>
|
||||
<string>Authorization user</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="1" column="0">
|
||||
@ -330,7 +328,7 @@
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonRegister</cstring>
|
||||
<cstring>buttonSIPRegister</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@ -478,6 +476,126 @@
|
||||
</vbox>
|
||||
</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">
|
||||
<property name="name">
|
||||
<cstring>DTMFPage</cstring>
|
||||
@ -1453,6 +1571,12 @@ Montreal, Quebec H2T 1S6, Canada</p></string>
|
||||
<receiver>ConfigurationPanel</receiver>
|
||||
<slot>slotSIPAccountChange(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cboIAXAccount</sender>
|
||||
<signal>activated(int)</signal>
|
||||
<receiver>ConfigurationPanel</receiver>
|
||||
<slot>slotIAXAccountChange(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonOk</sender>
|
||||
<signal>clicked()</signal>
|
||||
@ -1466,10 +1590,16 @@ Montreal, Quebec H2T 1S6, Canada</p></string>
|
||||
<slot>changeTabSlot()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonRegister</sender>
|
||||
<sender>buttonSIPRegister</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ConfigurationPanel</receiver>
|
||||
<slot>slotRegister()</slot>
|
||||
<slot>slotSIPRegister()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonIAXRegister</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ConfigurationPanel</receiver>
|
||||
<slot>slotIAXRegister()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonTestSoundDriver</sender>
|
||||
@ -1525,7 +1655,15 @@ Montreal, Quebec H2T 1S6, Canada</p></string>
|
||||
<tabstop>sipproxy</tabstop>
|
||||
<tabstop>chkAutoregister</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>buttonCancel</tabstop>
|
||||
<tabstop>Tab_Signalisations</tabstop>
|
||||
@ -1559,7 +1697,9 @@ Montreal, Quebec H2T 1S6, Canada</p></string>
|
||||
<slots>
|
||||
<slot>generate()</slot>
|
||||
<slot>slotSIPAccountChange(int)</slot>
|
||||
<slot>slotRegister()</slot>
|
||||
<slot>slotIAXAccountChange(int)</slot>
|
||||
<slot>slotSIPRegister()</slot>
|
||||
<slot>slotIAXRegister()</slot>
|
||||
<slot>slotRegisterReturn( bool, QString )</slot>
|
||||
<slot>slotTestSoundDriver()</slot>
|
||||
<slot>slotReloadSoundDriver()</slot>
|
||||
@ -1580,9 +1720,12 @@ Montreal, Quebec H2T 1S6, Canada</p></string>
|
||||
<function access="private" specifier="non virtual">init()</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">loadIAXAccount(int number)</function>
|
||||
<function access="private" specifier="non virtual">saveIAXAccount(int number)</function>
|
||||
</functions>
|
||||
<variables>
|
||||
<variable access="private">int lastSIPAccount;</variable>
|
||||
<variable access="private">int lastIAXAccount;</variable>
|
||||
<variable access="private">int _cutStringCombo;</variable>
|
||||
<variable access="private">std::map < int, int > _deviceInMap</variable>
|
||||
<variable access="private">std::map < int, int > _deviceOutMap</variable>
|
||||
|
@ -56,6 +56,7 @@ void ConfigurationPanel::init()
|
||||
_cutStringCombo = 30;
|
||||
//DebugOutput::instance() << "ConfigurationPanel::init()\n";
|
||||
lblError->hide();
|
||||
lblIAXError->hide();
|
||||
Tab_Signalisations->show();
|
||||
Tab_Audio->hide();
|
||||
Tab_Preferences->hide();
|
||||
@ -126,11 +127,15 @@ ConfigurationPanel::generate()
|
||||
ringsChoice->setCurrentText(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_RINGTONE));
|
||||
|
||||
// For signalisations tab
|
||||
|
||||
// Account
|
||||
QComboBox* cbo = 0;
|
||||
int nbItem = 0;
|
||||
|
||||
// Load account
|
||||
QComboBox* cbo = cboSIPAccount;
|
||||
cbo = cboSIPAccount;
|
||||
cbo->clear();
|
||||
int nbItem = 4;
|
||||
nbItem = 4;
|
||||
for (int iItem = 0; iItem < nbItem; iItem++) {
|
||||
QString accountId = "SIP" + QString::number(iItem);
|
||||
QString aliasName = ConfigurationManager::instance().get(accountId, ACCOUNT_ALIAS);
|
||||
@ -147,6 +152,28 @@ ConfigurationPanel::generate()
|
||||
}
|
||||
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,
|
||||
SIGNALISATION_SEND_DTMF_AS).toUInt());
|
||||
playTones->setChecked(ConfigurationManager::instance().get(SIGNALISATION_SECTION,
|
||||
@ -201,6 +228,7 @@ ConfigurationPanel::generate()
|
||||
void ConfigurationPanel::saveSlot()
|
||||
{
|
||||
saveSIPAccount(cboSIPAccount->currentItem());
|
||||
saveIAXAccount(cboIAXAccount->currentItem());
|
||||
|
||||
ConfigurationManager::instance().set(SIGNALISATION_SECTION,
|
||||
SIGNALISATION_PULSE_LENGTH,
|
||||
@ -396,23 +424,36 @@ ConfigurationPanel::SkinChoice_selected( const QString & )
|
||||
}
|
||||
|
||||
void
|
||||
ConfigurationPanel::slotRegister()
|
||||
ConfigurationPanel::slotSIPRegister()
|
||||
{
|
||||
saveSIPAccount(cboSIPAccount->currentItem());
|
||||
emit needRegister("SIP" + QString::number(cboSIPAccount->currentItem()));
|
||||
}
|
||||
|
||||
void
|
||||
ConfigurationPanel::slotIAXRegister()
|
||||
{
|
||||
saveIAXAccount(cboIAXAccount->currentItem());
|
||||
emit needRegister("IAX" + QString::number(cboIAXAccount->currentItem()));
|
||||
}
|
||||
|
||||
void
|
||||
ConfigurationPanel::slotRegisterReturn( bool hasError, QString )
|
||||
{
|
||||
// here we check the current page...
|
||||
if (hasError) {
|
||||
lblError->setPaletteForegroundColor(red); // red
|
||||
lblError->setText(QObject::tr("Register failed"));
|
||||
lblIAXError->setPaletteForegroundColor(red); // red
|
||||
lblIAXError->setText(QObject::tr("Register failed"));
|
||||
} else {
|
||||
lblError->setPaletteForegroundColor(black); // black
|
||||
lblError->setText(QObject::tr("Register Succeed"));
|
||||
lblIAXError->setPaletteForegroundColor(black); // black
|
||||
lblIAXError->setText(QObject::tr("Register Succeed"));
|
||||
}
|
||||
lblError->show();
|
||||
lblIAXError->show();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -558,3 +599,64 @@ ConfigurationPanel::saveSIPAccount(int number)
|
||||
SIGNALISATION_STUN_SERVER,
|
||||
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 @@
|
||||
#define SIGNALISATION_PLAY_TONES "DTMF.playTones"
|
||||
#define SIGNALISATION_PULSE_LENGTH "DTMF.pulseLength"
|
||||
#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_TYPE "Account.type"
|
||||
|
@ -210,6 +210,19 @@ IAXVoIPLink::getEvent()
|
||||
}
|
||||
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
|
||||
_mutexIAX.leaveMutex();
|
||||
//iaxRefreshRegistrations();
|
||||
@ -458,6 +471,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
|
||||
case IAX_EVENT_HANGUP:
|
||||
Manager::instance().peerHungupCall(id);
|
||||
if (Manager::instance().isCurrentCall(id)) {
|
||||
_currentCall = 0;
|
||||
audiolayer->stopStream();
|
||||
// stop audio
|
||||
}
|
||||
@ -468,6 +482,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
|
||||
Manager::instance().peerHungupCall(id);
|
||||
if (Manager::instance().isCurrentCall(id)) {
|
||||
// stop audio
|
||||
_currentCall = 0;
|
||||
audiolayer->stopStream();
|
||||
}
|
||||
removeCall(id);
|
||||
@ -487,6 +502,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
|
||||
call->setFormat(event->ies.format);
|
||||
|
||||
Manager::instance().peerAnsweredCall(id);
|
||||
_currentCall = call;
|
||||
audiolayer->startStream();
|
||||
// start audio here?
|
||||
} else {
|
||||
@ -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;
|
||||
#ifdef DATAFORMAT_IS_FLOAT
|
||||
toAudioLayer = _floatBuffer48000;
|
||||
#else
|
||||
#else
|
||||
src_float_to_short_array(_floatBuffer48000, _dataAudioLayer, nbSample);
|
||||
toAudioLayer = _dataAudioLayer;
|
||||
#endif
|
||||
toAudioLayer = _dataAudioLayer;
|
||||
#endif
|
||||
|
||||
} else {
|
||||
nbSample = nbInt16;
|
||||
#ifdef DATAFORMAT_IS_FLOAT
|
||||
// convert _receiveDataDecoded to float inside _receiveData
|
||||
// convert _receiveDataDecoded to float inside _receiveData
|
||||
src_short_to_float_array(_receiveDataDecoded, _floatBuffer8000, nbSample);
|
||||
toAudioLayer = _floatBuffer8000;
|
||||
toAudioLayer = _floatBuffer8000;
|
||||
#else
|
||||
toAudioLayer = _receiveDataDecoded; // int to int
|
||||
toAudioLayer = _receiveDataDecoded; // int to int
|
||||
#endif
|
||||
}
|
||||
audiolayer->putMain(toAudioLayer, nbSample * sizeof(SFLDataFormat));
|
||||
|
@ -139,6 +139,9 @@ private:
|
||||
|
||||
/** Buffer for 8000hz samples for mic conversion */
|
||||
int16* _intBuffer8000;
|
||||
|
||||
/** Current IAX call pointer, used for sending, change when starting audio, switching */
|
||||
IAXCall* _currentCall;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -283,12 +283,12 @@ SIPCall::SIPCallAnswered(eXosip_event_t *event)
|
||||
* @return true if ok (change / no change) or false on error
|
||||
*/
|
||||
bool
|
||||
SIPCall::SIPCallAnsweredWithoutHold(eXosip_event_t *event)
|
||||
SIPCall::SIPCallAnsweredWithoutHold(eXosip_event_t* event)
|
||||
{
|
||||
if (event->response == NULL || event->request == NULL) { return false; }
|
||||
|
||||
eXosip_lock();
|
||||
sdp_message_t *remote_sdp = eXosip_get_sdp_info (event->response);
|
||||
sdp_message_t* remote_sdp = eXosip_get_sdp_info (event->response);
|
||||
eXosip_unlock();
|
||||
if (remote_sdp == NULL) {
|
||||
_debug("SIP Failure: no remote sdp\n");
|
||||
@ -296,7 +296,7 @@ SIPCall::SIPCallAnsweredWithoutHold(eXosip_event_t *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
sdp_media_t *remote_med = getRemoteMedia(event->tid, remote_sdp);
|
||||
sdp_media_t* remote_med = getRemoteMedia(event->tid, remote_sdp);
|
||||
if (remote_med==NULL) {
|
||||
sdp_message_free(remote_sdp);
|
||||
return false;
|
||||
@ -306,8 +306,11 @@ SIPCall::SIPCallAnsweredWithoutHold(eXosip_event_t *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
char *tmp = (char *) osip_list_get (remote_med->m_payloads, 0);
|
||||
|
||||
#ifdef LIBOSIP2_WITHPOINTER
|
||||
char *tmp = (char*) osip_list_get (remote_med->m_payloads, 0);
|
||||
#else
|
||||
char *tmp = (char*) osip_list_get (&(remote_med->m_payloads), 0);
|
||||
#endif
|
||||
setAudioCodec(0);
|
||||
if (tmp != NULL) {
|
||||
int payload = atoi (tmp);
|
||||
@ -400,8 +403,15 @@ SIPCall::sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg)
|
||||
// for each medias
|
||||
int iMedia = 0;
|
||||
char *tmp = NULL;
|
||||
while (!osip_list_eol(remote_sdp->m_medias, iMedia)) {
|
||||
sdp_media_t *remote_med = (sdp_media_t *)osip_list_get(remote_sdp->m_medias, iMedia);
|
||||
#ifdef LIBOSIP2_WITHPOINTER
|
||||
const osip_list_t* remote_sdp_m_medias = remote_sdp->m_medias; // old abi
|
||||
#else
|
||||
const osip_list_t* remote_sdp_m_medias = &(remote_sdp->m_medias);
|
||||
#endif
|
||||
osip_list_t* remote_med_m_payloads = 0;
|
||||
|
||||
while (!osip_list_eol(remote_sdp_m_medias, iMedia)) {
|
||||
sdp_media_t *remote_med = (sdp_media_t *)osip_list_get(remote_sdp_m_medias, iMedia);
|
||||
if (remote_med == 0) { continue; }
|
||||
|
||||
if (0 != osip_strcasecmp (remote_med->m_media, "audio")) {
|
||||
@ -413,8 +423,14 @@ SIPCall::sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg)
|
||||
|
||||
// search for compatible codec: foreach payload
|
||||
int iPayload = 0;
|
||||
while (!osip_list_eol(remote_med->m_payloads, iPayload)) {
|
||||
tmp = (char *)osip_list_get(remote_med->m_payloads, iPayload);
|
||||
#ifdef LIBOSIP2_WITHPOINTER
|
||||
remote_med_m_payloads = remote_med->m_payloads; // old abi
|
||||
#else
|
||||
remote_med_m_payloads = &(remote_med->m_payloads);
|
||||
#endif
|
||||
|
||||
while (!osip_list_eol(remote_med_m_payloads, iPayload)) {
|
||||
tmp = (char *)osip_list_get(remote_med_m_payloads, iPayload);
|
||||
if (tmp!=NULL) {
|
||||
int payload = atoi(tmp);
|
||||
AudioCodec* audiocodec = _codecMap.getCodec((CodecType)payload);
|
||||
@ -464,10 +480,15 @@ SIPCall::sdp_analyse_attribute (sdp_message_t * sdp, sdp_media_t * med)
|
||||
|
||||
/* test media attributes */
|
||||
pos = 0;
|
||||
while (!osip_list_eol (med->a_attributes, pos)) {
|
||||
#ifdef LIBOSIP2_WITHPOINTER
|
||||
const osip_list_t* med_a_attributes = med->a_attributes; // old abi
|
||||
#else
|
||||
const osip_list_t* med_a_attributes = &(med->a_attributes);
|
||||
#endif
|
||||
while (!osip_list_eol (med_a_attributes, pos)) {
|
||||
sdp_attribute_t *at;
|
||||
|
||||
at = (sdp_attribute_t *) osip_list_get (med->a_attributes, pos);
|
||||
at = (sdp_attribute_t *) osip_list_get (med_a_attributes, pos);
|
||||
if (at->a_att_field != NULL &&
|
||||
0 == strcmp (at->a_att_field, "sendonly")) {
|
||||
return _SENDONLY;
|
||||
@ -484,10 +505,15 @@ SIPCall::sdp_analyse_attribute (sdp_message_t * sdp, sdp_media_t * med)
|
||||
/* test global attributes */
|
||||
pos_media = -1;
|
||||
pos = 0;
|
||||
while (!osip_list_eol (sdp->a_attributes, pos)) {
|
||||
#ifdef LIBOSIP2_WITHPOINTER
|
||||
const osip_list_t* sdp_a_attributes = sdp->a_attributes; // old abi
|
||||
#else
|
||||
const osip_list_t* sdp_a_attributes = &(sdp->a_attributes);
|
||||
#endif
|
||||
while (!osip_list_eol (sdp_a_attributes, pos)) {
|
||||
sdp_attribute_t *at;
|
||||
|
||||
at = (sdp_attribute_t *) osip_list_get (sdp->a_attributes, pos);
|
||||
at = (sdp_attribute_t *) osip_list_get (sdp_a_attributes, pos);
|
||||
if (at->a_att_field != NULL &&
|
||||
0 == strcmp (at->a_att_field, "sendonly")) {
|
||||
return _SENDONLY;
|
||||
@ -622,8 +648,13 @@ SIPCall::setAudioCodecFromSDP(sdp_media_t* remote_med, int tid)
|
||||
// Remote Payload
|
||||
char *tmp = NULL;
|
||||
int pos = 0;
|
||||
while (!osip_list_eol (remote_med->m_payloads, pos)) {
|
||||
tmp = (char *) osip_list_get (remote_med->m_payloads, pos);
|
||||
#ifdef LIBOSIP2_WITHPOINTER
|
||||
const osip_list_t* remote_med_m_payloads = remote_med->m_payloads; // old abi
|
||||
#else
|
||||
const osip_list_t* remote_med_m_payloads = &(remote_med->m_payloads);
|
||||
#endif
|
||||
while (!osip_list_eol (remote_med_m_payloads, pos)) {
|
||||
tmp = (char *) osip_list_get (remote_med_m_payloads, pos);
|
||||
if (tmp != NULL ) {
|
||||
int payload = atoi(tmp);
|
||||
// stop if we find a correct codec
|
||||
|
Reference in New Issue
Block a user