Question:
I know that this wont work so the question is how to trigger the timer to start the count when adl_call_event_answer_OK occour and how to define startTimerHandler ?
You can subscribe to a cyclic timer from the event ADL_CALL_EVENT_ANSWER_OK. A cyclic timer would expire after the specified timeout interval and the timer callback function would automatically be called by the ADL library. You can use a global variable which can be incremented from the timer callback function each time the timer expires.
Hence, using this mechanism you can find out the duration for which the call existed. (I think this is the scenario that you want to achieve).
I added few traces, accept those two in the original post, and the output is the same. Becuse im now realy stuck on this, can you copy - paste my orginal code, test it on your maschine and post edited code back ?
I dont know, but i can not find the error and regarding to number of views on this topic i guess that this thema is interesting to other forum members…
It’s your code on your machine - I have no access to it!
You need to post the code in the first place.
Be sure to post code that actually compiles without errors and warnings;
Be sure to post it by copying from your text file and pasting into the forum.
dear awneil,
the code that im talking about is sended before few posts.
Accept that, time part is set in the voice handler and i correct error with ; signs.
This program is compiled without errors and this is whole program.
I think Marc is using Open AT v4.xx (that’s why the wm_apmCustomStack variable is not declared as it it not required in this version of Open AT).
From the problem that is faced by Marc, I feel that the problem lies in answering to the call. From the code, it can be seen that in the case ADL_CALL_EVENT_RING_VOICE, the call is not answered. Please note that to answer any incoming call, the API adl_callAnswer () should be used.
Hence, the code should look something like:
case ADL_CALL_EVENT_RING_VOICE:
TRACE (( 7, "Ring OK" ));
if (myCount < 5){ adl_atSendResponse ( ADL_AT_UNS, "\r\n - under -\r\n" );myCount=0;}
if (myCount == 5){ /* something */ }
if (myCount > 5){ adl_atSendResponse ( ADL_AT_UNS, "\r\n - over - \r\n" );myCount=0;}
adl_callAnswer();
break;
When the call is hung up, the time for which the call was there could be conviently printed out from the event ADL_CALL_EVENT_HANGUP_OK. The statement:
TRACE((1,“The call was made for %d minutes”,myCount));
can be used to print the duration for which the call was there (in minutes).
It can be noted that if the user wants to hangup the call from withing the Open AT application, the API adl_callHangup () can also be used.
Marc, you can refer to the ADL user guide, for more information as to how to use the APIs and also find out which API suits your requirement.
The version is 4.xx and i using VC++. I did not get any errors. When i place a call i get -under- and answer OK. So i change the < to > to see the difference but its the same. One RING, message, answer OK. It does not matter if its over or under 5 seconds, one RING and answer.
Btw.
How will the ADL_CALL_EVENT_RING_VOICE know when the call is over. I mean, when i get hangup i have to go back into ADL_CALL_EVENT_RING_VOICE handler to read the myCount value, but i can not becuse the call is over so i can not go back into this handler. This could be total wrong thinking or …?
I can not see the:
TRACE((1,“The call was made for %d minutes”,myCount)); in the trace.