FreeCalypso > hg > themwi-smsc
comparison doc/Arch-design @ 1:c4f8a32af088
doc/Arch-design: continuing
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 20 Dec 2023 09:27:05 +0000 |
| parents | 9e364c18e0e8 |
| children | b203ebebe9b3 |
comparison
equal
deleted
inserted
replaced
| 0:9e364c18e0e8 | 1:c4f8a32af088 |
|---|---|
| 330 possible to avoid looking at users' private message content when it is not | 330 possible to avoid looking at users' private message content when it is not |
| 331 necessary to do so for technical troubleshooting reasons. Toward this | 331 necessary to do so for technical troubleshooting reasons. Toward this |
| 332 objective, themwi-smsc-dump must make it easy to look at only technically | 332 objective, themwi-smsc-dump must make it easy to look at only technically |
| 333 necessary information, without throwing unnecessary private info into the | 333 necessary information, without throwing unnecessary private info into the |
| 334 operator's eyeballs. | 334 operator's eyeballs. |
| 335 | |
| 336 2.3. themwi-smsc-core daemon operation | |
| 337 | |
| 338 The core daemon (long-lived process) of ThemWi-SMSC is named themwi-smsc-core. | |
| 339 Aside from themwi-smsc-dump read-only tool, themwi-smsc-core will be the only | |
| 340 software component that accesses pms.bin directly - all other components of | |
| 341 ThemWi-SMSC will connect to a UNIX domain local socket provided by | |
| 342 themwi-smsc-core. In more detail, the core daemon will perform the following | |
| 343 functions: | |
| 344 | |
| 345 * Read the potentially-active (not marked as historical-only) tail portion of | |
| 346 PMS on startup, catch all still-active SMs and hold them in RAM-based data | |
| 347 structures; | |
| 348 | |
| 349 * Listen on a UNIX domain local socket of type SOCK_SEQPACKET, meaning | |
| 350 connection- and message-oriented; | |
| 351 | |
| 352 * Accept message submission (or entry) commands from other ThemWi-SMSC | |
| 353 components connecting to this socket; | |
| 354 | |
| 355 * Allow those socket-connecting SMSC components to register themselves as | |
| 356 performing special roles (GSM network interface, IMSI resolver, uplink and | |
| 357 downlink SMPP connection handlers), and send notification packets to those | |
| 358 role-handlers when an active SM needs that type of processing; | |
| 359 | |
| 360 * When these just-described role-handlers respond with success or failure of | |
| 361 message handling, discharge the SM into historical state (either delivered or | |
| 362 failed), or in one special case (successful completion of MSISDN-to-IMSI | |
| 363 lookup) promote the SM from need-IMSI-lookup state into GSM-MT-delivery state. | |
| 364 | |
| 365 The key feature of themwi-smsc-core daemon is that it can stay up and running | |
| 366 even when all other ThemWi-SMSC daemon processes are shut down. It won't be | |
| 367 particularly useful in this state, and won't be able to bring any outstanding | |
| 368 active SMs any closer toward delivery, but the key point is that dependency | |
| 369 graph arrows between sw components point in only one direction. | |
| 370 | |
| 371 2.4. Message entry paths | |
| 372 | |
| 373 Every new SM enters the SMSC by way of one of our sw components making a local | |
| 374 socket connection to themwi-smsc-core and sending it a "submit new message" | |
| 375 command packet. The following ThemWi-SMSC sw components will be able to enter | |
| 376 new SMs in this manner: | |
| 377 | |
| 378 * A special command line utility named themwi-smsc-submit will perform just | |
| 379 this function and nothing else; | |
| 380 | |
| 381 * GSM network interface daemon themwi-smsc-gsmif will submit SMs received from | |
| 382 GSM subscribers as MO messages; | |
| 383 | |
| 384 * Upstream SMPP link handler themwi-smsc-uplink will submit SMs received from | |
| 385 the upstream connection, i.e., from the outside world; | |
| 386 | |
| 387 * Downstream SMPP link handlers will submit SMs received from downstream peers. | |
| 388 | |
| 389 Most of the common processing functions, such routing and validation steps, | |
| 390 will be performed by themwi-smsc-core. Once all admission-time checks pass, | |
| 391 the new SM will be written into PMS, and if the destination is anything other | |
| 392 than write-into-PMS-only, the new active SM will also be added to the core | |
| 393 daemon's in-RAM data structures. Further delivery steps will happen if and when | |
| 394 the appropriate role-handler connects to themwi-smsc-core and accepts messages | |
| 395 for processing. | |
| 396 | |
| 397 2.4.1. Routing of Short Messages | |
| 398 | |
| 399 For every incoming SM, themwi-smsc-core will apply routing based on the | |
| 400 destination address in addr_to_orig member of the submitted struct sm_record. | |
| 401 Referring to the general principles of section 1.1, this step is very specific | |
| 402 to the numbering plan (NANP) for which ThemWi-SMSC is designed. The following | |
| 403 routing rules will be applied: | |
| 404 | |
| 405 * If the destination number is international (TON=1) and the country code is | |
| 406 anything other than +1, the destination is set to SME_CLASS_UPSTREAM. | |
| 407 | |
| 408 * If the destination number is NANP, entered in international TON=1 format or | |
| 409 in one of local-culture formats (10-digit NPANXXXXXX or 11-digit 1NPANXXXXXX, | |
| 410 TON=0), NANP validation rules are applied and outright-invalid numbers are | |
| 411 rejected. The validated NANP number is looked up in themwi-nanp database of | |
| 412 locally owned phone numbers; if the number is locally owned, the destination | |
| 413 is either SME_CLASS_LOCAL or SME_CLASS_GSM, depending on how the number is | |
| 414 assigned, or the message may be rejected if the locally-owned number is of a | |
| 415 type that cannot receive SMS. If there is no hit in the database of locally | |
| 416 owned numbers, another number database gets a lookup, the one for numbers of | |
| 417 downstream peers - a hit in that database will set the destination to | |
| 418 SME_CLASS_DOWNSTREAM. Finally, if the NANP destination number doesn't hit | |
| 419 anywhere, the destination is SME_CLASS_UPSTREAM. | |
| 420 | |
| 421 * If the destination number is a USA SMS short code of form NXXXX or NXXXXX, | |
| 422 the destination is SME_CLASS_UPSTREAM. | |
| 423 | |
| 424 * In the case of locally originated SMs only (coming from GSM MO or from | |
| 425 themwi-smsc-submit command line utility), special 4-digit numbers may be | |
| 426 defined in the number database of themwi-nanp that are meaningful only | |
| 427 locally. If one of those numbers matches, the destination is SME_CLASS_LOCAL | |
| 428 or SME_CLASS_GSM according to the exact number type. | |
| 429 | |
| 430 * If none of the above conditions match, the message is rejected as unroutable. | |
| 431 | |
| 432 What is the difference between SME_CLASS_LOCAL and SME_CLASS_GSM destinations? | |
| 433 Answer: SME_CLASS_LOCAL means that writing the SM into PMS constitutes final | |
| 434 delivery, and nothing more needs to be done. OTOH, destination of SME_CLASS_GSM | |
| 435 means that an MSISDN-to-IMSI lookup needs to be performed, followed by GSM MT | |
| 436 delivery. | |
| 437 | |
| 438 There is one additional routing mode that is available only via | |
| 439 themwi-smsc-submit, or perhaps future specialized network sw components that | |
| 440 incorporate the same function: if a locally generated MT message needs to be | |
| 441 sent to a local GSM MS addressed by IMSI, with no destination phone number | |
| 442 existing at all, themwi-smsc-submit can instruct themwi-smsc-core to skip the | |
| 443 routing step, with the destination preset to SME_CLASS_GSM and dest_imsi | |
| 444 prefilled. | |
| 445 | |
| 446 2.4.2. Permission to send to the uplink | |
| 447 | |
| 448 To be described. | |
| 449 | |
| 450 2.4.3. PID and DCS constraints | |
| 451 | |
| 452 To be described. | |
| 453 | |
| 454 2.4.4. Validity period and expiry time | |
| 455 | |
| 456 To be described. | |
| 457 | |
| 458 3. SMS communication via direct shell access | |
| 459 | |
| 460 To be filled. | |
| 461 | |
| 462 4. Interface to local Osmocom GSM network | |
| 463 | |
| 464 GSUP and separate MSISDN-to-IMSI lookup, to be described. | |
| 465 | |
| 466 5. SMPP connection handlers and outside-world SM exchange | |
| 467 | |
| 468 To be filled. |
