Have changed the kamctl from
if [ $? -eq 0 ] ; then
minfo "user '$1' already exists"
exit 1
fi
to
if [ $? -ne 0 ] ; then
minfo "user '$1' already exists"
exit 1
fi
Now I can add user successfully.
Seems it's a bug in the script in kamailio 3.0.2
Thanks,
Kevin
> Date: Thu, 10 Jun 2010 16:48:13 +0200
> From: klaus.mailinglists@pernau.at
> To: kevin.jzh@hotmail.com
> Subject: Re: [SR-Users] Fail to add user account
>
> I have no idea.
>
> Try supplying a domain too:
>
> kamctl add user@yourdomain.com passwd
>
> regards
> klaus
>
> Am 10.06.2010 16:32, schrieb JinKevin:
> > Thanks Klaus,
> >
> > After change the LAST_LINE in the kamctlrc, the tail error is going, but
> > it still says user "xxxx" already exists.
> >
> > # tail tool
> > LAST_LINE="tail -1"
> >
> > I find the script below returns "false" which makes the kamctl exit.
> >
> > # params: user
> > # output: false if exists, true otherwise
> > is_user() {
> > set_user $1
> > QUERY="select count(*) from $SUB_TABLE where \
> > $SUBSCRIBER_COLUMN='$OSERUSER' and $REALM_COLUMN='$OSERDOMAIN';"
> > CNT=`$DBROCMD "$QUERY" "$DBRAWPARAMS" | $EGREP -v ERROR | $LAST_LINE`
> > mdbg "is_user: user counter=$CNT"
> > if [ "$CNT" = "0" ] ; then
> > false
> > else
> > true
> > fi
> > }
> >
> >
> > What could be the cause?
> >
> > Thanks,
> > Kevin
> >
> >
> > > Date: Thu, 10 Jun 2010 10:11:18 +0200
> > > From: klaus.mailinglists@pernau.at
> > > To: kevin.jzh@hotmail.com
> > > CC: sr-users@lists.sip-router.org
> > > Subject: Re: [SR-Users] Fail to add user account
> > >
> > >
> > >
> > > Am 10.06.2010 03:12, schrieb JinKevin:
> > > > AppSer01:root@/usr/local/kamailio-3.0/sbin$ kamctl add 2000 2000
> > > > usage: tail [+/-[n][lbc][f]] [file]
> > > > tail [+/-[n][l][r|f]] [file]
> > > > INFO: user '2000' already exists
> > >
> > >
> > > between your kamctl command and the error message (user '2000' already
> > > exists) is an error produced by the tail command.
> > >
> > > Looks like kamctl uses tail in a way which is not supported on your OS.
> > >
> > > regards
> > > klaus
> >
> > ------------------------------------------------------------------------
> > 更多热辣资讯尽在新版MSN首页! 立刻访问! <http://cn.msn.com/>
聊天+搜索+邮箱 想要轻松出游,手机MSN帮你搞定! 立刻下载!