Fixing SIP Problems with UC Manager & CUBE Normalization Tools

Similar documents
Fixing SIP Problems with UC Manager & CUBE Normalization Tools

Fixing SIP Problems with UC Manager's SIP Normalization Tools

Fixing SIP Problems with UC Manager's SIP Normalization Tools

Fixing SIP Problems with UC Manager's SIP Normalization Tools

Figure 1: Incoming and Outgoing messages where SIP Profiles can be applied

SIP Reliable Provisional Response on CUBE and CUCM Configuration Example

Figure 1: Incoming and Outgoing messages where SIP Profiles can be applied

SIP Transparency. Supported Features CHAPTER

Domain-Based Routing Support on the Cisco UBE

Mid-call Re-INVITE/UPDATE Consumption

Manipulating the Request or Response line. getrequestline() returns the method, request-uri, and version

SIP Core SIP Technology Enhancements

Application Notes for Configuring SIP Trunking between Cincinnati Bell Any Distance evantage and Avaya IP Office Issue 1.0

SIP Trunk design and deployment in Enterprise UC networks

SIP Trunk design and deployment in Enterprise UC networks

BRKCOC-2399 Inside Cisco IT: Integrating Spark with existing large deployments

Copying SIP Headers. Feature Information for Copying with SIP Profiles

Copying SIP Headers. Feature Information for Copying with SIP Profiles

Cisco Unified CM SIP Trunking, Session Management, and Global Dial Plan Replication

SIP Trunk design and deployment in Enterprise UC networks

CCIE Collaboration.

Cisco Unified Border Element Intercluster Lookup Service

INTERFACE SPECIFICATION SIP Trunking. 8x8 SIP Trunking. Interface Specification. Version 2.0

Cisco Unified Communications Manager Trunks

Cisco Unified Border Element SIP Support Configuration Guide, Cisco IOS Release 15M&T

SIP System Features. Differentiated Services Codepoint CHAPTER

Configuring SIP MWI Features

Abstract. Avaya Solution & Interoperability Test Lab

Avaya IP Office 4.1 SIP Customer Configuration Guide For use with AT&T IP Flexible Reach. Issue th April 2008

SIP Profiles Feature Module

Application Notes for Configuring SIP Trunking between Bandwidth.com SIP Trunking Solution and an Avaya IP Office Telephony Solution Issue 1.

SIP System Features. SIP Timer Values. Rules for Configuring the SIP Timers CHAPTER

Abstract. Avaya Solution & Interoperability Test Lab

SIP Pass Through APIs

Voice over IP Consortium

Department of Computer Science. Burapha University 6 SIP (I)

Technical specifications for connecting SIP PBX to the Business Trunk service by Slovak Telekom without registration, with static routing.

Configure Jabber Extend and Connect and Modify Calling Party Display

Cisco Unified Border Element (CUBE) Integration Guide

Application Notes for IntelePeer CoreCloud SIP Trunking Service with Avaya IP Office Release Issue 1.0

Chapter 3: IP Multimedia Subsystems and Application-Level Signaling

Abstract. Avaya Solution & Interoperability Test Lab

Abstract. Avaya Solution & Interoperability Test Lab

Application Notes for Configuring SIP Trunking between Global Crossing SIP Trunking Service and an Avaya IP Office Telephony Solution Issue 1.

URI-Based Dialing Enhancements

a. Draw a network diagram, showing how a telephone in the US would make calls to a telephone on Deception Island. (15 points).

Transparent Tunneling of QSIG and Q.931 over SIP TDM Gateway and SIP-SIP Cisco Unified Border Element

The Dynamic Payload Type Interworking for DTMF and Codec Packets for SIP-to-SIP Calls feature provides

URI-Based Dialing Enhancements

Cisco Unified Communications Gateway Services--Extended Media Forking

Setting Up an Alcatel 4400 Digital PIMG Integration with Cisco Unity Connection

Deploy Webex Video Mesh

Configuring Multi-Tenants on SIP Trunks

Contents XO COMMUNICATIONS CONFIDENTIAL 1

SIP System Features. SIP Timer Values. Rules for Configuring the SIP Timers CHAPTER

CUCM 10.5 / CUBE 9.5. BT SIP Trunk Configuration Guide. 1 BT SIP Trunk Configuration Guide

AT&T IP FlexReach: Connecting Cisco Unified Communications Manager 7.0 via the Cisco Unified Border Element 1.2 using SIP

SIP Profiles on the Session Border Controller

Overview of SIP. Information About SIP. SIP Capabilities. This chapter provides an overview of the Session Initiation Protocol (SIP).

SIP Compliance APPENDIX

Services Extended Media Forking

Setting up Alcatel 4400 Digital PIMG Integration

Understanding SIP exchanges by experimentation

Application Scenario 1: Direct Call UA UA

Configuring SIP Registration Proxy on Cisco UBE

Application Notes for Configuring SIP Trunking between McLeodUSA SIP Trunking Solution and an Avaya IP Office Telephony Solution Issue 1.

Common Components. Cisco Unified Border Element (SP Edition) Configuration Profile Examples 5 OL

Matching Inbound Dial Peers by URI

SIP Tutorial. Leonid Consulting V1.4. Copyright Leonid Consulting, LLC (2007) All rights reserved.

Cisco Virtual PGW 2200 Softswitch SIP Profiles Feature Module

How to set FAX on asterisk

TSM350G Midterm Exam MY NAME IS March 12, 2007

Application Notes for Configuring Avaya IP Office 8.1 with Etisalat SIP Trunk service Issue 1.0

Cisco UCS Director and ACI Advanced Deployment Lab

Configuring an Error Response Code upon an Out-of-Dialog OPTIONS Ping Failure

Application Notes for Windstream SIP Trunking Service using Broadsoft Platform with Avaya IP Office Issue 1.0

Cisco Unified SIP Proxy Version 9.0

Setting Up a Mitel SX-2000 Digital PIMG Integration with Cisco Unity Connection

Application Notes for Configuring SIP Trunking between TelePacific SmartVoice SIP Connect and an Avaya IP Office Telephony Solution 1.

Cisco TelePresence Conductor with Cisco Unified Communications Manager

ICE / TURN / STUN Tutorial

Nexmo SIP Trunking Configuration Guide. Skype for Business With Oracle E-SBC Acme Packet 3820 ECZ7.3.0 Patch 2 (Build 75)

Dynamic Payload Type Interworking for DTMF

Unified Border Element (CUBE) with Cisco Unified Communications Manager (CUCM) Configuration Example

Rev CUCM Mobility. c cnac o okbook.com

Technical specifications for connecting SIP PBX to the Business Trunk service by Slovak Telekom.

NXOS in the Real World Using NX-API REST

Session Initiation Protocol (SIP) Overview

Abstract. Avaya Solution & Interoperability Test Lab

Cisco Expressway Session Classification

Compliance with RFC 3261

Cisco TelePresence Conductor with Unified CM

Manipulating SIP Status-Line Header of SIP Responses

Cisco Unified SIP Proxy Version 9.1

Signaling trace on GSM/CDMA VoIP Gateway

In Depth Analysis of Ringback for all VoIP and Analog Protocols

SIP profile setup. About SIP profile setup. SIP profile reset. SIP profile deletion

Cisco TelePresence Integration Guide Documentation for integrating Cisco CTS/TX TelePresence Systems with BlueJeans

Configuring Triggers. Viewing and Deleting Triggers

Spectrum Enterprise SIP Trunking Service Cisco Unified Communication Mgr Firmware 6.01 IP PBX Configuration Guide

Transcription:

Fixing SIP Problems with UC Manager & CUBE Normalization Tools Mark Stover, CCIE #6901 Consulting Systems Engineer

Agenda Introduction (Very) Brief Review of SIP When Things Don t Work Overview of SIP Normalization Methods Using IOS SIP Profiles Normalization Using Unified CM Normalization Scripts Using Unified CM Transparency Conclusion

Cisco Spark Ask Questions, Get Answers, Continue the Experience Use Cisco Spark to communicate with the Speaker and fellow participants after the session Download the Cisco Spark app from itunes or Google Play 1. Go to the Cisco Live Berlin 2017 Mobile app 2. Find this session 3. Click the Spark button under Speakers in the session description 4. Enter the room, room name = 5. Join the conversation! The Spark Room will be open for 2 weeks after Cisco Live 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 7

Brief Review of SIP

Basic Design SIP is a Client-Server Protocol Clients send requests, receive responses Servers receive requests, send responses Modeled after HTTP Text Encoded Protocol Client request response Server Each request invokes method on server Main purpose of request Messages contain bodies 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 9

SIP Methods and Messages SIP Messages have distinct parts: IP/TCP/UDP Envelope SIP Header SIP Message Body MIME-Encoded Session Description Protocol (SDP) May contain other data Call signaling performed by SIP Methods Six Original SIP Methods: INVITE ACK OPTIONS BYE CANCEL REGISTER 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 10

SIP Message Syntax Many header fields from http Payload contains a media description SDP Session Description Protocol INVITE sip:alice@company.com SIP/2.0 From: Bob <sip:bob@university.edu> To: Alice <sip:alice@company.com> Via: SIP/2.0/UDP pc.university.edu Call-ID: 199723450578@192.169.100.100 Content-type: application/sdp CSeq: 4711 INVITE Content-Length: 187 v=0 o=ccm-sip 2000 1 IN IP4 192.168.100.100 s=sip Call c=in IP4 192.168.200.200 m=audio 26542 RTP/AVP 0 8 18 101 a=rtpmap:0 PCMU/8000 a=ptime:20 a=mid:1 c=in IP6 2001:0db8:aaaa::0987:65ff:fe01:234b m=audio 26662 RTP/AVP 0 a=mid:2 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 12

SIP Transactions Fundamental unit of messaging exchange Request Zero or more provisional responses Usually one final response Maybe ACK All signaling composed of independent transactions Transactions identified by Cseq Sequence number Method tag Complete call from INVITE to BYE is a dialog Defines a call leg Maintains the same call-id and tags 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 15

When things don t work

Gather Information Logs are good: Will help you determine if SIP is the problem May not reflect what is really on the wire May not include the header level detail Packet Capture is your friend Various ways to gather traces Further discussion just ahead Review Paul Giralt s SIP Troubleshooting session for many more details: BRKUCC-2932 Troubleshooting SIP with Cisco Unified Communications Was delivered earlier this morning 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 19

Getting SIP Messages Four potential sources of SIP Message Information 1. Unified CM Trace Files 2. Unified CM Network Capture utils network capture 3. Cisco IOS Packet Capture IP Traffic Capture Feature 4. Network Packet Capture (Wireshark) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 20

Example of Unified CM Trace File 17:38:59.871 //SIP/SIPTcp/wait_SdlReadRsp: Incoming SIP TCP message from 192.168.100.100 on port 65067 with 1872 bytes: INVITE sip:4125551212@192.168.200.200:5060 SIP/2.0 Via: SIP/2.0/TCP 192.168.100.100:5060;branch=z9hG4bK1266281727 From: "Alice" <sip:918145551212@192.168.100.100>;tag=3e6d44cc-ce4 To: <sip:4125551212@192.168.200.200> Date: Wed, 12 Oct 2011 21:38:59 GMT Call-ID: 6E2FCA41-F45111E0-95FBF44A-5979DA79@192.168.100.100 Supported: 100rel,timer,resource-priority,replaces,sdp-anat Cisco-Guid: 1847785776-4098953696-3044132940-1967707264 User-Agent: Cisco-SIPGateway/IOS-12.x CSeq: 101 INVITE Timestamp: 1318455539 Expires: 180 Allow-Events: telephone-event Content-Type: multipart/mixed;boundary=uniqueboundary Mime-Version: 1.0 Content-Length: 929 --uniqueboundary Content-Type: application/sdp Content-Disposition: session;handling=required v=0 o=ciscosystemssip-gw-useragent 4535 5918 IN IP4 192.168.100.100 s=sip Call c=in IP4 192.168.100.100 t=0 0 m=audio 17620 RTP/AVP 0 100 101 c=in IP4 192.168.100.100 a=rtpmap:0 PCMU/8000 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 21

Using Wireshark 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 23

Determine Needed Results 1. Make calls in both directions: Get SIP Captures of test calls in both directions 2. Traces may give you a clue: Mismatch in domain names No domain in one direction Maybe the redirect number only has four digits 3. May have to research each system s SIP trunk requirements Compare it to the other vendor s normal operation 4. Use your research and troubleshooting to determine the fix: Change the domain name of messages from incorrectly configured system Add a missing domain Remove headers that cause a failure 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 24

Write, Test, and Deploy Use the desired result to formulate a plan Configure SIP Normalization to process appropriate headers Test against traffic on a SIP trunk that does not carry production traffic Deploy to production trunk and verify 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 25

SIP Transparency & Normalization vs. IOS SIP Profiles

SIP Transparency & Normalization Unified CM s Normalization Tool Provide an interface for customization of SIP messages Initially conceived for Cisco Unified CM Session Management Edition (SME) Also supports Cisco Unified Communications Manager without SME Available in Release 8.5 and later Include: A Lua execution environment SIP Transparency & Normalization APIs Support: Transparent passing of SIP information from one call leg to another Normalizing SIP Messages to provide interoperability 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 27

IOS SIP Profiles Unified Border Element s (CUBE) Normalization Tool Key Cisco Unified Border Element (CUBE) function Customize SIP messaging to enable session negotiation with SIP Service Provider (to meet policy and security needs) Resolve incompatibilities between SIP devices inside the enterprise network Use IOS feature navigator to confirm minimum version requirements First available in IOS 12.4.15XZ Inbound SIP Profiles available in IOS 15.4.2T Uses regular expressions to match and replace fields in SIP messages 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 28

New Features in IOS SIP Profiles New Normalization and Transparency features continue to be added Inbound SIP Profiles available in IOS 15.4(2)T (CUBE 10.0.1) New features in IOS 15.5(2)T (CUBE 11.0): SIP Profile Rule Tags Normalization support for non-standard SIP Headers SDP Pass-Through and Normalization in IOS 15.6 (1)T (CUBE 11.5) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 29

Normalization Comparison What s the difference between SIP Profiles and SIP T&N Feature IOS SIP Profiles SIP T&N Platform CUBE Unified CM Outbound Messages Yes Yes Inbound Messages Yes (15.4.2T) Yes Transparency SDP Only (15.6.1T) Yes Programmability Match, Replace, Copy Lua Scripting Matching RegEx (egrep) Lua Matching (globbing) Conditionals & Loops No Yes Headers (Std & Non-Std) Yes Yes Message Body SDP Only Any 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 30

Overview of SIP Profiles Normalization

IOS SIP Profiles Unified Border Element s (CUBE) Normalization Tool CUBE supports normalization of SIP messages Includes add/remove/modify/copy of headers in a SIP message SIP Profiles feature added in 12.4(20)T and enhanced in 15.1(3)T and 15.4(1)T Inbound SIP Profiles available in IOS 15.4(2)T Inbound normalization takes place before regular SIP call processing CUBE acts as if it directly received the normalized message 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 32

What can SIP Profiles normalization change? Add, modify, remove or copy any SIP or SDP header value in a SIP message Can not remove or add mandatory SIP headers Only the modify option is available for mandatory headers Mandatory SIP headers include: To From Via Cseq Call-Id Max-Forwards Mandatory SDP headers include: v, o, s, t,c, and m 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 34

Using IOS SIP Profiles Normalization

Putting SIP Profiles to Work Using profiles to manipulate SIP messages SIP profiles can be configured either at the dial-peer or global levels Message modification uses a subset of standard regular expressions to match and replace fields Modification can also be used to change a header name to the compact form For example, From to f By default, IOS never sends the compact form (it receives either long or short form) SIP Profiles cannot modify compact form headers Changes made to messages are not remembered by CUBE Content-length field is recalculated after normalization is applied 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 37

Using Wild Cards in Rules ANY keyword indicates that a rule will be applied to any message within the specified category Note that rules configured for an INVITE message only apply to the first INVITE in the call REINVITE supports operations needed on subsequent INVITEs in the call 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 38

Using SIP Profiles: Adding Headers Add new information that might be missing from a message s SIP or SDP Headers Useful for adding fixed value headers to SIP Messages Used for: Adding new headers to SIP Requests or Responses Adding new SDP headers to specific SDP lines 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 39

Example: Adding Headers Adding a Retry-After Header Incoming Outgoing 480 Temporarily Not Available CUBE 480 Temporarily Not Available Retry-After: 60 voice class sip-profiles 10 response 480 sip-header Retry-After add Retry-After: 60 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 40

Example: Adding Headers Adding a Retry-After Header Incoming Outgoing 480 Temporarily Not Available CUBE 480 Temporarily Not Available Retry-After: 60 voice class sip-profiles 10 rule 10 response 480 sip-header Retry-After add Retry-After: 60 Note that, rule tagging is a new CUBE feature in IOS 15.5(2)T 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 41

Using SIP Profiles: Removing Headers Provides the ability to remove a message s SIP or SDP Headers Used for: Removing an incompatible header Discarding internal information not needed by SIP Service Provider 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 42

Using SIP Profiles: Modifying Messages Using regular expressions to match and replace fields Add fixed strings to existing header Substrings that have been matched can be part of replacement patterns When multiple rules apply to the same header, the second rule applies to the result string of the first rule Used for: Adding parameters to a header Modifying the URI Changing SDP 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 44

Example: Modifying Headers (1) Modify the originator SDP o= line Incoming INVITE sip:5551000@sip.com:5060 SIP/2.0 o=ciscosystemssip-useragent 4535 5918 IN IP4 192.168.100.100 CUBE Outgoing INVITE sip:5551000@sip.com:5060 SIP/2.0 o=ua 4535 5918 IN IP4 192.168.100.100 voice class sip-profiles 30 request INVITE sdp-header Session-Owner modify CiscoSystems-SIP-UserAgent UA 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 45

Example: Modifying Headers (2) Change anonymous to a directory number Incoming INVITE sip:5551000@sip.com:5060 SIP/2.0 From: <sip:anonymous@public.com:5060> CUBE Outgoing INVITE sip:5551000@sip.com:5060 SIP/2.0 From: <sip:5551212@public.com:5060> voice class sip-profiles 40 request INVITE sip-header From modify sip:anonymous@" sip:5551212@ 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 46

Using SIP Profiles: Copying Header Information Matched substrings can be saved in variables to copy into another header Variables u01 to u99 are shared by inbound and outbound SIP Profiles Can be used to copy information from inbound message to outbound message Uses peer-header feature of SIP Profiles Can use additional rules to modify the copied information Used for: Duplicating content of existing header to another header 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 47

Example: Copying Headers Copying phone number to Request URI Incoming INVITE sip:tjones@sip.com:5060 SIP/2.0 To: tjones <5551000@sip.com:5060> CUBE Outgoing INVITE sip:5551000@sip.com:5060 SIP/2.0 To: tjones <5551000@sip.com:5060> voice class sip-profiles 50 request INVITE sip-header To copy "sip:(.*)@" u01 request INVITE sip-header SIP-Req-URI modify ".*@(.*)" "INVITE sip:\u01@\1" 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 48

Inbound versus Outbound SIP Profiles SIP profiles applied to outgoing SIP messages by default Outbound rules are applied as the last step before the message leaves CUBE Normalization is after destination dial-peer matching has taken place Changes to the SIP message are not remembered after the message is sent SIP profiles can also be applied to incoming SIP messages Inbound rules are first applied as the message enters CUBE Normalization is done prior to dial-peer matching CUBE will perform a preliminary match to determine if inbound SIP Profile exists After normalization, final dial peer will be chosen 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 49

Some Inbound SIP Profile Notes Incoming messages can contain multiple instances of same header For example, an INVITE can have multiple Diversion headers Header values will be in a comma separated list Must keep this in mind if you plan to modify these headers If preliminary inbound dial-peer matching fails, Inbound SIP Profiles attached to dial peers will not run Could happen if the inbound message has an invalid Request URI A global Inbound SIP profile could be used, but use caution Performing SIP normalization will add extra processing logic, which slightly reduces CUBE performance 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 50

Enabling Inbound SIP Profile Feature Inbound SIP Profile has to be enabled at global level for normalizing incoming messages Configuration Example voice service voip sip sip-profiles inbound 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 51

Enabling Outbound SIP Profile Dial-Peer Profile Configuration Outbound SIP Profile removes the Cisco-Guid from any message leaving CUBE via specified Dial-Peer Configuration Example: voice class sip-profiles 20 rule 10 request ANY sip-header Cisco-Guid remove rule 20 response ANY sip-header Cisco-Guid remove dial-peer voice 10 voip voice-class sip profiles 20 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 52

Troubleshooting Commands Debug and Show Debug commands: debug ccsip info debug ccsip feature sip-profile debug ccsip error debug ccsip message Show commands: Verify the SIP Profile is assigned to a dial-peer: show dial-peer voice 1 include sip profile 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 53

Troubleshooting Sample sip profile to change user part of From header from anonymous to some value. voice class sip-profiles 1 request INVITE sip-header FROM modify "sip:anonymous@" "sip:1234@" INVITE sip:1111@192.168.1.1:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.2.1;branch=z9hG4bK-24227-1-0 From: anonymous <sip:anonymous@192.168.2.1:9232>;tag=1 To: 1111 <sip:1111@192.168.1.1:5060> Call-ID: 1-24227@192.168.2.1 Sample log: Sample incoming message with From header set to anonymous. Jan 17 18:24:00 EST: //-1/xxxxxxxxx/SIP/Info/verbose/64/ccsip_inbound_profile_populate_callinfo_in_ccb: Dialpeer 1 is used for inbound profiles config Jan 17 18:24:00 EST: //-1/xxxxxxxxx/SIP/Info/info/64/sipSPISetSipProfilesTag: voice class SIP Profiles inbound tag is set : 1 Jan 17 18:24:00 EST: //-1/xxxxxxxxx/SIP/Info/info/64/sip_profiles_application_modify_remove_header: Header before modification : From: sipp <sip:anonymous@192.168.2.1:9232>;tag=1 Jan 17 18:24:00 EST: //-1/xxxxxxxxx/SIP/Info/info/64/sip_profiles_application_modify_remove_header: Header after modification : From: sipp <sip:1234@192.168.2.1:9232>;tag=1 From header after modification Sip profile invoked for modifying the message is displayed here 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 54

The SIP Profile Generation Tool BU had a web-based tool to help build SIP Profiles Paste in messages, edit what you need, see the rule Officially unsupported after release of SIP Profile Test Tool Still available to Cisco internally at: http://cantor.cisco.com/sip-profilesgen.html 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 55

SIP Profile Test Tool Web-based tool to validate SIP Profiles https://cway.cisco.com/tools/sipprofiletest/ Checks SIP Profile syntax Use sample SIP messages to test SIP Profile logic Understand features and limitations of RegEx for SIP Profiles Takes the palce of the SIP-Profile Generation Tool 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 60

SIP Profile Test Tool https://cway.cisco.com/tools/sipprofiletest/ 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 62

Dialed Number Analyzer (DNA) for CUBE https://cway.cisco.com/tools/dnacube Features Use Cases Emulation of CUBE Dial-Plan validation E164 and URI Call Routing Features 2 Input modes E164 and SIP Message Understand Call routing logic Pre-deployment config validation Interoperability Testing 10 Call Routing features Output SIP Invite Generation Real-time config editing and testing 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 64

SIP Profiles Case Study

Case Study-Problem Statement Forwarded PSTN calls fail Customer has SIP trunks configured to the SIP service provider Unified CM configured to turn 4-digit extension into a valid E.164 number Dialed calls to the PSTN are completed Calls forwarded to PSTN fail Let s look at the problem 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 66

SIP Headers for Forwarded Call INVITE sip:4125553000@192.168.1.1:5060 SIP/2.0 Via: SIP/2.0/TCP 192.168.2.2:5060;branch=z9hG4bK12b5cc229a69621 From: Mark" <sip:8145551212@192.168.2.2>;tag=16101269~0458486e-22501993c802-145785687 To: <sip:4125553000@192.168.1.1> CSeq: 101 INVITE Cisco-Guid: 3386501632-0000065536-0002912165-2768792774 Diversion: <sip:1200@192.168.2.2>;reason=unconditional;privacy=off;screen=yes Content-Length: 0 Diversion Header contains internal Extension (x1200) Cisco-Guid meaningless outside enterprise 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 67

Tackling the Problem (1) Removing Cisco-Guid Removing Cisco-Guid from all requests and responses is straightforward No downside on trunks to SIP SP since it has no meaning outside enterprise SIP profile rules: request ANY sip-header Cisco-Guid remove response ANY sip-header Cisco-Guid remove 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 68

Tackling the Problem (2) Modifying Diversion Header Need to add the required E.164 digits to the extension in the Diversion Header Take advantage of the dial-plan All internal extensions have the format 1xxx Insert the digits 814555 in front of the extension Match the 1200@ in Diversion Header and capture the extension: (1 )@ Replace the match with 8145551200@ using the captured digits (\1): 814555\1@ Complete SIP profile rule: request INVITE sip-header Diversion modify (1 )@ 814555\1@ 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 69

Complete the Configuration Applying the SIP Profile rules to outgoing dial-peer Sample Configuration: voice class sip-profiles 100 request ANY sip-header Cisco-Guid remove response ANY sip-header Cisco-Guid remove request INVITE sip-header Diversion modify (1 )@ 814555\1@! dial-peer voice 100 voip voice-class sip profiles 100! 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 70

Verify Results of SIP Profiles INVITE sip:4125553000@192.168.1.1:5060 SIP/2.0 Via: SIP/2.0/TCP 192.168.2.2:5060;branch=z9hG4bK12b5cc229a69621 From: Mark" <sip:8145551212@192.168.2.2>;tag=16101269~0458486e-22501993c802-145785687 To: <sip:4125553000@192.168.1.1> CSeq: 101 INVITE Diversion: <sip:8145551200@192.168.2.2>;reason=unconditional;privacy=off;screen=yes Content-Length: 0 Diversion Header normalized to E.164 Cisco-Guid removed 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 71

Overview of SIP Transparency & Normalization

SIP Normalization The process of transforming inbound and outbound SIP messages Inbound normalization makes the SIP message useable by Unified CM For Example, how can we handle SIP redirecting numbers? Unified CM uses the Diversion header for redirecting number(s) Other SIP devices use the History-Info header for this purpose Normalization can transform History-Info headers into Diversion headers Outbound normalization makes the SIP message useable by another SIP device Use normalization to transform Unified CM s Diversion headers into History-Info headers for another SIP PBX 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 76

What can a normalization script change? Manipulate almost every aspect of a SIP message Currently, SIP Normalization can change: The request URI The response code and phrase SIP headers SIP parameters Content bodies SDP 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 77

Normalization Script Examples Reorder codecs in the SDP of an early offer Remove specific headers such as Cisco-Guid Mask the number to E.164 in a Diversion header to meet Service Provider requirements Fix the domain name of a system with the wrong one using a configured parameter in Unified CM Convert IP addresses to domain names Add content to the SIP Message Body 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 78

Case Study-Problem Statement Customer has several PBXs trunked to a Unified CM cluster Unified CM SIP trunked to a 3rd-party voice mail system After multiple call forwards, some calls are sent to voice mail Most calls go to the correct voice mail box Calls from one PBX did not In the broken case: Reaching the greeting for the station that finally forwarded the call to voice mail Not reaching the voice mail of the station originally called Will solve this problem with SIP Normalization in just a little while 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 79

Using Unified CM Normalization Scripts

Putting SIP Normalization to Work Using message handlers to manipulate SIP messages Message Handler name tells you: When the Handler will be invoked (entering or leaving) What type of message the Handler is for (SIP Method) To have a script process the INVITEs received by Unified CM: Script should have an inbound_invite message handler That message handler will run when an inbound INVITE is received A single parameter called msg represents the SIP Message in script Scripts use Cisco SIP Message API to access and manipulate the message Let s try looking at a diagram 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 81

How a Normalization Script Gets Run 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 82

How a Normalization Script Gets Run 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 83

How a Normalization Script Gets Run 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 84

How a Normalization Script Gets Run 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 85

How a Normalization Script Gets Run 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 86

How a Normalization Script Gets Run 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 87

How a Normalization Script Gets Run 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 88

How a Normalization Script Gets Run 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 89

Let s Start with a Simple Script Need to convert incoming History-Info headers into Diversion headers Script will run when Unified CM receives an INVITE Need to remove Cisco-Guid from outgoing headers Script will run when Unified CM sends an INVITE 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 90

Our First SIP Normalization Script M = {} function M.inbound_INVITE(msg) msg:converthitodiversion() end function M.outbound_INVITE(msg) msg:removeheader("cisco-guid") end return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 91

Focus on SIP Normalization Script - 1 M = {} Creates an empty Lua Table called M for all Handlers M is also the name of the Lua Module function M.inbound_INVITE(msg) msg:converthitodiversion() end function M.outbound_INVITE(msg) msg:removeheader("cisco-guid") end return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 92

Focus on SIP Normalization Script - 2 M = {} function M.inbound_INVITE(msg) end msg:converthitodiversion() Inbound INVITE Message Handler Inbound SIP Message accessed through msg Invokes an API call to perform the actual conversion function M.outbound_INVITE(msg) msg:removeheader("cisco-guid") end return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 93

Focus on SIP Normalization Script - 3 M = {} function M.inbound_INVITE(msg) msg:converthitodiversion() End function M.outbound_INVITE(msg) end msg:removeheader("cisco-guid") Outbound INVITE Message Handler Outbound SIP Message accessed through msg Invokes API call to remove a header (in this case, Cisco-Guid) return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 94

Focus on SIP Normalization Script - 4 M = {} function M.inbound_INVITE(msg) msg:converthitodiversion() end function M.outbound_INVITE(msg) msg:removeheader("cisco-guid") end return M Line is required Returns the Lua Table containing the message handlers to Unified CM execution environment Cisco SIP Lua Environment uses Table M to identify the message handlers 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 95

SIP Message Handler Formalities Each Transparency and Normalization script provides: Set of call-back functions to manipulate SIP messages Call-back functions are called message handlers The message handler s name indicates when a handler is invoked Only one Script per SIP Trunk or SIP Device All message handlers in that single script Can mix and match methods and directions in a single script Handlers for requests and responses have slightly different formats Will be covered next 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 96

Request Message Handlers Request message handler is named by combining: the SIP message direction AND the SIP method name Method name from the 'request line' of the SIP message Request format: <direction>_<method> Examples: inbound_invite outbound_update 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 97

Using Wild Cards in Request Message Handlers Recall that the Request format is: <direction>_<method> Wildcard ANY can be used in place of <method> <direction> does not support a wild card Valid Request Message Handler Names: M.inbound_INVITE M.inbound_ANY M.outbound_ANY Invalid Name: M.ANY_INVITE 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 98

Response Message Handlers Response message handler is named by combining 3 items: 1. the message direction 2. the response code 3. the SIP method Identify the method name from the CSeq header Response format: <direction>_<response code>_<method> Examples: inbound_183_invite inbound_200_invite outbound_200_update 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 99

Using Wild Cards in Response Message Handlers Replace <method> with ANY Replace <response code> with ANY <method> and <response code> can both be ANY <direction> does not support a wild card Cannot have a wildcard ANY <method> with a specific <response code> A wildcard character X can be used in <response code> 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 100

Wild Card Examples (Response Message Handlers) Valid Response Message Handler Names M.inbound_183_INVITE M.inbound_18X_INVITE M.outbound_ANY_INVITE M.outbound_ANY_ANY Invalid Response Names M.inbound_183_ANY (specific <response code> with ANY <method>) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 101

Rules for picking a message handler For Your Reference Unified CM uses these rules to choose a message handler: Message handlers are case-sensitive The direction is either inbound or outbound The direction is always written as lowercase The message direction is relative to Unified CM Note: The message direction has nothing to do with the dialog direction of the SIP session The method name in the SIP message is converted to uppercase to pick the message handler Longest match criteria: Unified CM uses the longest-match to choose the message handler A script has two message handlers: inbound_any_any and inbound_183_invite A 183 response is received by Unified CM The inbound_183_invite handler will be executed since it is the longest match 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 102

APIs for SIP and SDP Normalization SIP Messages APIs: Allows script to manipulate the SIP message SDP APIs: Allows script to manipulate the SDP SIP Pass Through APIs: Allows script to pass information from one call leg to another SIP Utility APIs: Utilities to manipulate header data such a parsing URIs into a SIP URI object SIP URI APIs: Allows script to manipulate the parsed SIP URI object Trace APIs: Allows script to enable, disable and manage tracing Script Parameters API: Allows script to obtain trunk or line specific parameters 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 104

Unified CM Normalization Case Study

Case Study Calls going to the wrong mail box Customer has several PBXs trunked to Cisco Unified CM Unified CM interfaced to a 3rd-party voice mail system via SIP Calls sent to voice mail after multiple call forwards Most calls were going to the correct voice mail box Calls from one PBX were not In the broken case, calls were going to the voice mail box of the last station the call was forwarded to Let s look in detail at these call flows 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 107

Case study call flow 5 Call from PSTN for x1100 1 Call from PSTN for x2100 6 Call Forward All to x1200 Bad Result 7 8 No Answer to Voice Mail Greeting for x1200 4 Greeting for x2100 2 Call Forward All to x2200 Good Result 3 No Answer to Voice Mail 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 108

Problem: SIP header from call to wrong mail box INVITE sip:4125553000@192.168.1.1:5060 SIP/2.0 Via: SIP/2.0/TCP 192.168.2.2:5060;branch=z9hG4bK12b5cc229a69621 From: "PSTN" <sip:8145551212@192.168.2.2>;tag=16101269~0458486e-22501993c802-145785687 To: <sip:4125553000@192.168.1.1> Date: Wed, 19 Dec 2012 16:45:01 GMT Call-ID: c9d9ea00-eef16a0d-46c59c-a5086cc6@192.168.2.2 Supported: 100rel,timer,resource-priority,replaces User-Agent: Cisco-CUCM8.5 Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY CSeq: 101 INVITE Expires: 180 Call-Info: <sip:192.168.2.2:5060>;method="notify;event=telephone-event;duration=500" Cisco-Guid: 3386501632-0000065536-0002912165-2768792774 Diversion: <sip:4125551200@192.168.2.2>;reason=no-answer;privacy=off;screen=yes Diversion: <sip:4125551100@192.168.2.2>;reason=unconditional;privacy=off;screen=yes Contact: sip:8145551212@192.168.2.2:5060;transport=tcp Content-Length: 0 Call goes to x1200 greeting instead of x1100 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 109

What the script will have to accomplish Keep it simple & just remove the headers we don t need for voice mail 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 110

Minimal Normalization Script for outbound INVITEs M = {} function M.outbound_INVITE(msg) -- Process outbound INVITES to VM -- Process INVITE to normalize it... end return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 111

Add logic to remove extra Diversion Headers -- Get all Diversion Headers local DiversArray = msg:getheadervalues("diversion ) local DiversCount = #DiversArray if DiversCount > 1 then for I = 1, (DiversCount - 1) do -- Number of Diversion Headers -- Only if there s more than one -- Remove all but last header -- remove a Diversion Header msg:removeheadervalue("diversion", DiversArray[I]) end end 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 112

Completed Script M = {} function M.outbound_INVITE(msg) local DiversArray = msg:getheadervalues("diversion ) local DiversCount = #DiversArray if DiversCount > 1 then for I = 1, (DiversCount - 1) do -- Process outbound INVITES to VM -- Get all Diversion Headers -- # of Diversion Headers in Invite -- Only if there s more than one -- Remove all but last header msg:removeheadervalue("diversion", DiversArray[I]) -- remove a Diversion Header end end end return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 113

Deploy the script to Unified CM Now that we have a script, what do we do with it? Apply it to the voice mail SIP trunk in Unified CM: 1. Add a SIP Normalization Script 2. Can be imported from a text file or copy/paste 3. Save the Script 4. Apply the Script to the appropriate SIP trunk 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 114

Add a SIP Normalization Script 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 115

Import the Script 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 116

Configure and save the Script 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 117

Apply the Script to the SIP trunk 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 118

Verify that your script fixes the problem INVITE sip:4125553000@192.168.1.1:5060 SIP/2.0 Via: SIP/2.0/TCP 192.168.2.2:5060;branch=z9hG4bK12b5cc229a69621 From: "PSTN" <sip:8145551212@192.168.2.2>;tag=16101269~0458486e-22501993c802-145785687 To: <sip:4125553000@192.168.1.1> Date: Wed, 19 Dec 2012 16:45:01 GMT Call-ID: c9d9ea00-eef16a0d-46c59c-a5086cc6@192.168.2.2 Supported: 100rel,timer,resource-priority,replaces User-Agent: Cisco-CUCM8.5 Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY CSeq: 101 INVITE Call-Info: <sip:192.168.2.2:5060>;method="notify;event=telephone-event;duration=500" Cisco-Guid: 3386501632-0000065536-0002912165-2768792774 Session-Expires: 1800 Diversion: <sip:4125551100@192.168.2.2>;reason=unconditional;privacy=off;screen=yes Contact: sip:8145551212@192.168.2.2:5060;transport=tcp Content-Length: 0 Call now goes to x1100 greeting (1 Diversion Header) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 119

Revisiting Use Last Diversion Header Same symptoms, different cause Thought this had been solved Another customer had calls to voicemail going to the wrong destination Discovered there were multiple Diversion Headers Diversion: Doe, John" <sip:jdoe@192.168.3.3>;reason=no-answer;privacy=off Diversion: Doe, John" <sip:1000@192.168.3.3>;reason=no-answer;privacy=off" Because of the comma in the Header, it breaks the processing It actually causes an issue with the SIP Normalization API The Headers are parsed into a Lua Table using commas and <CR><LF> 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 120

Some Common Scripting Forms

Navigating Script Formats Sample Normalization Scripts are available Can be confusing, not all scripts follow same format Scripts follow two basic formats: Function Name made up of the direction and SIP method example: function M.inbound_INVITE(msg) Function Name indicates purpose, but not direction or SIP Method example: function add_reply_to_header(msg) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 124

Name = Direction + Method Good: Know exactly what SIP messages will be acted on Bad: M = {} function M.inbound_INVITE(msg)... (function code)... end return M Cannot reuse the function for anything else Need to repeat the code to duplicate processing on outbound INVITE 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 125

Example: Name with Purpose M = {} local function add_reply_to_header(msg)... (function code)... end M.outbound_INVITE = add_reply_to_header return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 126

Name with Purpose Good: Function name describes exactly what it does Can reuse the function without repeating it To use add_reply_to_header for inbound INVITES: M.inbound_INVITE = add_reply_to_header To use add_reply_to_header for outbound INVITES: M.outbound_INVITE = add_reply_to_header Bad: Might search through entire script to figure out the direction and SIP Method 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 127

Setting a Script Parameter Access Unified CM Admin Set on the SIP Trunk Configuration page Must know the Parameter Name from the script Parameters are not indexed by Unified CM No pick-list provided 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 128

Using Script Parameters SIP T&N allows you to set script parameters Available in Unified CM Admin pages Allows deployment of a generic script Provide script with site settings at load time Use same script in multiple locations without rewriting Example: local mydomain = scriptparameters.getvalue("localdomain") local fqdn = host..... mydomain 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 129

Enabling Tracing in Scripts Scripts can write trace information to Unified CM logs Tracing must be enabled in BOTH: Your script Unified CM Configuration Can embed tracing in every script: Use for testing and troubleshooting Disable from Unified CM Admin in production to optimize performance Trace output added to Unified CM SDI Trace 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 130

Enabling Tracing from Unified CM 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 131

Adding Tracing to Your Scripts trace.enable() function M.inbound_NOTIFY(msg) local callid = msg:getheader("call-id") trace.format("m.inbound_notify: callid is '%s'", callid) trace.format(" -- missing URI host, no changes made") 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 132

Bonus Case Study and More Normalization Examples

MWI Lights Don t Light Adapting SIP Notify Problem: Unity Connection provides voicemail for user on multiple vendor PBXs Unity Connection homed to Unified CM SME SME connects to other PBXs via SIP One vendors PBX fails to update MWI status Initial Troubleshooting: Gathered traces: SIP Notify being sent to system Opened case with vendor Software release running on system needs Message-Account in the Notify 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 134

Examining the Problem Carefully Discover that Message-Account isn t a SIP Header at least for this release Message-Account should be in the content body Oh, and by the way Can you make sure it is right after the Messages-Waiting line That s a bit more complicated Can t do this with CUBE Need to use Unified CM Normalization 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 136

Tackling the Problem Can use the geturi( To ) function to grab the To: header like before You can t edit the content body in place: Read the body and save it: getcontentbody() Delete the current body: removecontentbody() Add updated body: addcontentbody() 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 137

Updating the Content Body Before and After Content-Body from Unity Connection: Messages-Waiting: yes Voice-Message: 5/0 (0/0) Fax-Message: 0/0 (0/0) Content-Body desired: Messages-Waiting: yes Message-Account: sip:5000@10.10.10.10 Voice-Message: 5/0 (0/0) Fax-Message: 0/0 (0/0) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 139

Build the Script Basics M = {} function M.outbound_NOTIFY(msg)... end return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 140

Create the Message-Account Line -- Get the URI from To: and extract user and host local uristring = msg:geturi("to") local nuri = siputils.parseuri(uristring) nuser = nuri:getuser() nhost = nuri:gethost() -- Build the Message-Account line ma = string.format( Message-Account: sip:%s@%s\r\n, nuser, nhost) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 141

Update the Content Body -- Set the content type of the body local ct = "application/simple-message-summary" -- Get the existing content body local cb = msg:getcontentbody(ct) -- Build a new content body local ncb = string.gsub(cb, "Messages%-Waiting%:%s%w+%c+", "%0".. ma) -- Have to remove the existing content body and re-add msg:removecontentbody(ct) msg:addcontentbody(ct, ncb) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 142

Example: Dealing with Phone Displays Adapting content of SIP INVITE to device types Problem: Some SIP phones have limited display space Typically, provisioned name & number delivered to phone User prefers number if they can t see both 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 144

Solution Basics Takes some simple string matching, but relatively straightforward to remove name from 'From:' header frmhdr = msg:getheader( From ) newfrmhdr = string.gsub( frmhdr,.*<sip:, <sip: ) Then, use the API to modifyheader: msg:modifyheader( From, newfrmhdr) 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 145

Validating the Solution 'From:' header in INVITE no longer has name...but UPDATE during dialog still includes name Script needs a slight modification to handle both methods 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 146

Use Name with Purpose for Final Script M = {} local function remove_from_caller_name(msg) frmhdr = msg:getheader( From ) newfrmhdr = string.gsub('frmhdr', '.*<sip:', '<sip:') msg:modfiyheader( From, newfrmhdr) end M.inbound_INVITE = remove_from_caller_name M.inbound_UPDATE = remove_from_caller_name return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 147

In Case of SDP Manipulation M={} local function remove_x_cisco(msg) local sdp = msg:getsdp() if sdp then sdp = sdp:removeline("a=x-cisco-media:", "umoh") msg:setsdp(sdp) end end M.outbound_ANY = remove_x_cisco return M 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 148

Overview of Unified CM Transparency

Some SIP Transparency Background Unified CM is a B2BUA, so it consumes SIP headers that pass through: That s true for KNOWN headers (there s a list of 71 of them) Unknown headers pass through transparently Transparency feature allows you to take information from known headers and preserve it as the call legs pass across Unified CM Unified CM can transparently pass: Parameters Unknown headers Unknown content-bodies 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 151

SIP Objects and Transparency support Transparency is limited to INVITE dialogs on SIP trunks Transparency scripts can pass almost any information in a SIP message SIP Headers SIP Parameters Content Bodies These SIP objects do not support Transparency scripts SUBSCRIBE dialogs PUBLISH out-of-dialog REFER out-of-dialog unsolicited NOTIFY MESSAGE 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 152

Why Use SIP Transparency? 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 153

Why Use SIP Transparency? Unified CM acting as SME will begin routing calls between PBX-A and PBX-Z 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 154

What Unified CM Does to Your 181 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 155

What We Want Unified CM to do 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 156

How Can Transparency Preserve 181 Fact 1: Unified CM consumes Reason header it is a known header Fact 2: The transparency feature lets you pass unknown headers through Unified CM Fact 3: Goal is to preserve the 181 Call is being forwarded Therefore Place in an unknown header when it ingresses Unified CM Restore the 181 as it egresses Unified CM 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 157

On Inbound 1. Invoked when Unified CM receives a 181 Response in an INVITE dialog 2. Create the PassThrough message block 3. Get the Reason header contents 4. Add the contents to an unknown X-Reason header B = {} function B.inbound_181_INVITE(msg) local pt = msg:getpassthrough() local rson = msg:getheader("reason") if pt and rson then pt:addheader("x-reason", rson) end end return B 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 158

What Happens after INBOUND Script Runs Unified CM Processes the SIP Message Because the reason is preserved in the X-Reason header: Unified CM will not consume it (in is an unknown header) It is preserved through call processing in the pass-through object Unified CM will consume the actual 181 Response and Unified CM will create a new 180 Response to take it s place The 180 Response still contains the pass-through object The 180 Response is now ready for OUTBOUND Processing 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 159

On Outbound A = {} function A.outbound_180_INVITE(msg) local reason = msg:getheader("x-reason") if reason then if string.find(reason, "cause=181") then msg:setresponsecode(181,"call is being forwarded") msg:addheader("reason", reason) end msg:removeheader("x-reason") end end return A 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 160

Conclusion

How to Choose Your Tool Should I pick Unified CM or IOS There is overlap between what you can accomplish with both tools Some things to consider when choosing a tool: What does the call flow look like? Programming versus Match/Replace? Knowledge of Language (Lua vs. RegEx)? Is the right version available? Are needed features available? 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 162

Make a Plan and Practice Patience If you can identify the problem, you can fix it Traces and packet captures are your friend All normalization scripts or expressions have same beginnings Transparency relies on turning known headers into unknown ones Test, write, test, fix, test, then go to production 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 163

Next Steps Use the available resources to learn more I ve listed many in the following slides Use the Appendix to this deck Introduction to Lua Some additional Normalization examples Start small, and build on your knowledge 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 164

Resources Unified CM Transparency & Normalization SIP Chapter in Unified CM System Guide: http://www.cisco.com/en/us/docs/voice_ip_comm/cucm/admin/10_0_1/ccmsys/cucm_ BK_SE5FCFB6_00_cucm-system-guide-100_chapter_0101000.html Developer Guide for SIP Transparency and Normalization http://www.cisco.com/en/us/docs/voice_ip_comm/cucm/sip_tn/9_1_1/sip_t_n.html Cisco Interoperability Portal http://www.cisco.com/go/interoperability Cisco Developer Network http://developer.cisco.com/ 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 165

Resources IOS SIP Profiles Configuration Note for CUBE SIP Normalization: http://www.cisco.com/c/en/us/support/docs/voice-unified-communications/unifiedborder-element/105624-cube-sip-normalization.html SIP Configuration Guide (15M&T) http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/voice/sip/configuration/15-mt/sipconfig-15-mt-book.html CUBE Configuration Guide for SIP Profiles http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/voice/cube/configuration/cubebook/voi-sip-param-mod.html#reference_869720458984374988879107666015624 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 166

Resources: Where to Ask Questions Cisco Developer Network has a SIP Transparency and Normalization Forum Part of the SIP Developer Portal Post questions there and interact with other developers 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 167

Complete Your Online Session Evaluation Please complete your Online Session Evaluations after each session Complete 4 Session Evaluations & the Overall Conference Evaluation (available from Thursday) to receive your Cisco Live T-shirt All surveys can be completed via the Cisco Live Mobile App or the Communication Stations Don t forget: Cisco Live sessions will be available for viewing on-demand after the event at CiscoLive.com/Online 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 168

Continue Your Education Demos in the Cisco campus Walk-in Self-Paced Labs Lunch & Learn Meet the Engineer 1:1 meetings I am on call from 14:00-16:00 Today Related sessions 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 169

Q & A

Thank You

Appendix Overview of Lua & Lua Programming Additional SIP Normalization Scripts

Overview of Lua

What is Lua? A powerful, fast, lightweight, embeddable scripting language A fast language engine with a small footprint that can embed easily into other applications Lua has a simple and well documented API that allows strong integration with code in other languages Adding Lua to an application does not bloat it Many more details about Lua can be found online: http://www.lua.org/about.html http://www.lua.org/manual/5.2/ 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 175