1sipt Module 2 3Torrey Searle 4 5 Voxbone SA 6 <torrey@voxbone.com> 7 8 Copyright © 2013 Voxbone SA 9 __________________________________________________________________ 10 11 Table of Contents 12 13 1. Admin Guide 14 15 1. Overview 16 2. Dependencies 17 3. Functions 18 19 3.1. sipt_destination(destination, hops, nai[, 20 terminator=1]) 21 22 3.2. sipt_set_bci_1(charge_indicator, called_status, 23 called_category, e2e_indicator) 24 25 3.3. sipt_set_calling(origin, nai, presentation, screening) 26 3.4. sipt_forwarding(origin, nai) 27 28 4. Exported pseudo-variables 29 30 4.1. $sipt(calling_party_number.presentation) / 31 $sipt_presentation 32 33 4.2. $sipt(calling_party_number.screening) / $sipt_screening 34 4.3. $sipt(hop_counter) / $sipt_hop_counter 35 4.4. $sipt(calling_party_category) / $sipt(cpc) / $sipt_cpc 36 4.5. $sipt(calling_party_number.nature_of_address) / 37 $sipt.(calling_party_number.nai) / 38 $sipt_calling_party_nai 39 40 4.6. $sipt(called_party_number.nature_of_address) / 41 $sipt(called_party_number.nai) / 42 $sipt_called_party_nai 43 44 4.7. $sipt(event_info) 45 4.8. $sipt(backward_call_indicator.charge_indicator) 46 4.9. $sipt(redirection_info) / $sipt_redirection_info 47 4.10. $sipt(redirection_number) / $sipt_redirection_number 48 4.11. $sipt(redirection_number.nai) / 49 $sipt_redirection_number_nai 50 51 List of Tables 52 53 1.1. Address Presentation Restricted Indicator Values 54 1.2. Screening Indicator Values 55 1.3. Calling Nature of Address Values 56 1.4. Called Nature of Address Values 57 1.5. Event Info Values 58 1.6. Charge Indicator Values 59 1.7. Redirecting reason Values 60 1.8. Redirecting number NAI Values 61 62 List of Examples 63 64 1.1. sipt_destination(destination, hops, nai) usage 65 1.2. sipt_destination(destination, hops, nai) usage 66 1.3. sipt_set_calling(origin, nai, presentation, screening) usage 67 1.4. sipt_set_calling(origin, nai) usage 68 1.5. sipt_presentation pseudo-variable usage 69 1.6. sipt_screening pseudo-variable usage 70 1.7. sipt_hop_counter pseudo-variable usage 71 1.8. sipt_cpc pseudo-variable usage 72 1.9. sipt_calling_party_nai pseudo-variable usage 73 1.10. sipt_called_party_nai pseudo-variable usage 74 1.11. sipt_redirection_number usage 75 76Chapter 1. Admin Guide 77 78 Table of Contents 79 80 1. Overview 81 2. Dependencies 82 3. Functions 83 84 3.1. sipt_destination(destination, hops, nai[, terminator=1]) 85 3.2. sipt_set_bci_1(charge_indicator, called_status, 86 called_category, e2e_indicator) 87 88 3.3. sipt_set_calling(origin, nai, presentation, screening) 89 3.4. sipt_forwarding(origin, nai) 90 91 4. Exported pseudo-variables 92 93 4.1. $sipt(calling_party_number.presentation) / $sipt_presentation 94 4.2. $sipt(calling_party_number.screening) / $sipt_screening 95 4.3. $sipt(hop_counter) / $sipt_hop_counter 96 4.4. $sipt(calling_party_category) / $sipt(cpc) / $sipt_cpc 97 4.5. $sipt(calling_party_number.nature_of_address) / 98 $sipt.(calling_party_number.nai) / $sipt_calling_party_nai 99 100 4.6. $sipt(called_party_number.nature_of_address) / 101 $sipt(called_party_number.nai) / $sipt_called_party_nai 102 103 4.7. $sipt(event_info) 104 4.8. $sipt(backward_call_indicator.charge_indicator) 105 4.9. $sipt(redirection_info) / $sipt_redirection_info 106 4.10. $sipt(redirection_number) / $sipt_redirection_number 107 4.11. $sipt(redirection_number.nai) / $sipt_redirection_number_nai 108 1091. Overview 110 111 Module for updating ISUP encapsulated in SIP (SIP-T/SIP-I) 112 113 The sipt module can be used to update various ss7 headers contained 114 inside a message. 115 1162. Dependencies 117 118 The module depends on the following modules (in the other words the 119 listed modules must be loaded before this module): 120 * none 121 1223. Functions 123 124 3.1. sipt_destination(destination, hops, nai[, terminator=1]) 125 3.2. sipt_set_bci_1(charge_indicator, called_status, called_category, 126 e2e_indicator) 127 128 3.3. sipt_set_calling(origin, nai, presentation, screening) 129 3.4. sipt_forwarding(origin, nai) 130 1313.1. sipt_destination(destination, hops, nai[, terminator=1]) 132 133 updates the IAM in the body if it exists, setting the called party 134 number to “destination” with the nature address specified in “nai” and 135 decrementing the hop counter value if present. If the hop counter 136 header is missing it will be added with the value of “hops”. If 137 “terminator” is set to 1, then F will be appended to digit string to 138 indicate the number is complete (default). 139 140 Example 1.1. sipt_destination(destination, hops, nai) usage 141... 142# update the destination number to our current request uri, 143# setting nature of address to international 144$rU = "19495551234"; 145sipt_destination($rU, 31, 4); 146... 147 1483.2. sipt_set_bci_1(charge_indicator, called_status, called_category, 149e2e_indicator) 150 151 updates the first byte of the backward call indicator in the ACM or COT 152 in the body if setting the Charge Indicator to “charge_indicator”, the 153 Called party's status indicator in “called_status”, the Called party's 154 category indicator in “called_category” and the End to End Method 155 Indicator with the value of the value of “e2e_indicator”. 156 157 Example 1.2. sipt_destination(destination, hops, nai) usage 158... 159# set bci for charging, subscriber free, ordinary, no e2e available 160sipt_set_bci_1("2", "1", "1", "0"); 161... 162 1633.3. sipt_set_calling(origin, nai, presentation, screening) 164 165 updates the IAM in the body if it exists, setting (or adding) the 166 calling party number to “origin” with the nature address specified in 167 “nai” and setting the presentation and screening values to 168 “presentation” and “screening”. 169 170 Example 1.3. sipt_set_calling(origin, nai, presentation, screening) 171 usage 172... 173# update the calling party to the value in the from header 174sipt_set_calling($fU, 4, 0, 3); 175... 176 1773.4. sipt_forwarding(origin, nai) 178 179 updates the IAM in the body if it exists, setting (or adding) the 180 forwarding number to “origin” with the nature address specified in 181 “nai”. 182 183 Example 1.4. sipt_set_calling(origin, nai) usage 184... 185# update the forwarding number to the value in the from header 186sipt_forwarfing($avp(s:forwarding_number), 3); 187... 188 1894. Exported pseudo-variables 190 191 4.1. $sipt(calling_party_number.presentation) / $sipt_presentation 192 4.2. $sipt(calling_party_number.screening) / $sipt_screening 193 4.3. $sipt(hop_counter) / $sipt_hop_counter 194 4.4. $sipt(calling_party_category) / $sipt(cpc) / $sipt_cpc 195 4.5. $sipt(calling_party_number.nature_of_address) / 196 $sipt.(calling_party_number.nai) / $sipt_calling_party_nai 197 198 4.6. $sipt(called_party_number.nature_of_address) / 199 $sipt(called_party_number.nai) / $sipt_called_party_nai 200 201 4.7. $sipt(event_info) 202 4.8. $sipt(backward_call_indicator.charge_indicator) 203 4.9. $sipt(redirection_info) / $sipt_redirection_info 204 4.10. $sipt(redirection_number) / $sipt_redirection_number 205 4.11. $sipt(redirection_number.nai) / $sipt_redirection_number_nai 206 2074.1. $sipt(calling_party_number.presentation) / $sipt_presentation 208 209 Returns the value of the Address presentation restricted indicator 210 contained in the Calling Party Number header of the IAM message if it 211 exists. Returns -1 if there isn't a Calling Party Number header. 212 213 Table 1.1. Address Presentation Restricted Indicator Values 214 0 presentation allowed 215 1 presentation restricted 216 2 address not avail (national use) 217 3 spare 218 219 Example 1.5. sipt_presentation pseudo-variable usage 220... 221# add privacy header if restriction is requested 222if($sipt(calling_party_number.presentation) == 1) 223{ 224 append_hf("Privacy: id\r\n"); 225 $fn = "Anonymous"; 226} 227 228... 229 2304.2. $sipt(calling_party_number.screening) / $sipt_screening 231 232 Returns the value of the Screening Indicator contained in the Calling 233 Party Number header of the IAM message if it exists. Returns -1 if 234 there isn't a Calling Party Number header. 235 236 Table 1.2. Screening Indicator Values 237 0 Reserved (user provided, not verified) 238 1 User Provided, Verified and Passed 239 2 Reserved (user provided, verified and failed) 240 3 Network provided 241 242 Example 1.6. sipt_screening pseudo-variable usage 243... 244 245# remove P-Asserted-Identity header if the screening isn't verified 246# or network provided 247$avp(s:screening) = $sipt(calling_party_number.screening); 248if($avp(s:screening) != 1 && $avp(s:screening) != 3) 249{ 250 remove_hf("P-Asserted-Id"); 251} 252 253... 254 2554.3. $sipt(hop_counter) / $sipt_hop_counter 256 257 Returns the value of the Hop Counter for the IAM message if it exists. 258 Returns -1 if there isn't a hop counter. 259 260 Example 1.7. sipt_hop_counter pseudo-variable usage 261... 262# get the hop counter and update the Max-Forwards header if it exists 263$avp(s:hop) = $sipt(hop_counter); 264if($avp(s:hop) > 0) 265{ 266 remove_hf("Max-Forwards"); 267 append_hf("Max-Forwards: $avp(s:hop)\r\n"); 268} 269 270... 271 2724.4. $sipt(calling_party_category) / $sipt(cpc) / $sipt_cpc 273 274 Returns the value of the Calling Party Category for the IAM message. 275 Returns -1 if there is a parsing error. 276 277 Example 1.8. sipt_cpc pseudo-variable usage 278... 279# get the Cpc code and set put it in a custom sip header 280append_hf("X-CPC: $sipt(cpc)\r\n"); 281 282... 283 2844.5. $sipt(calling_party_number.nature_of_address) / 285$sipt.(calling_party_number.nai) / $sipt_calling_party_nai 286 287 Returns the value of the Nature of Address Indicator of the Calling 288 Party for the IAM message. Returns -1 if there is a parsing error or if 289 the Calling Party Number is not present. 290 291 Table 1.3. Calling Nature of Address Values 292 0 Spare 293 1 Subscriber Number (national use) 294 2 Unknown (national use) 295 3 National (significant) number (national use) 296 4 International use 297 298 Example 1.9. sipt_calling_party_nai pseudo-variable usage 299... 300# get the Calling Nai and add country code if national 301if($sipt(calling_party_number.nai) == 3) 302{ 303 $fU = "32" + "$fU"; 304} 305 306... 307 3084.6. $sipt(called_party_number.nature_of_address) / 309$sipt(called_party_number.nai) / $sipt_called_party_nai 310 311 Returns the value of the Nature of Address Indicator of the Called 312 Party for the IAM message. Returns -1 if there is a parsing error. 313 314 Table 1.4. Called Nature of Address Values 315 0 Spare 316 1 Subscriber Number (national use) 317 2 Unknown (national use) 318 3 National (significant) number 319 4 International use 320 5 Network-specific number (national use) 321 322 Example 1.10. sipt_called_party_nai pseudo-variable usage 323... 324# get the Called Nai and add country code if national 325if($sipt(called_party_number.nai) == 3) 326{ 327 $rU = "32" + "$rU"; 328} 329 330... 331 3324.7. $sipt(event_info) 333 334 Returns the value of the Event Info header of the CPG message. Returns 335 -1 if there is a parsing error. 336 337 Table 1.5. Event Info Values 338 0 Spare 339 1 ALERTING 340 2 PROGRESS 341 3 In-band information or an appropriate pattern is now available 342 4 Call forward on busy 343 5 Call forward on no reply 344 6 Call forward unconditional 345 3464.8. $sipt(backward_call_indicator.charge_indicator) 347 348 Returns the value of the charge indication of the backward call 349 indicator header in the ACM or COT message. Returns -1 if there is a 350 parsing error. 351 352 Table 1.6. Charge Indicator Values 353 0 no indication 354 1 no charge 355 2 charge 356 3 spare 357 3584.9. $sipt(redirection_info) / $sipt_redirection_info 359 360 Returns redirection info header from ISUP Returns "Redirecting reason" 361 or -1 if no redirection info found. 362 363 Table 1.7. Redirecting reason Values 364 0 Unknown 365 1 User busy 366 2 PROGRESS 367 3 no reply 368 4 deflection during alerting 369 5 deflection immediate response 370 6 mobile subscriber not reachable 371 3724.10. $sipt(redirection_number) / $sipt_redirection_number 373 374 Returns number to which redirection will trigered Returns -1 if there 375 is a parsing error. 376 377 Example 1.11. sipt_redirection_number usage 378... 379# get the redirection number 380$avp(s:redir_num) = $sipt(redirection_number); 381 382... 383 3844.11. $sipt(redirection_number.nai) / $sipt_redirection_number_nai 385 386 Returns NAI for redirection number from ISUP Returns NAI for 387 redirection number or -1 if no info found. 388 389 Table 1.8. Redirecting number NAI Values 390 0 Spare 391 1 Subscriber Number (national use) 392 2 Unknown (national use) 393 3 National (significant) number (national use) 394 4 International use 395