Skip to main content

Cisco UC500 Lab #1-3: Configuring a SIP trunk on UC500

Introduction

On previous chapters we initialized the UC500 using the Telephony Setup Wizard on the Cisco CCA. We also configured some basic system settings. Next step will be configuring a SIP trunk from Flash Telecom (a provider I used on previous labs).

SIP Protocol

SIP is an ASCII based, application-layer control protocol that can be used to establish, maintain, and terminate calls between two or more endpoints. SIP has rapidly emerged as the standard protocol used in IP communications, because it is a multimedia protocol that can be used for video sessions and instant messaging in addition to voice. Also, SIP can handle conference sessions and broadcasts, as well as one-to-one sessions.

SIP trunks are similar to a phone line, except that SIP trunks use the IP network, not the PSTN. In addition, SIP trunks permit the convergence of voice and data onto common all-IP connections. In order to access the IP network using a SIP trunk, it is necessary that configurations be made on the service provider, as well as on the customer side. Customers need to set and configure CME, which is the PBX that will interpret the SIP signal adequately and pass traffic successfully. The service provider needs to configure an SIP Proxy Server. However, SIP trunks are more complicated to establish than regular PSTN trunks. The reason is that a customer faces challenges in handling different interpretation and implementations of SIP by equipment vendors, delivering security, managing quality of service (QoS), enabling Network Address Translation (NAT) and firewall traversal, and ensuring carrier-grade reliability and continuity of service.

These points describe why SIP trunks are becoming so apparent in small and medium businesses:

  • Quick and Easy Deployment

  • Improved Utilization of Network Capacity

  • Potential for Consolidating and Lowering Telephony Costs

  • Economical Direct Inward Dial (DID)

  • Business Continuity

CME SIP Trunk Support

Cisco CME is an IP telephony solution that is integrated directly into Cisco IOS software. CME permits small and medium businesses to deploy voice, data, and video on a single platform. An IP telephony network is simple to set because CME runs on a single router, which delivers a PBX functionality for businesses. Therefore, by using CME, small and medium businesses can deliver IP telephony and data routing using a single converged solution with minimal costs.

image.pngFlash Telecom SIP trunk cheapest offering.

The SIP Trunk offer from Flash Telecom includes:

  • SIP Number
  • 6 channels
  • 1000 minutes for incoming calls
  • Outgoing calls to landline numbers: 0,01€/min
  • Outgoing calls to mobile numbers: 0,027€/min

Using CCA to configure the SIP trunk

After ordering the SIP trunk, I got an email with the details needed to configure the SIP trunk.

These details are:

  • Host: pjsip.fmeuropa.com:5080
  • User: 910035317
  • Password: REDACTED

On CCA go to Configure > Telephony > Ports and Trunks > SIP Trunk

On the SIP Trunk window, hit Add to add a new service provider. Also make sure the Numbering Plan Locale matches your country (Spain in my case). For the DID Registration I'll keep the first option since I'll be using just one single DID.

image.png

On the Account Information tab:

image.png

After hitting Apply, enter the Flash Telecom assigned DID number on the dialog (this will be outgoing caller ID). After hitting OK, the configuration will be written to the UC500, and a success notification will appear.

image.png

image.png

Configuring the Outgoing Dial Plan

We will navigate to Configure > Telephony > Dial Plan > Outgoing. Here, we will select from the dropdown at Numbering Plan Local > Template: Spain (where I am established). After doing this, a warning will appear asking to change the default access code from 0 to 9 as per the Spain template. I will select Yes to change it.

image.png

We will also want to set Trunk Priority to SIP Only.

On the Caller ID tab we want to make sure the DID number we configured on the outgoing caller ID window before matches:

image.png

The default caller ID for calls going through the SIP trunk (Flash Telecom) is 910035317

Configuring the Incoming Dial Plan

Since I have only two phones in this lab, I would ideally configure a blast group and make both phones ring when the DID number is called from the outside. But for now I will map the number to extension 201 (the 7970 phone).

We want to make sure that Trunk is set to SIP Trunk:

image.png


Using CME CLI to configure the SIP trunk

For the outgoing and incoming dial plan, best bet is to use CCA since it will generate all the dial-peers for us, using predefined templates (i.e for Spain in the case of the outgoing calls).

However the SIP trunk itself can be configured very easily via CLI. Here is the CLI-equivalent configuration of the CCA configuration we made on the previous section for the SIP trunk configuration:

!--- Voice Class and Service VoIP Configuration ---

voice service voip
 ip address trusted list
  ipv4 0.0.0.0 0.0.0.0
 allow-connections h323 to h323
 allow-connections h323 to sip
 allow-connections sip to h323
 allow-connections sip to sip
 supplementary-service h450.12
 no supplementary-service sip moved-temporarily
 no supplementary-service sip refer
 sip
  registrar server expires max 3600 min 3600
  localhost dns:pjsip.fmeuropa.com
  no update-callerid
  sip-profiles 1000

voice class codec 1
 codec preference 1 g711ulaw

!--- SIP UA (User-Agent) Configuration ---

sip-ua
 keepalive target dns:pjsip.fmeuropa.com
 authentication username 910035317 password 7 <REDACTED>
 no remote-party-id
 retry invite 2
 retry register 10
 timers connect 100
 timers keepalive active 100
 registrar dns:pjsip.fmeuropa.com:5080 expires 3600
 sip-server dns:pjsip.fmeuropa.com:5080
 host-registrar

Fixing Incoming Calls

Recalling the topology, it is clear we will have a NAT issue:

image.png

The incoming call-flow is as follows:

  • External user calls (from Xiaomi smartphone) number 910035317
  • SIP INVITE is received by NAT GW which forwards it to UC540 at 192.168.1.50.
  • The UC540 sees on the Request-URI Host Part that the address (which will be the public IP address) does not match any IP configured on the UC54, and sends a 400 Bad Request - 'Invalid Host' hence ending the call.

image.png

Debug from CME (just the interesting parts)

UC_540#debug ccsip all
This may severely impact system performance. Continue? [confirm]
All SIP Call tracing is enabled
UC_540#
000610: May  2 15:01:56.465: //-1/xxxxxxxxxxxx/SIP/Info/HandleUdpIPv4SocketReads: Msg enqueued for SPI with IP addr: [161.22.43.99]:5080, local_address:[ - ]
000611: May  2 15:01:56.465: //-1/xxxxxxxxxxxx/SIP/Info/ccsip_process_sipspi_queue_event: ccsip_spi_get_msg_type returned: 2 for event 1
000612: May  2 15:01:56.465: //-1/xxxxxxxxxxxx/SIP/Transport/sipTransportProcessNWNewConnMsg: context=0x878B18A4
000613: May  2 15:01:56.465: //-1/xxxxxxxxxxxx/SIP/Transport/sipConnectionManagerProcessNewConnMsg: gConnTab=0x878B18A4, addr=161.22.43.99, port=5080, local_addr=, connid=3, transport=UDP
000614: May  2 15:01:56.465: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg:
Received:
INVITE sip:910035317@79.112.36.254:56350 SIP/2.0
Via: SIP/2.0/UDP 161.22.43.99:5080;rport;branch=z9hG4bKPj210ae631-ac71-4562-b51a-401fc455bf30
From: <sip:<REDACTED>@161.22.43.99>;tag=8e4877f0-2a15-45cc-b884-997efd992873
To: <sip:910035317@79.112.36.254>
Contact: <sip:asterisk@161.22.43.99:5080>
Call-ID: be3dd0a0-c128-4ba9-9c3c-4ee7b8975194
CSeq: 4343 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, INFO, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Flash Telecom A1
Content-Type: application/sdp
Content-Length:   695

v=0
o=- 1627838961 1627838961 IN IP4 161.22.43.99
s=Asterisk
c=IN IP4 161.22.43.99
t=0 0
m=audio 10496 RTP/AVP 0 8 3 18 9 107 101 113
a=ice-ufrag:0c09f27f35fd0d66128e1cdf31935360
a=ice-pwd:3d27389d74ee35415f9982623b73d175
a=candidate:Ha1162b63 1 UDP 2130706431 161.22.43.99 10496 typ host
a=candidate:Ha1162b63 2 UDP 2130706430 161.22.43.99 10497 typ host
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:9 G722/8000
a=rtpmap:107 opus/48000/2
a=fmtp:107 useinbandfec=1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:113 telephone-event/48000
a=fmtp:113 0-16
a=ptime:20
a=maxptime:20
a=sendrecv

000615: May  2 15:01:56.465: //-1/xxxxxxxxxxxx/SIP/Info/ccsip_new_msg_preprocessor: Checking Invite Dialog
000616: May  2 15:01:56.465: //-1/xxxxxxxxxxxx/SIP/Info/sipSPIAddContextToTable: Added context(0x88A5B940) with key=[454] to table
000617: May  2 15:01:56.465: //-1/000000000000/SIP/Info/ccsip_offer_ans_init:
000618: May  2 15:01:56.469: //-1/000000000000/SIP/Info/ccsip_iwf_init:
000619: May  2 15:01:56.469: //-1/000000000000/SIP/Info/ccsip_ipip_media_service_init:
000620: May  2 15:01:56.469: //-1/000000000000/SIP/Info/sipSPI_ipip_vcc_Initialization:  Entry...
000621: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Transport/sipSPIUpdateResponseInfo: Dialog Transaction Address 161.22.43.99,Port 5080, Transport 1, SentBy Port 5080
000622: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Info/resolve_sig_ip_address_to_bind: calling reg_invoke_ip_first_hop()
000623: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Info/resolve_sig_ip_address_to_bind: calling ip_best_local_address()
000624: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Info/resolve_sig_ip_address_to_bind: return addr 192.168.1.131
000625: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/State/sipSPIChangeState: 0x88A5B940 : State change from (STATE_NONE, SUBSTATE_NONE)  to (STATE_IDLE, SUBSTATE_NONE)
000626: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Transport/sipSPIUpdateResponseInfo: Dialog Transaction Address 161.22.43.99,Port 5080, Transport 1, SentBy Port 5060
000627: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Info/sipSPISetDateHeader: Converting TimeZone CET to SIP default timezone = GMT
000628: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Transport/sipSPIUpdateResponseInfo: Dialog Transaction Address 161.22.43.99,Port 5080, Transport 1, SentBy Port 5080
000629: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Info/resolve_sig_ip_address_to_bind: calling reg_invoke_ip_first_hop()
000630: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Info/resolve_sig_ip_address_to_bind: calling ip_best_local_address()
000631: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Info/resolve_sig_ip_address_to_bind: return addr 192.168.1.131
000632: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Error/sipSPI_validate_own_ip_addr: ReqLine IP addr does not match with host IP addr
000633: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Error/sact_idle_new_message_invite: Invalid URL in incoming INVITE
000634: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Info/ccsip_set_cc_cause_for_spi_err: Categorized cause:100, category:100
000635: May  2 15:01:56.469: //-1/xxxxxxxxxxxx/SIP/Info/ccsip_set_release_source_for_peer: ownCallId[-1], src[6]
000636: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Info/sipSPIUaddCcbToUASReqTable: ****Adding to UAS Request table.
000637: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Info/sipSPIUaddCcbToTable: Added to table. ccb=0x88A5B940 key=be3dd0a0-c128-4ba9-9c3c-4ee7b8975194910035317
000638: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Info/sipSPIUaddCcbToUASRespTable: ****Adding to UAS Response table.
000639: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Info/sipSPIUaddCcbToTable: Added to table. ccb=0x88A5B940 key=be3dd0a0-c128-4ba9-9c3c-4ee7b89751947629A4-23D3
000640: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Event/Session-Timer/sipSTSLMain: Event: E_STSL_SESSION_REFRESH_RESP
000641: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Event/Session-Timer/sipSTSLMain: dir:1, method:102, resp_code:400, container:8AF0FDD0
000642: May  2 15:01:56.469: //-1/397CE0E2817D/SIP/Info/Session-Timer/sipSTSLMain:
        SE: 0;refresher:none peer refresher:none, flags:0, posted event:E_STSL_INVALID_PEER_EVENT, reason:4
        Configured SE:1800, Configured Min-SE:1800
000643: May  2 15:01:56.473: //-1/397CE0E2817D/SIP/Info/sipSPISendInviteResponse: Associated container=0x8AF0FDD0 to Invite Response 400
000644: May  2 15:01:56.473: //-1/397CE0E2817D/SIP/Transport/sipSPITransportSendMessage: msg=0x872F048C, addr=161.22.43.99, port=5080, sentBy_port=5080, local_addr=, is_req=0, transport=1, switch=0, callBack=0x814AC8F4
000645: May  2 15:01:56.473: //-1/397CE0E2817D/SIP/Transport/sipSPITransportSendMessage: Proceedable for sending msg immediately
000646: May  2 15:01:56.473: //-1/397CE0E2817D/SIP/Transport/sipTransportLogicSendMsg: switch transport is 0
000647: May  2 15:01:56.473: //-1/397CE0E2817D/SIP/Transport/sipTransportLogicSendMsg: Trying to send resp=0x872F048C to default port=5080
000648: May  2 15:01:56.473: //-1/xxxxxxxxxxxx/SIP/Transport/sipConnectionManagerGetConnection: connection required for raddr:161.22.43.99, rport:5080 with laddr:

000649: May  2 15:01:56.473: //-1/397CE0E2817D/SIP/Transport/sipTransportLogicSendMsg: Connection obtained...sending msg=0x872F048C
000650: May  2 15:01:56.473: //-1/xxxxxxxxxxxx/SIP/Transport/sipTransportPostSendMessage: Posting send for msg=0x872F048C, addr=161.22.43.99, port=5080, local_addr=, connId=3 for UDP
000651: May  2 15:01:56.473: //-1/397CE0E2817D/SIP/Info/sentErrResDisconnecting: Sent an 3456XX Error Response
000652: May  2 15:01:56.473: //-1/397CE0E2817D/SIP/State/sipSPIChangeState: 0x88A5B940 : State change from (STATE_IDLE, SUBSTATE_NONE)  to (STATE_DISCONNECTING, SUBSTATE_NONE)
000653: May  2 15:01:56.473: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg:

Sent:
SIP/2.0 400 Bad Request - 'Invalid Host'
Via: SIP/2.0/UDP 161.22.43.99:5080;rport;branch=z9hG4bKPj210ae631-ac71-4562-b51a-401fc455bf30
From: <sip:<REDACTED>@161.22.43.99>;tag=8e4877f0-2a15-45cc-b884-997efd992873
To: <sip:910035317@79.112.36.254>;tag=7629A4-23D3
Date: Fri, 02 May 2025 15:01:56 GMT
Call-ID: be3dd0a0-c128-4ba9-9c3c-4ee7b8975194
CSeq: 4343 INVITE
Allow-Events: telephone-event
Reason: Q.850;cause=100
Server: Cisco-SIPGateway/IOS-12.x
Content-Length: 0

To fix this, we can simply add a loopback interface with the public IP address the UC500 is not recognizing:

interface Loopback1
 ip address 79.112.36.254 255.255.255.255

This way the UC500 will recognize the headers on the INVITE message and the incoming calls will be forwarded.