Dial Plans

Good day,

I am from South Africa and I am struggling to get the dial plan working.

How can I set up the dial plan to call?

example numbers

South Africa code +27

081 111 11111
018 111 1111
021 111 1111
011 111 1111

Kind Regards

If you have only one trunk and you don’t need to implement any restrictions, you could just set match pattern to “.” (without the quotes) and leave the other fields blank. That will match any number, so anything that is not an extension or a feature code will be sent to the trunk.

However, most systems do use patterns to match specific groups of numbers. For example, you want to block expensive international destinations, or want to treat emergency calls specially. If you have more than one trunk, you may route different destinations to each, for lowest cost or best quality. In a large organization, it’s common to allow only management personnel to call expensive countries.

The article at


states that all landline and mobile numbers are 10 digits (including the initial 0), but you show a mobile number with 11 digits. Which is correct?

Also, be sure to handle short codes properly such as 107 or 112 for emergencies. Do you have a list of such codes?

https://www.westerncape.gov.za/service/calling-help-emergency#:~:text=Currently%2C%20there’s%20no%20single%20emergency,requires%20an%20ambulance%2C%20dial%2010177.

Hi, Stewart1,

I have changed the dial pattern to “.” without the quotes and now when I try and call out, I get the number you have dialled does not exist or has not been allocated. any ideas on how to fix this?

Kind Regards
Darryl

This is not a FreePBX message, so it probably came from the trunking provider. Check that you are sending the destination number and caller ID in the format they require. They might want 0181111111, 27181111111, or +27181111111. If incoming is working, look at the format they send you.

If no luck, post details of your trunk configuration. Mask username, password and number, but use sample values so it is clear what they represent.

Here is the config,

I just tried the different ways to call out no luck.

host=sip.afrihost.com
username=0111111111
fromuser=0111111111
secret=************
type=peer
contex=from-trunk
trustrpid=yes
sendrpid=yes
qualify=yes
nat=yes
directmedia=no
insecure=port,invite
disallow=all
allow=ulaw

At the Asterisk command prompt, type
sip set debug on
Make a failing test call, paste the Asterisk log for the call at pastebin.freepbx.org and post the link here.

here is the link

https://pastebin.freepbx.org/view/b2e55879

Hello @FosterIT,

Your default sip channel is PJSIP and not SIP. So, your default sip port is 5060 PJSIP. You configured a SIP trunk that is listening to port 5160 SIP. Your provider is sending back messages to port 5060 which you did not configure a PJSIP trunk for it.
You can delete your SIP trunk and create a PJSIP trunk instead to solve your problem.

Thank you,

Daniel Friedman
Trixton LTD.

Although I agree that using pjsip is the best approach for a new system, I disagree with @danielf 's analysis. It appears that you have correctly moved chan_sip Bind Port to 5060 (and have moved pjsip Port to Listen On elsewhere or disabled it), so I don’t see any reason why chan_sip shouldn’t work. IMO you should put a little effort into finding the problem with chan_sip, before switching everything to pjsip.

Is the 08726 number you are sending in the From header correct for your account?

Afrihost rejected the call without requesting authentication. Do you know whether this is normal (they don’t authenticate once you have registered ok, or you are using IP auth)?

Your config shows sendrpid=yes but that header was not sent. Do you know whether this is required?

Have you been able to successfully make an outgoing call using a softphone or other device directly (without FreePBX)? If so, the settings you used may tell us what is wrong.

Do incoming calls work correctly? If so, please paste the Asterisk log for such a call (including sip debug). Most providers will accept the same formats on outgoing that they send on incoming.

Or, do you have documentation from the provider that shows the required formats?

HI @Stewart1 @danielf

Thank you for the help I got it working I can now call out.

Thank you for your help.

I change the trunk settings to the following and then it worked.

username=44564564564
fromuser=44564564564
secret=*************
host=sip.afrihost.com
fromdomain=sip.afrihost.com
type=friend
context=from-trunk
insecure=port,invite
trustrpid=yes
sendrpid=yes
directmedia=no
qualify=yes
keepalive=45
nat=yes
dtmfmode=rfc2833
disallow=all
allow=ulaw&alaw

Kind Regards
Darryl

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.