UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > Specific Vintage Equipment > Vintage Telephony and Telecomms

Notices

Vintage Telephony and Telecomms Vintage Telephones, Telephony and Telecomms Equipment

Reply
 
Thread Tools
Old 25th Mar 2019, 12:58 pm   #1
boombox
Pentode
 
Join Date: Mar 2012
Location: Rotherham, South Yorkshire, UK.
Posts: 137
Default Using a slide Switch 2A to switch between POTS and FreePBX

Hello - at the moment I've got a master socket and all extensions fed off the extension wiring at the back of the master socket half plate.

I'm working up to configuring FreePBX (running on a Pi) to handle all my PSTN calls.

What I was wondering about is whether it would be possible to plumb in a physical switch to allow a fallback to the wiring which existed before my SPA3000 and Asterisk got involved? And whether this could be done with one switch 2A or whether it would require two?

Anyone done something like this?

(I am aware that in the event of a powercut the SPA3000 will connect the FXS to the FXO)
boombox is offline   Reply With Quote
Old 25th Mar 2019, 3:06 pm   #2
merlinmaxwell
Dekatron
 
merlinmaxwell's Avatar
 
Join Date: Jul 2008
Location: Maidenhead, Berkshire, UK.
Posts: 8,398
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

As it is at most three wires a simple 3 pole two way will ensure full disconnection/connection of the relevant service. It will only be handling a small amount of power so (almost) anything will do.
__________________
Cats have staff, it's dogs that have owners.
merlinmaxwell is online now   Reply With Quote
Old 25th Mar 2019, 3:21 pm   #3
boombox
Pentode
 
Join Date: Mar 2012
Location: Rotherham, South Yorkshire, UK.
Posts: 137
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Well the thing is, I already have 2 x 2A switches sat ready! I'm just wondering about the wiring itself. I'll draw it up and try to visualise where I'd need to insert the switches.
boombox is offline   Reply With Quote
Old 25th Mar 2019, 9:44 pm   #4
OscarFoxtrot
Heptode
 
OscarFoxtrot's Avatar
 
Join Date: Apr 2011
Location: Edinburgh, UK.
Posts: 673
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Switch 2A is a double pole changeover.

Line to the middle terminals, SPA to one end pair, socket to the other end pair.

I think when the switch is 'up' the 'bottom' terminals are connected, and v.v. but I can't be sure.
OscarFoxtrot is offline   Reply With Quote
Old 26th Mar 2019, 8:07 pm   #5
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Hi Boombox, how far have you got with RASPBX?
I've had mine running for about six years and only had one major crash, which gave me the opportunity to rebuild it from scratch using Asterisk v13, as there didn't seem to be an easy upgrade track.

I would consider doing a minimal boot from SD card and running everything else from spinning rust.
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 27th Mar 2019, 10:45 am   #6
boombox
Pentode
 
Join Date: Mar 2012
Location: Rotherham, South Yorkshire, UK.
Posts: 137
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Hi Rambo - I'm having a spot of bother with my ATA and Freepbx. Not sure where the problem is. At one point it was working so long as my dialplan on the ATA was

(x.<:@gw0>)

then it was suggested I change that to

(999<:@gw0>|x.|*x.)

and then it was suggested I change that to

(999S0|1[1-3]x|1[45]xx|08001111|0845464x|0[58]00xxxxxx|01[2-9][02-9]xxxxxx|0[1-9]xxxxxxxxx|[2-9]xxxxx|00xxxxxxxx.)

and then it was suggested I change that to:

(999<:@gw0>S0|112<:@gw0>S0|1[1-3]x|1[45]xx|08001111|0845464x|0[58]00xxxxxx|01[2-9][02-9]xxxxxx|0[1-9]xxxxxxxxx|[2-9]xxxxx|00xxxxxxxx.|*x.)

At some point even the basic functionality with the first dialplan stopped working because now whenever I dial a number on my test handset plugged into the FXS port I hear very faintly a load of DTMF tones being rattled off and then after a pause I either get a BT announcement saying "sorry, there is a fault" or I get just a beepy fault code. I think the beepy fault code (technical term) and the "sorry there is a fault" are both generated from the PSTN because they are recognisable and the voice is the recent BT lady voice.

I could really use a hand if you're good with this sort of thing, Rambo, and have the time...? I'm getting help from the FreePBX community forum but because they're on a different time zone, I take a step forward on one evening and then have to wait 24 hours to take another step forward. When in reality it's probably easily(?!) solvable in one sitting.

Thanks for your interest, anyway!!

P.S. I should mention I've been fiddling with the proxy and port settings latterly, the guides all show completely differing recommendations for what the SIP port should be and whether after the proxy IP you should add a port as well, e.g. 192.168.1.120:5160 or just 192.168.1.120.
At one point I found that the only way I could hear anything on the test phone was if I added the port to the registration proxy.
boombox is offline   Reply With Quote
Old 28th Mar 2019, 1:00 am   #7
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

OK. I am also using the same set up with RASPBX, SPA3000 (and a PAP-2).
You want Asterisk to do all the heavy lifting, not the ATA, so use my dialplan

(*xx.|#xx.|xx.)

which does precisely nothing other than transparently pass everything to Asterisk including strings commencing with * or #

The best thing I can do is to attach my config (zipped HTML file) There is nothing particularly confidential in it.

Believe it or not, it is possible to restore my config file to your ATA, but it would be more instructive if you inspected the various tabs and adapted it for your system.

A couple of things come to mind.
On the PSTN tab, under PSTN-To-VoIP Gateway Setup make sure you have the option "Off Hook While Calling VoIP", some very early firmware didn't have it and it's important.

Also I recommend you call the Asterisk trunk "1-pstn" as I have, I once tried to change it and got some odd effects.

On the same tab the phone number in "dial plan 2" must match the outbound caller ID in trunk 1-pstn in RASPBX

(also see how dialplan 2 is selected as default further down the page
PSTN Caller Default DP:2 )

Finaly here are the peer details of the 1-pstn trunk

username=1-pstn
type=friend
secret=XXXXXX
qualify=yes
port=5061
nat=never
incominglimit=1
host=dynamic
dtmfmode=rfc2833
disallow=all
context=from-trunk
canreinvite=no
allow=ulaw


Other than that it's just inbound and outbound routes to set up.

See how you get on.
Attached Files
File Type: zip Sipura SPA Configuration2.zip (15.6 KB, 16 views)
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 28th Mar 2019, 10:20 pm   #8
boombox
Pentode
 
Join Date: Mar 2012
Location: Rotherham, South Yorkshire, UK.
Posts: 137
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

arrhghghgh I composed an epic grateful reply detailing the changes I'd made and those I hadn't, asking a few questions and the forum went and lost it for me. Wanted me to login again before I could post it. When I logged in it said it couldn't submit the post as I'd logged in since writing it. Well, yes, umm....

When I summon the will to type it all out again and research again the settings I was mentioning, I will.

For now: thank you.
boombox is offline   Reply With Quote
Old 28th Mar 2019, 11:17 pm   #9
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Quote:
Originally Posted by boombox View Post
arrhghghgh I composed an epic grateful reply detailing the changes I'd made and those I hadn't, asking a few questions and the forum went and lost it for me. Wanted me to login again before I could post it. When I logged in it said it couldn't submit the post as I'd logged in since writing it. Well, yes, umm....

When I summon the will to type it all out again and research again the settings I was mentioning, I will.

For now: thank you.
Stick with me B-B and you're welcome to copy any feature on my system.

eg.

Make calls from your mobile phone at VoIP rates (Because you trigger a callback from your system then make an onward call).

or

Have fun with those pesky telemarketers by sending the blacklisted numbers to your own "It's Lenny", or an interactive recording stack of your own making.
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 29th Mar 2019, 12:18 pm   #10
boombox
Pentode
 
Join Date: Mar 2012
Location: Rotherham, South Yorkshire, UK.
Posts: 137
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Thanks again Rambo. So I had a productive evening last night. It would have been even more productive if my four year old son hadn't kept waking up and interrupting progress!

So basically....

Line 1:
I changed my NAT mapping setting, the network jitter level and buffer adjustment, register expires, make/ans call without reg, use auth ID, auto pstn fallback. I didn't change the SIP port.
PSTN: I changed my NAT mapping setting, I didn't change the SIP port, I did change the make/ans call without reg, did rename user/auth ID to 1-pstn, changed VoIP default DP, turned off detect voip long silence, PSTN silence changed to medium.
Disconnect tone and port impedance left as they were. Current limiting turned off. Think I increased PSTN to SPA gain to match.

I was curious as to why our disconnect tones and port impedances differed.

I cautiously tried, once I got your setup working, to put in place "my" dialplan of:
(999<:@gw0>S0|112<:@gw0>S0|1[1-3]x|1[45]xx|08001111|0845464x|0[58]00xxxxxx|01[2-9][02-9]xxxxxx|0[1-9]xxxxxxxxx|[2-9]xxxxx|00xxxxxxxx.|*x.)
and sure enough - with all your settings it worked! The reason I did this was to make dialling out quicker. If I'm not mistaken it eliminates the delay between dialling and Asterisk deciding I'm finished dialling.

I did have to leave my proxy IP address with a :port after it and I had to leave my SIP ports set at different values, I guess either we're on different versions of FreePBX/Asterisk or you're using the older port settings? I also found I couldn't use auth-id on the PSTN tab, presumably beacuse it didn't match the FreePBX settings.

But it's brilliant! It's really great! It's been about a week of faffing with this most days and just by quickly alt-tabbing between your settings and mine everything's working!

New challenges:

-I'd like to get my Cnet trunk working and I'd like to get my Sipgate trunk working. At the moment something's going wrong with Sipgate, it just says "timed out" in the Asterisk CLI. As if a port is blocked on my router. I've made sure SIP ALG is turned off. I haven't done any port forwarding though. I didn't think I'd need to do that as I'm not exposing a service on my network to the internet, I'm trying to connect TO a service, aren't I?

I'd also like to find a way to present callers with an IVR after a certain point in the evening but I'm sure I can google for that.

Would be interested to hear what other fun things you do with your setup!
boombox is offline   Reply With Quote
Old 29th Mar 2019, 3:15 pm   #11
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Lots I could comment about there but I'll restrict this post to the one critical item I see it.

SIP ports.

The line 1 settings must match up with a CHAN_SIP extension in RASPBX. Mine is 301, the default port is 5060, there is no reason to change it so put 5060 in Line 1.
No doubt you can append it to the IP address with a colon, but why not just put it in the place provided for it?
The PSTN line must match up to a CHAN_SIP trunk in RASPBX again, the default is 5060 but the ATA cannot use the same port twice on the same network interface so its default is 5061, you must therefore change the trunk's port in RASPBX you do that in the peer settings of the trunk as I posted in #7
port=5061

Call the trunk 1-pstn
the incoming user context, user details, and register string can all be left blank.

Just a word on another type of port
In the SIP tab you may have noticed I have restricted the RTP port range to
16384 - 16484
you should similarly restrict the port range in RASPBX

Settings - Asterisk SIP settings RTP port settings.


Next time port forwarding and security...
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 29th Mar 2019, 3:22 pm   #12
boombox
Pentode
 
Join Date: Mar 2012
Location: Rotherham, South Yorkshire, UK.
Posts: 137
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Are you SURE the default SIP port is 5060? I thought it WAS 5060 and is now 5160? Hence me querying whether we have a version of Asterisk mismatch possibly? I might be wrong...

(By the way, in case it's not clear from #10, my setup is now working perfectly!!)
boombox is offline   Reply With Quote
Old 29th Mar 2019, 5:57 pm   #13
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

You can pretty much use whatever ports you like as long as you match them at both ends, that's doubly true if they both lie within your LAN

If the recommended default SIP port has changed I am blissfully unaware.

I use CHAN_PJSIP extensions for my Android phones and I have defined port 5063 for that.

5050/5051 for the two-parts of the SPA3000 and PAP-2
5063 for the Android phones.

Works for me!

Port forwarding is essential in my case, as I need the Android smartphones to register with freepbx from outside my LAN, it also solved problems of calls being cut off generally.
You will be horrified at the bots from various parts of the world swarm onto your system as seen in your router logs!
My solution is three-fold:

Strong extension and trunk secrets.
Install fail2ban on your Pi and assign strict rules.
Don't get paranoid.
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 29th Mar 2019, 6:39 pm   #14
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Quote:
Originally Posted by rambo1152 View Post
I use CHAN_PJSIP extensions for my Android phones and I have defined port 5063 for that.

5050/5051 for the two-parts of the SPA3000 and PAP-2
5063 for the Android phones.
Correction:
5060/5061 for the two-parts of the SPA3000 and PAP-2
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 30th Mar 2019, 11:35 pm   #15
boombox
Pentode
 
Join Date: Mar 2012
Location: Rotherham, South Yorkshire, UK.
Posts: 137
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Hi Graham - quick one - how quickly do your home phones 'ring' when you can hear that they would ordinarily ringing based on the ringing tone feedback you get as the caller? I'm finding that I've got about a five second delay before my phone rings - not the end of the world I guess...but actually seems longer than it sounds!
boombox is offline   Reply With Quote
Old 31st Mar 2019, 1:49 am   #16
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Quote:
Originally Posted by boombox View Post
Hi Graham - quick one - how quickly do your home phones 'ring' when you can hear that they would ordinarily ringing based on the ringing tone feedback you get as the caller? I'm finding that I've got about a five second delay before my phone rings - not the end of the world I guess...but actually seems longer than it sounds!

I wish I knew. I get nearly double that delay from the PSTN, enough for calling party to hear 5-6 rings.
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 31st Mar 2019, 2:23 am   #17
julie_m
Dekatron
 
Join Date: May 2008
Location: Derby, UK.
Posts: 7,306
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

While anybody's talking Asterisk, here's something I had to fix just this morning and seems appropriate to share.

If you get all calls, or all calls in one direction dropping after 32 seconds (billsec=32), check the external_media_address and external_signaling_address (yes, only one L) settings in your /etc/asterisk/pjsip.conf file match your external IP address.

If you get some or most calls dropping after 32 seconds but some carrying on after that point, in both directions, then check your iptables firewall rules are not blocking any UDP ports in the RTP range used by your SIP trunk provider. (The range must end with an odd number, as far as Asterisk is concerned: it always uses two consecutive ports, for the two halves of the call. If you tell Asterisk 10000 - 20000, then it will actually use 10000 - 20001. If your provider doesn't use 20000+20001, set your Asterisk to use 10000 - 19999 instead.)

It's surprising just how many phone calls are actually connected for less than 32 seconds! Which is why it took so long to notice in the first place .....
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments.
julie_m is offline   Reply With Quote
Old 31st Mar 2019, 3:32 am   #18
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Quote:
Originally Posted by julie_m View Post
While anybody's talking Asterisk, here's something I had to fix just this morning and seems appropriate to share.

If you get all calls, or all calls in one direction dropping after 32 seconds (billsec=32), check the external_media_address and external_signaling_address (yes, only one L) settings in your /etc/asterisk/pjsip.conf file match your external IP address.
On our systems that's in pjsip.transports_custom.conf and is managed by the GUI (Yes I know, GUIs are for WIMPs )
It's put my dyndns hostname in both positions.
Quote:
Originally Posted by julie_m View Post
If you get some or most calls dropping after 32 seconds but some carrying on after that point, in both directions, then check your iptables firewall rules are not blocking any UDP ports in the RTP range used by your SIP trunk provider. (The range must end with an odd number, as far as Asterisk is concerned: it always uses two consecutive ports, for the two halves of the call. If you tell Asterisk 10000 - 20000, then it will actually use 10000 - 20001. If your provider doesn't use 20000+20001, set your Asterisk to use 10000 - 19999 instead.)

It's surprising just how many phone calls are actually connected for less than 32 seconds! Which is why it took so long to notice in the first place .....
Yes, I initially thought the system was working fine without forwarding the media ports until my wife informed me her calls were being cut off after 32 seconds (although she couched it in more threatening terms)
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 31st Mar 2019, 4:01 am   #19
rambo1152
Octode
 
rambo1152's Avatar
 
Join Date: May 2010
Location: Manchester, UK.
Posts: 1,355
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

Quote:
Originally Posted by boombox View Post
I'd like to get my Sipgate trunk working. At the moment something's going wrong with Sipgate, it just says "timed out" in the Asterisk CLI. As if a port is blocked on my router. I've made sure SIP ALG is turned off. I haven't done any port forwarding though. I didn't think I'd need to do that as I'm not exposing a service on my network to the internet, I'm trying to connect TO a service, aren't I?
Sipgate is working fine, I have several accounts.
Try it on x-lite on a Windows box, or CSipSimple on an Android device.
Make sure you are using the SIP password, which is different from the one to access the web portal.
Quote:
Originally Posted by boombox View Post
I'd also like to find a way to present callers with an IVR after a certain point in the evening but I'm sure I can google for that.
Easy peasy. Send the call to the "Time Conditions" module then you can send it to two destinations depending if the condition is met or not.
__________________
--
Graham.
G3ZVT
rambo1152 is offline   Reply With Quote
Old 31st Mar 2019, 10:38 am   #20
julie_m
Dekatron
 
Join Date: May 2008
Location: Derby, UK.
Posts: 7,306
Default Re: Using a slide Switch 2A to switch between POTS and FreePBX

If you write your own dialplan, then have a look at GotoIfTime() for implementing different functionality depending on the time of day.
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments.
julie_m is offline   Reply With Quote
Reply

Thread Tools



All times are GMT +1. The time now is 6:26 pm.


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright ©2002 - 2019, Paul Stenning.