Ok… i figured out !
The modem needs the PIN number to connect to the network, but after you enter it with AT+CPIN=XXXX at the web field, you have to erase it inmediately after the modem logs into the net.
If you do that works perfectly, but its not very confortable for the regular user to do this every single time so i came out with this idea to automatize the process:
First of all you need to know if your APN needs authentification or not. In my case i do, so i need to create create a couple of files to provide that information.
Taking the example of mcumbee, i came to this (step by step):
First of all wake up the ppp0 interface and leave it like this:
Modem connected to : ttyUSB0
APN : web.tmovil.cl
Dial string : *99#
Optional AT string :
Autostart the connection at boot : Yes
Make this interface the Default Route : Yes
Enable NAT on this interface : Yes
Dial String and APN depends of your country and ISP provider. The modem can be connected in ttyUSB1 too, or maybe somewhere else, so i recommend that you type “dmesg | grep modem” once you put it into the USB port.
…then do this:
# cd /var/register/system/net/interfaces/ppp0
# touch USERNAME
# touch PASSWORD
Edit both files with VI and add the user and password of your APN (of course, each one in a different file). In my case, the user and password are the same : “web” (without the quotes)
Now, if we go to the web interface again and put “AT+CPIN=1234”, being 1234 the PIN code of the SIM card (without the quotes) in the “Optional AT string” of the 3G Modem configuration field, the Modem will register in the network. After that we have to reenter to he Modem configuration and erase the AT+CPIN=1234 sentence that we just write and save the changes. The modem will automatically make the hook up and retrieve a public IP from the ISP. It is important that the “Autostart the connection at boot :” is always set to “YES” as its show at the beggining.
As you can see this is a little tricky, so the ideal solution (at least for me) is that ZS can make all the process automatically at boot. In that case, if someone wants to connect a 3G modem to the router, all that he have to do is put the device in the USB port and reboot the machine (unplug the power and plug it back in).
To do this, we have to add the follow commands to the post boot script in the web interface or in the rc.local file inside the /etc folder:
comgt -d /udev/ttyUSB1 PIN
…once again, replace 1234 with the number of you SIM card`s PIN.
After that all that you have to do is reboot your ZS router with the 3G modem attached to the USB port and voila !
If you want to test the procedure from the command shell first you can always make :
# comgt -d /udev/ttyUSB0
comgt will ask you for the PIN code. This is equal to put the AT+CPIN=1234 in the web field.
If you already put the USERNAME and PASSWORD files in their place and you have the “Autostart the connection at boot :” at “YES”, the connection should start almost inmediately. The problem with this method is that you have to manually type the PIN number every time that you want to connect the modem. With “export COMGTPIN=”1234″ ” and “comgt -d /udev/ttyUSB1 PIN”, you edit the COMGTPIN variable before you register the modem to the network, so you don need to type it every time from the console or from the web page.
Hope this can help.