Discussion Board
answer a call
1970-01-01, 02:00
#1
Regular Contributor
Can i answer a incoming call,and the system application "EtelServer" did not answer.thank you.
RE: answer a call
1970-01-01, 02:00
#2
Regular Contributor
Hello,
Create an active object and use RLine::NotifyIncomingCall() to wait for a call. When the call is notified, create a RCall object and use AnswerIncomingCall() function to answer the call.
I hope this was an answer for your question.
Best Regards,
Marko / Forum Nokia
RE: answer a call
1970-01-01, 02:00
#3
Regular Contributor
Yes.These i know.Now I set the phone to expect a data call.
Q1. However, when the call comes in, it asks me whether to accept the incoming data call or not. Is there a way to turn off this option, so that it is accepted automatically?
Q2. If I accept the call, it then asks me if I want to turn on the iRDA port to connect to my PC. Is there a way to turn off this option so that my application can accept this call automatically?
Also, when calling RCall.AcquireOwnership, it returns error -2007 (call not active). What's going on here? Is it because the iRDA has acquired it?
and ,I could not use RCall::AnswerIncomingCAll(),it only can pick-up a voice call.This is my code.you can try to run.
#include <c32comm.h>
#include "Test.h"
_LIT(KTsyName,"PHONETSY.TSY" ;
_LIT(KFName, "C:\\debug.txt" ;
void Test::debugline(const char *a, void *arg1, void *arg2, void *arg3)
{
RFs iFs;
RFile fp;
TBuf8<1024> buf;
iFs.Connect();
if(!fp.Open(iFs, KFName, EFileShareAny|EFileWrite))
{
TInt spos = 0;
fp.Seek(ESeekEnd, spos);
}
else fp.Replace(iFs, KFName, EFileShareAny|EFileWrite);
TPtrC8 p((const unsigned char *)a);
buf.Format(p, arg1, arg2, arg3);
//buf.Append('\n');
fp.Write(buf);
fp.Close();
iFs.Close();
for(int i=0;i<buf.Length();i++)
{
_LIT(form, "%c" ;
console->Printf(form,buf[i]);
}
}
void Test::init(void)
{
RFs iFs;
iFs.Connect();
iFs.Delete(KFName);
}
void Test::debug(const char *a)
{
debugline(a,0,0,0);
}
void Test::debug(const char *a,void *b)
{
debugline(a,b,0,0);
}
void Test::debug(const char *a,void *b,void *c)
{
debugline(a,b,c,0);
}
void Test::debug(const char *a,void *b,void *c,void *d)
{
debugline(a,b,c,d);
}
void Test::debugname(TDes &name)
{
for(int i=0;i<name.Length();i++)
{
debug("%c",(void*)name[i]);
}
}
Test::Test(CConsoleBase *con) : CActive(0)
{
console=con;
init();
RTelServer ts;
debug("connect\n" ;
ts.Connect();
//add by cunzuo
ts.LoadPhoneModule(KTsyName);
//end by cunzuo
RTelServer::TPhoneInfo pinfo;
debug("get info\n" ;
ts.GetPhoneInfo(0,pinfo);
debug("info:" ; debugname(pinfo.iName); debug("\n" ;
RPhone phone;
TInt nr;
phone.Open(ts,pinfo.iName);
phone.EnumerateLines(nr);
debug("nr:%d\n",(void*)nr);
RPhone::TLineInfo aLineInfo;
for(int i=0;i<nr;i++)
{
phone.GetLineInfo(i,aLineInfo);
debug("cap:%d name:",(void*)aLineInfo.iLineCapsFlags); debugname(aLineInfo.iName); debug("\n" ;
}
//add by cunzuo
TRequestStatus commstatus;
RCommServ commServer;
RComm comm;
RCall::TCommPort commPort;
int ret= commServer.Connect();
User::LeaveIfError (ret);
TBufC<12> port(_L ("DATAPORT::0" );
ret= comm.Open(commServer, port, ECommShared);
TInt curlenth = comm.ReceiveBufferLength ();
comm.SetReceiveBufferLength (4096);
curlenth = comm.ReceiveBufferLength ();
//ATINIT=AT+CMOD=0;+CLIP=1;+CRC=0;+CSNS=4;+CBST=7,0,1
_LIT8(lpD,"AT+CMOD=0\r\n" ;
comm.Write(commstatus,lpD);
User::WaitForRequest(commstatus);
_LIT8(lpD1,"AT+CLIP=1\r\n" ;
comm.Write(commstatus,lpD1);
User::WaitForRequest(commstatus);
_LIT8(lpD2,"AT+CRC=0\r\n" ;
comm.Write(commstatus,lpD2);
User::WaitForRequest(commstatus);
_LIT8(lpD3,"AT+CSNS=4\r\n" ;
comm.Write(commstatus,lpD3);
User::WaitForRequest(commstatus);
_LIT8(lpD4,"AT+CBST=7,0,1\r\n" ;
comm.Write(commstatus,lpD4);
User::WaitForRequest(commstatus);
//end by cunzuo
phone.GetLineInfo(2,aLineInfo);
RLine line;
int ret=line.Open(phone,aLineInfo.iName);
//ret=line.Open(ts,info.iName);
debug("line opened ret:%d\n",(void*)ret);
TRequestStatus status=-1;
RCall::TStatus tstat=(RCall::TStatus)-1;
line.NotifyStatusChange(status,tstat);
RCall call;
for(i=0;i<50;i++)
{
debug("loop:%d\n",(void*)i);
RLine::TLineInfo tinfo;
// info.iNameOfCallForAnswering[0]=0;
//{ debug("stat:%d %d\n" ; console->Printf(str,tinfo.iStatus,tinfo.iHookStatus); }
debug("stat:%x stat:%d \n",(void*)status.Int(),(void*)tstat);
if(tstat==3 )
{
ret=line.GetInfo(tinfo);
if(ret != 0)
{
debug("Error: get info ret:%d\n",(void*)ret);
return;
}
debug("calling open call:" ;
debugname(tinfo.iNameOfCallForAnswering);
//debug(" last:" ;
debugname(tinfo.iNameOfLastCallAdded);
debug("\n" ;
ret=call.OpenExistingCall(line,tinfo.iNameOfCallForAnswering);
if(ret != 0)
{
debug("Error: OpenExistingCall ret:%d\n",(void*)ret);
return;
}
for(int j=0;j<50;j++)
{
debug("j:%d\n",(void*)j);
RCall::TOwnershipStatus owner;
call.GetOwnershipStatus(owner);
debug("owner:%d\n",(void*)owner);
RCall::TStatus st;
call.GetStatus(st);
debug("status of call: " ;
if(st==RCall::EStatusRinging)
{
debug("ringing, answering\n" ;
TRequestStatus req;
call.AcquireOwnership(req);
if(req != 0)
{
debug("Error: aquire1:%d\n",(void*)req.Int());
// call.LoanDataPort(req,commPort);
if(req != 0)
{
debug("Error: loandataport:%d\n",(void*)req.Int());
}
}
ret=call.AnswerIncomingCall();
if(ret != 0) debug("Error: answer\n" ;
ret=call.TransferOwnership();
if(ret != 0) debug("Error: transfer ownership\n" ;
}
else
if(st==RCall::EStatusRinging) debug("status:ringing\n" ;
else
if(st==RCall::EStatusAnswering) debug("status:answering\n" ;
else
if(st==RCall::EStatusIdle) debug("status:idle\n" ;
else
if(st==RCall::EStatusConnecting) debug("status:connecting\n" ;
else
if(st==RCall::EStatusConnected) debug("status:connected\n" ;
else
if(st==RCall::EStatusIdle) debug("status:idle\n" ;
else
debug("Error unknown status:%d\n",(void*)st);
if(owner==RCall::EOwnershipOwnedByAnotherClient)
{
debug("owned by another, taking ownership\n" ;
TRequestStatus req;
call.AcquireOwnership(req);
if(req != 0)
debug("Error: aquire2:%d\n",(void*)req.Int());
}
RCall::TCallInfo callinfo;
ret=call.GetInfo(callinfo);
if(ret != 0)
{
debug("Error: getcallinfo ret:%d\n",(void*)ret);
return;
}
debug("callname:" ; debugname(callinfo.iCallName);
debug(" line:" ; debugname(callinfo.iLineName);
debug(" duration:%d %d %d\n",(void*)callinfo.iDuration.Int(),(void*)callinfo.iLineName.Length(),(void*)callinfo.iCallName.Length() );
RPhone::TLineInfo aLineInfo; // last try...
for(int i=0;i<nr;i++)
{
phone.GetLineInfo(i,aLineInfo);
debug("name:" ; debugname(aLineInfo.iName); debug("\n" ;
}
delay(100000);
}
call.Close();
return;
}
delay(1500000);
}
}
void Test::delay(int n)
{
RTimer timer;
TRequestStatus timerStatus;
timer.CreateLocal();
timer.After(timerStatus,n);
User::WaitForRequest(timerStatus);
}
void Test: oCancel()
{
}
void Test::RunL()
{
}
this is test.h
#ifndef __TESE_H__
#define __TEST_H__
#include <f32file.h>
#include <e32base.h>
#include <e32cons.h>
#include <etel.h>
class Test : public CActive
{
public:
TRequestStatus stat;
TBool bret;
CConsoleBase* console; // console object
RFs fsSession;
public:
Test(CConsoleBase *con);
void debugline(const char *a, void *arg1, void *arg2, void *arg3);
void debug(const char *a);
void debug(const char *a,void *b);
void debug(const char *a,void *b,void *c);
void debug(const char *a,void *b,void *c,void *d);
void debugname(TDes &name);
void init(void);
void delay(int t);
void DoCancel();
void RunL();
};
#endif
Registered User
Hi,
Have you solved your problem? I am facing the same problem as you.
Best regards,
Registered User
I have also the same problem. AnswerIncomingCall() does not work for data calls. It is bug?
Registered User
Hi,
Is there any way to trap the outgoing calls.
Thanks;
Nilesh
Registered User
Yes, I've read in a Nokia document tha AnswerIncomingCall will not anwer data call - it's a bug. No workaround found.
Registered User
HI there,
I tried the code above and after some painfull removal / adition of code added by the wonderfull HTML message board I managed to compile the code but linking still fails with the following message:
MAKEDEF ERROR: command-line: 1 Frozen Export(s) missing from object files:
NewApplication__Fv @1
whese should I look?
I create a .mmp / .inf file for the project and ran bldmake bldfiles, abld build / abld freeze / abld build but it didn't help.
anyone?
rgs,
Antek
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules