Native call barring with BREW | developer.brewmp.com Native call barring with BREW | developer.brewmp.com

Developer

Native call barring with BREW

Forums:

Can v develop an App in BREW 3.x which restricts native calls when a user dials a number?

This app is known as "fixed dialing" and is present in many GSM mobile phones. When a user activates this function he can make calls only to the numbers enlisted in the fixed dialing list.

What i intend to do is that whenever a user tries to make a call the BREW app which may probably run in background, and catches the event thrown by pressing the "Dial" button. It should then check whether the number being called is there in the app list or not. If yes it makes the call, else restricts it.

You can probably use AEETCallEventData by setting up a mask for AEET_NMASK_VOICE_CALL. The AEETCallEventData will give you the phone number and other details of the call. for Details refer to the BREW API Reference.
In GSM phone, Fixed dialling is usually programmed on the SIM card. Similar things exist for CDMA while using R-UIM cards.

You can probably use AEETCallEventData by setting up a mask for AEET_NMASK_VOICE_CALL. The AEETCallEventData will give you the phone number and other details of the call. for Details refer to the BREW API Reference.
In GSM phone, Fixed dialling is usually programmed on the SIM card. Similar things exist for CDMA while using R-UIM cards.

Hi,
please can any one help me on this, we need to restrict making calls except to a group of contacts, are there any APIs to do so :confused:

Hi,
please can any one help me on this, we need to restrict making calls except to a group of contacts, are there any APIs to do so :confused:

You would probably need a device that supports ICallMgr (which most likely means the OEM dialer is implemented in BREW), and you would need to integrate with the OEM's dialer application. I don't believe there are many devices that meet these criteria, and establishing a relationship with the OEM/carrier is something you would have to pursue on your own.

You would probably need a device that supports ICallMgr (which most likely means the OEM dialer is implemented in BREW), and you would need to integrate with the OEM's dialer application. I don't believe there are many devices that meet these criteria, and establishing a relationship with the OEM/carrier is something you would have to pursue on your own.

Hi,
thanks for the info.

Hi,
thanks for the info.

I am able to restrict call from OEM dialer based on its phone number....but there's a problem when already a call is in progress an we try to reject a second incoming call, the call which was in progress also gets killed in effect all the calls are getting killed...
Also is there any way to enumerate calls present in the phone...
Any help in this regard'l be of great help coz im working on very tight deadline :-)
Cheers,
-Srinivas.

I am able to restrict call from OEM dialer based on its phone number....but there's a problem when already a call is in progress an we try to reject a second incoming call, the call which was in progress also gets killed in effect all the calls are getting killed...
Also is there any way to enumerate calls present in the phone...
Any help in this regard'l be of great help coz im working on very tight deadline :-)
Cheers,
-Srinivas.

You might want to try following steps to get your desired call among all active calls:
- Create ITelephone using ISHELL_CreateInstance
- Use ITELEPHONE_GetCalls to get Call Descriptors for active calls (this will give you array of Call Descriptors of all active calls)
- Create ICallMgr using ISHELL_CreateInstance
- use ICALLMGR_GetCall to get ICall (Note: pass the Call Descriptor you got from step 2. You need to pass descriptor of your desired call. use ICall_GetInfo to get call information)
- Finally you can use perticular ICall to end the call

You might want to try following steps to get your desired call among all active calls:
- Create ITelephone using ISHELL_CreateInstance
- Use ITELEPHONE_GetCalls to get Call Descriptors for active calls (this will give you array of Call Descriptors of all active calls)
- Create ICallMgr using ISHELL_CreateInstance
- use ICALLMGR_GetCall to get ICall (Note: pass the Call Descriptor you got from step 2. You need to pass descriptor of your desired call. use ICall_GetInfo to get call information)
- Finally you can use perticular ICall to end the call

hi Malay,
thnks for ur reply...we are doing these steps, thts how we're able to block the call first time...but our problem now is....suppose the phone is in conversation with another phone and now it gets a call from a restricted phone number....we do the steps you had mentioned...whts happening is the first call which is supposed to be on hold also gets killed along with the new call...
Also AEETCalls structure which is populated using the
ITELEPHONE_GetCalls(pMe->pITelephone, &tc, (sizeof(tc) + sizeof(AEETCalls)));
holds the call descriptor AEECallDesc calls[1]; ...we can only access the 0th location anytime...
how am i supposed to maybe hold the current call and kill the second and then resume the first one...im a bit confused about it...any help will be of great importance to me :-)
Cheers,
Srinivas

hi Malay,
thnks for ur reply...we are doing these steps, thts how we're able to block the call first time...but our problem now is....suppose the phone is in conversation with another phone and now it gets a call from a restricted phone number....we do the steps you had mentioned...whts happening is the first call which is supposed to be on hold also gets killed along with the new call...
Also AEETCalls structure which is populated using the
ITELEPHONE_GetCalls(pMe->pITelephone, &tc, (sizeof(tc) + sizeof(AEETCalls)));
holds the call descriptor AEECallDesc calls[1]; ...we can only access the 0th location anytime...
how am i supposed to maybe hold the current call and kill the second and then resume the first one...im a bit confused about it...any help will be of great importance to me :-)
Cheers,
Srinivas

Not sure why you are getting only 0th call descriptor!!! Look into following code and you should be able to understand.
Here I defined AEETCalls inside my pMe structure.
AEETCalls *pCalls;
Following is code for getting max 6 active Calls. You can set it your way though.
// Get ITelephone
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_TELEPHONE, (void **)&pMe->pITelephone);
if(checkSuccess(nErr))
{
// Getting call descriptors of all active calls
// maximum 6 simmultanious calls allowed
pMe->pCalls = (AEETCalls *)MALLOC(sizeof(AEECallDesc)*6 + sizeof(uint32));
nErr = ITELEPHONE_GetCalls(pMe->pITelephone, pMe->pCalls, sizeof(AEECallDesc)*6 + sizeof(uint32));
if(checkSuccess(nErr))
{
if(pMe->pCalls->dwCount) // more than zero calls active
{
// Get call manager
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_CALLMGR, (void **)&pMe->pICallMgr);
if(checkSuccess(nErr))
{
// NOTE: For the first call only. you can loop through all calls though
nErr = ICALLMGR_GetCall(pMe->pICallMgr, pMe->pCalls->calls[0], &pMe->pICall);
if(checkSuccess(nErr))
{
// Get call information
MEMSET(&pMe->sTCallInfo, 0, sizeof(pMe->sTCallInfo));
nErr = ICALL_GetInfo(pMe->pICall, &pMe->sTCallInfo, sizeof(pMe->sTCallInfo));
if (checkSuccess(nErr))
{
if(pMe->sTCallInfo.call_state == AEET_CALL_STATE_INCOM) // call is in incoming state
{
// End the incoming call
nErr = ICALL_End(pMe->pICall);
}
else if(pMe->sTCallInfo.call_state == AEET_CALL_STATE_CONV) // call is in conversation state
{
// Hold the conversation call
nErr = ICALL_Hold(pMe->pICall);
}
}
}
}
}
}
// Release call info structure
if(pMe->pICall)
ICALL_Release(pMe->pICall);
// Release call descriptors
if(pMe->pCalls)
FREE(pMe->pCalls);
// Release call manager
if(pMe->pICallMgr)
ICALLMGR_Release(pMe->pICallMgr);
// Release ITelephone
if(pMe->pITelephone)
ITELEPHONE_Release(pMe->pITelephone);
}
My code here just look into first call but I put a comment where you can loop through all other active calls also.

Not sure why you are getting only 0th call descriptor!!! Look into following code and you should be able to understand.
Here I defined AEETCalls inside my pMe structure.
AEETCalls *pCalls;
Following is code for getting max 6 active Calls. You can set it your way though.
// Get ITelephone
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_TELEPHONE, (void **)&pMe->pITelephone);
if(checkSuccess(nErr))
{
// Getting call descriptors of all active calls
// maximum 6 simmultanious calls allowed
pMe->pCalls = (AEETCalls *)MALLOC(sizeof(AEECallDesc)*6 + sizeof(uint32));
nErr = ITELEPHONE_GetCalls(pMe->pITelephone, pMe->pCalls, sizeof(AEECallDesc)*6 + sizeof(uint32));
if(checkSuccess(nErr))
{
if(pMe->pCalls->dwCount) // more than zero calls active
{
// Get call manager
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_CALLMGR, (void **)&pMe->pICallMgr);
if(checkSuccess(nErr))
{
// NOTE: For the first call only. you can loop through all calls though
nErr = ICALLMGR_GetCall(pMe->pICallMgr, pMe->pCalls->calls[0], &pMe->pICall);
if(checkSuccess(nErr))
{
// Get call information
MEMSET(&pMe->sTCallInfo, 0, sizeof(pMe->sTCallInfo));
nErr = ICALL_GetInfo(pMe->pICall, &pMe->sTCallInfo, sizeof(pMe->sTCallInfo));
if (checkSuccess(nErr))
{
if(pMe->sTCallInfo.call_state == AEET_CALL_STATE_INCOM) // call is in incoming state
{
// End the incoming call
nErr = ICALL_End(pMe->pICall);
}
else if(pMe->sTCallInfo.call_state == AEET_CALL_STATE_CONV) // call is in conversation state
{
// Hold the conversation call
nErr = ICALL_Hold(pMe->pICall);
}
}
}
}
}
}
// Release call info structure
if(pMe->pICall)
ICALL_Release(pMe->pICall);
// Release call descriptors
if(pMe->pCalls)
FREE(pMe->pCalls);
// Release call manager
if(pMe->pICallMgr)
ICALLMGR_Release(pMe->pICallMgr);
// Release ITelephone
if(pMe->pITelephone)
ITELEPHONE_Release(pMe->pITelephone);
}
My code here just look into first call but I put a comment where you can loop through all other active calls also.

Hi Malay,
thnks for ur reply...from the code snippet u sent me i had missed the MALLOC for AEETCalls part...i added to my code...but even then when i try to access the 1st member of the calls member of AEETCalls to get the second call which is in WAIT state, like
nErr = ICALLMGR_GetCall(pMe->pICallMgr, pMe->pCalls->calls[1], &pMe->pICall);
...it crashes for me when i access pMe->pICall 'coz its NULL :-(
however when i do
ITELEPHONE_GetMaxCallDescriptors( pMe->pITelephone, pdwCount );
i get pdwCount as 1 all the time...i m testing on Moto Razr V3c on TATA network in Bangalore, India...so does it mean i can only handle 1 call...but when i do another call...the phone shows Call Waiting
Any suggestions wud be of great help...
Cheers,
Srinivas

Hi Malay,
thnks for ur reply...from the code snippet u sent me i had missed the MALLOC for AEETCalls part...i added to my code...but even then when i try to access the 1st member of the calls member of AEETCalls to get the second call which is in WAIT state, like
nErr = ICALLMGR_GetCall(pMe->pICallMgr, pMe->pCalls->calls[1], &pMe->pICall);
...it crashes for me when i access pMe->pICall 'coz its NULL :-(
however when i do
ITELEPHONE_GetMaxCallDescriptors( pMe->pITelephone, pdwCount );
i get pdwCount as 1 all the time...i m testing on Moto Razr V3c on TATA network in Bangalore, India...so does it mean i can only handle 1 call...but when i do another call...the phone shows Call Waiting
Any suggestions wud be of great help...
Cheers,
Srinivas

You are true. On V3C you will only get one call descriptor at a time, which is current active call on the phone. If you get call in between conversation then call descriptor will be of the call which just came. Although, ending that call will end both calls.
Work-around can be as follows:
Facts:
- when call2 comes while call1 is in conversation, you will only get AEET_EVENT_CALL_CALLER_ID event and call2 will be in "call waiting" state on the screen.
Solution:
- let user to accept / reject the call2
- if user rejects the call2 then no problem
- if user accepts the call2,
-- AEET_EVENT_CALL_OPS event will occur
-- on that event, get call descriptor using following code snippet in your EVT_NOTIFY
AEETCallEventData * pTCallEventData = (AEETCallEventData *)&(pTNotifyInfo->event_data);
ICALLMGR_GetCall(pMe->pICallMgr, pTCallEventData->cd, &pMe->pICall);
-- end the call
- this will end both calls
- but call1 on the other party will not get disconnected and user will get call1 again
I tested this on V3C/Verizon and should work on your carrier also.

You are true. On V3C you will only get one call descriptor at a time, which is current active call on the phone. If you get call in between conversation then call descriptor will be of the call which just came. Although, ending that call will end both calls.
Work-around can be as follows:
Facts:
- when call2 comes while call1 is in conversation, you will only get AEET_EVENT_CALL_CALLER_ID event and call2 will be in "call waiting" state on the screen.
Solution:
- let user to accept / reject the call2
- if user rejects the call2 then no problem
- if user accepts the call2,
-- AEET_EVENT_CALL_OPS event will occur
-- on that event, get call descriptor using following code snippet in your EVT_NOTIFY
AEETCallEventData * pTCallEventData = (AEETCallEventData *)&(pTNotifyInfo->event_data);
ICALLMGR_GetCall(pMe->pICallMgr, pTCallEventData->cd, &pMe->pICall);
-- end the call
- this will end both calls
- but call1 on the other party will not get disconnected and user will get call1 again
I tested this on V3C/Verizon and should work on your carrier also.

Hi Malay,
Thanks a lot for the work around...guess i need to do more "out of the box" thinking...i checked on the Razr today and got it...have to still check on other devices....again thanks a lot for the solution mate...
Cheers,
D.Srinivas

Hi Malay,
Thanks a lot for the work around...guess i need to do more "out of the box" thinking...i checked on the Razr today and got it...have to still check on other devices....again thanks a lot for the solution mate...
Cheers,
D.Srinivas