Re: GSM_CancelCall not found
Paulo Roberto <[email protected]>
| Newsgroups | gmane.linux.drivers.gammu |
|---|---|
| Message-ID | <CA+96iqeg7C7FCUcs=NusYpkGgB5LAee4WcG7Lddh21Hnkbijtg@mail.gmail.com> |
Hello, Michal. About the: "Do you pass it same parameters? Most drivers do not support canceling individual calls, just all of them." My modem is one of them. That is why I removed the *if (call->CallIDAvailable)* test and started to cancel all the calls. On Tue, Aug 2, 2016 at 12:06 PM, Michal Čihař <[email protected]> wrote: > Hi > > Dne 30.7.2016 v 21:00 Paulo Roberto napsal(a): > > Hello Guys, > > I do need your help to solve this issue. > > I made some progress since the last e-mail. I fetched the last source > > code of gammu (commit: 70ab47136f12be6478b3892f43b913d2a23a3274), built > > it and test it with my application. > > > > I'm still unable to Cancel the calls but it is a totally different issue. > > The /s->Phone.Functions/ is initialized correctly and it's not /NULL/ > > anymore. And for the phone /Samsung GT-E2220/ the /GSM_CancelCall/ > > registered function is /ATGEN_CancelCall/ > > > > The problem now is a stack overflow. > > My /Incoming Call Callback/ routine, calls /GSM_CancelCall/ and this one > > indirectly call back my /Incoming Call Callback/ routine. A kind of a > > recursive infinite loop. > > The process continues until there is no space left on the stack and the > > OS kills the process. > > > > Inside my callback I do test the condition: /call->Status == > > GSM_CALL_IncomingCall (/Where call is the /GSM_Call/ parameter received) > > but for this situation is useless. > > > > I'm able to avoid this problem by setting a static variable to control > > the condition if it is a reentrant call. But it makes my routine not > > reentrant anymore. > > Besides that, this behavior is different from the Python implementation > > where everything works as expected. > > The Python API hides some ugliness of the C API. On of things it does is > that the callbacks are executed at different point. > > > When the device receives the call, the read message from it is: > > > > "+CLIP: \"099999999999\",129,\"\",,\"Promocoes Vivo\",0\r\nAT+CSQ\r\r" > > > > Below, there is the stack backtrace of my application. I stopped it > > exactly where my callback function calls the GSM_CancelCall for the > > second time. > > > > #0 GSM_CancelCall (s=0x7ffff5e1d010, ID=0, all=1) at > > git/gammu/gammu/libgammu/api.c:913 > Sorry, I've inserted some printf for debug in some points of the code, that is why the difference, I already reset them. (The problem were not affected by then, I made tests without then, before and after the code modification). The commit my tests were made was: 70ab47136f12be6478b3892f43b913d2a23a3274 And the line of this definition is: gammu/libgammu/api.c:909 b356bc7e libgammu/api.c (Michal <C4><8C>iha<C5><99> 2009-06-03 10:00:06 +0000 909) GSM_Error GSM_CancelCall(GSM_StateMachine *s, int ID, gboolean all) cc11f58a common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-17 10:50:38 +0000 910) { 1af702f9 common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-17 13:27:21 +0000 911) GSM_Error err; 97460c11 common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-23 15:31:37 +0000 912) 97460c11 common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-23 15:31:37 +0000 913) CHECK_PHONE_CONNECTION(); 97460c11 common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-23 15:31:37 +0000 914) 1af702f9 common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-17 13:27:21 +0000 915) err = s->Phone.Functions->CancelCall(s, ID, all); 1af702f9 common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-17 13:27:21 +0000 916) PRINT_LOG_ERROR(err); 1af702f9 common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-17 13:27:21 +0000 917) return err; cc11f58a common/api.c (Michal <C4><8C>iha<C5><99> 2007-05-17 10:50:38 +0000 918) } Last changes made by you :) And nothing changes up the last commit: cd9dc14cfe9a6884aa6caa7b752051b80b67c510 > This line is comment in current git, have you modified the file somehow? > > BTW: You can look at similar code in Gammu SMSD, which works: > > https://github.com/gammu/gammu/blob/master/smsd/core.c#L1877 > > My code is not far from that: void incoming_call_callback(GSM_StateMachine *sm, GSM_Call *call, void *user_data) { char phone_number[GSM_MAX_NUMBER_LENGTH + 1], *aux; time_t t; + static int reentrant = 0; + if(!call || reentrant) return; if(call->Status == GSM_CALL_IncomingCall ) { char *payload = NULL; m_message *req_open=NULL; unsigned long gateid=0; t = time(NULL); + reentrant=1; GSM_CancelCall(sm, 0, TRUE); + reentrant=0; .... more goes here ... } The lines starting with a + is my temporarily solution to the problem. Not much elegant. Regards. > -- > Michal Čihař | http://cihar.com/ | https://weblate.org/ > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Gammu-users mailing list - > https://lists.sourceforge.net/lists/listinfo/gammu-users > > ------------------------------------------------------------------------------ _______________________________________________ Gammu-users mailing list - https://lists.sourceforge.net/lists/listinfo/gammu-users