Project

General

Profile

Routing guide » History » Version 20

Adrian Georgescu, 06/03/2013 09:56 AM

1 5 Tijmen de Mes
h1. Routing Guide
2
3 20 Adrian Georgescu
MSP and SIP Thor platforms are based on a SIP Proxy/Registrar/Presence Agent design. Each SIP server node maintains transaction and dialog state for each session and is able to terminate each of them based on various criteria. The platform handles and controls the RTP and MSRP media planes and is able to take decisions related to authorization, authentication, accounting, NAT traversal and session termination based on the media flow behavior. The design eliminates the need of separate session border controller elements which just add costs, hurt scalability and add no end-user features.  
4 1 Tijmen de Mes
5 12 Adrian Georgescu
The platform has rich telephony functions equivalent with traditional Class 4 switches (routing inter-carrier calls) and Class 5 switches (routing last-mile calls to end-users).
6 1 Tijmen de Mes
7 12 Adrian Georgescu
The platform can be equally used to perform SIP services that include and are not limited to Residential VoIP, Prepaid Cards, Video Calling, Presence and IM, Trunking, Least Cost Routing and ENUM Peering.
8 1 Tijmen de Mes
9 4 Tijmen de Mes
h2. Logical Architecture
10 2 Tijmen de Mes
11 6 Tijmen de Mes
!msp-interconnect.png!
12 2 Tijmen de Mes
13 1 Tijmen de Mes
h2. SIP Entities
14
15 2 Tijmen de Mes
This document describes routing logic between several SIP entities defined as follows:
16
17 4 Tijmen de Mes
# SIP Proxy: the platform core that performs the logic described in this document
18
# End-Point: a SIP end-user device that is configured with the credentials of a SIP account for which the platform is responsable
19
# PBX: a SIP end-point or intermediary that is configured under a foreign SIP domain not handled by the platform
20
# PSTN gateway: a SIP end-point or intermediary that is handling the translation between IP (using SIP protocol) and PSTN networks
21 1 Tijmen de Mes
22 4 Tijmen de Mes
h2. Supported Signaling
23 3 Tijmen de Mes
24 20 Adrian Georgescu
The platform supports SIP protocol over UDP/TCP/TLS transports. Additional, a gateway to and from XMPP remote domains can be configured. 
25 2 Tijmen de Mes
26 3 Tijmen de Mes
h2. Supported Media
27 2 Tijmen de Mes
28
The platform supports sessions containing the following media types:
29 1 Tijmen de Mes
30 4 Tijmen de Mes
* Audio (RTP and sRTP)
31
* Video (RTP and sRTP)
32
* FAX (RTP and T.38)
33
* Instant messaging (MSRP and its relay extension)
34
* File transfer (MSRP and its relay extension)
35
* Page mode messaging (SIP MESSAGE method)
36 2 Tijmen de Mes
37 4 Tijmen de Mes
The platform is codec agnostic, the negotiation of the codecs depends entirely on the end-points. The MediaProxy component that relays the RTP media between the end-points, for NAT traversal and accounting purposes, relays all packets at IP layer 3 (UDP protocol that encapsulates the RTP/RTCP streams). The actual payload with the particular codecs used inside the RTP streams is transparently passed between end-points without interference from MediaProxy.
38 2 Tijmen de Mes
39 1 Tijmen de Mes
Other payloads are supported as long as they are embedded into a supported stream, for example any payload that is embedded within the RTP streams (zRTP, DTMF tones) or MSRP streams (file transfer, multy-party chat service, desktop sharing).
40
41 2 Tijmen de Mes
h2. Primitives
42
43 3 Tijmen de Mes
The routing of SIP sessions is governed by two main protocols:
44 2 Tijmen de Mes
45 4 Tijmen de Mes
# Domain based SIP routing based on RFC3261 and RFC3263
46
# ENUM lookups based on RFC3761
47 2 Tijmen de Mes
48
The routing logic of the platform can be configured by changing its database tables and configuration files. The primitives used for routing are:
49
50
51 4 Tijmen de Mes
|Registrar database|Used to translate a SIP address into a SIP contact address|
52
|ENUM|Used to translate an E.164 telephone number into a SIP address|
53
|SIP alias|Used for adding aliases to existing SIP accounts|
54
|Emergency numbers|Translation between 911 and 112 into closest emergency access points|
55
|Call diversion|Translate a SIP address into another based on signaling conditions or end-user preferences|
56
|DNS lookups|Translate a SIP domain/hostname into an protocol:IP:port combination|
57
|LCR|Used for selection of PSTN gateway|
58 2 Tijmen de Mes
59
60 4 Tijmen de Mes
h2. Server Location
61 1 Tijmen de Mes
62 4 Tijmen de Mes
To locate the SIP Proxy/Registrar for a domain, SIP endpoints must perform DNS lookups based on RFC3263 that return the IP:port combination for which the server is configured.
63 1 Tijmen de Mes
64 4 Tijmen de Mes
h2. Configuration Files
65 1 Tijmen de Mes
66 4 Tijmen de Mes
Index of SIP Proxy configuration files located in/etc/opensips/:
67 2 Tijmen de Mes
68 4 Tijmen de Mes
69
|config/settings.m4|Contains the settings that can customize the routing logic|
70
|config/opensips.m4|Contains the proxy routing logic (should not be modified)|
71
|config/siteconfig/handle-incoming-pstn.m4|Used to customize routing logic for incoming PSTN calls|
72
|config/siteconfig/handle-local-extensions.m4|Used to define installation specific custom local extensions|
73
|config/siteconfig/handle-outgoing-peers.m4|Used to customize routing for outgoing calls to non-local domains|
74
|config/siteconfig/postprocess-request.m4|Used to customize outgoing requests before they leave the proxy|
75
|config/siteconfig/preprocess-pstn.m4|Used to customize outgoing PSTN requests before applying LCR routing|
76
|config/siteconfig/preprocess-request.m4|Used to apply custom pre-processing to a request before anything else|
77
|config/siteconfig/preprocess-uri.m4|Used to apply custom pre-processing to the request URI before converting to E164|
78
79
80
The settings.m4 file is used to customize the existing routing logic defined in opensips.m4 using the predefined routing options. 
81
 The files under the siteconfig/ directory can contain installation specific routing logic, which will be included by opensips.m4 and will allow for the routing logic to be adapted to the specific requirements of a given installation. The opensips.m4 file will always be overwritten on upgrades, so it should never be modified, while the files under the siteconfig/ directory will never be overwritten and can be modified without restrictions.
82
83 2 Tijmen de Mes
h2. NAT Traversal
84 1 Tijmen de Mes
85 4 Tijmen de Mes
NAT traversal methods encountered in the field and their properties:
86 1 Tijmen de Mes
87 4 Tijmen de Mes
* SIP server based (Relay) - reliable server side technology that works with all SIP clients, this method is used by the platform
88
* SIP client based (ICE) - client and server technology where client may negotiate media paths, is supported by the platform
89
* Intermediates based:
90
** NAT routers with SIP Application Level Gateway (SIP ALG) - located in customer premises network and the most *unreliable* technique
91
** Sessions Border Controllers (SBC) - located in service provider network - reliable with high cost and high complexity
92 1 Tijmen de Mes
93 4 Tijmen de Mes
The most reliable way to solve NAT issues with SIP is server based, by relaying packets using servers visible by both end-points. A new methodology under development is ICE, which relies partially on the SIP clients. NAT traversal applied in intermediates only introduce problems and SBCs add costs without adding value to the SIP service.
94 2 Tijmen de Mes
95
Below is a display of all possible NAT traversal techinques used for SIP and related media.
96
97 6 Tijmen de Mes
!nat-traversal-techniques.png!
98 1 Tijmen de Mes
99 4 Tijmen de Mes
The platform handles the NAT traversal for all its end-points by relaying all traffic, signaling and media through its servers that have public IP address and are visible for both end-points involved in a call flow.
100 2 Tijmen de Mes
101 4 Tijmen de Mes
Optional, "ICE can be deployed":http://mediaproxy-ng.org/wiki/ICE when supported by the end-points. The media relay acts like a TURN candidate and the operator may choose on a per call basis when and how this relay is to be used. When using ICE, SIP sessions that do not have a BYE cannot be accounted for.
102 2 Tijmen de Mes
103 4 Tijmen de Mes
NAT traversal is not the same thing as Firewall traversal. A firewall has an administrative policy, which must be set to support SIP and associated media traffic.
104 2 Tijmen de Mes
105 1 Tijmen de Mes
h3. Platform Ports
106
107 4 Tijmen de Mes
See the Firewall Setup section for a list of ports used by the platform software.
108 1 Tijmen de Mes
109 4 Tijmen de Mes
bq. Make sure that NAT traversal functions related to SIP known as SIP ALG functionality in the NAT routers are disabled.
110 1 Tijmen de Mes
111 4 Tijmen de Mes
112
113 1 Tijmen de Mes
h2. AAA
114
115
Authentication, Authorization and Accounting are performed depending on particular call flows as follows:
116
117 4 Tijmen de Mes
h3. Authentication
118 1 Tijmen de Mes
119 4 Tijmen de Mes
The trust relationship between SIP subscribers and SIP Proxy is based on DIGEST algorithm, both have a database with shared credentials.
120 1 Tijmen de Mes
121 4 Tijmen de Mes
h4. Sessions
122
123 1 Tijmen de Mes
Authentication for INVITE requests based on two methods:
124 2 Tijmen de Mes
125 4 Tijmen de Mes
# *SIP credentials*, when the From header contains a domain served by the platform. The From header presented by the device must match the credentials used for authentication.
126
# *Trusted peer* identified by IP address, used when the From header contains a remote domain and the request URI is not a local SIP address.
127 1 Tijmen de Mes
128 4 Tijmen de Mes
By default, incoming SIP sessions from remote domains to local SIP accounts served by the platform are not authenticated and always authorized.
129 1 Tijmen de Mes
130
For Instant Messaging and File transfers, MSRP relay reservations are authenticated using the same credentials for each SIP account.
131
132 4 Tijmen de Mes
h4. Register
133 1 Tijmen de Mes
134
Authentication for REGISTER methods is based on SIP credentials, this method can be used only by local SIP accounts and will not be relayed outside the platform. The From header presented by the SIP device must match the credentials used for authentication.
135 2 Tijmen de Mes
136
h4. Presence
137 1 Tijmen de Mes
138
The platform provides a Presence Agent that handles PUBLISH, SUBSCRIBE and NOTIFY methods based on SIP SIMPLE standards. The following event packages are supported:
139
140 4 Tijmen de Mes
* presence
141
* presence.winfo
142 19 Adrian Georgescu
* xcap-diff
143 1 Tijmen de Mes
144 4 Tijmen de Mes
Authentication for PUBLISH is based on SIP credentials, this methods can be used only by local SIP accounts and will not be relayed outside the platform. The From header presented by the SIP device must match the credentials used for authentication. Authentication for SUBSCRIBE requests are based on SIP credentials, when the From header contains a domain served by the SIP Proxy.
145 1 Tijmen de Mes
146 4 Tijmen de Mes
SUBSCRIBE requests from remote domains are allowed without authentication when the request URI is a local SIP address served by the platform.
147 1 Tijmen de Mes
148
SUBSCRIBE for the events message-summary and presence.winfo are allowed only for local users.
149
150 2 Tijmen de Mes
XCAP requests are authenticated using the same credentials for each SIP account.
151 1 Tijmen de Mes
152
The following XCAP documents are supported:
153
154 13 Adrian Georgescu
http://www.openxcap.org/projects/openxcap/wiki/Features
155 2 Tijmen de Mes
156 4 Tijmen de Mes
h3. Authorization
157 1 Tijmen de Mes
158 4 Tijmen de Mes
h4. Sessions
159 2 Tijmen de Mes
160
Authorization for outgoing SIP sessions can be performed for local SIP accounts based on:
161 1 Tijmen de Mes
162 4 Tijmen de Mes
# Access to PSTN
163
# Administrative blocking
164
# Monthly quota usage
165
# Prepaid balance
166 14 Adrian Georgescu
# Concurrent number of calls
167 4 Tijmen de Mes
# Call barring (user driven)
168
# Custom SIP Proxy logic
169 1 Tijmen de Mes
170 2 Tijmen de Mes
Authorization for incoming SIP sessions can be performed for local SIP accounts based on:
171
172 14 Adrian Georgescu
# Source IP address
173 4 Tijmen de Mes
# Administrative blocking
174
# Accept based on caller
175
# Accept based on time of day
176
# Reject based on caller id
177
# Custom SIP Proxy logic
178 1 Tijmen de Mes
179
Automatic session cut-off
180
181
SIP sessions can be terminated forcefully by the platform based on the following conditions:
182
183 4 Tijmen de Mes
# Prepaid balance exceeded (in real time)
184
# Monthly quota exceeded (on the next call)
185
# Maximum call duration exceeded
186
# RTP media timeout
187 14 Adrian Georgescu
# Signaling path lost
188
189 1 Tijmen de Mes
190 4 Tijmen de Mes
h4. Presence
191 1 Tijmen de Mes
192 2 Tijmen de Mes
Authorization for SUBSCRIBE for the presence event can be performed for local SIP accounts based on:
193
194 4 Tijmen de Mes
# XCAP pres-rules document
195
# Trusted peers
196 2 Tijmen de Mes
197
198
199 4 Tijmen de Mes
h3. Accounting
200 2 Tijmen de Mes
201 4 Tijmen de Mes
All SIP and RTP sessions are accounted by using RADIUS requests. See "accounting guide for more information":/wiki/AccountingGuide.
202 1 Tijmen de Mes
203 4 Tijmen de Mes
h2. End-Point to End-Point
204 1 Tijmen de Mes
205 7 Tijmen de Mes
!flow-sip-phone-a-b.png!
206 4 Tijmen de Mes
207
208
|Authentication|SIP account A|
209
|Authorization|SIP account A|
210
|Billing party|SIP account A|
211
|Accounting|Postpaid, Prepaid|
212
|Media types|RTP (audio and video), Presence, MSRP (Instant messaging and file transfers)|
213
|Address resolution|SIP address, SIP alias, Quickdial, ENUM|
214
|From header|Must contain a local SIP domain|
215
216
217
h3. Quick Dial
218
219 1 Tijmen de Mes
Quick dial is a per SIP account feature that allows to dial short numbers to match other SIP accounts in the same number range. The SIP Proxy will try to autocomplete the number to form a full address. To use this feature:
220
221 4 Tijmen de Mes
# The username part of the SIP account must be numeric (example "31208005169@ag-projects.com":mailto:31208005169@ag-projects.com)
222
# The *quickdial* attribute of the SIP account must be set to a substring matching the beginning of the username (e.g. 312080051).
223
# When user dials 60 the example above, the SIP Proxy will concatenate the quickdial set to 312080051 with the dialed number 60 and try "31208005160@ag-projects.com":mailto:31208005160@ag-projects.com as destination.
224 1 Tijmen de Mes
225 4 Tijmen de Mes
h2. End-Point to PBX
226 1 Tijmen de Mes
227 7 Tijmen de Mes
!flow-sip-phone-a-pbx-b.png!
228 1 Tijmen de Mes
229
230 4 Tijmen de Mes
|Authentication|SIP account A|
231
|Authorization|SIP account A|
232
|Caller Id|Asserted by the platform|
233
|Billing party|SIP account A|
234
|Accounting|Postpaid, Prepaid|
235
|Media types|RTP (audio)|
236
|Address resolution|ENUM|
237
|From header|Must contain a local SIP domain|
238 1 Tijmen de Mes
239
240 4 Tijmen de Mes
h2. PBX to PBX
241
242 7 Tijmen de Mes
!flow-pbx-a-pbx-b.png!
243 4 Tijmen de Mes
244 1 Tijmen de Mes
The PBX has its own accounts and connected devices. Requests originating from a PBX cannot be therefore authorized based on username/password combinations as they are not provisioned in the platform subscriber database, they are locally managed by the PBX owner. The traffic generated by the PBX can be only identified by its source IP address(es). To allow traffic from a PBX, the platform uses the concept of trusted peers. A trusted peer is an IP address that is allowed to route SIP calls through the platform without digest authorization. Beware that, no checks are done by the proxy related to the incoming caller identity, as long as the SIP sessions originate from the trusted IP address. Once you trust an IP address, you trust all traffic generated by it.
245
246
247 4 Tijmen de Mes
|Authentication|None|
248
|Authorization|Trusted peer A|
249
|Caller Id|Supplied by trusted peer A|
250
|Billing party|Trusted peer A|
251
|Accounting|Postpaid|
252
|Media types|RTP (audio)|
253
|Address resolution|ENUM|
254
|From header|Must contain a non-local SIP domain|
255 1 Tijmen de Mes
256 2 Tijmen de Mes
257 4 Tijmen de Mes
* The domain name used by the PBX in the From field must be different than any domain served by the SIP Proxy otherwise the Proxy will challenge the session for credentials as it does for any other locally registered SIP account.
258
* To route incoming traffic for a number block assigned to the PBX, create ENUM entries that point to the hostname (or IP address) of the PBX.
259
260
h2. End-Point to PSTN
261
262 1 Tijmen de Mes
For interconnection with PSTN, a SIP trunking service must be setup between the SIP Proxy and the PSTN gateway provider. The authorization of SIP requests is based on transitive trust. The SIP Proxy has a trust relationship with each SIP subscriber and the PSTN gateway has a trust relation with the SIP Proxy. The trust relation between the SIP Proxy and the PSTN gateway is based on the IP addresses. The PSTN gateway cannot use DIGEST authentication in the relation with the SIP Proxy because it does not have access to the SIP accounts database of the SIP Proxy.
263
264 4 Tijmen de Mes
h3. PSTN Gateway Requirements
265 2 Tijmen de Mes
266
Must have:
267
268 4 Tijmen de Mes
* SIP signaling based on RFC 3261
269
* DNS lookups based on RFC 3263
270
* Support for SIP extensions for caller id and privacy (P headers)
271
* RTP active mode (send RTP data as soon as call setup is completed)
272
* Use public routable IP addresses for both signaling and media
273 2 Tijmen de Mes
274
Recommended:
275
276 4 Tijmen de Mes
* ENUM lookups based on RFC 3761
277 2 Tijmen de Mes
278
Routing to PSTN destinations is realized by provisioning the PSTN carriers, gateways and routes (also known as Least Cost Routing engine or LCR). The structure of the PSTN provisioning is as follows:
279
280 9 Tijmen de Mes
  Route ->  Carriers -> Gateways -> Rules
281 2 Tijmen de Mes
282
283 4 Tijmen de Mes
For each PSTN prefix (called a PSTN route) a set of carriers can be assigned with an optional priority. Each carrier can have one or more gateways and each gateway can have optional rules for converting the number. For more information see the "provisioning guide":/wiki/ProvisioningGuide.
284
285 2 Tijmen de Mes
Once the SIP request is authenticated, the SIP Proxy authorizes the request based on the rights associated with the subscriber account and decides whether a SIP session to the PSTN gateway is allowed or not. If the session is allowed, the SIP Proxy asserts an identity associated to the SIP account, which can be the telephone number presented as caller ID to the destination, locates a PSTN gateway for the dialed number (by using least cost routing or other configured logic) and forwards the request to the PSTN gateways inserting itself in the path of subsequent messages.
286
287 7 Tijmen de Mes
!flow-sip-phone-a-pstn.png!
288 2 Tijmen de Mes
289
290 4 Tijmen de Mes
|Authentication|SIP account A|
291
|Authorization|SIP account A|
292
|Caller Id|Asserted by the platform|
293
|Billing party|SIP account A|
294
|Accounting|Postpaid, Prepaid|
295
|Media types|RTP (audio)|
296
|Address resolution|ENUM, LCR|
297 2 Tijmen de Mes
|From header|Must contain a local SIP domain|
298
299 4 Tijmen de Mes
h3. Caller id indication
300 2 Tijmen de Mes
301 4 Tijmen de Mes
The platform generates a Caller ID indication by appending Remote-Party-Id or P-Asserted identity headers, depending on its configuration. The content of the headers is generated with the SipAccount->rpid attribute associated with the SIP account.
302 2 Tijmen de Mes
303 4 Tijmen de Mes
h2. PSTN to End-Point
304 2 Tijmen de Mes
305 4 Tijmen de Mes
The platform is designed to accept traffic from outside SIP end-points (this includes remote PSTN gateways) to any local user. This means that a PSTN gateway that initiates a session to a correct SIP address user@domain belonging to the platform will be accepted and routed to the SIP devices belonging to the user with no extra configurations. When a SIP session originates from the PSTN, only the dialed telephone (a.k.a. E.164) number is known. For routing sessions from the PSTN to the SIP Proxy of the platform the gateway must translate the telephone number into a valid SIP address.
306 2 Tijmen de Mes
307 4 Tijmen de Mes
h4. ENUM Routing
308
309 7 Tijmen de Mes
!msp-enum-lookup.png!
310 4 Tijmen de Mes
311 2 Tijmen de Mes
The ideal way to achieve this number translation with minimum configuration is for the PSTN gateway to perform an ENUM lookup (RFC 3761). All popular open source software gateways like Asterisk and OpenSIPS are able to perform ENUM lookups and commercial gateways have started adding this support into their commercial products.
312
313
The ENUM look-up queries the DNS server provisioned with E.164 numbers by the operator, which is always kept up to date by the operator. The result of a successful ENUM lookup is a SIP address. Once the ENUM lookup is complete, the PSTN gateway can initiate the SIP session to the SIP address returned by the ENUM lookups.
314
315
The only setting required in the PSTN gateway for this setup is the top level domain used to perform ENUM lookups. The ENUM top level domain must be the same used by the SIP Proxy lookup and NGNPro provisioning.
316
317 4 Tijmen de Mes
h4. Manual Routing
318 2 Tijmen de Mes
319 4 Tijmen de Mes
For PSTN gateways that are not able to perform ENUM lookups and from which we need to accept incoming sessions, the SIP Proxy can be configured to accept any traffic, manipulate the number format based on custom rules and help performing the ENUM lookup in the behalf of the gateway.
320 2 Tijmen de Mes
321
The PSTN gateway must be configured for the E.164 number ranges to be routed to the MSP platform and the hostname of the SIP Proxy machine (e.g. sip.example.com). Do not use static IP addresses in the PSTN configuration, use the DNS name configured by the operator so that when the IP addresses of the SIP Proxy change or when multiple SIP Proxies are used by default (like in SIP Thor) the gateway does not need to be re-configured.
322
323
You must setup the following SIP Proxy configuration file:
324
325 8 Tijmen de Mes
  sipproxy:/etc/opensips/config/siteconfig/handle-incoming-pstn.m4
326 2 Tijmen de Mes
327
328 4 Tijmen de Mes
Example:
329
330
<pre class="wiki">
331 2 Tijmen de Mes
if (allow_trusted()) {
332 10 Tijmen de Mes
    DINFO('Incoming PSTN call');
333
    if (uri=~'^sip:0[1-9][0-9]{4,}@.*') {
334 2 Tijmen de Mes
        strip(1);
335 10 Tijmen de Mes
        prefix('+31');
336
        DINFO('Converted to ENUM number $ru');
337
    } else if (uri=~'^sip:0031[1-9][0-9]{4,}@.*') {
338 2 Tijmen de Mes
        strip(2);
339 10 Tijmen de Mes
        prefix('+');
340
        DINFO('Converted to ENUM number $ru');
341 2 Tijmen de Mes
    } else {
342 10 Tijmen de Mes
        ERROR('Invalid destination');
343
        sl_send_reply('403', 'Invalid destination');
344
        LOG_MISSED_CALL('403');
345 2 Tijmen de Mes
        exit;
346
    }
347
348 10 Tijmen de Mes
    rewritehostport('example.com');
349 2 Tijmen de Mes
350
    route(__ENUM_LOOKUP);
351
352
    if (retcode==-1) {
353 10 Tijmen de Mes
        DINFO('User not found');
354
        sl_send_reply('404', 'User not found');
355
        LOG_MISSED_CALL('404');
356 2 Tijmen de Mes
        exit;
357
    } else if (!is_uri_host_local()) {
358 10 Tijmen de Mes
        DINFO('Call to non local user');
359
        sl_send_reply('403', 'Invalid destination');
360
        LOG_MISSED_CALL('403');
361 2 Tijmen de Mes
        exit;
362
    }
363
}
364 4 Tijmen de Mes
</pre>
365 2 Tijmen de Mes
366
367 4 Tijmen de Mes
|Authentication|None|
368
|Authorization|Custom SIP Proxy logic|
369
|Billing party|Trusted peer|
370
|Accounting|Postpaid|
371
|Media types|RTP (audio)|
372
|From header|Must contain a non-local SIP domain|
373 2 Tijmen de Mes
|Address resolution|ENUM, Custom SIP Proxy logic|
374
375 4 Tijmen de Mes
h2. PBX to PSTN
376
377 7 Tijmen de Mes
!flow-pbx-a-pstn.png!
378 4 Tijmen de Mes
379 2 Tijmen de Mes
The IP address(es) of the PBX must be added in the trusted table using the SOAP/XML provisioning API. To allow trusted parties to transit your SIP Proxy edit sip:/etc/opensips/config/siteconfig/handle-incoming-pstn.m4 and add to it:
380
381 11 Tijmen de Mes
<pre>
382
if (allow_trusted()) {
383 2 Tijmen de Mes
    if (uri=~"^sip:0[1-9]*@.*") {
384
        # National calls must be formated as 00XX
385
        strip(1);
386
        prefix("0031");
387
        route(__PSTN_TRANSIT);
388
        exit;
389
    } else if (uri=~"^sip:00[1-9]*@.*") {
390
        # International calls
391
        route(__PSTN_TRANSIT);
392
        exit;
393
    } else {
394
        ERROR("Invalid destination");
395
        sl_send_reply("403", "Invalid destination");
396
        LOG_MISSED_CALL("403");
397
        exit;
398 1 Tijmen de Mes
    }
399 2 Tijmen de Mes
}
400 11 Tijmen de Mes
</pre>
401 2 Tijmen de Mes
402 4 Tijmen de Mes
403
|Authentication|None|
404
|Authorization|Trusted peer A|
405
|Caller Id|Supplied by trusted peer A|
406
|Billing party|Trusted peer A|
407
|Accounting|Postpaid|
408
|Media types|RTP (audio)|
409
|Address resolution|ENUM, LCR, Custom SIP Proxy logic|
410
|From header|Must contain a non-local SIP domain|
411
412
413 2 Tijmen de Mes
The domain name used by the PBX in the From field must be different than any domain served by the SIP Proxy otherwise the Proxy will challenge the session for credentials as it does for any other locally registered SIP account.
414
415 4 Tijmen de Mes
h3. Rating
416 2 Tijmen de Mes
417
To rate the traffic generated by trusted peers you must add a rating plan in CDRTool rating engine based on the source IP address (the gateway field in rating customers table). Beware that no quota can be imposed on the traffic of a trusted peer.
418
419 4 Tijmen de Mes
h3. Caller Id Indication
420 2 Tijmen de Mes
421 4 Tijmen de Mes
Traffic generated by the trusted peers and any header thereof containing caller id indication is also trusted. When allowing traffic to transit from PBXs to PSTN gateways connected to the, make sure that the way caller ID indication is provided by the trusted party is compatible with what the PSTN gateway expects.
422 2 Tijmen de Mes
423 4 Tijmen de Mes
h2. PSTN to PBX
424 2 Tijmen de Mes
425 7 Tijmen de Mes
!flow-pbx-a-pstn.png!
426 2 Tijmen de Mes
427
428 4 Tijmen de Mes
|Authentication|None|
429
|Authorization|Trusted peer PSTN gateway|
430
|Caller Id|Supplied by PSTN gateway|
431
|Billing party|Trusted peer PSTN gateway|
432
|Accounting|Postpaid|
433
|Media types|RTP (audio)|
434
|From header|Must contain a non-local SIP domain|
435
|Address resolution|ENUM, Custom SIP Proxy logic|
436 2 Tijmen de Mes
437
438 4 Tijmen de Mes
h2. Call Diversion
439
440 7 Tijmen de Mes
!flow-sip-phone-a-b-diverted.png!
441 4 Tijmen de Mes
442 2 Tijmen de Mes
A user may chose to divert his/her calls based on various conditions (like unconditional, busy or not online) to another SIP address including PSTN destinations. Diverted calls are always charged to the user who enabled them. For every call diversion, a new Diversion header is appended to the original SIP request.
443
444
445 4 Tijmen de Mes
|Authentication|SIP account A|
446
|Authorization|SIP account A|
447
|Billing party|SIP account B|
448
|Accounting|Postpaid, Prepaid|
449
|Address resolution|SIP address, SIP alias, Quickdial, ENUM, LCR|
450 2 Tijmen de Mes
451 4 Tijmen de Mes
452
h2. Presence
453
454 7 Tijmen de Mes
!flow-presence.png!
455 4 Tijmen de Mes
456 2 Tijmen de Mes
Multiple watchers are subscribed to a publisher. The Publisher authorizes the watchers to subscriber to presence notifications by updating pres-rules XCAP document. The Publisher must subscribe to event presence.winfo to receive notifications from the Presence Agent about the watcher list.
457
458
459 4 Tijmen de Mes
|Authorization|XCAP pres-rules|
460
|Address resolution|SIP address, SIP alias, Quickdial, ENUM|
461
|Accounting|None|
462 2 Tijmen de Mes
463 18 Adrian Georgescu
h2. Presence using RLS
464 4 Tijmen de Mes
465 7 Tijmen de Mes
!flow-rls-services.png!
466 4 Tijmen de Mes
467 2 Tijmen de Mes
A subscriber uploads to the XCAP server a resource list. Then it subscribes to the list by sending a SUBSCRIBE for event presence with extra header Supported: eventlist, the Presence agent then subscribes to all recipients from the resource lists and returns consolidated NOTIFY with the state of all lists.
468
469 1 Tijmen de Mes
470 15 Adrian Georgescu
|Authorization|XCAP org.openmobilealliance.pres-rules|
471
|Contacts Storage| XCAP rls-services and resource-lists|
472
|Signaling|RLS SUBSCRIBE RFC4662 and RLMI NOTIFY RFC4662|
473 4 Tijmen de Mes
|Address resolution|SIP address, SIP alias, Quickdial, ENUM|
474 1 Tijmen de Mes
|Accounting|None|
475
476 4 Tijmen de Mes
h2. IM using MSRP Relay
477
478 7 Tijmen de Mes
!flow-msrp-relay.png!
479 4 Tijmen de Mes
480 1 Tijmen de Mes
Instant Messaging based on MSRP protocol is similar to a regular SIP audio session. Instead of RTP media , MSRP is used for establishing a media channel. Instead of MediaProxy, A MSRP relay is used to traverse the NAT. The called party reserves a session in the MSRP relay and offeres it in the response to the SIP INVITE. The calling party the initiates a TCP/TLS connection to the relay reserved address and the called party does the same. By using the relay both parties can establish a TCP flow from behind their NAT routers.
481
482 4 Tijmen de Mes
h2. IM using MSRP ACM
483 1 Tijmen de Mes
484 7 Tijmen de Mes
!flow-msrp-acm.png!
485 1 Tijmen de Mes
486 4 Tijmen de Mes
MSRP ACM is an alternative method for traversing NAT that is standardized by 3GPP that is interoperable with the IETF MSRP relay specification. The SBC mangles the SDP and stays in the SIP signaling and MSRP media path and forces the end-points to be both active (that is starting the outbound MSRP connection) when behind NAT.
487 1 Tijmen de Mes
488 4 Tijmen de Mes
h2. IM using MSRP ACM and Relay
489 1 Tijmen de Mes
490 7 Tijmen de Mes
!flow-msrp-acm-relay.png!
491 1 Tijmen de Mes
492
MSRP ACM and Relay methodologies can interoperate.
493
494 4 Tijmen de Mes
h2. File Transfer
495
496 1 Tijmen de Mes
File transfer based on MSRP protocol is similar to a regular SIP audio session. Instead of RTP media , MSRP is used for establishing a media channel. A MSRP relay is used to traverse the NAT.
497
498 4 Tijmen de Mes
h2. Emergency Calls
499 1 Tijmen de Mes
500 4 Tijmen de Mes
Emergency calls refer to dialing short numbers usually associated with emergency services like police or fire-brigade (e.g. 112 or 911). When a session is setup to a short number designated as an emergency number (in the SIP Proxy configuration), a database lookup is performed by the proxy in the emergency&#95;mapping table. Based on the *region* attribute provisioned with the SIP account, the final destination corresponding with the emergency number is looked up. Only local users can dial an emergency number.
501 1 Tijmen de Mes
502 4 Tijmen de Mes
See "Provisioning the emergency numbers":/wiki/ProvisioningGuide#Emergencynumbers section for more information.
503 1 Tijmen de Mes
504 16 Adrian Georgescu
h2. XMMP gateway
505
506
The platform can be setup to federate with remote XMPP domains using a gateway function. The functionality is described at:
507
508
http://sylkserver.ag-projects.com/projects/sylkserver/wiki/DesignXMPP
509
510 17 Adrian Georgescu
h2. PBX Media Functions
511 1 Tijmen de Mes
512
Functions involving playing media in the middle of a call setup are not possible by the design of a SIP Proxy. Features like:
513
514 4 Tijmen de Mes
* IVR
515
* Auto-attendant
516
* Call queues and ACD
517
* Listen-in and barge-in
518
* Call parking
519
* Music on hold (MoH)
520 1 Tijmen de Mes
521 4 Tijmen de Mes
are not performed by a SIP Proxy. Such functions can be implemented only by dedicated IP-PBX added to the platform. The platform is used to route calls between such PBXs, from the MSP perspective these PBX are seen as SIP trunks connected to the platform.