Showing results for 
Search instead for 
Did you mean: 


Add route group to outbound SIP invite via LUA

I am trying to get CM 10.5 to pass the route group to an IOS SIP gateway. I get the kind of information I want coming inbound from the SIP gateway. See the following.


Via: SIP/2.0/UDP;x-route-tag="tgrp:PRIPSTN";branch=z9hG4bK59C2575B


The PRI where this call came in is in a trunk group called "PRIPSTN". I want CM to add that to outbound invite to the gateway. I am thinking it would look something like this.


M = {}
function M.outbound_INVITE(msg)
    msg:addHeaderValueParameter("Via", "x-route-tag", "$some_variable")
return M


I have been unable to locate a document that tells me what info/variables are available for this. It seems like it should be simple.

Rising star

Re: Add route group to outbound SIP invite via LUA

Hi There,



Based on your description, I think what you are trying to do is influence which trunk group is used on your VGW by adding in the x-route-tag to the outbound SIP invite from CUCM?


If so, this is not possible to accomplish using the method you have described. All voice gateways route calls by matching an inbound and outbound dial-peer. A good explanation to the options you have available to you for inbound and outbound dial-peer matching can be found here:


A better way of influencing which trunk group an outbound call from CUCM would utilize on a VGW is through carefully considered inbound/outbound dial-peers on the VGW.


For example, for the types of calls you would like to force out the PRI you could pre-pend a steering code to the called number on CUCM, and then match the steering code on your inbound and outbound dial-peers.


Here is one example of how this could be done for a single destination number.


Example call flow (simplified):

  1. User dials 9-604-555-1234 (we would like to force this destination out a particular trunk-group)
  2. Route-pattern on CUCM for 96045551234 sends the call to the VGW Route List. The route pattern also translates the called number to 010#6045551234 before sending the call to the VGW.
  3. Inbound VOIP dial-peer on VGW matches on called number of 010#6045551234
    • incoming called-number 010#6045551234
  4. Outbound dial-peer POTS dial-peer on VGW which points to your chosen trunk group matches on the steering code as well.
    • destination-pattern 010#T

Does this help? Or is my assumption incorrect on what you are trying to accomplish?





Re: Add route group to outbound SIP invite via LUA

You are correct about what I am trying to do. However, there are other ways of matching incoming dial peers including "incoming uri". I have used that in several places to match an incoming dial peer based on the "To:" IP address in the URI, and that is what I would like to do here. I thought about doing a different set of translation patterns and route patterns, but this seems like it would be a smaller footprint. Besides, I am intrigued to learn something about LUA scripts.

CreatePlease to create content
Content for Community-Ad

Cisco COVID-19 Survey