SIP trunk on a Cisco IOS Gateway to connect to a SIP PSTN Provider
Blueface is the SIP PSTN provider in this example
It's not possible to connect a SIP trunk directly from a Cisco UC Manager (CUCM) to Blueface.
The below sample configuration, shows how it's possible to register an IOS gateway to Blueface and make and receive to Blueface from your CUCM through the gateway.
You could run this gateway as a GNS virtual router.
Pay particular attention to the SIP-UA config, which needs to be set up correctly with your Blueface username and password.
Note: Blueface will only accept a SIP request from a valid SIP FROM header, (which will be <your-username>@blueface.ie)
Tip: If you send from a valid FROM head, Blueface will respond with an “unauthorized” where the Cisco gateway will then resend the request with authorization. If you are getting a “declined” and not a unauthorized,double check your SIP FROM Header values.
TIP: If you need to remove a “credentials username” from the sip-ua config, you must enter the password unencrypted, i.e. not as it is displayed in the “show run” (very annoying).
IOS config extract
voice service voip media flow-around allow-connections sip to sip no supplementary-service sip moved-temporarily no supplementary-service sip refer sip ! ! voice class uri bluefaceURI sip !This is used to match the incoming calls from Blueface, which will have an invite of sip:bob1234@<ip-address>:xxxx !Since your username is not routing for CCM, you need to change this to a valid extension number using a translation rule. user-id bob1234 ! ! voice class codec 1 !Note you need to configure the codec that the CCM phone will use. !This will depend on region settings, usually either G711ulaw or G729. !CCM will not negotiate the codec that is configured here - so it needs to match. codec preference 1 g711ulaw ! voice translation-rule 1 ! USED for Outbound Calls to Blueface rule 1 /^9/ // ! voice translation-rule 2 ! USED to insert a called number for calls arriving in from Blueface. ! configure this to be the extension you want the calls to routing to. rule 1 /.*/ /1001/ ! ! voice translation-profile BluefaceIncoming translate called 2 ! voice translation-profile strip9 translate called 1 ! dial-peer voice 1 voip description *** Incoming Call from Blueface *** translation-profile incoming BluefaceIncoming voice-class codec 1 session protocol sipv2 incoming uri to bluefaceURI dtmf-relay rtp-nte no vad ! dial-peer voice 2 voip description *** Incoming Call from CUCM and Outgoing Call to Blueface *** translation-profile outgoing strip9 destination-pattern 9T voice-class codec 1 session protocol sipv2 session target sip-server incoming called-number 9T dtmf-relay rtp-nte no vad ! dial-peer voice 3 voip description *** Outgoing Call to CUCM *** ! I only could get this working with the destination pattern below. ! The translation rule occurs on dial-peer 1, seems to occur AFTER this dial-peer is matched. ! Maybe a better way? destination-pattern .% voice-class codec 1 session protocol sipv2 session target ipv4:192.168.1.111 dtmf-relay rtp-nte no vad ! sip-ua credentials username bob1234 password xxxxxxxxxxxxxxxxx realm sip.blueface.ie:5060 authentication username bob1234 password 7 xxxxxxxxxxxxxxxxx realm sip.blueface.ie !Set this to any value calling-info pstn-to-sip from name set Bob !You must set this to your Blueface usename calling-info pstn-to-sip from number set bob1234 registrar dns:sip.blueface.ie expires 60 sip-server dns:sip.blueface.ie !
show sip user agent register status
HQ-Gateway#sh sip-ua register status Line peer expires(sec) registered ================================ ========== ============ ========== bob1234 -1 51 yes
Blueface SIP Register debug output
*Feb 18 15:13:43.407: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: REGISTER sip:sip.blueface.ie:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK6BD9F From: <sip:[email protected]>;tag=33EBD0-174E To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:13:43 GMT Call-ID: D8F22737-3AA511E0-80278B08-BD12CC86 User-Agent: Cisco-SIPGateway/IOS-12.x Max-Forwards: 70 Timestamp: 1298042023 CSeq: 40 REGISTER Contact: <sip:[email protected]:5060> Expires: 60 Content-Length: 0 *Feb 18 15:13:43.467: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: SIP/2.0 401 Unauthorised Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK6BD9F To: <sip:[email protected]>;tag=7099981250 From: <sip:[email protected]>;tag=33EBD0-174E Call-ID: D8F22737-3AA511E0-80278B08-BD12CC86 CSeq: 40 REGISTER Contact: <sip:[email protected]:50570> WWW-Authenticate: Digest realm="sip.blueface.ie:5060",nonce="2131657515",algorithm=md5 Server: obelisk-registrar *Feb 18 15:13:43.467: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: REGISTER sip:sip.blueface.ie:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK6C11F7 From: <sip:[email protected]>;tag=33EBD0-174E To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:13:43 GMT Call-ID: D8F22737-3AA511E0-80278B08-BD12CC86 User-Agent: Cisco-SIPGateway/IOS-12.x Max-Forwards: 70 Timestamp: 1298042023 CSeq: 41 REGISTER Contact: <sip:[email protected]:5060> Expires: 60 Authorization: Digest username="bob1234",realm="sip.blueface.ie:5060",uri="sip:si HQ-Gateway#p.blueface.ie:5060",response="6f63e29bd0f29f79af31ba2fdcff2766",nonce="2131657515",algorithm=md5 Content-Length: 0 *Feb 18 15:13:43.539: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: SIP/2.0 200 Ok Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK6C11F7 To: <sip:[email protected]>;tag=7100762500 From: <sip:[email protected]>;tag=33EBD0-174E Call-ID: D8F22737-3AA511E0-80278B08-BD12CC86 CSeq: 41 REGISTER Contact: <sip:[email protected]:50570>;expires=60 Date: Fri, 18 Feb 2011 15:11:50 GMT Server: obelisk-registrar
SIP example call to blueface debug output
debug ccsip messages
Note: this is a call from a Cisco UC Manager to the Gateway and onto Blueface
HQ-Gateway# *Feb 18 15:16:57.551: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: INVITE sip:[email protected]:5060 SIP/2.0 Via: SIP/2.0/TCP 192.168.83.51:5060;branch=z9hG4bK2323ee3faf From: "Bob" <sip:[email protected]>;tag=43efa1e3-4e19-49e5-80d4-080091b6b5f8-24402090 To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:14:54 GMT Call-ID: [email protected] Supported: timer,resource-priority,replaces Min-SE: 1800 User-Agent: Cisco-CUCM8.0 Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY CSeq: 101 INVITE Contact: <sip:[email protected]:5060;transport=tcp> Expires: 180 Allow-Events: presence, kpml Supported: X-cisco-srtp-fallback Supported: Geolocation Call-Info: <sip:192.168.83.51:5060>;method="NOTIFY;Event=telephone-event;Duration=500" Cisco-Guid: 3581096064-0000065536-0000000036-0861120704 Session-Expires: 1800 P-Asserted-Identity: "Bob" <sip:[email protected]> Remote-Party-ID: "Bob" <sip:[email protected]>;party=calling;screen=yes;privacy=off Max-Forwards: 70 Content-Length: 0 *Feb 18 15:16:57.559: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: SIP/2.0 100 Trying Via: SIP/2.0/TCP 192.168.83.51:5060;branch=z9hG4bK2323ee3faf From: "Bob" <sip:[email protected]>;tag=43efa1e3-4e19-49e5-80d4-080091b6b5f8-24402090 To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:16:57 GMT Call-ID: [email protected] CSeq: 101 INVITE Allow-Events: telephone-event Server: Cisco-SIPGateway/IOS-12.x Content-Length: 0 *Feb 18 15:16:57.643: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: INVITE sip:[email protected]:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK7517E8 Remote-Party-ID: "Bob" <sip:[email protected]>;party=calling;screen=yes;privacy=off From: "Bob" <sip:[email protected]>;tag=36E28C-483 To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:16:57 GMT Call-ID: [email protected] Supported: 100rel,timer,resource-priority,replaces Min-SE: 1800 Cisco-Guid: 3581096064-65536-36-861120704 User-Agent HQ-Gateway#: Cisco-SIPGateway/IOS-12.x Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER CSeq: 101 INVITE Timestamp: 1298042217 Contact: <sip:[email protected]:5060> Expires: 180 Allow-Events: telephone-event Max-Forwards: 69 Content-Length: 0 *Feb 18 15:16:57.707: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK7517E8 To: <sip:[email protected]>;tag=as00004eed From: Bob <sip:[email protected]>;tag=36E28C-483 Call-ID: [email protected] CSeq: 101 INVITE WWW-Authenticate: Digest realm="sip.blueface.ie",nonce="00005795",algorithm=md5 Server: asterisk Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer *Feb 18 15:16:57.707: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: ACK sip:[email protected]:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK7517E8 From: "Bob" <sip:[email protected]>;tag=36E28C-483 To: <sip:[email protected]>;tag=as00004eed Date: Fri, 18 Feb 2011 15:16:57 GMT Call-ID: [email protected] Max-Forwards: 70 CSeq: 101 ACK Allow-Events: telephone-event Content-Length: 0 *Feb 18 15:16:57.707: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: INVITE sip:[email protected]:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK761E41 Remote-Party-ID: "Bob" <sip:[email protected]>;party=calling;screen=yes;privacy=off From: "Bob" <sip:[email protected]>;tag=36E28C-483 To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:16:57 GMT Call-ID: [email protected] Supported: 100rel,timer,resource-priority,replaces Min-SE: 1800 Cisco-Guid: 3581096064-65536-36-861120704 User-Agent: Cisco-SIPGateway/IOS-12.x Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER CSeq: 102 INVITE Timestamp: 1298042217 Contact: <sip:[email protected]:5060> Expires: 180 Allow-Events: telephone-event Authorization: Digest username="bob1234",realm="sip.blueface.ie",uri="sip:[email protected]:5060",response="f30120a9ed0c386d71c531138b8f9389",nonce="00005795",algorithm=md5 Max-Forwards: 69 Content-Length: 0 HQ-Gateway# *Feb 18 15:16:57.783: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: SIP/2.0 100 Trying Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK761E41 To: <sip:[email protected]> From: Bob <sip:[email protected]>;tag=36E28C-483 Call-ID: [email protected] CSeq: 102 INVITE Contact: <sip:[email protected]:5061> Record-Route: <sip:194.213.29.100:5060;lr> Server: asterisk Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer HQ-Gateway# *Feb 18 15:17:00.979: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: SIP/2.0 183 Session Progress Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK761E41 To: <sip:[email protected]>;tag=as00004794 From: Bob <sip:[email protected]>;tag=36E28C-483 Call-ID: [email protected] CSeq: 102 INVITE Contact: <sip:[email protected]:5061> Record-Route: <sip:194.213.29.100:5060;lr> Content-Type: application/sdp Content-Length: 397 Server: asterisk Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer v=0 o=root 17612 17612 IN IP4 194.213.29.62 s=Asterisk PBX 1.6.2.13 c=IN IP4 194.213.29.62 t=0 0 m=audio 17144 RTP/AVP 8 0 18 3 97 110 101 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:18 G729/8000 a=fmtp:18 annexb=no a=rtpmap:3 GSM/8000 a=rtpmap:97 iLBC/8000 a=fmtp:97 mode=30 a=rtpmap:110 speex/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=sendrecv *Feb 18 15:17:00.983: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: SIP/2.0 183 Session Progress Via: SIP/2.0/TCP 192.168.83.51:5060;branch=z9hG4bK2323ee3faf From: "Bob" <sip:[email protected]>;tag=43efa1e3-4e19-49e5-80d4-080091b6b5f8-24402090 To: <sip:[email protected]>;tag=36EF98-131D Date: Fri, 18 Feb 2011 15:16:57 GMT Call-ID: [email protected] CSeq: 101 INVITE Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER Allow-Events: telephone-event Remote-Party-ID: <sip:[email protected] HQ-Gateway#.83.21>;party=called;screen=no;privacy=off Contact: <sip:[email protected]:5060;transport=tcp> Server: Cisco-SIPGateway/IOS-12.x Content-Type: application/sdp Content-Disposition: session;handling=required Content-Length: 250 v=0 o=CiscoSystemsSIP-GW-UserAgent 6572 7610 IN IP4 192.168.83.21 s=SIP Call c=IN IP4 192.168.83.21 t=0 0 m=audio 16558 RTP/AVP 8 101 c=IN IP4 192.168.83.21 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 HQ-Gateway# *Feb 18 15:17:04.179: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: CANCEL sip:[email protected]:5060 SIP/2.0 Via: SIP/2.0/TCP 192.168.83.51:5060;branch=z9hG4bK2323ee3faf From: "Bob" <sip:[email protected]>;tag=43efa1e3-4e19-49e5-80d4-080091b6b5f8-24402090 To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:14:54 GMT Call-ID: [email protected] CSeq: 101 CANCEL Max-Forwards: 70 Content-Length: 0 *Feb 18 15:17:04.179: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: SIP/2.0 200 OK Via: SIP/2.0/TCP 192.168.83.51:5060;branch=z9hG4bK2323ee3faf From: "Bob" <sip:[email protected]>;tag=43efa1e3-4e19-49e5-80d4-080091b6b5f8-24402090 To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:17:04 GMT Call-ID: [email protected] CSeq: 101 CANCEL Content-Length: 0 *Feb 18 15:17:04.183: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: CANCEL sip:[email protected]:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK761E41 From: "Bob" <sip:[email protected]>;tag=36E28C-483 To: <sip:[email protected]> Date: Fri, 18 Feb 2011 15:16:57 GMT Call-ID: [email protected] CSeq: 102 CANCEL Max-Forwards: 70 Timestamp: 1298042224 Reason: Q.850;cause=16 Content-Length: 0 *Feb 18 15:17:04.183: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: SIP/2.0 487 Request Cancelled Via: SIP/2.0/TCP 192.168.83.51:5060;branch=z9hG4bK2323ee3faf From: "Bob" <sip:[email protected]>;tag=43efa1e3-4e19-49e5-80d4-080091b6b5f8-24402090 To: <sip:[email protected]>;tag=36EF98-131D Date: Fri, 18 Feb 2011 15:17:04 GMT Call-ID: [email protected] CSeq: 101 INVITE Allow-Events: telephone-event Server: Cisco-SIPGateway/IOS-12.x Reason: Q.850;cause=16 Content-Length: 0 *Feb 18 15:17:04.183: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: ACK sip:[email protected]:5060 SIP/2.0 Via: SIP/2.0/TCP 192.168.83.51:5060;branch=z9hG4bK2323ee3faf From: "Bob" <sip:[email protected]>;tag=43efa1e3-4e19-49e5-80d4-080091b6b5f8-24402090 To: <sip:[email protected]>;tag=36EF98-131D Date: Fri, 18 Feb 2011 15:14:54 GMT Call-ID: [email protected] Max-Forwards: 70 CSeq: 101 ACK Allow-Events: presence, kpml Content-Length: 0 *Feb 18 15:17:04.239: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Received: SIP/2.0 487 Request Terminated Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK761E41 To: <sip:[email protected]>;tag=as00004794 From: Bob <sip:[email protected]>;tag=36E28C-483 Call-ID: [email protected] CSeq: 102 INVITE Server: asterisk Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer *Feb 18 15:17:04.239: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg: Sent: ACK sip:[email protected]:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.83.21:5060;branch=z9hG4bK761E41 From: "Bob" <sip:[email protected]>;tag=36E28C-483 To: <sip:[email protected]>;tag=as00004794 Date: Fri, 18 Feb 2011 15:16:57 GMT Call-ID: [email protected] Max-Forwards: 70 CSeq: 102 ACK Allow-Events: telephone-event Content-Length: 0