Asterisk - The Open Source Telephony Project  18.5.0
Data Structures | Macros | Functions
smdi.h File Reference

SMDI support for Asterisk. More...

#include <termios.h>
#include <time.h>
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/optional_api.h"
Include dependency graph for smdi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ast_smdi_md_message
 An SMDI message desk message. More...
 
struct  ast_smdi_mwi_message
 An SMDI message waiting indicator message. More...
 

Macros

#define SMDI_MAX_FILENAME_LEN   256
 
#define SMDI_MAX_STATION_NUM_LEN   10
 
#define SMDI_MESG_DESK_NUM_LEN   3
 
#define SMDI_MESG_DESK_TERM_LEN   4
 
#define SMDI_MESG_NAME_LEN   80
 
#define SMDI_MWI_FAIL_CAUSE_LEN   3
 

Functions

struct ast_smdi_interfaceast_smdi_interface_find (const char *iface_name)
 Find an SMDI interface with the specified name. More...
 
struct ast_smdi_md_messageast_smdi_md_message_pop (struct ast_smdi_interface *iface)
 Get the next SMDI message from the queue. More...
 
struct ast_smdi_md_messageast_smdi_md_message_wait (struct ast_smdi_interface *iface, int timeout)
 Get the next SMDI message from the queue. More...
 
struct ast_smdi_mwi_messageast_smdi_mwi_message_pop (struct ast_smdi_interface *iface)
 Get the next SMDI message from the queue. More...
 
struct ast_smdi_mwi_messageast_smdi_mwi_message_wait (struct ast_smdi_interface *iface, int timeout)
 Get the next SMDI message from the queue. More...
 
struct ast_smdi_mwi_messageast_smdi_mwi_message_wait_station (struct ast_smdi_interface *iface, int timeout, const char *station)
 
int ast_smdi_mwi_set (struct ast_smdi_interface *iface, const char *mailbox)
 Set the MWI indicator for a mailbox. More...
 
int ast_smdi_mwi_unset (struct ast_smdi_interface *iface, const char *mailbox)
 Unset the MWI indicator for a mailbox. More...
 

Detailed Description

SMDI support for Asterisk.

Author
Matthew A. Nicholson mnich[email protected]olso[email protected][email protected][email protected]ium.[email protected]com
Russell Bryant russe[email protected][email protected][email protected]igium[email protected].com

Definition in file smdi.h.

Macro Definition Documentation

◆ SMDI_MAX_FILENAME_LEN

#define SMDI_MAX_FILENAME_LEN   256

Definition at line 42 of file smdi.h.

◆ SMDI_MAX_STATION_NUM_LEN

#define SMDI_MAX_STATION_NUM_LEN   10

Definition at line 41 of file smdi.h.

◆ SMDI_MESG_DESK_NUM_LEN

#define SMDI_MESG_DESK_NUM_LEN   3

Definition at line 38 of file smdi.h.

Referenced by smdi_msg_find().

◆ SMDI_MESG_DESK_TERM_LEN

#define SMDI_MESG_DESK_TERM_LEN   4

Definition at line 39 of file smdi.h.

Referenced by smdi_msg_find().

◆ SMDI_MESG_NAME_LEN

#define SMDI_MESG_NAME_LEN   80

Definition at line 37 of file smdi.h.

◆ SMDI_MWI_FAIL_CAUSE_LEN

#define SMDI_MWI_FAIL_CAUSE_LEN   3

Definition at line 40 of file smdi.h.

Function Documentation

◆ ast_smdi_interface_find()

struct ast_smdi_interface* ast_smdi_interface_find ( const char *  iface_name)

Find an SMDI interface with the specified name.

Parameters
iface_namethe name/port of the interface to search for.
Returns
an ao2 reference to the interface located or NULL if none was found.

Definition at line 563 of file res_smdi.c.

References ao2_find, ao2_global_obj_ref, ao2_ref, c, NULL, and OBJ_SEARCH_KEY.

Referenced by actual_load_config(), mkintf(), and smdi_msg_retrieve_read().

564 {
565  struct ao2_container *c;
566  struct ast_smdi_interface *iface = NULL;
567 
568  c = ao2_global_obj_ref(smdi_ifaces);
569  if (c) {
570  iface = ao2_find(c, iface_name, OBJ_SEARCH_KEY);
571  ao2_ref(c, -1);
572  }
573 
574  return iface;
575 }
The arg parameter is a search key, but is not an object.
Definition: astobj2.h:1105
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
static struct test_val c
#define NULL
Definition: resample.c:96
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
Generic container type.

◆ ast_smdi_md_message_pop()

struct ast_smdi_md_message* ast_smdi_md_message_pop ( struct ast_smdi_interface iface)

Get the next SMDI message from the queue.

Parameters
ifacea pointer to the interface to use.

This function pulls the first unexpired message from the SMDI message queue on the specified interface. It will purge all expired SMDI messages before returning.

Returns
the next SMDI message, or NULL if there were no pending messages.

Definition at line 534 of file res_smdi.c.

References SMDI_MD, and smdi_msg_pop().

535 {
536  return smdi_msg_pop(iface, SMDI_MD);
537 }
static void * smdi_msg_pop(struct ast_smdi_interface *iface, enum smdi_message_type type)
Definition: res_smdi.c:416

◆ ast_smdi_md_message_wait()

struct ast_smdi_md_message* ast_smdi_md_message_wait ( struct ast_smdi_interface iface,
int  timeout 
)

Get the next SMDI message from the queue.

Parameters
ifacea pointer to the interface to use.
timeoutthe time to wait before returning in milliseconds.

This function pulls a message from the SMDI message queue on the specified interface. If no message is available this function will wait the specified amount of time before returning.

Returns
the next SMDI message, or NULL if there were no pending messages and the timeout has expired.

Definition at line 539 of file res_smdi.c.

References NULL, SMDI_MD, smdi_message_wait(), and timeout.

Referenced by __analog_ss_thread(), and analog_ss_thread().

540 {
541  struct ast_flags options = { 0 };
542  return smdi_message_wait(iface, timeout, SMDI_MD, NULL, options);
543 }
static int timeout
Definition: cdr_mysql.c:86
#define NULL
Definition: resample.c:96
static void * smdi_message_wait(struct ast_smdi_interface *iface, int timeout, enum smdi_message_type type, const char *search_key, struct ast_flags options)
Definition: res_smdi.c:478
Structure used to handle boolean flags.
Definition: utils.h:199
static struct test_options options

◆ ast_smdi_mwi_message_pop()

struct ast_smdi_mwi_message* ast_smdi_mwi_message_pop ( struct ast_smdi_interface iface)

Get the next SMDI message from the queue.

Parameters
ifacea pointer to the interface to use.

This function pulls the first unexpired message from the SMDI message queue on the specified interface. It will purge all expired SMDI messages before returning.

Returns
the next SMDI message, or NULL if there were no pending messages.

Definition at line 545 of file res_smdi.c.

References smdi_msg_pop(), and SMDI_MWI.

546 {
547  return smdi_msg_pop(iface, SMDI_MWI);
548 }
static void * smdi_msg_pop(struct ast_smdi_interface *iface, enum smdi_message_type type)
Definition: res_smdi.c:416

◆ ast_smdi_mwi_message_wait()

struct ast_smdi_mwi_message* ast_smdi_mwi_message_wait ( struct ast_smdi_interface iface,
int  timeout 
)

Get the next SMDI message from the queue.

Parameters
ifacea pointer to the interface to use.
timeoutthe time to wait before returning in milliseconds.

This function pulls a message from the SMDI message queue on the specified interface. If no message is available this function will wait the specified amount of time before returning.

Returns
the next SMDI message, or NULL if there were no pending messages and the timeout has expired.

Definition at line 550 of file res_smdi.c.

References NULL, smdi_message_wait(), SMDI_MWI, and timeout.

551 {
552  struct ast_flags options = { 0 };
553  return smdi_message_wait(iface, timeout, SMDI_MWI, NULL, options);
554 }
static int timeout
Definition: cdr_mysql.c:86
#define NULL
Definition: resample.c:96
static void * smdi_message_wait(struct ast_smdi_interface *iface, int timeout, enum smdi_message_type type, const char *search_key, struct ast_flags options)
Definition: res_smdi.c:478
Structure used to handle boolean flags.
Definition: utils.h:199
static struct test_options options

◆ ast_smdi_mwi_message_wait_station()

struct ast_smdi_mwi_message* ast_smdi_mwi_message_wait_station ( struct ast_smdi_interface iface,
int  timeout,
const char *  station 
)

Definition at line 556 of file res_smdi.c.

References smdi_message_wait(), and SMDI_MWI.

Referenced by run_externnotify().

558 {
559  struct ast_flags options = { 0 };
560  return smdi_message_wait(iface, timeout, SMDI_MWI, station, options);
561 }
static int timeout
Definition: cdr_mysql.c:86
static void * smdi_message_wait(struct ast_smdi_interface *iface, int timeout, enum smdi_message_type type, const char *search_key, struct ast_flags options)
Definition: res_smdi.c:478
Structure used to handle boolean flags.
Definition: utils.h:199
static struct test_options options

◆ ast_smdi_mwi_set()

int ast_smdi_mwi_set ( struct ast_smdi_interface iface,
const char *  mailbox 
)

Set the MWI indicator for a mailbox.

Parameters
ifacethe interface to use.
mailboxthe mailbox to use.

Definition at line 309 of file res_smdi.c.

References mailbox, and smdi_toggle_mwi().

Referenced by poll_mailbox(), and run_externnotify().

310 {
311  return smdi_toggle_mwi(iface, mailbox, 1);
312 }
static char mailbox[AST_MAX_MAILBOX_UNIQUEID]
Definition: chan_mgcp.c:204
static int smdi_toggle_mwi(struct ast_smdi_interface *iface, const char *mailbox, int on)
Definition: res_smdi.c:282

◆ ast_smdi_mwi_unset()

int ast_smdi_mwi_unset ( struct ast_smdi_interface iface,
const char *  mailbox 
)

Unset the MWI indicator for a mailbox.

Parameters
ifacethe interface to use.
mailboxthe mailbox to use.

Definition at line 314 of file res_smdi.c.

References mailbox, and smdi_toggle_mwi().

Referenced by poll_mailbox(), and run_externnotify().

315 {
316  return smdi_toggle_mwi(iface, mailbox, 0);
317 }
static char mailbox[AST_MAX_MAILBOX_UNIQUEID]
Definition: chan_mgcp.c:204
static int smdi_toggle_mwi(struct ast_smdi_interface *iface, const char *mailbox, int on)
Definition: res_smdi.c:282