Yate Community Forum

Yate server => Other Yate server issues => Topic started by: bnaetsch on February 02, 2016, 07:51:31 AM

Title: Routing calls beginning wiht +
Post by: bnaetsch on February 02, 2016, 07:51:31 AM
Hi

I want to route some calls, beginning with +4935121324 to an other context than the other calls.
Therefore I wrote this entrys in regexroute.conf

[contexts]

 ^+4935121324\(.*\)=megacalltest
.*=inbound

But every call, which comes in, uses the default route to context inbound.
I don't understand why.

I have tryed

this
 ^\+\4935121324\(.*\)=megacalltest
.*=inbound

and

^\(+\)4935121324\(.*\)=megacalltest
.*=inbound

and

^\(+\)4935121324$.*=megacalltest
.*=inbound

The contexts inbound and megacalltest are existing.

Thanks for any advice

Kind Regards
Burkhard
Title: Re: Routing calls beginning wiht +
Post by: marian on February 03, 2016, 01:41:56 AM
Context classify is made using the calling party number.
If you want to do that using called party number use parameter match:
${called}^+4935121324=some_context

Remember: regexroute don't handle call.preroute if caller party number is empty.
Set prerouteall=yes in 'general' section if you want to handle empty calling party numbers.
Title: Re: Routing calls beginning wiht +
Post by: bnaetsch on February 05, 2016, 04:05:32 AM
Thank you for your advice, the change of the context works now.

I have a general question

The yate server must work as a proxy, like this

Yate get calls from different servers without registration but with authentication.
Yate has to register on another PBX

The call from the different servers comes in and will routed to the PBX where yate has registered itself.

So I made 2 accounts in accfile.conf
One account for the incomming calls without registration

[megactestin]
enabled=yes
protocol=sip
username=megactestin
description=Testaccount for Incomming
authname=megactestin
password=xxxxxxxxxxxx


One account for the registering to the  PBX

[megactestout]
enabled=yes
protocol=sip
username=megactestout
description=Testaccount fuer Outgoing
interval=600
authname=megactestout
password=xxxxxxxxxxxxxx
registrar=213.69.XXX.XXX:5060
outbound=213.69.XXX.XXX:5060

For tests, I use a defined phone number range like this +4935121324241XX
In the past I worked with asterisk, but I think yate is smaller and also more performant
I configured in the file regexroute.conf the following context.

[megacall]
${called}^+4935121324241.*S=echo called is ${called}
${called}^+4935121324241.*$=sip/sip:\0@megactestout


Is this the right way ?

Many Thanks
Title: Re: Routing calls beginning wiht +
Post by: marian on February 05, 2016, 04:18:49 AM
Route calls to PBX using the registered account (it may be challenged for authentication):
^+4935121324241=line/\0;line=megactestout

If you want to remove the prefix:
^+4935121324241\(.*\)$=line/\1;line=megactestout

Note: there is no need to use ${called} when routing in a context: it is the default parameter to check!

The first configured account in accfile defines a client account on sip with no registration performed.
It can be used for outgoing calls needing credentials.
Title: Re: Routing calls beginning wiht +
Post by: bnaetsch on February 09, 2016, 09:18:23 AM
Thank you
It works fine