Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

MSISDN Handling


Detailed Description

MSISDN is a term we use for mobile phone number (proper term would be address). In general the mobile phone numbering is quite complex and there are more numbering schemes, details can be found in Ref. 03.40.

The two main formats used by ME are:

Some ME/SIM commands need ADN, some SMS format.

MSISDN API provides functions to operate with both formats and also with MSISDN stored as a plain string.

There exist functions for:

To ask user for MSISDN use the msisdn() function.

To convert MSISDN to user name from phonebook get_adn() can be used.

MSISDN ADN Format
Ref. 11.11

  1. Length of BCD number - number of next bytes, incl. TON/NPI byte
  2. TON (type of number, bits 567) and NPI (numbering plan identification, bits 1234) - 1 byte
  3. Dialing number = (Length-1) bytes

MSISDN SMS Format
Ref. 03.40

  1. Address Length - 1 byte
  2. Type of Address - 1 byte (TON and NPI)
  3. Address Value - (Address Length)/2 ceiled to be even

As of TON/NPI Ref. 03.40, there are plenty of schemes, but the most used are:

Defines

Functions


Define Documentation

#define MSISDN_ADN
 

Indicates ADN format MSISDN.

#define MSISDN_SMS
 

Indicates SMS format MSISDN.

#define MSISDN_STR
 

Indicates string format ('\0' terminated) MSISDN.


Function Documentation

u8 adn_len void   ) 
 

EF_ADN alpha len, Ref. 11.11.

u8* get_adn u8 msisdn,
u8  msisdn_type
 

Try to find msisdn in the SIM EF_ADN (Ref. 11.11) phonebook and return name (=alpha) if found.

Attention:
You have to free() the result once not needed.
Parameters:
msisdn MSISDN to search for, pointer to RAM only
msisdn_type type of MSISDN, either MSISDN_ADN or MSISDN_SMS
Returns:
a character pointer to either alpha or msisdn2str, NULL if malloc error
See also:
adn_ready()

u8* msisdn u8  alpha[ALPHA_LEN]  ) 
 

Inquire user for MSISDN, ref. MSISDN Handling.

Warning:
SIM Toolkit function, usable only in stk_thread().
Parameters:
alpha if not NULL then return name of MSISDN (if available).
Returns:
MSISDN, NULL if user cancel, ENULL if user terminated whole application
Examples:
callback.c, certs.c, pos.c, and tsmsacl.c.

u8* msisdn2str const u8 msisdn,
u8  msisdn_type,
u8  to_src
 

Converts MSISDN in either MSISDN_ADN or MSISDN_SMS formats to string.

Attention:
You have to free() (or efree()) the result once not needed.
Parameters:
msisdn source MSISDN in either MSISDN_ADN or MSISDN_SMS, can be from RAM, EEPROM, PROGMEM
msisdn_type the type MSISDN, either MSISDN_ADN or MSISDN_SMS
to_src resulting memory, MEM_R indicates that result is malloc'ed, MEM_E is emalloc'ed
Returns:
a character pointer, NULL if failed.
See also:
str2msisdn()

u8 msisdncmp const u8 a,
u8  a_type,
const u8 b,
u8  b_type
 

Compare two MSISDNs, each can be in either MSISDN_ADN or MSISDN_SMS formats.

Parameters:
a pointer on MSISDN_A, can be from RAM, EEPROM, PROGMEM
a_type type of MSISDN_A, can be MSISDN_ADN or MSISDN_SMS
b pointer on MSISDN_B, can be from RAM, EEPROM, PROGMEM
b_type type of MSISDN_B, can be MSISDN_ADN or MSISDN_SMS
Returns:
1 if equal, 0 if not equal.

u8* msisdncpy const u8 msisdn,
u8  type,
u8  to_src
 

Make a copy of MSISDN.

Attention:
You have to free() (efree()) the result once not needed.
Parameters:
msisdn pointer on source MSISDN, can be from RAM, EEPROM, PROGMEM
type type of MSISDN, can be MSISDN_ADN or MSISDN_SMS
to_src resulting memory, MEM_R indicates that result is malloc'ed, MEM_E is emalloc'ed
Returns:
a character pointer, NULL if failed.
Examples:
callback.c, certs.c, pos.c, and tsmsacl.c.

u8* str2msisdn const u8 str,
u8  type,
u8  to_src
 

Converts MSISDN string to MSISDN in either MSISDN_ADN or MSISDN_SMS formats.

Attention:
You have to free() (or efree()) the result string once not needed.
Parameters:
str source string - MSISDN in string format, e.g. "606123456" or "+420606123456", can be from RAM, EEPROM, PROGMEM
type the type resulting MSISDN, either MSISDN_ADN or MSISDN_SMS
to_src resulting memory, MEM_R indicates that result is malloc'ed, MEM_E is emalloc'ed
Returns:
a character pointer, NULL if failed.
See also:
msisdn2str()
Examples:
alarm.c, and alarm_flipflop.c.


Copyright © 2004-2006 BLADOX
Turbo version 1.2