Simple Dial Plan for Incoming Calls

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Simple Dial Plan for Incoming Calls

Post by JRayfield »

1. Brekeke Product Name and Version:

Brekeke SIP Server 3 (BSS3)

2. Java version:

Not sure

3. OS type and the version:

Windows 7 Pro

4. UA (phone), gateway or other hardware/software involved:

3CX IP PBX Server

5. Your problem:

I have BSS3 connected to my underlying VoIP service provider. This connection is authenticated by IP address. It is not 'registered' with username/password.

I have a 3CX IP PBX connected to BSS3. This connection is registered.

BSS3 is one one network (with a public IP address) and the 3CX IP PBX is on another network (with a different public IP address).

I have an outbound dial plan that works fine, so that I can make outbound calls from the 3CX system through BSS3.

I need to create a dial plan that will route incoming calls, from my underlying VoIP service provider, through BSS3, and into the 3CX IP PBX.

I've tried the following.

The "12223334444" is the DID telephone number (obviously, this is not the 'real' number that I'm using).

The "xxx.xxx.xxx.xxx" is the public IP address of the 3CX IP PBX server.

Matching Pattern:
$request = INVITE
To = 12223334444@xxx.xxx.xxx.xxx

Deploy Pattern:
$rtp = TRUE
To = sip:12223334444@xxx.xxx.xxx.xxx

When I try making a call to the DID telephone number, a packet capture on the BSS3 server doesn't show it ever trying to pass anything on to the 3CX IP PBX server.

What am I doing wrong?

John Rayfield, Jr.
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
janP
Posts: 336
Joined: Sun Nov 25, 2007 2:55 pm

Post by janP »

> To = 12223334444@xxx.xxx.xxx.xxx

Are you sure that the underlying VoIP service provider sends an INVITE with the above SIP-URI format in the To-header??

You said xxx.xxx.xxx.xxx is 3CX's IP address.
If so, the VoIP service provider's INVITE indicates 3CX's IP address in To-header.
Is it correct?
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

I'm slowly learning how to set up these Dial Plans. They aren't what I would call 'easy', but not extremely hard either (if you know what you're doing <G>).

I ended up with this:

Matching Pattern:

$request = ^INVITE
$geturi(To) = 12223334444@
$geturi(From) = @xxx.xxx.xxx.xxx

Deploy Pattern:

$rtp = true
$target = sip:%1@xxx.xxx.xxx.xxx

This requires an incoming INVITE from the underlying carrier to include the proper DID number (the number that the caller has called) and to come from a specific IP address (the IP address of my underlying carrier). It then passes the INVITE on to the 3CX IP PBX that is registered with BSS for use with this DID number.

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
janP
Posts: 336
Joined: Sun Nov 25, 2007 2:55 pm

Post by janP »

If y.y.y.y is the VoIP service provider's IP address, and x.x.x.x is the 3CX's IP address.

Matching Patterns
$addr = ^y.y.y.y$
$request = ^INVITE
To = sip:12223334444@

Deploy Patterns
$rtp = true
To = sip:%1@x.x.x.x

If you use "$geturi(From) = @xxx.xxx.xxx.xxx" for checking whether the caller is the VoIP service provider or not, I recommend you use $addr instead.
http://wiki.brekeke.com/wiki/DialPlan-Matching-addr

This is because someone (such as an attacker) can pretend the VoIP provider if he/she uses the same From-header .
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

Ok.

I understand why using $addr is better, for the sake of security.

Why use "To =" instead of "$geturi(To) ="? I tried both, and both of them work.

I tried using "To =" in the Deploy Pattern, but it wouldn't work. Looking at the SIP messages, the "To" line ends up looking like this:

To = sip:%1@xxx.xxx.xxx.xxx

where xxx.xxx.xxx.xxx is the IP address of the 3CX server.

In other words, the "%1" was not replaced with the telephone number.

Using Target = sip:%1@xxx.xxx.xxx.xxx

works fine.

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

Another question:

addr$ = xxx.xxx.xxx.xxx

works fine.

So, why have:

addr$ = ^xxx.xxx.xxx.xxx$


John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
janP
Posts: 336
Joined: Sun Nov 25, 2007 2:55 pm

Post by janP »

> I understand why using $addr is better, for the sake of security.

Any SIP headers (such as From and To) can be manipulated by sender or middle-entity (such as a router) because SIP content is text-based.
However, generally, source IP address/port information in IP/TCP/UDP header is not manipulated.


> Why use "To =" instead of "$geturi(To) ="? I tried both, and both of them work.

"To=" evaluates entire To-header line.
"$geturi(To)=" evaluates SIP-URI in To-header.
http://wiki.brekeke.com/wiki/DialPlan-Matching-getUri


For example, if INVITE's To-header looks like the following.
To: "Mike" <sip:12223334444@x.x.x.x;user=phone>

"To=" evaluates "Mike" <sip:12223334444@x.x.x.x;user=phone>
"$geturi(To)=" evaluates sip:12223334444@x.x.x.x

Since both strings contain "sip:12223334444@", both definitions work.

I recommend you use "To=" instead of "$geturi(To)=" in the above case to avoid an internal method call.


> I tried using "To =" in the Deploy Pattern, but it wouldn't work.
> Looking at the SIP messages, the "To" line ends up looking like this:

This is because you don't have definition for %1.
Modify the Matching Patterns like the following.
Matching Patterns
$addr = ^y.y.y.y$
$request = ^INVITE
To = sip:(12223334444)@

Enclose 12223334444 with (). If so 12223334444 will be stored into %1.



> Using Target = sip:%1@xxx.xxx.xxx.xxx

This is because $target uses IP address/FQDN part only.
janP
Posts: 336
Joined: Sun Nov 25, 2007 2:55 pm

Post by janP »

> So, why have:
> addr$ = ^xxx.xxx.xxx.xxx$

For example
$addr = 1.2.3.4 will match several IP addresses.
such as 111.2.3.4, 1.2.3.44, 21.2.3.45...

but $addr = ^1.2.3.4$ matches 1.2.3.4 only.

FYI:
https://en.wikipedia.org/wiki/Regular_expression
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

For outbound, I have:

Matching Pattern:

$request = ^INVITE
$addr = ^x.x.x.x$
To = sip:(.+)@

Deploy Pattern:

$rtp = true
$target = y.y.y.y|y.y.y.z

How's this look?

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
janP
Posts: 336
Joined: Sun Nov 25, 2007 2:55 pm

Post by janP »

If y.y.y.y and y.y.y.z are the VoIP service provider's IP addresses, and x.x.x.x is the 3CX's IP address.

Matching Patterns
$request = ^INVITE
$addr = ^x.x.x.x$
To = sip:(.+)@


Deploy Patterns will be one of followings.

Deploy Patterns
To = sip:%1@y.y.y.y
$rtp = true
$target = y.y.y.y, y.y.y.z

-OR-

Deploy Patterns
To = sip:%1@y.y.y.y
$rtp = true
$session = failover sip:%1@y.y.y.z


With $target (1st example), the SIP Server can failover with Inviting Timeout.
http://wiki.brekeke.com/wiki/multiple-target-failover

With $session=failover (2nd example) , the SIP Server can failover with Inviting Timeout, Ringing Timeout or response code.
http://wiki.brekeke.com/wiki/How-to-mak ... -Dial-Plan

I recommend that you use the 2nd Deploy Patterns.
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

I had the Deploy Pattern close to:

$rtp = true
$target = y.y.y.y, y.y.y.z

and that worked without the "To = sip:%1@y.y.y.y".

Why is that line, "To = sip:%1@y.y.y.y", needed, if it worked without it?

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
janP
Posts: 336
Joined: Sun Nov 25, 2007 2:55 pm

Post by janP »

John, it is time to start reading the document.

To = sip:%1@y.y.y.y
The SIP server replaces To-header with "sip:%1@y.y.y.y", and forwards the outgoing packet to y.y.y.y.

$target = y.y.y.y
The SIP server forwards the outgoing packet to y.y.y.y.

If the DeployPatterns has both "To=" and "$target=", the SIP server replaces To-header, and forwards the outgoing packet to the destination what $target defines.
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

I appreciate your help very much, and I have read the docs. Probably not enough. But for someone who is just starting to learn about BSS, some of the docs are not that 'simple' to understand. They could be somewhat better, in my opinion (coming at this from a beginner's standpoint).

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
janP
Posts: 336
Joined: Sun Nov 25, 2007 2:55 pm

Post by janP »

I might answer your questions if I can :) so let you post.
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

Thanks. But I will read more. :wink:
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

I might mention, too, that you've pointed me in a good direction to know what to read in the documentation that will help me to learn more and understand what I'm doing. Thank you VERY much.

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
tuti
Posts: 5
Joined: Wed Jan 25, 2012 2:22 am
Location: lAGOS

Post by tuti »

Hello John,
I think you you are in the position help resolve the issue i have and i will appreciate your kind support.
I need the dial-plan to integrate my Brekeke to Asterisk Freepbx.
Thank you.
seeshy
Posts: 1
Joined: Mon Mar 30, 2015 5:48 pm
Location: Quiftviat

Simple Dial Pl

Post by seeshy »

I can call out but no incoming calls. Callers complained that they can only hear a busy tone or dial tone.

NOTE: All settings are in default values. It is behind a routerconnected to one of the four sockets.

Help please....
james
Posts: 501
Joined: Mon Dec 10, 2007 12:56 pm

Post by james »

Is the callee registered in the SIP Server?
Let you check the SIP Server's Error Logs page.
Post Reply