Author Topic: yate as small pbx: context routing questions  (Read 7595 times)

fheynert

  • Newbie
  • *
  • Posts: 3
    • View Profile
yate as small pbx: context routing questions
« on: October 04, 2017, 06:14:19 AM »
Hi All,

Im watching the YATE Project since a while now. Right now I have my first litte use case.

I am building a small PBX for home use and may have some help guiding me.

I want to stick with regexroute.conf,accfile.conf and regfile.conf

As far as I understood a context in regexroute is just a section with route objectives/permissions wich can be chained together to form calling permissions. Great

So based on the calling number in [context] I can set permission.

Code: [Select]
${sip_user-agent}^.*scanner.*$=BLACKHOLE
${sip_user-agent}^friendly-scanner$=BLACKHOLE
${sip_user-agent}^.*sipcli.*$=BLACKHOLE
${sip_user-agent}^.*pplsip.*$=BLACKHOLE


[default]
; some stuff here

[BLACKHOLE]
^.*$=echo context:$context ${type} ${username} ${sip_to} called is ${called}:${calledname} from                  ${callername}:${caller}
.*=-;error=forbidden;reason=BLACKHOLE[BLACKHOLE]

This Works Great..
according to the guide http://docs.yate.ro/wiki/Call.route#Parameters the 'context' is a parameter
according to the regfile.conf docu I can set/modify any call.route parameter to a user

so

Code: [Select]
[100]
password=100
context=INTERN

IMHO should set the required conntext for a call comming in from this user
but this does not work


Im a using Yate 5.0.0 1 r5675

Could somebody help me with this?

best regards



marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: yate as small pbx: context routing questions
« Reply #1 on: October 05, 2017, 01:11:39 AM »
An incoming call has 3 stages of processing:
1. Pre-route. This may be used to handle the call origin, adjust parameters ... The [contexts] section in regexroute.conf handles the call.preroute message. The pre-route stage stopes when a context is returned.
2. Route. This is used to return an internal target and additional parameters used to make the outgoing call. The [default] section or sections matching 'context' returned in pre-route are used by regexroute module to return (or not) a target. Route stops when a target or error is returned
3. Execute. Execute the call to specified target

The regfile module is a routing module. When call.route is handled and called party number indicates a registered user the module will return its location (target). Routing process stops. No other module will handle call.route.
If you want to handle the call.route in regexroute just lower its call.route priority (see the 'route' parameter in [priorities] section. This will make regexroute to handle the call.route message before regfile module.

An alternative is to install a call.execute message handler in regexroute:
[extra]
call.execute=30

[call.execute]
${context}^INTERNAL$= ............ Call was routed by regfile
${context}^BLACKHOLE$= .............. Call was routed by regexroute

fheynert

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: yate as small pbx: context routing questions
« Reply #2 on: October 05, 2017, 08:44:44 AM »
Thank you Very much for your explanaition...

The flexibility of yate is great, but certanly raises questions :-)

Quote
The regfile module is a routing module. When call.route is handled and called party number indicates a registered user the module will return its location (target). Routing process stops. No other module will handle call.route.
If you want to handle the call.route in regexroute just lower its call.route priority (see the 'route' parameter in [priorities] section. This will make regexroute to handle the call.route message before regfile module.

I guess I understood the Prioritiy
95  regexroute.conf
100 regfile.conf

So first look for the destination in Regexroute ( Do whatever with the called number, eg. Number to [Number|Name] Translation.  eg ^200$=return;called=100 )  In this case Returns means, Exchange called number and continue Searching regexroute.conf from this point down. If no match found in regexroute continue searching regfile.conf

So what would be the preferd way to have dialing permissions ?
e.g. Phone in Kitchen, and a Phone in the public space are only allowed to dial INTERNAL and Emergency Targets?
Office Phones are allowed to reach all Targets, etc.

But I will give the section [extra]a try...