Click here to Skip to main content
15,881,882 members
Articles / Mobile Apps / Windows Phone 7

Make Call Blocker Application on Windows mobile

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
7 May 2012CPOL7 min read 32.6K   778   16   4
Black List Application in window mobile (Blocker Application)

Introduction

Most of time we got annoying calls from annoying Pepole in mid night or work time

so what we can do to ignore this case ? we can buy Application from Store to do this ,but wait why you have to buy if you can devlope custom by you

Background

In This Application I will Highlight RIL (Radio interface Layer).

The Radio Interface Layer (RIL) provides an interface that handles the communication between the CellCore system software and the radio hardware. The RIL provides an abstraction layer that enables you to create a single driver that can be implemented on different radios. The RIL abstracts the details of the hardware dependent components of a device to enable OEMs to integrate a variety of modems into their equipment, offering an opportunity for product differentiation. This single driver then allows all of the radios to work under a single set of CellCore components.

RIL Overview

The RIL provides the interface between the system software and the radio stack residing within the modem. The system software includes all elements of the Operating System, Windows Mobile, eg: TAPI / ExTAPI, SIM Manager, SMS Manager, Dialler, etc. and customer / 3rd party applications. The RIL services system requests for radio functions, eg: voice, data, SMS, etc. and provides asynchronous notifications of changes to the system, eg: signal strength, coverage, incoming voice calls, incoming SMS messages. Telephony services within Windows Mobile are defined by the Operating System, each function or service ideally being independent of both the modem and the modem / applications processor interface. The RIL is architectured such that Windows Mobile provides a standard interface, API set and call back mechanisms which can be used across different platforms, with the specific details being hidden from the remainder of the system

Image 1

Platform Implementation

The RIL source code is usually based on the sample RIL provided by Microsoft in the adaptation kit under <platform root folder>\public\cellcore\ril\driver, which provides all the mechanisms required to support a standard AT command based modem. For a non AT command based modem it may be more efficient to redesign the RIL. The sample RIL provides support for Siemens, TI, and TTPCom based modems, hence modifications will be required to adapt the RIL to the selected modem if not based on one of the above. Although most modems conform to the GSM or CDMA specifications most manufacturers implement these specifications in similar but not identical ways, hence, although the AT commands may be the same, the actual behaviour of the commands may differ. For example AT+COPS=0 on some modems block until the modem has registered (or failed to register) on the network, whereas other modems respond immediately and register in the background. The Logo Test Kit assumes a particular modem behaviour, hence, some modems will require RIL modifications to match the expected behaviour. The most common areas that require modification for each modem and/or platform are:

Power Management

The power management of the radio is a combination of modem specific and platform specific methods, eg: the modem may support power saving modes via AT commands and/or the platform may provide hardware power control to the modem. These two methods each have their own issues which need to be addressed in the RIL driver.

Audio Management

The RIL is responsible for adjusting the volume of the voice signals from the modem and selecting which audio device is currently in use. This is normally undertaken using AT commands to adjust the modem settings, however, some platforms may have external audio hardware to make these changes and in these cases the RIL will need to either access the hardware directly or, preferably, to access another device driver.

SMS handling

The sample RIL supports GSM SMS phase 2 mode 2, however, if this is not supported by the modem then the handling of SMS messages requires modification.

SIM toolkit

The SIM toolkit support in the sample RIL is designed around the Condat and TTPCom AT command set. Many modem manufacturers implement their own proprietary AT command extensions for SIM toolkit commands, hence, some work may be required to convert the radio command to what the OS is expecting. This can be quite complex if the modem implements vastly different SIM toolkit functionality as considerable changes to the parsing of the commands will need to be added within the RIL.

Own Number

Many modems do not implement the +CNUM AT command which can cause problems when the OS

attempts to fetch the modem’s own phone number as the phone control panel applet will display ‘unavailable’. To avoid this, the RIL can be modified to obtain the own number from the SIM phonebook by selecting the own number phonebook, however, this is SIM/Network operator dependent, hence, some SIM cards may not include any entries in this phonebook

RIL Modem Interface

The RIL allows hardware abstraction by accepting service requests from the upper layers, mainly TAPI and ExTAPI and converts those requests into commands supported by the modem, exchanging information over a modem / host processor interface. The original modem system design dating back over 3 decades provided a single communications channel over which both AT commands and data was routed, requiring a time consuming switching mechanism between command mode and data mode, essentially allowing only single processes to be active at any time. Advances in networks, ie: 2.5G and 3G, now provide multiple simultaneous services, eg: data connection to browse the web, send / receive email, send / receive SMS messages, originate answer voice calls, poll signal strength, etc. Network advances have outstripped modem interface advances to such a degree that it is necessary to expend effort on maximizing throughput, eg: support for a multiplexer device driver and multiplexer support in the RIL itself. Network advances have necessitated modem architecture evolution such that it is usually necessary to expend effort on the modem interface Some modems provide other interfaces eg: high speed UART’s, USB, shared memory. The same principles apply to high speed UART’s and USB ports, access to the modem is still via a standard device driver, serial or USB, with no specific RIL or MUX related functions. A shared memory

implementation requires considerable changes to the RIL and is outside the scope of this document

 Image 2

Using the Code

before we Start in code i suggest to take view in Radio interface Layer RIL.

This Library its very useful here you can check famous function like :

  • RIL_Dial: This function is responsible for dialing voice and data calls.
  • RIL_GetCellTowerInfo: This function retrieves information about the cell tower currently used by the phone.
  • RIL_GetCurrentOperator:This function retrieves the operator the device is currently registered with.
  • RIL_GetMinimumQualityOfServiceList:This function gets the minimum quality of service profile for all contexts.
  • RIL_AddCallForwarding :This function adds a call forwarding rule.
  • RIL_AddPreferredOperator :This function adds a specified operator to the list of preferred operators.
  • RIL_Answer:This function is implemented by a RIL driver. It is responsible for answering the currently offering call.
  • RIL_CancelSupServiceDataSession :This function cancels the current supplementary service session.
  • RIL_ChangeCallBarringPassword :This function changes the password for the specified type of call barring.
  • RIL_ChangeLockingPassword :This function changes the locking password for the specified facility.
  • RIL_ClearCCBSRegistration :This function clears the registration for a completion of the call to busy subscriber (CCBS) index.
  • RIL_Deinitialize :This function deinitializes RIL. This function is synchronous.
  • RIL_DeleteGPRSContext :This function deletes a particular GPRS context. 
  • RIL_Dial :This function is responsible for dialing voice and data calls.
  • RIL_DisableNotifications :This function disables classes of notifications for a client. This function is synchronous.
  • RIL_EnableNotifications :This function enables additional classes of notifications for a client. This function is synchronous.
  • RIL_EnterGPRSDataMode :This function enters into a GPRS data state.
  • RIL_FetchSimToolkitCmd :This function fetches a SIM Toolkit command from the SIM.
  • RIL_GetAllOperatorsList :This function retrieves the built-in list of all known operators.
  • RIL_GetATR :This function gets the Answer To Reset (ATR) string from the SIM.
  • RIL_GetAudioDevices :This function retrieves the current transmit and receive audio devices.
  • RIL_GetAudioGain :This function retrieves audio gain information.
  • RIL_GetAudioMuting :This function is implemented by a RIL driver. It is responsible for querying the mute status of the radio. 
 For More Function 
C++
HRESULT hRes; 
DWORD dwNotificationClasses = 0xffff0000;  
hRes = RIL_Initialize(1, RILResultCallBack, RILNotifyCallBack, dwNotificationClasses, 0x55AA55AA, &g_hRil); 
{ 
if (g_hRil == NULL) 
	 
RIL_Deinitialize(g_hRil); 
return 0; 
}//

RIL_Initialize : This function initializes RIL for use by a client , and dwNotificationClasses 0xffff0000 to Specifies the classes of notifications in our case we will implement CALL_RING .

C++
case RIL_NCLASS_CALLCTRL:
		{
			 switch (dwCode) {   
				 case RIL_NOTIFY_CALLPROGRESSINFO:
					 {
					
						callInfo = (RILCALLINFO*) pData;
						raAddress = callInfo->raAddress;//Phone Number

					 }break;
				 case RIL_NOTIFY_RING:
					{
						KillCProg();//End Call
					}break; 
            }   
            break;

CallBack Function it's fire when you got Call

RIL_NOTIFY_CALLPROGRESSINFO : it' recived some of caller information like phone number.

RIL_NOTIFY_RING : run when we got notify ring.

C++
// Take a snapshot of all modules in the specified process.
		hProcesses = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 
		if (INVALID_HANDLE_VALUE == hProcesses) { 
		dwError = ::GetLastError(); 
		} 
		pe.dwSize = sizeof(pe); 

		// Retrieve information about the first module,
		  // and exit if unsuccessful	
		for (bVal = ::Process32First(hProcesses, &pe); bVal; bVal = 
		::Process32Next(hProcesses, &pe)) 
		{ 
		if (!_tcscmp(TEXT("cprog.exe"), pe.szExeFile)) 
		{ 
			  hProc = ::OpenProcess(0, FALSE, pe.th32ProcessID); 
			::TerminateProcess(hProc, 0); 
			::CloseHandle(hProc); 
		break; 
		} 
		} 
		::CloseToolhelp32Snapshot(hProcesses);

Now we are going inside Process view to kill cprog.exe

cprog.exe :Phone Application which used to make call or Recived call

hProcesses = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

// Take a snapshot of all modules in the specified process.

C++
::Process32First(hProcesses, &pe);
		// Retrieve information about the first module, and exit if unsuccessful

when we catch cprog.exe if (!_tcscmp(TEXT("cprog.exe"), pe.szExeFile)) ,we can kill it ,& end of Annoying Story.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Jordan Jordan
Mobile Developer with deep Experience in Handheld Device Pocket Pc, Smart Phone in Win32, MFC With more than 8 years ago."Arabizer, Hook Function, Poom, Wirless Application, and low level Application". By C++ MFC and win32

http://windowsmobiledn.blog.com/

Comments and Discussions

 
QuestionOldie but Goldie? Pin
KarstenK17-Dec-14 22:02
mveKarstenK17-Dec-14 22:02 
Questionapplication storage Pin
Member 1040796118-Nov-13 18:41
Member 1040796118-Nov-13 18:41 
QuestionWhoa, hold the phone... Pin
FerretallicA7-May-12 16:57
FerretallicA7-May-12 16:57 
AnswerRe: Whoa, hold the phone... Pin
emranallan7-May-12 19:05
emranallan7-May-12 19:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.