Click here to Skip to main content
Click here to Skip to main content

Make Call Blocker Application on Windows mobile

, 7 May 2012
Rate this:
Please Sign up or sign in to vote.
Black List Application in window mobile (Blocker Application)
This is an old version of the currently published tip/trick.

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

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

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.
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 .

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.

// 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.

::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)

About the Author

emranallan
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

Discussions on this specific version of this article. Add your comments on how to improve this article here. These comments will not be visible on the final published version of this article.
 
SuggestionNot an article PinmemberShahin Khorshidnia7-May-12 6:10 
GeneralRe: Not an article Pinmemberemranallan7-May-12 7:43 
GeneralRe: Not an article PinmemberShahin Khorshidnia7-May-12 7:55 
GeneralRe: Not an article Pinmemberemranallan7-May-12 8:44 
Thanks for Reply ,but i my Article describe the RIL in Details
BTW :i will update my Article RIL to be more details.
 
thank you
windowsmobiledn.blog.com

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

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


Discussions posted for the Published version of this article. Posting a message here will take you to the publicly available article in order to continue your conversation in public.
 
Questionapplication storage PinmemberMember 1040796118-Nov-13 18:41 
QuestionWhoa, hold the phone... PinmemberFerretallicA7-May-12 16:57 
AnswerRe: Whoa, hold the phone... Pinmemberemranallan7-May-12 19:05 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 7 May 2012
Article Copyright 2012 by emranallan
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid