Commit 567e11c5 authored by yanmorin's avatar yanmorin
Browse files

Adding new method to iaxvoiplink (answer, refuse, transfer, senddtmf)

parent 6726d18c
......@@ -17,7 +17,7 @@ For sflphone-qt:
---------------
Add samplerate combobox if sample rate is compiled
Save account status if modified in configuration
Bug when moving sflphone and clicking inside the lcd
From FIXME:
......
......@@ -54,8 +54,9 @@ AudioRtp::createNewSession (SIPCall *ca) {
// something should stop the thread before...
if ( _RTXThread != 0 ) {
_debug("Try to create a new audio rtp thread...\n");
return -1;
_debug("AudioRTP Failure: Thread already exists..., stopping it\n");
delete _RTXThread; _RTXThread = 0;
//return -1;
}
// Start RTP Send/Receive threads
......@@ -64,6 +65,7 @@ AudioRtp::createNewSession (SIPCall *ca) {
try {
if (_RTXThread->start() != 0) {
_debug("AudioRTP Failure: unable to start RTX Thread\n");
return -1;
}
} catch(...) {
......
......@@ -292,6 +292,19 @@ IAXVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl)
return call;
}
bool
IAXVoIPLink::answer(const CallID& id)
{
IAXCall* call = getIAXCall(id);
if (call==0) { _debug("Call doesn't exists\n"); return false; }
_mutexIAX.enterMutex();
iax_answer(call->getSession());
_mutexIAX.leaveMutex();
call->setState(Call::Active);
call->setConnectionState(Call::Connected);
return true;
}
bool
IAXVoIPLink::hangup(const CallID& id)
{
......@@ -335,6 +348,44 @@ IAXVoIPLink::offhold(const CallID& id)
return true;
}
bool
IAXVoIPLink::transfer(const CallID& id, const std::string& to)
{
IAXCall* call = getIAXCall(id);
if (call==0) { _debug("Call doesn't exists\n"); return false; }
char callto[to.length()+1];
strcpy(callto, to.c_str());
_mutexIAX.enterMutex();
iax_transfer(call->getSession(), callto);
_mutexIAX.leaveMutex();
// should we remove it?
// removeCall(id);
}
bool
IAXVoIPLink::refuse(const CallID& id)
{
IAXCall* call = getIAXCall(id);
if (call==0) { _debug("Call doesn't exists\n"); return false; }
_mutexIAX.enterMutex();
iax_reject(call->getSession(), "Call rejected manually.");
_mutexIAX.leaveMutex();
removeCall(id);
}
bool
IAXVoIPLink::carryingDTMFdigits(const CallID& id, char code)
{
IAXCall* call = getIAXCall(id);
if (call==0) { _debug("Call doesn't exists\n"); return false; }
_mutexIAX.enterMutex();
iax_send_dtmf(call->getSession(), code);
_mutexIAX.leaveMutex();
}
bool
IAXVoIPLink::iaxOutgoingInvite(IAXCall* call)
{
......
......@@ -51,15 +51,15 @@ public:
bool setUnregister (void);
Call* newOutgoingCall(const CallID& id, const std::string& toUrl);
bool answer(const CallID& id) {return false;}
bool answer(const CallID& id);
bool hangup(const CallID& id);
bool cancel(const CallID& id) { return false; }
bool onhold(const CallID& id);
bool offhold(const CallID& id);
bool transfer(const CallID& id, const std::string& to) { return false; }
bool refuse (const CallID& id) { return false; }
bool carryingDTMFdigits(const CallID& id, char code) { return false; }
bool transfer(const CallID& id, const std::string& to);
bool refuse (const CallID& id);
bool carryingDTMFdigits(const CallID& id, char code);
bool sendMessage(const std::string& to, const std::string& body) { return false; }
public: // iaxvoiplink only
......
......@@ -613,6 +613,13 @@ SIPVoIPLink::onhold(const CallID& id)
SIPCall* call = getSIPCall(id);
if (call==0) { _debug("Call doesn't exist\n"); return false; }
// Stop sound
call->setAudioStart(false);
call->setState(Call::Hold);
_debug("SIP: Stopping AudioRTP when onhold\n");
_audiortp.closeRtpSession();
int did = call->getDid();
eXosip_lock ();
......@@ -661,12 +668,6 @@ SIPVoIPLink::onhold(const CallID& id)
osip_message_set_content_type (invite, "application/sdp");
}
// Stop sound
call->setAudioStart(false);
call->setState(Call::Hold);
_debug("SIP: Stopping AudioRTP when onhold\n");
_audiortp.closeRtpSession();
// send request
_debug("< Send on hold request\n");
eXosip_lock ();
......
......@@ -30,7 +30,7 @@ if [ -z `$pidof 'sflphoned'` ]; then
echo -en "\n";
fi
callstring="call someone with $callid $telephonenumber\n"
callstring="call someone SIP0 $callid $telephonenumber\n"
echo "Calling $telephonenumber..."
echo -en $callstring | $netcat
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment