Brekeke Forum Index » Brekeke SIP Server Forum

Post new topic   Reply to topic
Simple Dial Plan for Incoming Calls
Author Message
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Mon Aug 11, 2014 7:41 am    Post subject: Simple Dial Plan for Incoming Calls Reply with quote

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 Patterns
$request = INVITE
To = 12223334444@xxx.xxx.xxx.xxx
Deploy Patterns
$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
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Mon Aug 11, 2014 11:16 pm    Post subject: Reply with quote

> 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?
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Tue Aug 12, 2014 11:11 am    Post subject: Reply with quote

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 Patterns
$request = ^INVITE
$geturi(To) = 12223334444@
$geturi(From) = @xxx.xxx.xxx.xxx

Deploy Patterns
$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
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Tue Aug 12, 2014 2:56 pm    Post subject: Reply with quote

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 .
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Tue Aug 12, 2014 3:34 pm    Post subject: Reply with quote

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
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Tue Aug 12, 2014 3:44 pm    Post subject: Reply with quote

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
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Tue Aug 12, 2014 5:17 pm    Post subject: Reply with quote

> 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.
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Tue Aug 12, 2014 5:22 pm    Post subject: Reply with quote

> 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
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Wed Aug 13, 2014 8:06 am    Post subject: Reply with quote

For outbound, I have:

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

Deploy Patterns
$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
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Wed Aug 13, 2014 2:05 pm    Post subject: Reply with quote

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-make-Failover-in-the-Dial-Plan

I recommend that you use the 2nd Deploy Patterns.
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Thu Aug 14, 2014 4:52 am    Post subject: Reply with quote

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
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Thu Aug 14, 2014 10:19 am    Post subject: Reply with quote

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.
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Thu Aug 14, 2014 10:38 am    Post subject: Reply with quote

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
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Thu Aug 14, 2014 11:45 am    Post subject: Reply with quote

I might answer your questions if I can Smile so let you post.
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Thu Aug 14, 2014 12:42 pm    Post subject: Reply with quote

Thanks. But I will read more. Wink
_________________
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Sat Aug 16, 2014 10:05 am    Post subject: Reply with quote

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
Back to top
View user's profile
tuti
Brekeke Junior Member


Joined: 25 Jan 2012
Posts: 5
Location: lAGOS

PostPosted: Tue Nov 25, 2014 5:52 am    Post subject: Reply with quote

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.
Back to top
View user's profile
seeshy
Brekeke Newbie


Joined: 30 Mar 2015
Posts: 1
Location: Quiftviat

PostPosted: Tue Mar 31, 2015 1:31 am    Post subject: Simple Dial Pl Reply with quote

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....
Back to top
View user's profile Send e-mail
james
Brekeke Master Guru


Joined: 10 Dec 2007
Posts: 494

PostPosted: Tue Mar 31, 2015 9:25 am    Post subject: Reply with quote

Is the callee registered in the SIP Server?
Let you check the SIP Server's Error Logs page.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Brekeke Forum Index » Brekeke SIP Server Forum All times are GMT - 7 Hours
Page 1 of 1