Setup Autopatch

From AllStarLink Wiki
Revision as of 15:38, 28 January 2019 by imported>N8THN (added the content)
Jump to navigation Jump to search


The autopatch feature in app_rpt allows users on the radio to interconnect with the public switched telephone network.

Regulatory Issues

Some countries which disallow third-party traffic do not allow autopatching or telephone interconnection on amateur radio frequencies. In addition, if a system is linked between one country which allows autopatching and one which doesn't, just the passing of the traffic itself across the link could be considered a violation of the rules in the prohibiting country. In countries which permit autopatching, users need be made aware of this and should take the node off-link before using the autopatch.

Security Issues

The examples provided here do not secure the autopatch against toll fraud. A lot can be done to prevent or reduce toll fraud, but the prevention measures vary by where you are located geographically. Most of the prevention measures will be in extensions.conf, as you can write contexts to reject certain number sequences. The asterisk book in the references section should be consulted to see how to do this, Before placing any autopatch in service, please make sure you have secured your system so that toll fraud does not become an issue.

Selecting an ITSP

Call termination into the public switched telephone network is a service offered by an Internet Telephone Service Provider (ITSP). This is a highly competitive business, and there are lots of ITSP's offering termination for Asterisk users. In the reference section is a link to a site which lists several ITSP's. Termination is usually provided using the SIP protocol, and IAX is also offered by a few providers.

When selecting an ITSP, make sure they provide setup instructions with example configurations including usernames, and passwords. Quite a few ITSP's will automatically generate a custom SIP or IAX stanza for insertion into sip.conf, or iax.conf respectively.

Configuration Files

Three configuration files will be affected: rpt.conf, extensions.conf and iax.conf or sip.conf. The ITSP should provide a stanza for you to insert in iax.conf or sip.conf. The flow diagram below shows how each of these files are used when an outgoing autopatch call is made:

In the rpt.conf configuration file, a context in extensions.conf is defined in a node stanza using the context key:

[1234]
.
.
.
context=autopatch      ; Aserisk context in which to place the call
accountcode="MYACCT"   ; optional ACCOUNTCODE for call on Asterisk
callerid="5592557827"  ; optional callerid to send for call
.
.
.

Also in the rpt.conf file, entries are added to the function table so that users can bring up or take down the autopatch:

[functions]
.
.
.
6=autopatchup,noct=1,farenddisconnect=1,dialtime=20000 
0=autopatchdn 
.
.
.

In extensions.conf, a stanza for the autopatch context is added which refers to the peer stanza in iax.conf or sip.conf. For outbound IAX connections extensions.conf

[autopatch] 

exten => _1NXXNXXXXXX,1,Dial,IAX2/peername/${EXTEN} 
exten => _1NXXNXXXXXX,2,Congestion 

For outbound SIP connections it should look like this:

[autopatch] 

exten => _1NXXNXXXXXX,1,Dial,SIP/peername/${EXTEN} 
exten => _1NXXNXXXXXX,2,Congestion 

The peer stanza you insert in iax.conf or sip.conf should preferably be provided by your ITSP. You'll want to use the stanza they identify for performing outgoing connections. A nonoperational example of an iax2 peer stanza looks like this:

[peername]
type=peer 
host=127.0.0.1 
secret=nunya
auth=md5 
disallow=all 
allow=gsm 
allow=ulaw

Autopatch Options

You may have noticed several options being passed in to the autopatchup command class.

This table summarizes what they do:

Autopatch Option Description
context Override the context specified for the autopatch in rpt.conf
dialtime The maximum time to wait between DTMF digits when a telephone number is being dialed. The patch will automatically disconnect if this time is exceeded. The value is specified in milliseconds.
farenddisconnect When set to 1, the patch will automatically disconnect when the called party hangs up. The default is send a circuit busy tone until the radio user brings the patch down.
noct When this is set to 1 the courtesy tone during an autopatch call will be disabled. The default is to send the courtesy tone whenever the radio user unkeys.
quiet When set to 1, Don't send dial tone, voice responses, just try to connect the call.