Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

Would anyone provide a simple example for setting a CallListener struct and using it with ICALLMGR_Originate?
My code crashes in the simulator if CallListener is set.

Here is the code I have tried:

common code

ISHELL_CreateInstance(pMe->pIShell, AEECLSID_CALLMGR, (void**)(&pMe->pICallMgr))
if(NULL == pMe->pICallMgr)
return EFAILED;

AEETOriginateOpt coo[2];
MEMSET(coo, 0, sizeof(coo));
coo[0].nId = AEET_ORIGOPT_CLIR_INFO;// suppress caller information restriction
coo[0].pVal = (void *) AEET_CLIR_SUPPRESSION;
coo[1].nId = AEET_ORIGOPT_END;
if(AEE_SUCCESS != ICALLMGR_AddOrigOpt(pMe->pICallMgr, coo))
return EFAILED;

Try #1 (ICALLMGR_Originate Succeeds but I can't setup a callback for call event changes)

ret = ICALLMGR_Originate(
pMe->pICallMgr,
AEET_CALL_TYPE_VOICE, (const char *) pBuffer,
NULL,
&pMe->pICall,
0);
if (AEE_SUCCESS != ret)
{
// call origination request rejected
DBGPRINTF("ICALLMGR_Originate failed with error 0x%08X", ret);
}
else
{
// call origination request accepted
DBGPRINTF("ICALLMGR_Originate succeeded");
}

<-- 2009/5/20 15:43 Pac-- REMOVED OTHER UNNECESSARY DETAILS -->

-J_Tom_Moon_79

btw, I have seen this post http://brewforums.qualcomm.com/showthread.php?t=16727&highlight=ICALLMGR_Originate but it didn't adequately answer the question.

The correct code was easy:
CallListener * pcl = (CallListener *) MALLOC(sizeof(CallListener));
MEMSET(pcl, 0, sizeof(CallListener));
pcl->pfnListener = &VoiceCall_Listener;
// TODO: set the callListener callback
ret = ICALLMGR_Originate(
pMe->pICallMgr,
AEET_CALL_TYPE_VOICE,
(const char *) pEvent->pBuffer,
NULL, &pMe->pICall,
pcl);
if (AEE_SUCCESS != ret)
{
DBGPRINTF("ICALLMGR_Originate ret 0x%08X",ret);
}
else
{
DBGPRINTF("ICALLMGR_Originate accepted");
}
...
void VoiceCall_Listener(void * pUserData, ModelEvent * pEvent)
{
DBGPRINTF("@0x%08X, @0x%08X", pUserData, pEvent);
return;

I can see the function VoiceCall_Listener print the parameter information.
-J_Tom_Moon_79

The correct code was easy:
CallListener * pcl = (CallListener *) MALLOC(sizeof(CallListener));
MEMSET(pcl, 0, sizeof(CallListener));
pcl->pfnListener = &VoiceCall_Listener;
// TODO: set the callListener callback
ret = ICALLMGR_Originate(
pMe->pICallMgr,
AEET_CALL_TYPE_VOICE,
(const char *) pEvent->pBuffer,
NULL, &pMe->pICall,
pcl);
if (AEE_SUCCESS != ret)
{
DBGPRINTF("ICALLMGR_Originate ret 0x%08X",ret);
}
else
{
DBGPRINTF("ICALLMGR_Originate accepted");
}
...
void VoiceCall_Listener(void * pUserData, ModelEvent * pEvent)
{
DBGPRINTF("@0x%08X, @0x%08X", pUserData, pEvent);
return;

I can see the function VoiceCall_Listener print the parameter information.
-J_Tom_Moon_79