Thu Apr 28 2011 16:57:18

Asterisk developer's documentation


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/astobj.h"
#include "asterisk/astobj.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...

Defines

#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_MWI_FAIL_CAUSE_LEN   3

Functions

struct ast_smdi_interfaceast_smdi_interface_find (const char *iface_name) attribute_weak
 Find an SMDI interface with the specified name.
void ast_smdi_interface_unref (struct ast_smdi_interface *iface) attribute_weak
void ast_smdi_md_message_destroy (struct ast_smdi_md_message *msg) attribute_weak
 ast_smdi_md_message destructor.
struct ast_smdi_md_messageast_smdi_md_message_pop (struct ast_smdi_interface *iface) attribute_weak
 Get the next SMDI message from the queue.
void ast_smdi_md_message_putback (struct ast_smdi_interface *iface, struct ast_smdi_md_message *msg) attribute_weak
 Put an SMDI message back in the front of the queue.
struct ast_smdi_md_messageast_smdi_md_message_wait (struct ast_smdi_interface *iface, int timeout) attribute_weak
 Get the next SMDI message from the queue.
void ast_smdi_mwi_message_destroy (struct ast_smdi_mwi_message *msg) attribute_weak
 ast_smdi_mwi_message destructor.
struct ast_smdi_mwi_messageast_smdi_mwi_message_pop (struct ast_smdi_interface *iface) attribute_weak
 Get the next SMDI message from the queue.
void ast_smdi_mwi_message_putback (struct ast_smdi_interface *iface, struct ast_smdi_mwi_message *msg) attribute_weak
 Put an SMDI message back in the front of the queue.
struct ast_smdi_mwi_messageast_smdi_mwi_message_wait (struct ast_smdi_interface *iface, int timeout) attribute_weak
 Get the next SMDI message from the queue.
struct ast_smdi_mwi_messageast_smdi_mwi_message_wait_station (struct ast_smdi_interface *iface, int timeout, const char *station) attribute_weak
int ast_smdi_mwi_set (struct ast_smdi_interface *iface, const char *mailbox) attribute_weak
 Set the MWI indicator for a mailbox.
int ast_smdi_mwi_unset (struct ast_smdi_interface *iface, const char *mailbox) attribute_weak
 Unset the MWI indicator for a mailbox.

Detailed Description

SMDI support for Asterisk.

Author:
Matthew A. Nicholson <mnicholson@digium.com>
Russell Bryant <russell@digium.com>

Definition in file smdi.h.


Define Documentation

#define SMDI_MAX_FILENAME_LEN   256

Definition at line 45 of file smdi.h.

#define SMDI_MAX_STATION_NUM_LEN   10

Definition at line 44 of file smdi.h.

#define SMDI_MESG_DESK_NUM_LEN   3

Definition at line 41 of file smdi.h.

#define SMDI_MESG_DESK_TERM_LEN   4

Definition at line 42 of file smdi.h.

#define SMDI_MWI_FAIL_CAUSE_LEN   3

Definition at line 43 of file smdi.h.


Function Documentation

struct ast_smdi_interface* ast_smdi_interface_find ( const char *  iface_name) [read]

Find an SMDI interface with the specified name.

Parameters:
iface_namethe name/port of the interface to search for.
Returns:
a pointer to the interface located or NULL if none was found. This actually returns an ASTOBJ reference and should be released using ASTOBJ_UNREF(iface, ast_smdi_interface_destroy).

Definition at line 529 of file res_smdi.c.

References ASTOBJ_CONTAINER_FIND, and smdi_ifaces.

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

{
   return (ASTOBJ_CONTAINER_FIND(&smdi_ifaces, iface_name));
}
void ast_smdi_interface_unref ( struct ast_smdi_interface iface)

Definition at line 161 of file res_smdi.c.

References ast_smdi_interface_destroy(), and ASTOBJ_UNREF.

Referenced by destroy_dahdi_pvt().

void ast_smdi_md_message_destroy ( struct ast_smdi_md_message msg)
struct ast_smdi_md_message* ast_smdi_md_message_pop ( struct ast_smdi_interface iface) [read]

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 500 of file res_smdi.c.

References SMDI_MD, and smdi_msg_pop().

{
   return smdi_msg_pop(iface, SMDI_MD);
}
void ast_smdi_md_message_putback ( struct ast_smdi_interface iface,
struct ast_smdi_md_message msg 
)

Put an SMDI message back in the front of the queue.

Parameters:
ifacea pointer to the interface to use.
md_msga pointer to the message to use.

This function puts a message back in the front of the specified queue. It should be used if a message was popped but is not going to be processed for some reason, and the message needs to be returned to the queue.

Definition at line 231 of file res_smdi.c.

References ast_cond_broadcast(), ast_mutex_lock(), ast_mutex_unlock(), ASTOBJ_CONTAINER_LINK_START, ast_smdi_interface::md_q, ast_smdi_interface::md_q_cond, and ast_smdi_interface::md_q_lock.

struct ast_smdi_md_message* ast_smdi_md_message_wait ( struct ast_smdi_interface iface,
int  timeout 
) [read]

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 505 of file res_smdi.c.

References SMDI_MD, and smdi_message_wait().

Referenced by ss_thread().

{
   struct ast_flags options = { 0 };
   return smdi_message_wait(iface, timeout, SMDI_MD, NULL, options);
}
void ast_smdi_mwi_message_destroy ( struct ast_smdi_mwi_message msg)

ast_smdi_mwi_message destructor.

Definition at line 731 of file res_smdi.c.

References ast_free.

Referenced by ast_smdi_interface_destroy(), run_externnotify(), smdi_read(), and unref_msg().

{
   ast_free(msg);
}
struct ast_smdi_mwi_message* ast_smdi_mwi_message_pop ( struct ast_smdi_interface iface) [read]

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 511 of file res_smdi.c.

References smdi_msg_pop(), and SMDI_MWI.

{
   return smdi_msg_pop(iface, SMDI_MWI);
}
void ast_smdi_mwi_message_putback ( struct ast_smdi_interface iface,
struct ast_smdi_mwi_message msg 
)

Put an SMDI message back in the front of the queue.

Parameters:
ifacea pointer to the interface to use.
mwi_msga pointer to the message to use.

This function puts a message back in the front of the specified queue. It should be used if a message was popped but is not going to be processed for some reason, and the message needs to be returned to the queue.

Definition at line 239 of file res_smdi.c.

References ast_cond_broadcast(), ast_mutex_lock(), ast_mutex_unlock(), ASTOBJ_CONTAINER_LINK_START, ast_smdi_interface::mwi_q, ast_smdi_interface::mwi_q_cond, and ast_smdi_interface::mwi_q_lock.

struct ast_smdi_mwi_message* ast_smdi_mwi_message_wait ( struct ast_smdi_interface iface,
int  timeout 
) [read]

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 516 of file res_smdi.c.

References smdi_message_wait(), and SMDI_MWI.

{
   struct ast_flags options = { 0 };
   return smdi_message_wait(iface, timeout, SMDI_MWI, NULL, options);
}
struct ast_smdi_mwi_message* ast_smdi_mwi_message_wait_station ( struct ast_smdi_interface iface,
int  timeout,
const char *  station 
) [read]

Definition at line 522 of file res_smdi.c.

References smdi_message_wait(), and SMDI_MWI.

Referenced by run_externnotify().

{
   struct ast_flags options = { 0 };
   return smdi_message_wait(iface, timeout, SMDI_MWI, station, options);
}
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 221 of file res_smdi.c.

References smdi_toggle_mwi().

Referenced by poll_mailbox(), and run_externnotify().

{
   return smdi_toggle_mwi(iface, mailbox, 1);
}
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 226 of file res_smdi.c.

References smdi_toggle_mwi().

Referenced by poll_mailbox(), and run_externnotify().

{
   return smdi_toggle_mwi(iface, mailbox, 0);
}