400 Developing SIP and IP Multimedia Subsystem (IMS) Applications
Figure 12-49 Select a reference partner
21.The selected Partner and Interface are displayed in the Details tab.
22.Choose getLocation as the operation.
23.Make sure that Use Data Type Variables check box is checked.
24.To assign a variable to the URI input parameter, click the icon at the end
of the line. The Select Variable for URI dialog box opens (see Figure 12-50 on
page 401).
25.Select uriAddress.
26.Click OK.
Chapter 12. Implementing the IMS sample service 401
Figure 12-50 Select variable
27.Similarly assign the following variables to the input and output parameters of
the getLocation operation:
Table 12-7 Assign variables to the getLocation parameters
The completed GetLocation Details tab should look like Figure 12-51 on
page 402.
Parameter Variable
requestedAccuracy nRequestedAccuracy
acceptableAccuracy nAcceptableAccuracy
getLocationReturn LocationResponse
402 Developing SIP and IP Multimedia Subsystem (IMS) Applications
Figure 12-51 GetLocation details
28.Select the Determine Closest Address sequence.
29.Right-click and select Add Snippet.
30.Rename the new snippet Assign GetLocation Output.
31.With the snippet selected, open the Properties view.
32.Select the Details tab.
33.Create a visual snippet as shown in Figure 12-52.
Figure 12-52 Assign GetLocation Output snippet
Chapter 12. Implementing the IMS sample service 403
To calculate the address that is nearest to the originator we need to call the
getTerminalDistance for each address in the list:
34.Select the Determine Closest Address sequence.
35.Right-click and select Add While Loop.
36.Set the name of the new While loop to Loop Through Addresslist.
37.With the snippet selected, open the Properties view.
38.Select the Details tab to specify the loop conditions.
39.In the Details tab select Create a New Condition. This opens the visual
snippet editor.
40.The loop shall iterate through all entries in the addresslist. The condition is
implemented in the snippet as shown in Figure 12-53.
Figure 12-53 Loop through Addresslist condition
41.Select the Loop Through Addresslist While loop.
42.Right-click and select Add Snippet.
43.Rename the new snippet Assign GetDistance Input.
44.With the snippet selected, open the Properties view.
45.Select the Details tab.
46.Create a visual snippet as shown in Figure 12-54.
Figure 12-54 Assign GetDistance Input snippet
We are ready to invoke the getTerminalDistance operation of the Location Web
service.
404 Developing SIP and IP Multimedia Subsystem (IMS) Applications
47.Select the Loop Through Addresslist While loop.
48.Right-click and select Add Invoke.
49.Rename the new invoke node GetDistance.
50.With the invoke node selected, open the Properties view.
51.Select the tab Details.
52.Click Browse to select a Reference Partner. The partner selection dialog box
opens.
53.Select LocationServicePartner.
54.Click OK.
55.The selected Partner and Interface are displayed in the Details tab.
56.Choose getTerminalDistance as the operation.
57.Make sure that Use Data Type Variables check box is checked.
58.Similar to the getLocation invoke node (see Step 24 on page 400) assign the
following variables to the input and output parameters of the
getTerminalDistance operation:
Table 12-8 Assign variables to the getTerminalDistance parameters
When you are finished, the GetDistance Details tab should look similar to
Figure 12-55 on page 405.
Parameter Variable
uri uriAddress
latitude fOrigLatitude
longitude fOrigLongitude
getTerminalDistanceReturn nCurDistance

Get Developing SIP and IP Multimedia Subsystem (IMS) Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.