WEBVTT 00:00:00.000 --> 00:00:03.816 align:middle line:90% 00:00:03.816 --> 00:00:07.155 align:middle line:90% [AUDIO LOGO] 00:00:07.155 --> 00:00:10.020 align:middle line:90% 00:00:10.020 --> 00:00:12.270 align:middle line:90% Hello, and welcome to INE. 00:00:12.270 --> 00:00:15.420 align:middle line:84% Today in this video, we will look at section 2, dial plan 00:00:15.420 --> 00:00:18.520 align:middle line:90% part 3, basically, task 2.7. 00:00:18.520 --> 00:00:21.600 align:middle line:84% Now under this task, we need to create a LUA script 00:00:21.600 --> 00:00:24.930 align:middle line:84% on HQ-SME which changes the remote caller 00:00:24.930 --> 00:00:29.640 align:middle line:84% ID for calls coming from PSTN to HQ or site B. 00:00:29.640 --> 00:00:32.700 align:middle line:84% When PSTN calls HQ phones or site B phones 00:00:32.700 --> 00:00:37.950 align:middle line:84% SME should change the remote caller ID to INE_PSTN. 00:00:37.950 --> 00:00:42.480 align:middle line:84% Verify by placing a call from PSTN to HQ phone 1 or site 00:00:42.480 --> 00:00:46.050 align:middle line:84% B phone 1 or any of the other phones, even Tony Stark. 00:00:46.050 --> 00:00:50.830 align:middle line:84% The phones should display INE_PSTN as the caller ID. 00:00:50.830 --> 00:00:53.640 align:middle line:84% So let's quickly go and build this. 00:00:53.640 --> 00:00:57.120 align:middle line:84% Now, the first thing what I'm going to do before I actually 00:00:57.120 --> 00:00:59.160 align:middle line:84% build the LUA script, what I'm going to do 00:00:59.160 --> 00:01:03.300 align:middle line:84% is I'll make a call from PSTN to HQ Tony 00:01:03.300 --> 00:01:05.610 align:middle line:90% Stark, which is extension 2003. 00:01:05.610 --> 00:01:14.220 align:middle line:84% So let's call 1-408-202-2003 and see what does Tony Stark see 00:01:14.220 --> 00:01:16.530 align:middle line:90% as the remote caller ID. 00:01:16.530 --> 00:01:18.990 align:middle line:90% So he sees HQ PSTN. 00:01:18.990 --> 00:01:21.780 align:middle line:84% Because I'm calling in from PSTN line 1, 00:01:21.780 --> 00:01:24.090 align:middle line:90% that's why we see HQ PSTN. 00:01:24.090 --> 00:01:31.800 align:middle line:84% Let's say if the PSTN dials from line 2 and he calls 00:01:31.800 --> 00:01:36.810 align:middle line:90% 1-408-202-2003, then HQ-- 00:01:36.810 --> 00:01:41.920 align:middle line:84% then again the PSTN is sending the same thing, HQ PSTN. 00:01:41.920 --> 00:01:45.090 align:middle line:84% So the thing is what the question states 00:01:45.090 --> 00:01:52.290 align:middle line:84% is that we want SME to intercept that SIP call and change 00:01:52.290 --> 00:01:57.390 align:middle line:84% the remote caller ID to not show HQ PSTN 00:01:57.390 --> 00:02:01.470 align:middle line:90% but instead show INE_PSTN. 00:02:01.470 --> 00:02:03.390 align:middle line:90% Let's go and do that. 00:02:03.390 --> 00:02:06.750 align:middle line:84% Now for building a LUA script, the first thing 00:02:06.750 --> 00:02:09.030 align:middle line:84% what we need to do is we need to look 00:02:09.030 --> 00:02:12.540 align:middle line:84% at the documentation of Cisco because again, it's 00:02:12.540 --> 00:02:17.100 align:middle line:84% really difficult to remember the format or the script details 00:02:17.100 --> 00:02:18.670 align:middle line:90% for the LUA script. 00:02:18.670 --> 00:02:23.990 align:middle line:84% So what I'm going to do is go to cisco.com, 00:02:23.990 --> 00:02:28.550 align:middle line:84% and let's go to Support, All Product Support. 00:02:28.550 --> 00:02:31.700 align:middle line:84% Let's scroll down to Unified Communication. 00:02:31.700 --> 00:02:35.750 align:middle line:84% Scroll down all the way to Unified Communication Manager, 00:02:35.750 --> 00:02:37.480 align:middle line:90% which is a call manager. 00:02:37.480 --> 00:02:39.060 align:middle line:90% Here, select your version. 00:02:39.060 --> 00:02:41.960 align:middle line:84% So our version is going to be 12.5. 00:02:41.960 --> 00:02:46.250 align:middle line:84% So click on 12.5, and then scroll down 00:02:46.250 --> 00:02:50.180 align:middle line:84% to Configuration, so Document Categories, Configuration. 00:02:50.180 --> 00:02:53.570 align:middle line:84% Under here, if you scroll down, you 00:02:53.570 --> 00:02:58.700 align:middle line:84% should see something called as Configuration Examples. 00:02:58.700 --> 00:03:02.480 align:middle line:84% Let's scroll back up and see if we see any configuration 00:03:02.480 --> 00:03:03.570 align:middle line:90% examples. 00:03:03.570 --> 00:03:05.720 align:middle line:84% So here are our configuration examples. 00:03:05.720 --> 00:03:10.370 align:middle line:84% Go down to View All Documentation of this Type. 00:03:10.370 --> 00:03:13.370 align:middle line:84% And inside here, you can search for-- 00:03:13.370 --> 00:03:14.400 align:middle line:90% scroll all the way down. 00:03:14.400 --> 00:03:18.560 align:middle line:84% You can do a Control-F and search for SIP Normalization. 00:03:18.560 --> 00:03:22.760 align:middle line:84% So you have a document here for SIP normalization script 00:03:22.760 --> 00:03:24.170 align:middle line:90% in call manager. 00:03:24.170 --> 00:03:25.290 align:middle line:90% Let's click on that. 00:03:25.290 --> 00:03:32.186 align:middle line:84% And here is where we get our basic format for creating the-- 00:03:32.186 --> 00:03:35.700 align:middle line:84% for creating basically your LUA script. 00:03:35.700 --> 00:03:39.420 align:middle line:90% So let's copy this. 00:03:39.420 --> 00:03:42.980 align:middle line:84% Now obviously, I would not be able to copy 00:03:42.980 --> 00:03:48.500 align:middle line:84% from outside the machine and go back to my call manager which 00:03:48.500 --> 00:03:53.385 align:middle line:84% is inside the INE environment, I would not 00:03:53.385 --> 00:03:54.510 align:middle line:90% be able to do a copy/paste. 00:03:54.510 --> 00:03:56.360 align:middle line:84% So if I actually go back to Device Settings 00:03:56.360 --> 00:04:00.750 align:middle line:84% and go to SIP Normalization on my SME, 00:04:00.750 --> 00:04:03.780 align:middle line:84% and there are some built-in scripts. 00:04:03.780 --> 00:04:04.785 align:middle line:90% I didn't create these. 00:04:04.785 --> 00:04:06.180 align:middle line:90% These are built-in scripts. 00:04:06.180 --> 00:04:10.890 align:middle line:84% If I actually go back and say Add New and try and paste that, 00:04:10.890 --> 00:04:13.900 align:middle line:90% let's try and paste that. 00:04:13.900 --> 00:04:17.200 align:middle line:90% 00:04:17.200 --> 00:04:18.380 align:middle line:90% Wait, hold on. 00:04:18.380 --> 00:04:22.493 align:middle line:84% So this script-- so I was able to paste that. 00:04:22.493 --> 00:04:23.910 align:middle line:84% But sometimes in the lab exam, you 00:04:23.910 --> 00:04:25.870 align:middle line:90% may not be able to paste that. 00:04:25.870 --> 00:04:29.910 align:middle line:84% But let's say if you were not able to paste that. 00:04:29.910 --> 00:04:37.160 align:middle line:84% For example, let me go ahead and copy this and go back here. 00:04:37.160 --> 00:04:43.780 align:middle line:84% Let's copy this and see if you can paste that. 00:04:43.780 --> 00:04:45.590 align:middle line:84% Yeah, we are not able to paste that. 00:04:45.590 --> 00:04:49.060 align:middle line:84% So from outside the INE environment, 00:04:49.060 --> 00:04:52.430 align:middle line:84% you would not be able to paste into the INE environment. 00:04:52.430 --> 00:04:56.590 align:middle line:84% So what I would suggest is it's easier 00:04:56.590 --> 00:04:58.540 align:middle line:84% to first look at the documentation 00:04:58.540 --> 00:05:01.100 align:middle line:84% because you really can't remember all the syntax. 00:05:01.100 --> 00:05:05.630 align:middle line:84% So what I would do is go back here, go to the built-in ones. 00:05:05.630 --> 00:05:12.130 align:middle line:84% So for example, if I go back, there is a SIP-- 00:05:12.130 --> 00:05:14.590 align:middle line:84% if you look at this one, there is a SIP-- 00:05:14.590 --> 00:05:17.620 align:middle line:84% for the SIP Trunk, there is a referred pass through SIP 00:05:17.620 --> 00:05:18.940 align:middle line:90% normalization script. 00:05:18.940 --> 00:05:20.120 align:middle line:90% Use that script. 00:05:20.120 --> 00:05:25.100 align:middle line:84% So go inside that and scroll down, 00:05:25.100 --> 00:05:27.110 align:middle line:90% you will get your base template. 00:05:27.110 --> 00:05:31.660 align:middle line:84% So if you see somewhere here, so start from here. 00:05:31.660 --> 00:05:35.390 align:middle line:84% M equals curly brackets open and close. 00:05:35.390 --> 00:05:41.710 align:middle line:84% So copy all the way till end and say copy. 00:05:41.710 --> 00:05:44.230 align:middle line:90% Then go back here to add new. 00:05:44.230 --> 00:05:49.940 align:middle line:84% Let's create a script called as, let's say, LUA script, 00:05:49.940 --> 00:05:52.290 align:middle line:90% whatever name you want to give. 00:05:52.290 --> 00:05:59.920 align:middle line:84% And it should be LUA script and paste it here. 00:05:59.920 --> 00:06:02.290 align:middle line:84% So now we have the base template. 00:06:02.290 --> 00:06:04.165 align:middle line:84% Let's go and remove a few things. 00:06:04.165 --> 00:06:05.790 align:middle line:84% So the first thing what I'm going to do 00:06:05.790 --> 00:06:09.940 align:middle line:84% is to remove a few things, I will first change this. 00:06:09.940 --> 00:06:14.280 align:middle line:84% So where do we want to change the remote caller ID? 00:06:14.280 --> 00:06:17.520 align:middle line:84% The remote caller ID is always in the invite. 00:06:17.520 --> 00:06:19.680 align:middle line:84% If you actually make the call, and let's say 00:06:19.680 --> 00:06:24.120 align:middle line:84% if you go to router 1 and do a debug CCSIP messages, 00:06:24.120 --> 00:06:27.825 align:middle line:84% you will see the remote caller ID flag in the invite. 00:06:27.825 --> 00:06:30.390 align:middle line:90% 00:06:30.390 --> 00:06:33.100 align:middle line:90% So go back here and change this. 00:06:33.100 --> 00:06:34.630 align:middle line:90% Let's modify this. 00:06:34.630 --> 00:06:39.240 align:middle line:84% So all you have to do is change the message to invite, 00:06:39.240 --> 00:06:42.960 align:middle line:90% so function M.inbound-- 00:06:42.960 --> 00:06:45.270 align:middle line:84% there's an inbound call coming in from PSTN. 00:06:45.270 --> 00:06:48.570 align:middle line:84% So from SME's perspective, he's receiving the call inbound. 00:06:48.570 --> 00:06:51.970 align:middle line:84% So in the invite, what do we want to change? 00:06:51.970 --> 00:06:55.180 align:middle line:90% Let's remove this whole line. 00:06:55.180 --> 00:06:58.580 align:middle line:84% And make sure you have no extra spaces in the lines. 00:06:58.580 --> 00:07:00.610 align:middle line:90% So just pull them back up. 00:07:00.610 --> 00:07:03.650 align:middle line:90% And let's delete all of this. 00:07:03.650 --> 00:07:05.060 align:middle line:90% So we only need the first line. 00:07:05.060 --> 00:07:09.610 align:middle line:84% So here what we're doing is local give a variable name. 00:07:09.610 --> 00:07:13.480 align:middle line:84% Let's say variable name is old remote party ID, 00:07:13.480 --> 00:07:14.890 align:middle line:90% or you can just say old. 00:07:14.890 --> 00:07:17.810 align:middle line:90% Old equals-- what do we want? 00:07:17.810 --> 00:07:21.310 align:middle line:84% So this remains the same message colon get header. 00:07:21.310 --> 00:07:22.940 align:middle line:90% What do we want to change? 00:07:22.940 --> 00:07:26.230 align:middle line:84% So we want to change the remote party ID. 00:07:26.230 --> 00:07:28.720 align:middle line:84% So that is going to be inside this bracket, so 00:07:28.720 --> 00:07:36.360 align:middle line:84% Remote-Party-ID, and then hit Enter. 00:07:36.360 --> 00:07:39.540 align:middle line:90% 00:07:39.540 --> 00:07:46.200 align:middle line:84% Then we would say local, let's say, new equals-- 00:07:46.200 --> 00:07:51.270 align:middle line:84% go back to your Cisco documentation. 00:07:51.270 --> 00:07:55.320 align:middle line:84% If you scroll down here, you will see the string.gsub, 00:07:55.320 --> 00:07:57.780 align:middle line:84% which is the LUA function in order 00:07:57.780 --> 00:08:01.330 align:middle line:84% to replace a particular content from the string. 00:08:01.330 --> 00:08:08.120 align:middle line:84% So we would call that function, say, new string-- 00:08:08.120 --> 00:08:11.410 align:middle line:90% 00:08:11.410 --> 00:08:12.340 align:middle line:90% what does it say? 00:08:12.340 --> 00:08:17.830 align:middle line:90% So string.gsub, so string.gsub. 00:08:17.830 --> 00:08:21.450 align:middle line:90% 00:08:21.450 --> 00:08:23.710 align:middle line:84% And then what do we want to replace? 00:08:23.710 --> 00:08:28.110 align:middle line:84% So we want-- so right now, the Remote-Party-ID from the invite 00:08:28.110 --> 00:08:32.559 align:middle line:84% is stored inside the variable called old. 00:08:32.559 --> 00:08:35.220 align:middle line:84% So in the first line, which is local equals old, 00:08:35.220 --> 00:08:39.150 align:middle line:84% what I'm doing here is I'm saying from the invite message, 00:08:39.150 --> 00:08:42.059 align:middle line:84% from the header of the Remote-Party-ID, 00:08:42.059 --> 00:08:45.960 align:middle line:84% store that information inside a variable called as old. 00:08:45.960 --> 00:08:50.550 align:middle line:84% Now I'm creating a new variable called new equals gsub. 00:08:50.550 --> 00:09:00.870 align:middle line:84% We want to replace old, then quotes-- 00:09:00.870 --> 00:09:05.543 align:middle line:84% we want to replace dot star, so any IP address. 00:09:05.543 --> 00:09:07.710 align:middle line:84% If you look at the SIP message-- let me in fact do-- 00:09:07.710 --> 00:09:10.500 align:middle line:84% let me show you the SIP message first just to show you 00:09:10.500 --> 00:09:13.710 align:middle line:90% what we want to change. 00:09:13.710 --> 00:09:14.840 align:middle line:90% Let's go back to R1. 00:09:14.840 --> 00:09:19.430 align:middle line:84% I will do a debug ccsip messages and go back 00:09:19.430 --> 00:09:24.970 align:middle line:90% to PSTN and make that call. 00:09:24.970 --> 00:09:33.380 align:middle line:84% And on R1 now I would do an un all and cancel that call. 00:09:33.380 --> 00:09:37.010 align:middle line:84% If I look at R1 now and look at the invite message 00:09:37.010 --> 00:09:40.340 align:middle line:84% that he received from PSTN, which is this one, 00:09:40.340 --> 00:09:42.530 align:middle line:84% and this is the invite message which 00:09:42.530 --> 00:09:51.430 align:middle line:84% he sent to SME, if I look at the Remote-Party-ID, 00:09:51.430 --> 00:09:54.780 align:middle line:90% it should be here. 00:09:54.780 --> 00:09:57.110 align:middle line:90% Remote-Party-ID is HQ PSTN. 00:09:57.110 --> 00:10:00.620 align:middle line:90% 00:10:00.620 --> 00:10:07.580 align:middle line:84% And if you look at the SIP message, so it is SIP, 00:10:07.580 --> 00:10:11.300 align:middle line:84% and then there is the calling number 00:10:11.300 --> 00:10:13.770 align:middle line:90% of whoever is calling in. 00:10:13.770 --> 00:10:18.050 align:middle line:84% So what I'm going to do here is I would say dot star, so 00:10:18.050 --> 00:10:23.240 align:middle line:90% anything that starts with-- 00:10:23.240 --> 00:10:24.950 align:middle line:90% let's give the SIP. 00:10:24.950 --> 00:10:41.170 align:middle line:84% So anything that's-- let's open brackets, SIP colon dot star. 00:10:41.170 --> 00:10:48.900 align:middle line:84% Let's close bracket and close my quotes, comma. 00:10:48.900 --> 00:10:56.350 align:middle line:84% Replace it with, again, single quote then double quotes. 00:10:56.350 --> 00:11:00.910 align:middle line:90% Replace it with INE_PSTN. 00:11:00.910 --> 00:11:05.990 align:middle line:84% Close your double quotes, space, %1. 00:11:05.990 --> 00:11:11.010 align:middle line:84% Close your single quotes, and then close your parentheses. 00:11:11.010 --> 00:11:16.650 align:middle line:84% After this, I would go back to my Cisco documentation 00:11:16.650 --> 00:11:23.980 align:middle line:84% and copy this line, which is message modifyHeader. 00:11:23.980 --> 00:11:25.530 align:middle line:84% So again, I can't do a copy/paste, 00:11:25.530 --> 00:11:26.700 align:middle line:90% so I'll have to type it out. 00:11:26.700 --> 00:11:29.610 align:middle line:90% 00:11:29.610 --> 00:11:36.700 align:middle line:90% So message colon modifyHeader. 00:11:36.700 --> 00:11:38.390 align:middle line:90% What do I want to modify? 00:11:38.390 --> 00:11:41.500 align:middle line:84% I want to modify a Remote-Party-ID, so 00:11:41.500 --> 00:11:42.490 align:middle line:90% Remote-Party-ID. 00:11:42.490 --> 00:11:46.570 align:middle line:90% 00:11:46.570 --> 00:11:50.020 align:middle line:90% Close your quotes, comma. 00:11:50.020 --> 00:11:53.530 align:middle line:90% Modify it with new. 00:11:53.530 --> 00:11:56.530 align:middle line:90% Close your parentheses. 00:11:56.530 --> 00:12:01.300 align:middle line:84% Then we would say end and then return M. 00:12:01.300 --> 00:12:02.513 align:middle line:90% That should be your script. 00:12:02.513 --> 00:12:03.430 align:middle line:90% Let's save this first. 00:12:03.430 --> 00:12:06.420 align:middle line:90% 00:12:06.420 --> 00:12:08.670 align:middle line:84% It says that the name does not allow that. 00:12:08.670 --> 00:12:17.420 align:middle line:84% Let's do LUA_Script and save this. 00:12:17.420 --> 00:12:21.440 align:middle line:90% So look at my script. 00:12:21.440 --> 00:12:26.920 align:middle line:84% So the first line is M equals over curly brackets 00:12:26.920 --> 00:12:28.180 align:middle line:90% open and close. 00:12:28.180 --> 00:12:30.580 align:middle line:90% The last line is return M. 00:12:30.580 --> 00:12:32.770 align:middle line:84% Now, if you look at the function, in the function 00:12:32.770 --> 00:12:34.660 align:middle line:90% I'm saying M.inbound. 00:12:34.660 --> 00:12:40.990 align:middle line:84% When the invite comes inbound, then local equals all. 00:12:40.990 --> 00:12:43.465 align:middle line:90% So "all" is a variable name. 00:12:43.465 --> 00:12:46.240 align:middle line:84% From the header, store the Remote-Party-ID information 00:12:46.240 --> 00:12:48.245 align:middle line:84% inside the variable called as old. 00:12:48.245 --> 00:12:50.620 align:middle line:84% Then I'm saying-- then I'm creating a new variable called 00:12:50.620 --> 00:12:54.390 align:middle line:84% new, which says string.gsub, which is, again-- 00:12:54.390 --> 00:12:57.060 align:middle line:90% 00:12:57.060 --> 00:13:00.300 align:middle line:84% which is basically used to replace something in a string, 00:13:00.300 --> 00:13:03.080 align:middle line:90% so string.gsub. 00:13:03.080 --> 00:13:07.910 align:middle line:84% From old, which contains a Remote-Party-ID information, 00:13:07.910 --> 00:13:11.740 align:middle line:84% anything that begins with dot star, 00:13:11.740 --> 00:13:15.440 align:middle line:84% then SIP message, if it's a SIP message with whatever IP 00:13:15.440 --> 00:13:18.050 align:middle line:84% address, I don't really care, whatever the caller and calling 00:13:18.050 --> 00:13:23.966 align:middle line:84% information is, replace that information with INE_PSTN. 00:13:23.966 --> 00:13:27.770 align:middle line:84% Then I'm saying modify the header of the Remote-Party-ID 00:13:27.770 --> 00:13:28.910 align:middle line:90% with new. 00:13:28.910 --> 00:13:35.120 align:middle line:84% So what I'm really doing in the local news line, 00:13:35.120 --> 00:13:38.450 align:middle line:84% I am changing whatever name came-- 00:13:38.450 --> 00:13:40.970 align:middle line:84% Remote-Party-ID name came from PSTN, 00:13:40.970 --> 00:13:44.750 align:middle line:84% I'm changing that with INE_PSTN and storing 00:13:44.750 --> 00:13:46.550 align:middle line:84% that inside a variable called as new. 00:13:46.550 --> 00:13:48.710 align:middle line:84% And then with the modifyHeader, I 00:13:48.710 --> 00:13:52.580 align:middle line:84% am changing the Remote-Party-ID with the variable new. 00:13:52.580 --> 00:13:53.570 align:middle line:90% Let's go and test this. 00:13:53.570 --> 00:13:56.600 align:middle line:84% To apply this LUA script, I need to go back to my trunk 00:13:56.600 --> 00:13:58.100 align:middle line:90% from the cube. 00:13:58.100 --> 00:14:03.440 align:middle line:84% So if you remember, we had a SME-PSTN 00:14:03.440 --> 00:14:05.390 align:middle line:90% which was going to the VCUBE. 00:14:05.390 --> 00:14:07.475 align:middle line:84% Go back to the peer-- to that SIP Trunk. 00:14:07.475 --> 00:14:10.590 align:middle line:90% 00:14:10.590 --> 00:14:15.630 align:middle line:84% Scroll all the way down to Normalization Script 00:14:15.630 --> 00:14:19.770 align:middle line:84% and choose your script, which was LUA script, and save it. 00:14:19.770 --> 00:14:22.960 align:middle line:90% 00:14:22.960 --> 00:14:27.210 align:middle line:84% Once I save this, make sure you reset for it to apply. 00:14:27.210 --> 00:14:29.940 align:middle line:90% 00:14:29.940 --> 00:14:30.645 align:middle line:90% Let's reset. 00:14:30.645 --> 00:14:36.540 align:middle line:90% 00:14:36.540 --> 00:14:40.240 align:middle line:84% Let's go back to Jabber3 and make that call. 00:14:40.240 --> 00:14:43.620 align:middle line:84% So when I make that call, if I look at Jabber1 now, 00:14:43.620 --> 00:14:47.010 align:middle line:90% I should see INE_PSTN. 00:14:47.010 --> 00:14:48.765 align:middle line:90% So I still don't see it. 00:14:48.765 --> 00:14:53.700 align:middle line:84% Let's disconnect and go back and remake the call just 00:14:53.700 --> 00:14:57.120 align:middle line:90% to see if we are getting that. 00:14:57.120 --> 00:14:58.120 align:middle line:90% So I still don't see it. 00:14:58.120 --> 00:14:59.800 align:middle line:84% So maybe there's something wrong with the script. 00:14:59.800 --> 00:15:01.560 align:middle line:84% Let's go back and check our script. 00:15:01.560 --> 00:15:07.210 align:middle line:90% 00:15:07.210 --> 00:15:08.410 align:middle line:90% I want to go back here. 00:15:08.410 --> 00:15:11.090 align:middle line:90% 00:15:11.090 --> 00:15:14.180 align:middle line:84% Go back to Device Settings, to SIP Normalization Script. 00:15:14.180 --> 00:15:17.900 align:middle line:90% 00:15:17.900 --> 00:15:19.160 align:middle line:90% Go back to LUA script. 00:15:19.160 --> 00:15:22.600 align:middle line:90% 00:15:22.600 --> 00:15:28.080 align:middle line:84% Let's check function M.inbound for the invite message. 00:15:28.080 --> 00:15:31.170 align:middle line:84% We are going to change the Remote-Party-ID. 00:15:31.170 --> 00:15:35.490 align:middle line:84% This name has to match as per your CCSIP messages. 00:15:35.490 --> 00:15:38.790 align:middle line:84% If you see here, the name was Remote-Party-ID. 00:15:38.790 --> 00:15:41.920 align:middle line:90% So I'm matching that. 00:15:41.920 --> 00:15:48.900 align:middle line:90% Local new, string.gsub, old. 00:15:48.900 --> 00:15:56.906 align:middle line:84% Let's see, dot star SIP dot star, comma, INE_PSTN. 00:15:56.906 --> 00:16:00.320 align:middle line:90% 00:16:00.320 --> 00:16:02.480 align:middle line:90% Looks good. 00:16:02.480 --> 00:16:09.830 align:middle line:84% Message colon modifyHeader Remote-Party-ID. 00:16:09.830 --> 00:16:11.480 align:middle line:90% Replace that with new. 00:16:11.480 --> 00:16:20.850 align:middle line:90% 00:16:20.850 --> 00:16:21.955 align:middle line:90% So looks OK. 00:16:21.955 --> 00:16:27.770 align:middle line:90% 00:16:27.770 --> 00:16:35.240 align:middle line:84% Gsub old, comma, open single quotes dot star. 00:16:35.240 --> 00:16:38.800 align:middle line:90% 00:16:38.800 --> 00:16:47.640 align:middle line:84% And then we have SIP colon dot star, comma. 00:16:47.640 --> 00:16:56.400 align:middle line:84% And I think we had an extra space there. 00:16:56.400 --> 00:16:57.695 align:middle line:90% Let's go ahead and save this. 00:16:57.695 --> 00:17:03.220 align:middle line:90% 00:17:03.220 --> 00:17:06.780 align:middle line:84% I'm going to copy this into a Notepad, 00:17:06.780 --> 00:17:10.619 align:middle line:90% just to expand it to see easier. 00:17:10.619 --> 00:17:12.270 align:middle line:90% Let me go back. 00:17:12.270 --> 00:17:18.250 align:middle line:84% Let's save this first and test again. 00:17:18.250 --> 00:17:21.339 align:middle line:84% I want to go back and first reset my-- 00:17:21.339 --> 00:17:23.230 align:middle line:84% because I made changes, I want to reset this. 00:17:23.230 --> 00:17:29.760 align:middle line:90% 00:17:29.760 --> 00:17:34.630 align:middle line:84% And go back to PSTN and make the call. 00:17:34.630 --> 00:17:39.970 align:middle line:90% 00:17:39.970 --> 00:17:45.240 align:middle line:90% Hmm, I still see HQ PSTN. 00:17:45.240 --> 00:17:55.360 align:middle line:84% Let me go back to our Notepad, Application, Ignore. 00:17:55.360 --> 00:17:56.470 align:middle line:90% Let's go to Notepad. 00:17:56.470 --> 00:18:00.420 align:middle line:90% 00:18:00.420 --> 00:18:03.120 align:middle line:90% And let's paste. 00:18:03.120 --> 00:18:04.365 align:middle line:90% Let's expand this. 00:18:04.365 --> 00:18:09.040 align:middle line:90% 00:18:09.040 --> 00:18:13.180 align:middle line:90% View, Zoom In. 00:18:13.180 --> 00:18:23.150 align:middle line:90% 00:18:23.150 --> 00:18:24.680 align:middle line:90% All right. 00:18:24.680 --> 00:18:27.080 align:middle line:90% So function M.inbound_INVITE. 00:18:27.080 --> 00:18:28.790 align:middle line:90% So first line is fine. 00:18:28.790 --> 00:18:32.020 align:middle line:90% Second line is fine. 00:18:32.020 --> 00:18:38.170 align:middle line:84% Third line local old, message colon get header. 00:18:38.170 --> 00:18:41.780 align:middle line:84% Let's look back at the Cisco documentation. 00:18:41.780 --> 00:18:45.790 align:middle line:84% So this is a variable name, message colon get header from. 00:18:45.790 --> 00:18:48.810 align:middle line:90% That looks OK. 00:18:48.810 --> 00:18:50.460 align:middle line:90% Remote-Party-ID. 00:18:50.460 --> 00:18:52.740 align:middle line:90% So this line is fine. 00:18:52.740 --> 00:18:56.140 align:middle line:84% I feel there's something wrong here. 00:18:56.140 --> 00:19:03.210 align:middle line:84% So local new equals string.gsub, so string.gsub. 00:19:03.210 --> 00:19:07.090 align:middle line:90% 00:19:07.090 --> 00:19:14.500 align:middle line:84% Old, so I am replacing from old, which 00:19:14.500 --> 00:19:17.260 align:middle line:90% contains the Remote-Party-ID. 00:19:17.260 --> 00:19:24.420 align:middle line:84% I am saying dot star, open parentheses, SIP colon dot 00:19:24.420 --> 00:19:30.460 align:middle line:90% star, which looks OK. 00:19:30.460 --> 00:19:32.665 align:middle line:90% And then I'm saying INE_PSTN. 00:19:32.665 --> 00:19:39.850 align:middle line:90% 00:19:39.850 --> 00:19:40.740 align:middle line:90% Looks OK. 00:19:40.740 --> 00:19:52.120 align:middle line:84% Message modifyHeader replace with new. 00:19:52.120 --> 00:19:52.870 align:middle line:90% Oh, you know what? 00:19:52.870 --> 00:19:54.820 align:middle line:84% The problem is here, the spelling. 00:19:54.820 --> 00:19:57.350 align:middle line:90% Return spelling is wrong. 00:19:57.350 --> 00:19:59.690 align:middle line:90% Let's go back here. 00:19:59.690 --> 00:20:01.160 align:middle line:90% Go back to Jabber1. 00:20:01.160 --> 00:20:11.960 align:middle line:84% Go back to my script, return, return M. Let's save this. 00:20:11.960 --> 00:20:17.100 align:middle line:90% 00:20:17.100 --> 00:20:19.905 align:middle line:90% And let's reset for it to apply. 00:20:19.905 --> 00:20:23.340 align:middle line:90% 00:20:23.340 --> 00:20:25.230 align:middle line:84% Always reset when you make the changes. 00:20:25.230 --> 00:20:32.460 align:middle line:90% 00:20:32.460 --> 00:20:33.870 align:middle line:90% OK. 00:20:33.870 --> 00:20:37.190 align:middle line:84% Let's go back to Jabber3 and make the call. 00:20:37.190 --> 00:20:40.280 align:middle line:90% 00:20:40.280 --> 00:20:44.720 align:middle line:84% As you can see now, it changed to INE_PSTN. 00:20:44.720 --> 00:20:48.320 align:middle line:84% So what really happened is that the PSTN calls in. 00:20:48.320 --> 00:20:51.290 align:middle line:84% The Remote-Party-ID is HQ PSTN, which 00:20:51.290 --> 00:20:53.960 align:middle line:84% is being sent by PSTN to cube, cube 00:20:53.960 --> 00:20:57.320 align:middle line:84% is forwarding that to SME, SME takes the invite 00:20:57.320 --> 00:21:00.110 align:middle line:84% and captures the Remote-Party-ID information 00:21:00.110 --> 00:21:04.130 align:middle line:84% into a variable called as old, then replaces 00:21:04.130 --> 00:21:11.060 align:middle line:84% the old with the HQ PSTN with INE_PSTN and inside a variable 00:21:11.060 --> 00:21:11.930 align:middle line:90% called new. 00:21:11.930 --> 00:21:15.230 align:middle line:84% And then I'm saying that modify the header 00:21:15.230 --> 00:21:18.560 align:middle line:84% of the Remote-Party-ID with new, the variable new. 00:21:18.560 --> 00:21:20.930 align:middle line:84% So what was inside new-- what was inside new? 00:21:20.930 --> 00:21:27.860 align:middle line:84% In new, we had replaced the HQ PSTN with INE_PSTN. 00:21:27.860 --> 00:21:31.370 align:middle line:84% And we stored that in a variable called new. 00:21:31.370 --> 00:21:33.260 align:middle line:84% And now with the modified message header, 00:21:33.260 --> 00:21:37.675 align:middle line:84% I am replacing a Remote-Party-ID with new 00:21:37.675 --> 00:21:39.050 align:middle line:84% which is the variable name, which 00:21:39.050 --> 00:21:44.870 align:middle line:84% contains the new name that we want SME to send to HQ or site 00:21:44.870 --> 00:21:45.620 align:middle line:90% B. 00:21:45.620 --> 00:21:48.950 align:middle line:84% With this, we've basically met the requirements 00:21:48.950 --> 00:21:51.680 align:middle line:84% of the question that we created a LUA script 00:21:51.680 --> 00:21:54.860 align:middle line:84% to change something in the SIP message, 00:21:54.860 --> 00:21:58.240 align:middle line:84% where we changed the Remote-Party-ID. 00:21:58.240 --> 00:22:00.000 align:middle line:84% I hope this video was informative for you, 00:22:00.000 --> 00:22:02.500 align:middle line:90% and thank you for watching. 00:22:02.500 --> 00:22:03.000 align:middle line:90%