Using Asterisk with the repro SIP proxy

Setup the SIP proxy as described in the section called “repro SIP proxy”. Add a UDP transport in repro.config, it will be used to communicate with Asterisk. It is a good idea to ensure that the firewall prevents external hosts from sending any UDP traffic to either the SIP proxy or the SIP port on Asterisk.

Go to the repro web administration page and click to add a route. Configure the route using the details in Table 17.1, “repro route configuration”. Replace A.B.C.D with the IP address of the Asterisk server.

Table 17.1. repro route configuration

ParameterValue
URI^sip:([0-9]*)@sip-proxy\.example\.org;.*transport=tls
Destinationsip:$1@A.B.C.D:5060;transport=udp

Notice that this route looks for the transport=tls parameter. This means it will only be applied to calls coming from the users. When a call comes into the SIP proxy from the Asterisk server, it will be coming over the UDP transport and it won't be matched by this route (otherwise it would go into a loop).

Next, in the repro web administration page, click to add an entry to the ACL. Add an entry permitting packets from the IP address and SIP port used by the Asterisk server.

Remember to restart the repro SIP proxy if changes were made to the list of domains or the repro.config file.

In the Asterisk server, setup the sip.conf file as demonstrated in Example 17.1, “Asterisk sip.conf. In particular, replace A.B.C.D with the IP address that the Asterisk server should bind to, this must be a routable IP address on the Asterisk host.

Example 17.1. Asterisk sip.conf

; should match the realm used by the proxy
realm=sip-proxy.example.org
domain=sip-proxy.example.org
fromdomain=sip-proxy.example.org
port=5060
bindaddr=A.B.C.D

; follow this pattern to define a user
[8001]
username=8001
secret=whatever
host=dynamic
canreinvite=no
mailbox=8001
nat=yes

The Asterisk server will need to be able to send calls to SIP users who are registered with the SIP proxy. The calls can be routed using the Dial command as demonstrated in Example 17.2, “Asterisk extensions.conf.

Example 17.2. Asterisk extensions.conf

exten => _8XXX,n,Dial(SIP/${EXTEN}@sip-proxy.example.org,45)