Re: [Users] Mbuni try to send POST MMS before GPRS connection is established

2010-08-03 Thread Piotr Isajew
On Wed, Aug 04, 2010 at 07:14:52AM +0200, Emmanuel CHANSON wrote:
> Thanks Piotr for this,
> 
> One more questions:
> Where and when do I call "ip-up.sh $1 $2 ..." and then call pppd ? All
> inside custom-settings "gprs-on= option" ?

it's enough if you symlink it to /etc/ppp/ip-up. From pppd manual:

   /etc/ppp/ip-up
  A program or script which is executed when the link is available
  for  sending  and  receiving  IP packets (that is, IPCP has come
  up).  It is executed with the parameters

  interface-name  tty-device  speed   local-IP-address
  remote-IP-address ipparam


> 
> I miss some experience on this
> 
> About:
> *Mbuni uses curl to connect() to proxy. This is issued just after start-gprs
> pid is returned so on "normal" system it uses default
> route, which is not good because of firewalling and most ops using private
> addresses for mmsc's. From what I saw (maybe someone will correct me here)
> mmsbox-mm1 does not set any connection timeouts on CURL and default is to
> wait indefinitly (or at least very long). So handle_mm1 thread blocks here.*
> 
> I understand that if ppp0 connection is not well established before Mbuni
> try to send MMS, Mbuni blocks and becomes unsuable ?

That's mine experience with it. 

> So I really have to make ppp0 connection ready and ip routing to reach MMS-C
> configured, before Mbuni it try to send any MMS right ? or patch
> mmsbox_mm1/curl function to add a timeout ? or fasten my GPRS connection
> process (because 1st try failed and second try successfully connect to GPRS
> always)?
> Is this issue due to my pppd config? the modem I use ? Is it a normal
> behavior ?

That may be due to imperfect chat script. You should check your logs
to find a reason. On the other way it can always happen that you can
temporarily lost connection with MMSC even with perfect configuration
on your side. IMO modifying mmsbox_mm1 is the only way to get rid of
the problem in production environment. I've modified mmsbox_mm1.c to
fix problems with this. I'll send a patch to devel list later.

> I plan to test using Huawei E220 modem maybe it will be better.
> 
> I try tu understand if all mbuni user had same problem when using MM1
> interface through a modem
> 
> BR,
> 
> Emmanuel
> 
> custom-settings = "gprs-on=pppd call mobile-auth;gprs-pid=cat
> > /var/run/ppp0.pid|head -1;port=3130;mmsc-url=
> > http://mms.x.xx/mmsc;proxy=192.168.39.201;msisdn=100";
> > mmsc-library = /usr/local/lib/libmmsbox_mm1.
> 
> 2010/8/4 Piotr Isajew 
> 
> > On Wed, Aug 04, 2010 at 04:01:22AM +0200, Emmanuel CHANSON wrote:
> > > Is it possible to get an example of the if-up/down script that deal with
> > > ppp0.pid symlink so that Mbuni start to send MMS only after the ppp0
> > > connection is established?
> > You may try something like:
> > ip-up.sh:
> > IFNAME="$1"
> > LOCAL_IP="$4"
> > REMOTE_IP="$5"
> > IPPARAM="$6"
> > MMS_PROXY="your mmsc proxy ip"
> > ip route add to $MMS_PROXY dev $IFNAME
> > # routing has been set up, so:
> > ln -sf /var/run/ppp-${IPPARAM}.pid /var/run/ppp-for-mbuni.pid
> >
> > then start pppd with:
> > nodetach
> > linkname mms
> > ipparam mms
> >
> > and watch for it's pid in mbuni with something like:
> > gprs-pid=cat /var/run/ppp-for-mbuni.pid|head -1
> >
> > >
> > > I notice that routing is also missing after the GPRS connection is
> > > established that is why maybe mbuni POST nothing.
> > > I need to set a "route add mmsproxyip@ gw ppp0" in order to reach
> > > MMS-C
> > Yes
> > >
> > > One question about the port parameter:
> > > # Sample conf for MMSBox using a modem (MM1)
> > > group = mmsc
> > > id = modem
> > > type = custom
> > > custom-settings = "gprs-on=pppd call mobile-auth;gprs-pid=cat
> > > /var/run/ppp0.pid|head -1;port=3130;mmsc-url=
> > > http://mms.x.xx/mmsc;proxy=192.168.39.201;msisdn=100";
> > > mmsc-library = /usr/local/lib/libmmsbox_mm1.
> > >
> > > Is it the same to use "port=*3130*" and mmsc-url=http://mmscurl
> > ;pro...@ip:*
> > > 3130* ? in the mmsbox.conf?
> > > In my case I use port=3130 and does not set a ":port" on the proxy
> > parameter
> > > in mmsc-url
> >
> > No. port in settings is for other applications (like kannel) to
> > communicate with mmsbox i.e. to trigger fetch actions. To specify your
> > operator's mmsc port use :port in mmsc url or proxy settings depending
> > on your MMSC settings.
> > >
> > > Regards & thanks for your help
> > >
> > > Emmanuel
> > >
> > > 2010/8/3 Piotr Isajew 
> > >
> > > > On Tue, Aug 03, 2010 at 05:44:30PM +1100, Emmanuel CHANSON wrote:
> > > > > One question:
> > > > >
> > > > > Does Mbuni will open and close GPRS connection each time it will have
> > to
> > > > > send a MMS ? or does it keep the connection always open ?
> > > >
> > > > It opens connection once there is something in queue and keeps it open
> > > > until processing queue is empty. In reality to achieve this you should
> > > > have max-send-threads slightly 

Re: [Users] Mbuni try to send POST MMS before GPRS connection is established

2010-08-03 Thread Piotr Isajew
On Wed, Aug 04, 2010 at 04:01:22AM +0200, Emmanuel CHANSON wrote:
> Is it possible to get an example of the if-up/down script that deal with
> ppp0.pid symlink so that Mbuni start to send MMS only after the ppp0
> connection is established?
You may try something like:
ip-up.sh:
IFNAME="$1"
LOCAL_IP="$4"
REMOTE_IP="$5"
IPPARAM="$6"
MMS_PROXY="your mmsc proxy ip"
ip route add to $MMS_PROXY dev $IFNAME
# routing has been set up, so:
ln -sf /var/run/ppp-${IPPARAM}.pid /var/run/ppp-for-mbuni.pid

then start pppd with:
nodetach 
linkname mms
ipparam mms

and watch for it's pid in mbuni with something like:
gprs-pid=cat /var/run/ppp-for-mbuni.pid|head -1

> 
> I notice that routing is also missing after the GPRS connection is
> established that is why maybe mbuni POST nothing.
> I need to set a "route add mmsproxyip@ gw ppp0" in order to reach
> MMS-C
Yes
> 
> One question about the port parameter:
> # Sample conf for MMSBox using a modem (MM1)
> group = mmsc
> id = modem
> type = custom
> custom-settings = "gprs-on=pppd call mobile-auth;gprs-pid=cat
> /var/run/ppp0.pid|head -1;port=3130;mmsc-url=
> http://mms.x.xx/mmsc;proxy=192.168.39.201;msisdn=100";
> mmsc-library = /usr/local/lib/libmmsbox_mm1.
> 
> Is it the same to use "port=*3130*" and mmsc-url=http://mmscurl;pro...@ip:*
> 3130* ? in the mmsbox.conf?
> In my case I use port=3130 and does not set a ":port" on the proxy parameter
> in mmsc-url

No. port in settings is for other applications (like kannel) to
communicate with mmsbox i.e. to trigger fetch actions. To specify your
operator's mmsc port use :port in mmsc url or proxy settings depending
on your MMSC settings.
> 
> Regards & thanks for your help
> 
> Emmanuel
> 
> 2010/8/3 Piotr Isajew 
> 
> > On Tue, Aug 03, 2010 at 05:44:30PM +1100, Emmanuel CHANSON wrote:
> > > One question:
> > >
> > > Does Mbuni will open and close GPRS connection each time it will have to
> > > send a MMS ? or does it keep the connection always open ?
> >
> > It opens connection once there is something in queue and keeps it open
> > until processing queue is empty. In reality to achieve this you should
> > have max-send-threads slightly higher than amount of modems
> > used. I.e. for one modem you shoud have 2 sending threads. With one
> > thread it will open and close the connection for each message.
> >
> > > Is it a good idea to keep the GPRS connection open in case a lot of MMS
> > have
> > > to be send through modem?
> >
> > If you have lots to send you could write fake start-gprs script that
> > does nothing and start persistent pppd connection outside of
> > mbuni. That could evolve to "inteligent" start-gprs script that starts
> > gprs connection once something appears on queue and stays open for
> > some idle period while "cheating" mbuni for closing connection (mbuni
> > kills pid given in pid file when it does not need gprs connection any more)
> >
> >
> > >
> > > I will check about if-up script.
> > >
> > > Others ideas maybe ? Just to confirm that it is a normal behavior and I
> > > should not use "pppd call gprs"  that lead to this behavior ?
> >
> > depends on your options. To be more specific using 'nodetach' option
> > of pppd works better for me.
> >
> > >
> > > BR,
> > >
> > > Emmanuel
> > >
> > > 2010/8/3 Piotr Isajew 
> > >
> > > > You could also do this with proper if-up script. Mbuni tries to
> > > > connect to MMS proxy when it sees pppd pid file. On other hand pid
> > > > file is created _before_ interface IP and routing is set up. I solved
> > > > this by symlinking ppp pid to some path in if-up after everything is
> > > > set-up and making mbuni to look for a file on that path.
> > > >
> > > > On Tue, Aug 03, 2010 at 03:13:09PM +1100, Emmanuel CHANSON wrote:
> > > > > Hello mbuni users and developers,
> > > > >
> > > > > Mbuni CVS 20100702
> > > > > Modem: Sagem My300x
> > > > >
> > > > > Purpose: Try to send MMS through MM1 GPRS modem but failed.
> > > > >
> > > > > I did not succeed to send a MMS through MM1 GPRS modem connection.
> > > > > When sending a MMS through mmsbox interface I do see the pppd process
> > > > > starting to connect to GPRS but fail the first time then succeed, but
> > > > Mbuni
> > > > > says:
> > > > >
> > > > > WARNING: mmsbox_mm1.c:375  [mmsbox-mm1] [n/a] *failed to
> > > > start
> > > > > GPRS connection. waiting...
> > > > > *
> > > > > Mbuni did not make a retry after the GPRS connection was
> > established.*
> > > > >
> > > > > Find below:
> > > > > *- mmsbox.log
> > > > > - messages file (pppd message)
> > > > > - mmmsbox.conf*
> > > > >
> > > > > Questions:
> > > > > **- Did you ever experiment this situation ?
> > > > > - Do I have to use another process instead of pppd ?
> > > > > - Why Mbuni does not retry to send the MMS stored in pool ?**
> > > > > **- Problem of configuration ? of mbuni or routing issue to contact
> > > > MMS-C**
> > > > > *- I saw an another post where a someone implement a delay (from Ben
> > > > > Hardill):*
> > > > > -

Re: [Users] Mbuni try to send POST MMS before GPRS connection is established

2010-08-03 Thread Piotr Isajew
Mbuni uses curl to connect() to proxy. This is issued just after
start-gprs pid is returned so on "normal" system it uses default
route, which is not good because of firewalling and most ops using
private addresses for mmsc's. From what I saw (maybe someone will
correct me here) mmsbox-mm1 does not set any connection timeouts on
CURL and default is to wait indefinitly (or at least very long). So
handle_mm1 thread blocks here.


On Wed, Aug 04, 2010 at 02:15:46PM +1100, Emmanuel CHANSON wrote:
> I also dont understand why mbuni does not retry to send the MMS stored in
> spool after the ppp0 connection is up ?
> 
> mbuni stay blocked:
> 
> 2010-08-04 13:52:37 [10240] [5] INFO: mmsbox_mm1.c:659 
> [mmsbox-mm1] [n/a] waiting for connection: 0, pid=10263 cpid=10263,
> ifexited=1, exitstatus=0
> 2010-08-04 13:52:37 [10240] [5] WARNING: mmsbox_mm1.c:375 
> [mmsbox-mm1] [n/a] failed to start GPRS connection. waiting...
> 
> Emmanuel
> >> > > > 2010-08-03 14:31:44 [3327] [14] DEBUG: Thread 14
> >> > > > (mms_queue.c:(gwthread_func_t *)tdeliver) maps to pid 3327.
> >> > > >
> >> > > >
> >> > > > MMS send through MMS interface of mmsbox:
> >> > > > # lynx -dump "
> >> > > >
> >> > >
> >> http://localhost:10002/?username=tester&password=foobar&mmsc=modem&to=%2B87773502/TYPE=PLMN&subject=Test&text=MMS-1
> >> > > > "
> >> > > >   Accepted: Mbuni-msg.7610.x1.24.85
> >> > > >
> >> > > > mmsbox.log generated after the MMS:
> >> > > > 
> >> > > > 2010-08-03 14:53:30 [2324] [3] DEBUG: HTTP: Creating HTTPClient for
> >> > > > `127.0.0.1'.
> >> > > > 2010-08-03 14:53:30 [2324] [3] DEBUG: HTTP: Created HTTPClient area
> >> > > > 0xb5700ab0.
> >> > > > 2010-08-03 14:53:30 [2324] [18] DEBUG: WSP: Mapping `text/plain',
> >> WSP 1.2
> >> > > to
> >> > > > 0x0003.
> >> > > > 2010-08-03 14:53:30 [2324] [18] INFO: mmsbox.c:1366
> >> 
> >> > > > [mmsbox] [n/a] MMSBox: Queued message from service [sendmms-user],
> >> > > [transid
> >> > > > [Mbuni-msg.7610.x1.24.85]: q-qf7610.1.x324.69
> >> > > > 2010-08-03 14:53:30 [2324] [18] DEBUG: HTTP: Destroying HTTPClient
> >> area
> >> > > > 0xb5700ab0.
> >> > > > 2010-08-03 14:53:30 [2324] [18] DEBUG: HTTP: Destroying HTTPClient
> >> for
> >> > > > `127.0.0.1'.
> >> > > > 2010-08-03 14:53:30 [2324] [18] INFO: mmsbox.c:1613
> >> > > 
> >> > > > [mmsbox] [n/a] MMSBox.mmssend: u=tester, Queued [Accepted:
> >> > > > Mbuni-msg.7610.x1.24.85]
> >> > > > 2010-08-03 14:53:35 [2324] [7] DEBUG: Queued to thread 0 for
> >> > > > /var/spool/mbuni/mmsbox_outgoing/q/qf7610.1.x324.69,
> >> sendt=1280807610,
> >> > > > tnow=1280807615
> >> > > > arg 0: pppd
> >> > > > arg 1: call
> >> > > > arg 2: mobile-auth
> >> > > > cat: /var/run/ppp0.pid: Aucun fichier ou dossier de ce type
> >> > > > 2010-08-03 14:53:40 [2324] [5] INFO: mmsbox_mm1.c:659 
> >> > > > [mmsbox-mm1] [n/a] waiting for connection: 0, pid=2457 cpid=2457,
> >> > > > ifexited=1, exitstatus=0
> >> > > > 2010-08-03 14:53:40 [2324] [5] WARNING: mmsbox_mm1.c:375
> >> 
> >> > > > [mmsbox-mm1] [n/a] *failed to start GPRS connection. waiting...*
> >> > > >
> >> > > > /var/log/messages:
> >> > > > 
> >> > > > Aug  3 14:53:35 navette kernel: PPP generic driver version 2.4.2
> >> > > > Aug  3 14:53:35 navette pppd[2462]: pppd 2.4.5 started by admin, uid
> >> 0
> >> > > > Aug  3 14:53:36 navette chat[2463]: abort on (BUSY)
> >> > > > Aug  3 14:53:36 navette chat[2463]: abort on (NO CARRIER)
> >> > > > Aug  3 14:53:36 navette chat[2463]: abort on (VOICE)
> >> > > > Aug  3 14:53:36 navette chat[2463]: abort on (NO DIALTONE)
> >> > > > Aug  3 14:53:36 navette chat[2463]: abort on (NO DIAL TONE)
> >> > > > Aug  3 14:53:36 navette chat[2463]: abort on (NO ANSWER)
> >> > > > Aug  3 14:53:36 navette chat[2463]: abort on (DELAYED)
> >> > > > Aug  3 14:53:36 navette chat[2463]: report (CONNECT)
> >> > > > Aug  3 14:53:36 navette chat[2463]: timeout set to 6 seconds
> >> > > > Aug  3 14:53:36 navette chat[2463]: send (ATQ0^M)
> >> > > > Aug  3 14:53:36 navette chat[2463]: expect (OK)
> >> > > > Aug  3 14:53:36 navette chat[2463]: ^M
> >> > > > Aug  3 14:53:36 navette chat[2463]: OK
> >> > > > Aug  3 14:53:36 navette chat[2463]:  -- got it
> >> > > > Aug  3 14:53:36 navette chat[2463]: send (ATZ^M)
> >> > > > Aug  3 14:53:37 navette chat[2463]: timeout set to 3 seconds
> >> > > > Aug  3 14:53:37 navette chat[2463]: expect (OK)
> >> > > > Aug  3 14:53:37 navette chat[2463]: ^M
> >> > > > Aug  3 14:53:37 navette chat[2463]: ^M
> >> > > > Aug  3 14:53:37 navette chat[2463]: OK
> >> > > > Aug  3 14:53:37 navette chat[2463]:  -- got it
> >> > > > Aug  3 14:53:37 navette chat[2463]: send (AT^M)
> >> > > > Aug  3 14:53:37 navette chat[2463]: expect (OK)
> >> > > > Aug  3 14:53:37 navette chat[2463]: ^M
> >> > > > Aug  3 14:53:40 navette chat[2463]: alarm
> >> > > > Aug  3 14:53:40 navette chat[2463]: send (AT^M)
> >> > > > Aug  3 14:53:40 navette chat[2463]: expect (OK)
> >> > > > Aug  3 14:53

Re: [Users] Mbuni try to send POST MMS before GPRS connection is established

2010-08-03 Thread Emmanuel CHANSON
Is it possible to get an example of the if-up/down script that deal with
ppp0.pid symlink so that Mbuni start to send MMS only after the ppp0
connection is established?

I notice that routing is also missing after the GPRS connection is
established that is why maybe mbuni POST nothing.
I need to set a "route add mmsproxyip@ gw ppp0" in order to reach MMS-C

One question about the port parameter:
# Sample conf for MMSBox using a modem (MM1)
group = mmsc
id = modem
type = custom
custom-settings = "gprs-on=pppd call mobile-auth;gprs-pid=cat
/var/run/ppp0.pid|head -1;port=3130;mmsc-url=
http://mms.x.xx/mmsc;proxy=192.168.39.201;msisdn=100";
mmsc-library = /usr/local/lib/libmmsbox_mm1.

Is it the same to use "port=*3130*" and mmsc-url=http://mmscurl;pro...@ip:*
3130* ? in the mmsbox.conf?
In my case I use port=3130 and does not set a ":port" on the proxy parameter
in mmsc-url

Regards & thanks for your help

Emmanuel

2010/8/3 Piotr Isajew 

> On Tue, Aug 03, 2010 at 05:44:30PM +1100, Emmanuel CHANSON wrote:
> > One question:
> >
> > Does Mbuni will open and close GPRS connection each time it will have to
> > send a MMS ? or does it keep the connection always open ?
>
> It opens connection once there is something in queue and keeps it open
> until processing queue is empty. In reality to achieve this you should
> have max-send-threads slightly higher than amount of modems
> used. I.e. for one modem you shoud have 2 sending threads. With one
> thread it will open and close the connection for each message.
>
> > Is it a good idea to keep the GPRS connection open in case a lot of MMS
> have
> > to be send through modem?
>
> If you have lots to send you could write fake start-gprs script that
> does nothing and start persistent pppd connection outside of
> mbuni. That could evolve to "inteligent" start-gprs script that starts
> gprs connection once something appears on queue and stays open for
> some idle period while "cheating" mbuni for closing connection (mbuni
> kills pid given in pid file when it does not need gprs connection any more)
>
>
> >
> > I will check about if-up script.
> >
> > Others ideas maybe ? Just to confirm that it is a normal behavior and I
> > should not use "pppd call gprs"  that lead to this behavior ?
>
> depends on your options. To be more specific using 'nodetach' option
> of pppd works better for me.
>
> >
> > BR,
> >
> > Emmanuel
> >
> > 2010/8/3 Piotr Isajew 
> >
> > > You could also do this with proper if-up script. Mbuni tries to
> > > connect to MMS proxy when it sees pppd pid file. On other hand pid
> > > file is created _before_ interface IP and routing is set up. I solved
> > > this by symlinking ppp pid to some path in if-up after everything is
> > > set-up and making mbuni to look for a file on that path.
> > >
> > > On Tue, Aug 03, 2010 at 03:13:09PM +1100, Emmanuel CHANSON wrote:
> > > > Hello mbuni users and developers,
> > > >
> > > > Mbuni CVS 20100702
> > > > Modem: Sagem My300x
> > > >
> > > > Purpose: Try to send MMS through MM1 GPRS modem but failed.
> > > >
> > > > I did not succeed to send a MMS through MM1 GPRS modem connection.
> > > > When sending a MMS through mmsbox interface I do see the pppd process
> > > > starting to connect to GPRS but fail the first time then succeed, but
> > > Mbuni
> > > > says:
> > > >
> > > > WARNING: mmsbox_mm1.c:375  [mmsbox-mm1] [n/a] *failed to
> > > start
> > > > GPRS connection. waiting...
> > > > *
> > > > Mbuni did not make a retry after the GPRS connection was
> established.*
> > > >
> > > > Find below:
> > > > *- mmsbox.log
> > > > - messages file (pppd message)
> > > > - mmmsbox.conf*
> > > >
> > > > Questions:
> > > > **- Did you ever experiment this situation ?
> > > > - Do I have to use another process instead of pppd ?
> > > > - Why Mbuni does not retry to send the MMS stored in pool ?**
> > > > **- Problem of configuration ? of mbuni or routing issue to contact
> > > MMS-C**
> > > > *- I saw an another post where a someone implement a delay (from Ben
> > > > Hardill):*
> > > > --
> > > > **In order to get it all working I had to add a small delay after
> > > starting
> > > > PPP as Mbuni was trying to send the post before the routing was all
> up
> > > and
> > > > running properly, so I have added the following just after the call
> to
> > > start
> > > > ppp in mmsbox_mm1.c
> > > >
> > > >  if (mm1->gprs_on)
> > > >
> > > >   pid = start_gprs(mm1->gprs_on, mm1->gprs_pid);
> > > >
> > > >   gwthread_sleep(3);   #<--- short pause to allow ppp to
> > > finish
> > > > setting up the connection
> > > >
> > > >  if (pid<  0) {
> > > >
> > > >   mms_warning(0, "mmsbox-mm1", NULL,"failed to start GPRS
> > > > connection. waiting...");*
> > > > *--
> > > > *
> > > > Starting log:
> > > > mmsbox.log:
> > > > ---
> > > > [r...@navette mbuni]# mmsbox /etc/mbuni/mmsbox.conf
> > > > 2010-08-03 14:31:44 [3327] [0] INFO: D