Dial a number
Login to reply to this topic.
Thu, 2005-01-06 06:38
Joined: 2004-11-30
Forum posts: 92
How can i use RCall so that i can dial to a perticular number on a button click from a view?

-=< Thamasoma Jyothirgamaya >=--


Thu, 2005-01-06 09:18
Joined: 2004-05-24
Forum posts: 982
Quote from: Alicia_UIQ
How can i use RCall so that i can dial to a perticular number on a button click from a view?

You can use this
Code:
// emulator does not support dialing
#if __WINS__
//not suported
#else
//Create a connection to the tel server
RTelServer server;
CleanupClosePushL(server);
User::LeaveIfError(server.Connect());

//Load in the phone device driver
User::LeaveIfError(server.LoadPhoneModule(KTsyName));

//Find the number of phones available from the tel server
TInt numberPhones;
User::LeaveIfError(server.EnumeratePhones(numberPhones));

//Check there are available phones
if (numberPhones < 1)
{
User::Leave(KErrNotFound);
}

//Get info about the first available phone
RTelServer::TPhoneInfo info;
User::LeaveIfError(server.GetPhoneInfo(0, info));

//Use this info to open a connection to the phone, the phone is identified by its name
RPhone phone;
CleanupClosePushL(phone);
User::LeaveIfError(phone.Open(server, info.iName));

//Get info about the first line from the phone
RPhone::TLineInfo lineInfo;
User::LeaveIfError(phone.GetLineInfo(0, lineInfo));

//Use this to open a line
RLine line;
CleanupClosePushL(line);
User::LeaveIfError(line.Open(phone, lineInfo.iName));

//Open a new call on this line
TBuf <100> newCallName;
RCall call;
CleanupClosePushL(call);
User::LeaveIfError(call.OpenNewCall(line, newCallName));

//newCallName will now contain the name of the call
User::LeaveIfError(call.Dial(aPhoneNumber));  //aPhoneNumber is a const TDesC&

//Close the phone, line and call connections and remove them from the cleanup stack
//NOTE: This does not hang up the call
CleanupStack::PopAndDestroy(3);//phone, line, call

//Unload the phone device driver
User::LeaveIfError(server.UnloadPhoneModule(KTsyName));

//Close the connection to the tel server and remove it from the cleanup stack
CleanupStack::PopAndDestroy(&server);

#endif

and somewhere in the start of the file you'll put
_LIT (KTsyName,"phonetsy.tsy");

pirosl

Thu, 2005-01-06 10:32
Joined: 2004-06-08
Forum posts: 32
Do you want to develop for UIQ or S60?

For UIQ the code from pirosl wont work.

BR

Arne
Thu, 2005-01-06 12:04
Joined: 2004-05-24
Forum posts: 982
Quote from: Arne
Do you want to develop for UIQ or S60?

For UIQ the code from pirosl wont work.

BR

Arne

Yes, Arne is right. It wont work for UIQ. The code is for S60.

Lucian

pirosl

Thu, 2005-01-06 13:28
Anonymous (not verified)
Forum posts: 2037
I am working in UIQ ... If it will not work please help...
Thu, 2005-01-06 22:04
Joined: 2004-09-13
Forum posts: 11
just simple as:

#include <QPhoneAppExternalInterface.h>

TVwsViewId id(KUidPhoneApp, KUidPhoneAppView);
TNumDnlPhone dnl;
dnl.iNumber = aNumber;
TNumDnlPhoneBuf dnlBuf(dnl);
CEikAppUi* appUi = iEikonEnv->EikAppUi();
         
appUi->ActivateViewL(id, KUidNumDnlPhone, dnlBuf);
Thu, 2005-01-06 22:52
Joined: 2004-02-05
Forum posts: 176
Hi allÂ…

The code that pirosl posted will actually work fine in UIQ except for one small issue, the .TSY module is different on UIQ.  Instead of hard-coding the TSY module name, you could look it up from the Communication Database.  Here is one method you may use to do thatÂ…


Code:
void CExample::GetTsyModuleL(TDes& aTSYName)
{
CCommsDatabase* const db = CCommsDatabase::NewL(EDatabaseTypeUnspecified);
CleanupStack::PushL(db); // PUSH

TUint32 modemId = 0;
db->GetGlobalSettingL(TPtrC(MODEM_PHONE_SERVICES_SMS), modemId); //Find the modem bearer for phone and SMS service.

CCommsDbTableView* const view = db->OpenViewMatchingUintLC(TPtrC(MODEM),
  TPtrC(COMMDB_ID), modemId); // PUSH
TInt err = view->GotoFirstRecord();
User::LeaveIfError(err);
view->ReadTextL(TPtrC(MODEM_TSY_NAME), aTSYName);
CleanupStack::PopAndDestroy(2, db); // view & db
}
Once you successfully look up the correct TSY module name, you could use the same code to make a phone call.  You would replace the hard-coded KTsyName with the looked up value.

Example:

Code:
TBuf<64> tsyModuleName;
GetTsyModuleL(tsyModuleName);

//Change the lines that Load and Unload the TSY Module
User::LeaveIfError(server.LoadPhoneModule(tsyModuleName));

User::LeaveIfError(server.UnloadPhoneModule(tsyModuleName));

Now you will be able to make a phone call using the same code with the above changes.  But there is still an issue, there is no user interface allowing the user to see the number dialed, cancel the call, or other facilities the user would want available when making a phone call.
In UIQ, you may decide to use the DNL of the phone application to make the phone call instead.  Here is an example of how to do thatÂ…

Code:
#include <QPhoneAppExternalInterface.h>
//Number hardcoded for testing
_LIT(KExampleNumber,"2065551212");
TVwsViewId id(KUidPhoneApp,KUidPhoneAppView);
TNumDnlPhone dnl;
dnl.iNumber = KExampleNumber;
TNumDnlPhoneBuf dnlBuf(dnl);

iEikonEnv->EikAppUi()->ActivateViewL(id, KUidNumDnlPhone, dnlBuf);

Thu, 2005-01-06 23:41
Joined: 2004-09-13
Forum posts: 11
the dnl is the good way for many things , and it s a big lack on s60. thanks to sony
Fri, 2005-01-07 04:55
Joined: 2004-11-30
Forum posts: 92
Thanks a lot..

-=< Thamasoma Jyothirgamaya >=--

Fri, 2005-01-07 10:09
Joined: 2004-05-24
Forum posts: 982
Hy dishneau

Can you please let me know which is the .TSY module on UIQ?

Thanks

pirosl

Mon, 2005-01-10 10:38
Joined: 2004-11-20
Forum posts: 67
Hi,
If I want to have a listener for outgoing call, is it possible to use RCall, RPhone,... in my ActiveObject for P900??

I just want to detect outgoing call then hang it up.

I heard that P900 doesn't have full support for ETel, then is it possible to do this, If not how can I detect an outgoing call then process this object?

thank u

copyright 2003-2009 NewLC SARL