I recently was given a cisco 1760 with a 4 port FXS card and 2 DSPs. I decided to replace my PAP2T FXS gateway with that one instead.
Asterisk
I did not want the cisco gateway to register the FXS ports to the asterisk server. So the gateway will send an invite, but asterisk needs to know to which context that INVITE must be sent. To do this, in sip.conf I have configured the "host" with the ip address of the router. I needed to specify "insecure=invite,port". That way, when an INVITE comes from the gateway, asterisk will recognize the IP of the gateway and will associate it with that SIP peer from sip.conf
[ciscogateway]
type=friend
context=phones
host=192.168.x.x
secret=password1
insecure=invite,port
Cisco gateway
The cisco gateway is easy to configure. You need dial-peers which are basically dialplans. You need to configure voice ports and the SIP user agent.
dial-peer
With dial-peers, you configure patterns that needs to be matched and the destination it will go. So if you want to dial "734" and you want the call to be routed to voice port 1, then you would do:
dial-peer voice 704 pots
destination-pattern 704
port 2/0
!
You could also make several dial peers to be routed to the same voice-ports if you would like the port to have multiple extensions. By the way, when typing "dial-peer voice 734 pots", the 734 really is just a tag. It doesn't mean anything at a dialplan point of view.
Now if you want all calls to 10 digits numbers to be redirected to the Asterisk server, you would need a dial-peer that matches a 10digit number and sends the call to the sip-server:
dial-peer voice 1 voip
destination-pattern .T
session protocol sipv2
session target sip-server
session transport udp
codec g711ulaw
no vad
!
sip-ua
This is the configuration of the sip user agent. The configuration is pretty straight-forward:
service voip
sip
sip-ua
sip-server ipv4:192.168.1.3
voice-port
These configurations are only meant to configure voice ports aspects like inter-digit timeouts, gain etc.. In a basic setup, you don't need to configure anything in there. But this is what I'm using:
voice-port 2/0
input gain -3
no vad
timeouts interdigit 5
station-id name ciscofxs0
caller-id enable