Cisco router with FXO as an Asterisk gateway

It occured to me that I never wrote up how I managed to get Asterisk working with my Cisco 1760 as an FXO gateway.  So, here it is:

I have a Cisco 1760 that began it's life as a CallManager Express (CME).  After a while I transitioned it to an MGCP gateway for CM 4.1 and then just a SIP gateway for the same CM4.1  See, CallerID didn't work for my VIC with MGCP, but it worked with SIP.  Now the router is a SIP gateway for Asterisk, which is my primary system.  Verizon comes into the FXO on the router and then is trunked via SIP to Asterisk.  So...on to the configs.  Here's the important part of the router config:

!
voice rtp send-recv
!
voice service voip
allow-connections h323 to h323
allow-connections h323 to sip
allow-connections sip to h323
!
!
voice-port 0/0
timing hookflash-out 50
connection plar 401
caller-id enable
!
dial-peer voice 8 pots
destination-pattern 8.T
port 0/0
!
dial-peer voice 400 voip
destination-pattern 4..
session protocol sipv2
session target ipv4:192.168.x.x:5060
session transport udp
dtmf-relay rtp-nte
codec g711ulaw
no vad
!
sip-ua
retry invite 3
retry response 3
retry bye 3
retry cancel 3
timers trying 1000
sip-server ipv4:192.168.x.x
!
!
telephony-service
fxo hook-flash
max-conferences 4 gain -6
transfer-system full-blind
transfer-pattern ....

I'm quite certain all of that is not necessary but it works, so I'll leave it alone.

Here's the config in AMP.  I got this working through the raw config files but wanted to figure it out in AMP.  If you're going to use A@H and AMP it's best to get it working through AMP.  AMP has a nice habit of writing over certain files because it know's it correct!  Anyway,  here's the config for the SIP trunk:

Outbound caller-id: Set to your PSTN number (although I don't think it matters)
Max Channels: Set to 2 but I think it should probably be 1
Dial Rules: Whatever's appropriate for you situation
Outgoing Settings: trunk name should be something meaningful
allow=ulaw
context=from-pstn
disallow=all
dtmfmode=rfc2833
host=192.168.x.x
insecure=very
ipaddr=192.168.x.x
type=peer

Replace x.x with the address of the router.  Make sure to add the insecure=very!  I can't tell you how important that is.  I went round and round before stumbling across that.  The partial tutorials on the intarweb don't specify that.  From what I can understand you need this because there's no means of authenticating the SIP session with the router, aside from the source IP address.

Leave everything else blank.  Don't forget to add your outbound routing dial patterns.

That's it.  If someone has a comment please email me or leave it in the comments here.