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");
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.
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.
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Â…
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?
Forum posts: 982
You can use this
#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
Forum posts: 32
For UIQ the code from pirosl wont work.
BR
Arne
Forum posts: 982
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
Forum posts: 11
#include <QPhoneAppExternalInterface.h>
TVwsViewId id(KUidPhoneApp, KUidPhoneAppView);
TNumDnlPhone dnl;
dnl.iNumber = aNumber;
TNumDnlPhoneBuf dnlBuf(dnl);
CEikAppUi* appUi = iEikonEnv->EikAppUi();
appUi->ActivateViewL(id, KUidNumDnlPhone, dnlBuf);
Forum posts: 176
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Â…
{
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
}
Example:
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Â…
//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);
Darin Dishneau
www.dishneau.com/symbian
Forum posts: 11
Forum posts: 92
-=< Thamasoma Jyothirgamaya >=--
Forum posts: 982
Can you please let me know which is the .TSY module on UIQ?
Thanks
pirosl
Forum posts: 67
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