# Disconecting GPRS by operator to take payment

**URL:** <https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957>\
**Category:** Open AT\
**Created:** [February 19, 2009, 10:31am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957 "2009-02-19T10:31:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpasinski](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@mpasinski](https://forum.sierrawireless.com/u/mpasinski)\
**Post date:** [February 19, 2009, 10:31am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/1 "2009-02-19T10:31:46Z")

</div>

Hi all,  
I have another from tricky question series.  
My Fastrack is connected to remote server through GPRS as a TCP socket client. Session is established by WIP library and is always active.  
From time to time (depends on GSM operator) GPRS session is deactivated to charge for GPRS.  
I couldn’t catch any network event that session is disconnected in such a situation. Is it possible?  
Thanks for replay.

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [February 19, 2009, 11:03am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/2 "2009-02-19T11:03:04Z")

</div>

> [@mpasinski](#):
>
> GPRS session is deactivated

What, exactly, do you mean by that

> [@](#):
>
> to charge for GPRS.

Don’t see why that should have anything to do with it!

> [@](#):
>
> I couldn’t catch any network event that session is disconnected in such a situation. Is it possible?

Quite possibly not - but see [viewtopic.php?f=16&t=3167&p=11799&hilit=be+designed+specifically+cope+with+such+conditions#p11799](http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?f=16&t=3167&p=11799&hilit=be+designed+specifically+cope+with+such+conditions#p11799)

Maybe you could implement a periodic “keep-alive” signal to stop the operator closing the session…?

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [February 21, 2009, 2:13am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/3 "2009-02-21T02:13:41Z")

</div>

Hiya,

You can’t catch the GPRS disconnect from within WIP - but if you subscribe to the ADL GPRS events, you can be notified on the REGISTER and UNREGISTER events.

Have a look at adl\_gprsSubscribe() and the associated ADL\_GPRS\_EVENT\_ME\_UNREG and ADL\_GPRS\_EVENT\_ME\_ATTACH events.

Works for me.

ciao, Dave

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [February 21, 2009, 9:26am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/4 "2009-02-21T09:26:34Z")

</div>

> [@davidc](#):
>
> You can’t catch the GPRS disconnect from within WIP - but if you subscribe to the ADL GPRS events, you can be notified on the REGISTER and UNREGISTER events.

Shouldn’t WIP be monitoring these itself?

Shouldn’t it give a WIP\_BERR\_IP\_DISCONNECTED or whatever to indicate that the Bearer has failed?

> [@](#):
>
> Have a look at adl\_gprsSubscribe() and the associated ADL\_GPRS\_EVENT\_ME\_UNREG and ADL\_GPRS\_EVENT\_ME\_ATTACH events.

So how should one react to those events?

eg, Should ADL\_GPRS\_EVENT\_ME\_UNREG be taken as equivalent to WIP\_BERR\_IP\_DISCONNECTED (or whatever) - so you take your normal recovery action for that WIP event…?

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [February 22, 2009, 12:56am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/5 "2009-02-22T00:56:42Z")

</div>

Hiya,

> [@awneil](#):
>
> Shouldn’t WIP be monitoring these itself?Shouldn’t it give a WIP\_BERR\_IP\_DISCONNECTED or whatever to indicate that the Bearer has failed?

In my opinion, yes - most certainly. However, in my experience, it doesn’t. See the tail of [viewtopic.php?f=16&t=2947#p10813](http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?f=16&t=2947#p10813) thread for a discussion on this effect.

> [@awneil](#):
>
> So how should one react to those events?eg, Should ADL\_GPRS\_EVENT\_ME\_UNREG be taken as equivalent to WIP\_BERR\_IP\_DISCONNECTED (or whatever) - so you take your normal recovery action for that WIP event…?

I do the following:  
For a ADL\_GPRS\_EVENT\_ME\_UNREG, I call wip\_bearerStop() to close the connection cleanly (release memory etc).  
For a ASL\_GPRS\_EVENT\_ME\_ATTACH, I attempt to re-establish the connection (wip\_netInit(), wip\_bearerOpen(), wip\_bearerSetOpts()).

Note that I return ADL\_GPRS\_FORWARD as the return code for the event handler - this ensures that the events are proagated to other parts of the OS that are registered to recieve the events…

ciao, Dave

---

<div class="post-metadata">

**Author:** ![mpasinski](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@mpasinski](https://forum.sierrawireless.com/u/mpasinski)\
**Post date:** [February 24, 2009, 11:53am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/6 "2009-02-24T11:53:49Z")

</div>

Is it a good idea to use WIP library and GPRS subscription at the same time? Does it not lead to any errors or unpredictable behaviour? Is terminal working stable?  
And one more thing. What exactly is happening with WIP library when GPRS session is interrupted by CSD connection. I have noticed that no events related to GPRS WIP are happening.  
I have noticed that without detaching GPRS, when CSD call is connected, I can’t send and receive nothing through GPRS. It is normal behaviour. After call ends, GPRS session is re-established. Is in this situation GPRS connection frozen? I have noticed that if call is longer than 5 minutes, GPRS WIP error occures WIP\_CERR\_TIMEOUT. It means that GPRS is some how active. Is this behaviour defined and described somewhere?

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [February 25, 2009, 3:24am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/7 "2009-02-25T03:24:17Z")

</div>

Hiya,

> [@mpasinski](#):
>
> Is it a good idea to use WIP library and GPRS subscription at the same time?

I wouldn’t have thought so - but the WIP library (in my experience) currently cannot deal with the Network being disconnected - thus my use of the ADL GPRS events. Note that I am not doing any control of the GPRS flow using the ADL GPRS fuctions - only catching the Register/unregister events then calling WIP library routines to do the disconnect/cleanup etc.

I suspect that closing the GPRS connection using the ADL GPRS functions when the connection was opened using WIP is probably a recipe for disaster!

> [@mpasinski](#):
>
> I have noticed that without detaching GPRS, when CSD call is connected, I can’t send and receive nothing through GPRS. It is normal behaviour.

Yes. The Wavecom modem (and many other phones) cannot do concurrent GPRS and CSD connections. I have seen this mentioned in the documentation and elsewhere on the forum. Don’t know why - may be a limitation of the GSM network?

ciao, Dave

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [February 25, 2009, 7:51am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/8 "2009-02-25T07:51:39Z")

</div>

> [@davidc](#):
>
> the WIP library (in my experience) currently cannot deal with the Network being disconnected

I wonder if this is actually WIP trying to be “helpful” i[/i]?

That is, WIP is hoping that the connection will recover (maybe it has its own internal recovery mechanisms) - so it doesn’t (initially) notify the application ❓

IF this is the case, it is extremely bad that it is not clearly documented. 😠

It would also bad if there was no way for the application to control or configure it. 😠

WIP’s handling of GPRS failure cases does seem to be particularly poor - eg, see also: [viewtopic.php?f=16&t=2733](http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?f=16&t=2733)😠

---

<div class="post-metadata">

**Author:** ![mpasinski](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@mpasinski](https://forum.sierrawireless.com/u/mpasinski)\
**Post date:** [February 25, 2009, 10:18am UTC](https://forum.sierrawireless.com/t/disconecting-gprs-by-operator-to-take-payment/2957/9 "2009-02-25T10:18:30Z")

</div>

> [@davidc](#):
>
> > [@mpasinski](#):
> >
> > I have noticed that without detaching GPRS, when CSD call is connected, I can’t send and receive nothing through GPRS. It is normal behaviour.
> 
> Yes. The Wavecom modem (and many other phones) cannot do concurrent GPRS and CSD connections. I have seen this mentioned in the documentation and elsewhere on the forum. Don’t know why - may be a limitation of the GSM network?

I know that it works like that. Excluding the fact that it is not the best solution to have class A modems (theoretically both GSM and GPRS are abled to work at the same time) and don’t support software alowing that.  
I am only wondering if you have experience about that. I have continuous TCP/IP session open wit socket server. WIP library is taking care of the connection on modems site. I have also subscription to CSD data calls. Without disconnecting GPRS session WIP library is friezing it (GPRS) during CSD call. I have not receiving any events related to this. After call ends GPRS is reestablished. Is this behaviour documented somewhere?  
What exactly is happening with GPRS session?  
What is more thanks davidc for advice with handling “rare” GPRS events. I will try this. Maybe the problem with WIP library is, that when GPRS sesion is disconnected or connected by external “thing” (e.g. network, ADL) WIP library don’t receive any events and don’t know nothing about it. I thing that I have read something like that but I am not sure.

Cheers, Marcin
