I am working on a project involving GPRS. In particular I use u-blox Lisa-U200 GPRS/GSM chip. Ran into a problem with the PDP contexts when I started testing it out with different carriers. And after spending days on Google I don't seem to find the answer anywhere.
Why do some phones/devices require APN Authentication (PAP/CHAP/None) and some don't? Or as I have titled the question - how do mobile devices (smartphones) detect APN Authentication method automatically? Or do they at all?
The way I test it is this - Linux box, running pppd with a chat script. The chat script defines the context (AT+CGDCONT=1,"IP", and so on) and starts the connection.
The symptoms - if I don't specify the authentication method in the PDP context explicitly it does not even activate (or LCP negotiation fails in the ppp). From the little I understand about GPRS networks this makes sense - I suppose because the gateway node refuses the context if it does not indicate there will be authentication to follow.
Tested with few operators and here comes the most weird part - some of the operators I tested work ONLY if I set it to either PAP or CHAP (and provide correct username and password). And some work whatever I specify (NOAUTH, wrong user/password, etc).
The ideas I have come up with so far are:
1) Provide option to the user to select authentication type. (Not the approach I am fond of because I prefer the user to enter as little as possible.)
2) If the user has set a username/password for the APN - set the auth method to CHAP (I have noticed most operators support both CHAP and PAP). If not - use None as method. (Sounds reasonable?)
3) Brute force - set to CHAP, activate - watch for error; if failed - set to PAP and activate, etc... (Can't say I am too happy about it)
Please excuse me if I answer a very dumb and common question with a well known answer in the mobile industry or if I am completely off track in my logic here, but I am a software developer and that just doesn't make any sense to me :)
Thanks to anyone who shares some experience and knowledge on the topic!