[ previous ] [ next ] [ threads ]
 To :  yate@v...
 From :  Thilo Bangert <thilo.bangert@g...>
 Subject :  Re: [yate] yate2
 Date :  Tue, 17 Jan 2012 14:25:16 +0100
On Tuesday, January 17, 2012 10:40:11 AM Monica Tepelus wrote:
> Hi Tonny,
> 
> Do you have a good reason to stick to yate2? There were a lot of
> improvements in yate3, and it has been almost 2 years since yate 3.0.0
> was released.
> Even the configuration files were improved to make them easier to
> understand.

a good reason is that 2.2 is what is packaged for debian... a backport would 
be nice, though.

kind regards
Thilo

> 
> Tonny van der Cammen wrote:
> > Hi Monica,
> > 
> > 
> > 
> > I am still struggling with yate2 reading my extensions from database.
> > 
> > 
> > 
> > I manually added some account in the database, but my clients won't
> > register.
> 
> - from what I see in the configuration file your clients should be able
> to register. Is the postgresql connection up? Connect with telnet and
> give status command. What do you see in the logs?
> 
> > -                    Do I have to run an initquery to read the
> > accounts from the table lines?
> 
> - no, initquery is just used to make sure you don't have extensions
> marked as inuse or cdr entries not finished when starting yate (in case
> something went wrong when yate previously stopped and this info was not
> correctly updated)
> 
> > -                    Second I do not have a table getroute like
> > requested in the query from the call.route section. How can I fix/skip
> > this issue?
> 
> - getroute is a stored procedure in the example. We chose it there to
> imply that you can do more advanced routing like that
> - you can use below query instead when routing to your extensions.
> SELECT location FROM lines WHERE line='{$called}'
> 
> > Below is my register.conf file.
> > 
> >  [root@d57d701b ~]# cat /usr/local/etc/yate/register.conf | more
> > 
> > [general]
> > 
> > ; Global module settings that are read only at first initialization
> > 
> > 
> > 
> > ; expires: int: Will execute the engine.timer query only every that
> > many seconds
> > 
> > expires=60
> > 
> > 
> > 
> > ; stoperror: regexp: disconnect errors for which fallback is disabled
> > 
> > stoperror=busy\|noanswer
> > 
> > 
> > 
> > ; The following parameters enable handling of individual messages
> > 
> > ; Each must be enabled manually in this config file
> > 
> > 
> > 
> > accounts=yes
> > 
> > fallback=yes
> > 
> > 
> > 
> > ; user.auth: bool: Activate handler on the "user.auth" message
> > 
> > user.auth=yes
> > 
> > 
> > 
> > ; user.register: bool: Activate handler on the "user.register" message
> > 
> > user.register=yes
> > 
> > 
> > 
> > ; user.unregister: bool: Activate handler on the "user.unregister"
> > message
> > 
> > user.unregister=yes
> > 
> > 
> > 
> > ; engine.timer: bool: Activate handler on the "engine.timer" message
> > 
> > engine.timer=yes
> > 
> > 
> > 
> > ; call.preroute: bool: Activate handler on the "call.preroute" message
> > 
> > call.preroute=no
> > 
> > 
> > 
> > ; call.route: bool: Activate handler on the "call.route" message
> > 
> > call.route=yes
> > 
> > 
> > 
> > ; call.cdr: bool: Activate handler on the "call.cdr" message
> > 
> > call.cdr=yes
> > 
> > 
> > 
> > ; linetracker: bool: Activate line status tracking on "call.cdr"
> > 
> > ;linetracker=no
> > 
> > 
> > 
> > 
> > 
> > [default]
> > 
> > ; This section holds default settings for each of the following
> > message handlers
> > 
> > ; All these settings can be overriden in individual handler sections
> > 
> > 
> > 
> > ; priority: int: Priority in Yate's handlers chain
> > 
> > priority=10
> > 
> > 
> > 
> > ; account: string: Name of the database connection to use
> > 
> > account=yateadmin
> > 
> > 
> > 
> > ; In each of the following sections you have to specify the following:
> > 
> > ; - initial query to execute when module is initialized
> > 
> > ; - query to execute for each received message
> > 
> > ; - result field to copy in message's textual return value (only for
> > some)
> > 
> > ; You can also override the settings from section [default]
> > 
> > 
> > 
> > ; Sample queries below are for PostgreSQL
> > 
> > ; Timestamps and intervals are unfortunately non-portable
> > 
> > 
> > 
> > 
> > 
> > [accounts]
> > 
> > ; This  section is going to replace accfile
> > 
> > 
> > 
> > ; message sent after receiving an engine.init
> > 
> > initquery=SELECT * from initaccounts() as t(enabled bool,protocol
> > text,username text,description text,interval text,formats t
> > 
> > ext,authname text,password text,server text,gatekeeper text,domain
> > text,registrar text,outbound text,localaddress text,modifi
> > 
> > ed bool, account text,id int4,status text,number text, gw bool)
> > 
> > 
> > 
> > ; message sent after receiving an engine.timer
> > 
> > timerquery=SELECT * from updateaccounts() as t(enabled bool,protocol
> > text,username text,description text,interval text,format
> > 
> > s text,authname text,password text,server text,gatekeeper text,domain
> > text,registrar text,outbound text,localaddress text,mod
> > 
> > ified bool, account text,id int4,status text, number text, gw bool)
> > 
> > 
> > 
> > ; update status after user.notify
> > 
> > 
> > 
> > statusquery=UPDATE accounts SET status='${status}' WHERE
> > account='${internalaccount}'
> > 
> > 
> > 
> > 
> > 
> > [fallback]
> > 
> > ; This section is going to be enabled if fallback is desired
> > 
> > 
> > 
> > 
> > 
> > [user.auth]
> > 
> > ; Query and result name for the user.auth message
> > 
> > 
> > 
> > query=SELECT password FROM lines WHERE line='${username}'
> > 
> > result=password
> > 
> > 
> > 
> > [user.register]
> > 
> > ; Query for the user.register message
> > 
> > 
> > 
> > query=UPDATE lines SET location='${data}',expires=CURRENT_TIMESTAMP +
> > INTERVAL '${expires} s' WHERE line='${username}'
> > 
> > 
> > 
> > [user.unregister]
> > 
> > ; Query for the user.unregister message
> > 
> > 
> > 
> > query=UPDATE lines SET location=NULL,expires=NULL WHERE expires IS NOT
> > NULL AND line='${username}'
> > 
> > 
> > 
> > 
> > 
> > [engine.timer]
> > 
> > ; Query for the timer message that expires registrations
> > 
> > ; Also look at the expires setting in section [general]
> > 
> > 
> > 
> > query=UPDATE lines SET location=NULL,expires=NULL WHERE expires IS NOT
> > NULL AND expires<=CURRENT_TIMESTAMP
> > 
> > 
> > 
> > 
> > 
> > [call.preroute]
> > 
> > ; Query and result name for the prerouting message
> > 
> > 
> > 
> > ;query=
> > 
> > 
> > 
> > [call.route]
> > 
> > ; Query and result name for the routing message
> > 
> > 
> > 
> > ; offlineauto: boolean: Set the "offline" error for queries that
> > return records but no route
> > 
> > ;offlineauto=yes
> > 
> > 
> > 
> > query=SELECT * from getroute('${called}') as t(location text, called
> > text, error text, line text)
> > 
> > result=location
> > 
> > 
> > 
> > 
> > 
> > [call.cdr]
> > 
> > ; Queries for the CDR updating message
> > 
> > 
> > 
> > ; critical: boolean: Reject all registrations and routing if query fails
> > 
> > critical=no
> > 
> > 
> > 
> > initquery=UPDATE cdr SET ended=true WHERE ended IS NULL OR NOT ended
> > 
> > 
> > 
> > cdr_initialize=INSERT INTO cdr VALUES(TIMESTAMP 'EPOCH' + INTERVAL
> > '${time} s', '${chan}', '${address}', '${direction}', '${b
> > 
> > illid}', '${caller}', '${called}', INTERVAL '${duration} s', INTERVAL
> > '${billtime} s', INTERVAL '${ringtime} s', '${status}',
> > 
> >  '${reason}', false)
> > 
> > cdr_update=UPDATE cdr SET address='${address}',
> > direction='${direction}', billid='${billid}', caller='${caller}',
> > called='${c
> > 
> > alled}', duration=INTERVAL '${duration} s', billtime=INTERVAL
> > '${billtime} s', ringtime=INTERVAL '${ringtime} s', status='${s
> > 
> > tatus}', reason='${reason}' WHERE chan='${chan}' AND time=TIMESTAMP
> > 'EPOCH' + INTERVAL '${time} s'
> > 
> > 
> > 
> > cdr_finalize=UPDATE cdr SET address='${address}',
> > direction='${direction}', billid='${billid}', caller='${caller}',
> > called='$
> > 
> > {called}', duration=INTERVAL '${duration} s', billtime=INTERVAL
> > '${billtime} s', ringtime=INTERVAL '${ringtime} s', status='$
> > 
> > {status}', reason='${reason}', ended=true WHERE chan='${chan}' AND
> > time=TIMESTAMP 'EPOCH' + INTERVAL '${time} s'
> > 
> > 
> > 
> > 
> > 
> > [linetracker]
> > 
> > ; Queries for the line usage tracker
> > 
> > 
> > 
> > ; critical: boolean: Reject all registrations and routing if query fails
> > 
> > ;critical=no
> > 
> > 
> > 
> > initquery=UPDATE lines SET inuse=0
> > 
> > 
> > 
> > cdr_initialize=UPDATE lines SET inuse=inuse+1 WHERE line='${external}'
> > 
> > 
> > 
> > cdr_finalize=UPDATE lines SET inuse=(CASE WHEN inuse>0 THEN inuse-1
> > ELSE 0 END) WHERE line='${external}'
> > 
> > [root@d57d701b ~]#
> > 
> > 
> > 
> > 
> > 
> > Thanks in advance
> > 
> > 
> > 
> > Best regards,
> > 
> > 
> > 
> > Tonny van der Cammen, Support Engineer
> > 
> > 
> > 
> > 
> > 
> > Heynen bv  P.O. Box 10  NL-6590 AA  Gennep  t +31 (0)485 55 09 21  f
> > +31 (0)485 55 09 00  www.heynen.com
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > -----Oorspronkelijk bericht-----
> > Van: Monica Tepelus [mailto:monica@v...]
> > Verzonden: vrijdag 13 januari 2012 14:44
> > Aan: Tonny van der Cammen
> > CC: yate@v...
> > Onderwerp: Re: [yate] yate2
> > 
> > 
> > 
> > They are both loaded by default. You can have both of them or just
> > 
> > register.. As long as you move the users to the database it doesn't
> > 
> > matter if the module is loaded or not. It might be clearer for someone
> > 
> > else looking at the system if you unload it.
> > 
> > Tonny van der Cammen wrote:
> > > Hi Monica,
> > > 
> > > 
> > > 
> > > Thanks for your answer.
> > > 
> > > 
> > > 
> > > When I take a look at the loaded modules, I see both modules are
> > > loaded:
> > > 
> > > 
> > > 
> > > Loaded module Registration from file
> > > 
> > > Loaded module Register for database
> > > 
> > > 
> > > 
> > > Do I need to unload the module Registration from File?
> > > 
> > > 
> > > 
> > > In the configuration file: register.conf
> > > 
> > > 
> > > 
> > > There is a part:
> > > 
> > > 
> > > 
> > > ; user.auth: bool: Activate handler on the "user.auth" message
> > > 
> > > user.auth=yes
> > > 
> > > 
> > > 
> > > ; user.register: bool: Activate handler on the "user.register" message
> > > 
> > > user.register=yes
> > > 
> > > 
> > > 
> > > ; user.unregister: bool: Activate handler on the "user.unregister"
> > 
> > message
> > 
> > > user.unregister=yes
> > > 
> > > 
> > > 
> > > and there is also a query :
> > > 
> > > 
> > > 
> > > [user.auth]
> > > 
> > > ; Query and result name for the user.auth message
> > > 
> > > 
> > > 
> > > query=SELECT password FROM lines WHERE line='${username}'
> > > 
> > > result=password
> > > 
> > > 
> > > 
> > > [user.register]
> > > 
> > > ; Query for the user.register message
> > > 
> > > 
> > > 
> > > query=UPDATE lines SET location='${data}',expires=CURRENT_TIMESTAMP +
> > 
> > INTERVAL '${expires} s' WHERE line='${username}'
> > 
> > > [user.unregister]
> > > 
> > > ; Query for the user.unregister message
> > > 
> > > 
> > > 
> > > query=UPDATE lines SET location=NULL,expires=NULL WHERE expires IS
> > 
> > NOT NULL AND line='${username}'
> > 
> > > Is this what it should use, or does this have other purposes.
> > 
> > - yes, this is what you should use and also  [call.route] section and
> > 
> > handler
> > 
> > 
> > 
> > Regards,
> > 
> > Monica Tepelus
> > 
> > > Thanks in advance.
> > > 
> > > 
> > > 
> > > Best regards,
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Tonny van der Cammen, Support Engineer
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Heynen bv  P.O. Box 10  NL-6590 AA  Gennep  t +31 (0)485 55 09 21  f
> > 
> > +31 (0)485 55 09 00  www.heynen.com
> > 
> > > -----Oorspronkelijk bericht-----
> > > 
> > > Van: Monica Tepelus [mailto:monica@v...]
> > > 
> > > Verzonden: vrijdag 13 januari 2012 9:51
> > > 
> > > Aan: Tonny van der Cammen
> > > 
> > > CC: yate@v...
> > > 
> > > Onderwerp: Re: [yate] yate2
> > > 
> > > 
> > > 
> > > Hi
> > > 
> > > Tonny van der Cammen wrote:
> > >> Dear all,
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> Is there a way to have regfile.conf automatically load into the yate2
> > >> 
> > >> engine without restarting yate?
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> I like to have the accounts for my extensions in a database so I can
> > >> 
> > >> add and edit accounts via a gui.
> > > 
> > > You could use register module that reads the accounts from the database
> > > 
> > > directly, and you wouldn't need a reload when accounts are modified.
> > > 
> > > 
> > > 
> > > Regards,
> > > 
> > > Monica Tepelus
> > > 
> > >> I am running Yate2.
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> Thanks in advance.
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> Best regards,
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> Tonny van der Cammen, Support Engineer
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> *Heynen bv  *P.O. Box 10  NL-6590 AA  Gennep  *t* +31 (0)485 55 09 21
> > >> 
> > >>  *f* +31 (0)485 55 09 00  _www.heynen.com _