MTP3 API Operation

1. Sample application
Note: Not implemented yet 

The sample application is a good way to get familiar with the FreeTDM interface. 

After generating your sample /usr/local/freetdm/conf/freetdm.conf and freetdm.conf.xml files,  you can run the sample application:

#>./run_mtp3 -conf freetdm.conf.xml

The sample application will transmit dummy MSU's on each MTP3 link. And listen incoming events from FreeTDM. The source codes for the run_mtp2 application are:

  1. run_mtp3.c
    Initialization and configuration. 

  2. run_mtp3_test.c
    Test functions and event handlers. 

2. Initialization

The FreeTDM library is initialised using the following function calls:

  1. ftdm_global_init()

  2. ftdm_global_configuration()

  3. For each span:
    ftdm_configue_span_signaling(...);

  4. For each span:
    ftdm_span_start(...); 

 

2.1 ftdm_global_init(void)
FreeTDM initialization function. FreeTDM internal variables and parameters are initialized when this function is called.

2.2. ftdm_global_configuration(void)
FreeTDM general configuration function. FreeTDM protocol specific modules are initialized and loaded when this function is called.

2.3.ftdm_configure_span_signaling(ftdm_span_t *span, fio_signal_cb_t sig_cb, ftdm_conf_parameter_t *ftdm_parameters)
Signaling parameters for each span are set using this function.
span: FreeTDM span structure.
sig_cb: Call back function for events.
ftdm_parameters: configuration parameters. Refer to run_mtp2.c:load_config function for an example of how ftdm_parameters is populated.

2.4.ftdm_span_start(ftdm_span_t *span);
Starts the span.  

3. API Requests

3.1. ftdm_status_t ftdm_channel_set_sig_status_ex(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t sigstatus, ftdm_usrmsg_t *usrmsg);

This function is used by the upper layer to request a change of status to MTP3.

TBD

3.2. ftdm_channel_call_indicate_ex(ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_usrmsg_t *usrmsg);

This function is used by the upper layer to request maintenance tasks to MTP3.

3.3. ftdm_channel_write(ftdm_channel_t *ftdmchan, void* data, ftdm_size_t datasize, ftdm_size_t datalen); 

Used to transmit MSU's. 

example:

/* Request MTP3 to transmit */ static void request_mtp3_transmit(ftdm_channel_t *ftdmchan, void* data, uint32_t datalen) { if (ftdm_channel_write(ftdmchan, data, MAX_MSU_SIZE, &datalen) != FTDM_SUCCESS) { fprintf(stderr, "Failed to write data to channel\n"); } return; }

 


4. API Events 

All indications from the MTP2 layer will result in a signal callback function that was previously registered using ftdm_span_configure.

event_id

Event Type

FTDM_SIGEVENT_SIGSTATUS_CHANGED

Signalling status changed

FTDM_SIGEVENT_RAW

Response to a maintenance request

FTDM_SIGEVENT_IO_INDATA

Incoming data received

 

 To be finalized:

 

User application will be able to register multiple callback function for incoming data, for example:

  1. User application will register 1 callback function for incoming ISUP messages, and 1 callback function for  SCCP messages. When an incoming ISUP message is received, the callback function for ISUP will be called, and when a SCCP message is received, the callback function for SCCP will be called.

Return to Documentation Home I Return to Sangoma Support