Advanced Documents
Sangoma SDK Interfaces
Sangoma HW Operation Interface
Detect Sangoma Hardware
Load kernel module
Iterate over all hw ports
call back user for each port
Configure Sangoma HW Port
For each port save configuration to the driver
Start Sangoma HW Port
Start driver/hw port.
Start Sangoma HW Port
Stop driver/hw port.
Sangoma FreeTDM Operation Interface
Once sangoma hw ports are configured and started, the FreeTDM Framework can be started for each span.
Create FreeTDM Span
Start FreeTDM Span
Refer to the Sangoma FreeTDM Configuration Interface
Â
Sangoma FreeTDM Signaling and Media Interface
Â
Once FreeTDM Spans are started user application will wait for events.
On call start event, do something useful
Eg: Launch a thread and start recording the media to file from a bchannel
Refer to Sangoma FreeTDM Signaling and Media Interface
Â
Sangoma HW Operation Interface Functions
The Sangoma SDK HW operation interface is located in:
applications/common/libsangoma_wp_config.h |
HW Operation Interface Data Structures
/*!  Sangoma port object structure contains all hw port information  The object is provided to user opaque in order to simplify development.  /*!  The callback structure allows user application to pass on  user_obj - is a user pointer that will be passed back to the user application  hw_probe_callback() - is functin that will be called for each port detected |
Â
Hardware Detection Function
/*!  A very first access to the sangoma operations library. /*!  Detect sangoma hardware on a machine  In callback function user application should: |
Sangoma Port Object Config and Misc Methods
/*! Â This is a method that operates on sangoma_port_obj. */ /*! Â This is a method that operates on sangoma_port_obj. /*! This is a method that operates on sangoma_port_obj. char* sangoma_config_port_hwinfo_get_model_str(sangoma_port_obj_t sangoma_port_obj); |
Â
Sangoma HW Port Operation Methods
/*! Â This is a method that operates on sangoma_port_obj. Â /*! Â This is a method that operates on sangoma_port_obj. /*! Â This is a method that operates on sangoma_port_obj. |
Sangoma FreeTDM Configuration Functions
The Sangoma FreeTDM Operation Interface is located in:
applications/common/libsangoma_freetdm.h |
/*! Main FreeTDM initializatino function. */ Â
/*!
 \fn int sangoma_freetdm_destroy(void);
 \brief Stop the FreeTDM Framework. All Spans will be deallocated.
 \param void
 \return File Descriptor: Non Zero is error, 0 is success
 Stop the FreeTDM Framework.
 All spans will be deallocated.
 Usually called before the application exits.
 Must be the first function to be called before any other FreeTDM call.
*/
int sangoma_freetdm_destroy(void);
/*!
 \fn int sangoma_freetdm_create_span(sangoma_port_obj_t port, ftdm_span_t **span, int operating_mode);
 \brief Create FreeTDM Span. User hw port object for span cfg info.
 \param port Sangoma hw prot obj.
 \param span Created span will be stored in this pointer. Span is an opaque object.
  \param operating_mode will contain the mode on which span needs to be operated like ANALOG/ISUP_SIG/ISUP_VOICE/ISDN/MTP2_API_LSL/MTP2_API_HSL
 \return File Descriptor: Non Zero is error, 0 is success
 Create FreeTDM Span in FreeTDM framework.
 The Sangoma port object will be used to extract hw configuration necessary
 to create the span.
 The FreeTDM span opaque object will be stored in the span argument.
 At this point span is only half configured.
 Next step is to call span configuration function.
*/
int sangoma_freetdm_create_span(sangoma_port_obj_t port, ftdm_span_t **span, int operating_mode);
/*!
 \fn int sangoma_freetdm_span_config_and_start(sangoma_port_obj_t port, ftdm_span_t *span, int operating_mode);
 \brief Configure FreeTDM span based on sangoma port object configuration options.
 \param port Sangoma hw prot obj.
 \param span FreeTDM span object
  \param operating_mode will contain the mode on which span needs to be configured and started like ANALOG/ISUP_SIG/ISUP_VOICE/ISDN/MTP2_API_LSL/MTP2_API_HSL
 \return File Descriptor: Non Zero is error, 0 is success
 This function will configure the FreeTDM span using information from sangoma port obj.
 Once the span is fully configured, the span will be started.
 Once the FreeTDM span starts it will
   Initialize and start signaling on port dchan
   Wait for dchan events.
   One signaling event (such as call start) FreeTDM pass the event structure
   to user application via callback function.
 At this point application is able to call FreeTDM Signaling and Media Functions.
*/
int sangoma_freetdm_span_config_and_start(sangoma_port_obj_t port, ftdm_span_t *span, int operating_mode); |
Â
Sangoma FreeTDM Signaling and Media I/O Interface Functions
The Sangoma FreeTDM Signaling and Media Interface is located in:
Â
FreeTDM Place Call, Indicate Call, Answer Call
/*! \brief Place an outgoing call with the given caller data in a channel according to the hunting scheme provided and records
 *
 *
 */ /*! \brief Place an outgoing call with the given caller data in a channel according to the hunting scheme provided */  /*! \brief Indicate a new condition in an incoming call
 *
 */ /*! \brief Answer call. This can also be accomplished by ftdm_channel_call_indicate with FTDM_CHANNEL_INDICATE_ANSWER, in both
 */ |
Â
FreeTDM Hangup Call
Â
Hangup Cause Codes
Â
Note that some of the hangup codes only apply to FreeTDM framework internals,
not the use application
/*! \brief Hangup cause codes */ |
Â
FreeTDM Call Support Functions
Â
FreeTDM Channel Support Functions
/*!
 *
 *
 */  /*!
 *
 * /*!
 *
 *  /*!
 *
 *
 */ /*!
 *
 */ /*!
 *
 *
 */  /*!
 *
 *
 */ /*!
 *
 *
 */ |
Â
FreeTDM Media Wait, Read, Write
Â
FreeTDM Media Support Functions
Â
FreeTDM Alarm and Statistics
Â