dial.c File Reference

Dialing API. More...

#include "asterisk.h"
#include <sys/time.h>
#include <signal.h>
#include "asterisk/channel.h"
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/linkedlists.h"
#include "asterisk/dial.h"
#include "asterisk/pbx.h"
#include "asterisk/musiconhold.h"
#include "asterisk/app.h"
#include "asterisk/causes.h"
#include "asterisk/stasis_channels.h"

Include dependency graph for dial.c:

Go to the source code of this file.

Data Structures

struct  answer_exec_struct
 Structure for 'ANSWER_EXEC' option. More...
struct  ast_dial
 Main dialing structure. Contains global options, channels being dialed, and more! More...
struct  ast_dial_channel
 Dialing channel structure. Contains per-channel dialing options, asterisk channel, and more! More...
struct  ast_option_types

Defines

#define AST_MAX_WATCHERS   256
 Maximum number of channels we can watch at a time.
#define FIND_RELATIVE_OPTION(dial, dial_channel, ast_dial_option)   (dial_channel->options[ast_dial_option] ? dial_channel->options[ast_dial_option] : dial->options[ast_dial_option])
 Macro for finding the option structure to use on a dialed channel.
#define IS_CALLER(chan, owner)   (chan == owner ? 1 : 0)
 Macro that determines whether a channel is the caller or not.

Typedefs

typedef int(* ast_dial_option_cb_disable )(void *data)
 Typedef for dial option disable.
typedef void *(* ast_dial_option_cb_enable )(void *data)
 Typedef for dial option enable.

Functions

static int answer_exec_disable (void *data)
 Disable function for 'ANSWER_EXEC' option.
static void * answer_exec_enable (void *data)
 Enable function for 'ANSWER_EXEC' option.
static void answer_exec_run (struct ast_dial *dial, struct ast_dial_channel *dial_channel, char *app, char *args)
 Application execution function for 'ANSWER_EXEC' option.
struct ast_channelast_dial_answered (struct ast_dial *dial)
 Return channel that answered.
struct ast_channelast_dial_answered_steal (struct ast_dial *dial)
 Steal the channel that answered.
int ast_dial_append (struct ast_dial *dial, const char *tech, const char *device, const struct ast_assigned_ids *assignedids)
 Append a channel.
struct ast_dialast_dial_create (void)
 New dialing structure.
int ast_dial_destroy (struct ast_dial *dial)
 Destroys a dialing structure.
struct ast_channelast_dial_get_channel (struct ast_dial *dial, int num)
 Get the dialing channel, if prerun has been executed.
void * ast_dial_get_user_data (struct ast_dial *dial)
 Return the user data on a dial structure.
void ast_dial_hangup (struct ast_dial *dial)
 Hangup channels.
enum ast_dial_result ast_dial_join (struct ast_dial *dial)
 Cancel async thread.
int ast_dial_option_disable (struct ast_dial *dial, int num, enum ast_dial_option option)
 Disables an option per channel.
int ast_dial_option_enable (struct ast_dial *dial, int num, enum ast_dial_option option, void *data)
 Enables an option per channel.
int ast_dial_option_global_disable (struct ast_dial *dial, enum ast_dial_option option)
 Disables an option globally.
int ast_dial_option_global_enable (struct ast_dial *dial, enum ast_dial_option option, void *data)
 Enables an option globally.
int ast_dial_prerun (struct ast_dial *dial, struct ast_channel *chan, struct ast_format_cap *cap)
 Request all appended channels, but do not dial.
int ast_dial_reason (struct ast_dial *dial, int num)
 Get the reason an outgoing channel has failed.
enum ast_dial_result ast_dial_run (struct ast_dial *dial, struct ast_channel *chan, int async)
 Execute dialing synchronously or asynchronously.
void ast_dial_set_global_timeout (struct ast_dial *dial, int timeout)
 Set the maximum time (globally) allowed for trying to ring phones.
void ast_dial_set_state_callback (struct ast_dial *dial, ast_dial_state_callback callback)
 Set a callback for state changes.
void ast_dial_set_timeout (struct ast_dial *dial, int num, int timeout)
 Set the maximum time (per channel) allowed for trying to ring the phone.
void ast_dial_set_user_data (struct ast_dial *dial, void *user_data)
 Set user data on a dial structure.
enum ast_dial_result ast_dial_state (struct ast_dial *dial)
 Return state of dial.
const char * ast_hangup_cause_to_dial_status (int hangup_cause)
 Convert a hangup cause to a publishable dial status.
static void * async_dial (void *data)
 Dial async thread function.
static int begin_dial (struct ast_dial *dial, struct ast_channel *chan, int async)
 Helper function that does the beginning dialing per dial structure.
static int begin_dial_channel (struct ast_dial_channel *channel, struct ast_channel *chan, int async, const char *predial_string)
 Helper function that does the beginning dialing per-appended channel.
static int begin_dial_prerun (struct ast_dial_channel *channel, struct ast_channel *chan, struct ast_format_cap *cap, const char *predial_string)
 Helper function that requests all channels.
static struct ast_dial_channelfind_dial_channel (struct ast_dial *dial, int num)
 Helper function for finding a channel in a dial structure based on number.
static struct ast_dial_channelfind_relative_dial_channel (struct ast_dial *dial, struct ast_channel *owner)
 Helper function that finds the dialed channel based on owner.
static int handle_call_forward (struct ast_dial *dial, struct ast_dial_channel *channel, struct ast_channel *chan)
 Helper function to handle channels that have been call forwarded.
static void handle_frame (struct ast_dial *dial, struct ast_dial_channel *channel, struct ast_frame *fr, struct ast_channel *chan)
 Helper function that handles control frames WITH owner.
static void handle_frame_ownerless (struct ast_dial *dial, struct ast_dial_channel *channel, struct ast_frame *fr)
 Helper function that handles control frames WITHOUT owner.
static int handle_timeout_trip (struct ast_dial *dial, struct timeval start)
 Helper function to handle when a timeout occurs on dialing attempt.
static enum ast_dial_result monitor_dial (struct ast_dial *dial, struct ast_channel *chan)
 Helper function that basically keeps tabs on dialing attempts.
static int music_disable (void *data)
static void * music_enable (void *data)
static int predial_disable (void *data)
static void * predial_enable (void *data)
static void set_state (struct ast_dial *dial, enum ast_dial_result state)

Variables

static struct ast_option_types option_types []
 Map options to respective handlers (enable/disable).


Detailed Description

Dialing API.

Author:
Joshua Colp <jcolp@digium.com>

Definition in file dial.c.


Define Documentation

#define AST_MAX_WATCHERS   256

Maximum number of channels we can watch at a time.

Definition at line 214 of file dial.c.

#define FIND_RELATIVE_OPTION ( dial,
dial_channel,
ast_dial_option   )     (dial_channel->options[ast_dial_option] ? dial_channel->options[ast_dial_option] : dial->options[ast_dial_option])

Macro for finding the option structure to use on a dialed channel.

Definition at line 217 of file dial.c.

Referenced by handle_call_forward(), and monitor_dial().

#define IS_CALLER ( chan,
owner   )     (chan == owner ? 1 : 0)

Macro that determines whether a channel is the caller or not.

Definition at line 220 of file dial.c.

Referenced by monitor_dial().


Typedef Documentation

typedef int(* ast_dial_option_cb_disable)(void *data)

Typedef for dial option disable.

Definition at line 82 of file dial.c.

typedef void*(* ast_dial_option_cb_enable)(void *data)

Typedef for dial option enable.

Definition at line 79 of file dial.c.


Function Documentation

static int answer_exec_disable ( void *  data  )  [static]

Disable function for 'ANSWER_EXEC' option.

Definition at line 117 of file dial.c.

References answer_exec_struct::args, and ast_free.

00118 {
00119    struct answer_exec_struct *answer_exec = data;
00120 
00121    /* Make sure we have a value */
00122    if (!answer_exec)
00123       return -1;
00124 
00125    /* If arguments are present, free them too */
00126    if (answer_exec->args)
00127       ast_free(answer_exec->args);
00128 
00129    /* This is simple - just free the structure */
00130    ast_free(answer_exec);
00131 
00132    return 0;
00133 }

static void* answer_exec_enable ( void *  data  )  [static]

Enable function for 'ANSWER_EXEC' option.

Definition at line 91 of file dial.c.

References answer_exec_struct::app, app, answer_exec_struct::args, args, ast_calloc, ast_copy_string(), ast_strdup, ast_strdupa, ast_strlen_zero, and NULL.

00092 {
00093    struct answer_exec_struct *answer_exec = NULL;
00094    char *app = ast_strdupa((char*)data), *args = NULL;
00095 
00096    /* Not giving any data to this option is bad, mmmk? */
00097    if (ast_strlen_zero(app))
00098       return NULL;
00099 
00100    /* Create new data structure */
00101    if (!(answer_exec = ast_calloc(1, sizeof(*answer_exec))))
00102       return NULL;
00103 
00104    /* Parse out application and arguments */
00105    if ((args = strchr(app, ','))) {
00106       *args++ = '\0';
00107       answer_exec->args = ast_strdup(args);
00108    }
00109 
00110    /* Copy application name */
00111    ast_copy_string(answer_exec->app, app, sizeof(answer_exec->app));
00112 
00113    return answer_exec;
00114 }

static void answer_exec_run ( struct ast_dial dial,
struct ast_dial_channel dial_channel,
char *  app,
char *  args 
) [static]

Application execution function for 'ANSWER_EXEC' option.

Definition at line 167 of file dial.c.

References ast_hangup(), ast_mutex_lock, ast_mutex_unlock, AST_PTHREADT_STOP, ast_dial::lock, NULL, ast_dial_channel::owner, pbx_exec(), pbx_findapp(), and ast_dial::thread.

Referenced by monitor_dial().

00168 {
00169    struct ast_channel *chan = dial_channel->owner;
00170    struct ast_app *ast_app = pbx_findapp(app);
00171 
00172    /* If the application was not found, return immediately */
00173    if (!ast_app)
00174       return;
00175 
00176    /* All is well... execute the application */
00177    pbx_exec(chan, ast_app, args);
00178 
00179    /* If another thread is not taking over hang up the channel */
00180    ast_mutex_lock(&dial->lock);
00181    if (dial->thread != AST_PTHREADT_STOP) {
00182       ast_hangup(chan);
00183       dial_channel->owner = NULL;
00184    }
00185    ast_mutex_unlock(&dial->lock);
00186 
00187    return;
00188 }

struct ast_channel* ast_dial_answered ( struct ast_dial dial  )  [read]

Return channel that answered.

Note:
Returns the Asterisk channel that answered
Parameters:
dial Dialing structure

Definition at line 963 of file dial.c.

References AST_DIAL_RESULT_ANSWERED, AST_LIST_FIRST, ast_dial::channels, NULL, and ast_dial::state.

Referenced by ari_originate_dial(), dial_trunk(), page_state_callback(), pbx_outgoing_exec(), and sla_handle_dial_state_event().

00964 {
00965    if (!dial)
00966       return NULL;
00967 
00968    return ((dial->state == AST_DIAL_RESULT_ANSWERED) ? AST_LIST_FIRST(&dial->channels)->owner : NULL);
00969 }

struct ast_channel* ast_dial_answered_steal ( struct ast_dial dial  )  [read]

Steal the channel that answered.

Note:
Returns the Asterisk channel that answered and removes it from the dialing structure
Parameters:
dial Dialing structure

Definition at line 975 of file dial.c.

References AST_DIAL_RESULT_ANSWERED, AST_LIST_FIRST, ast_dial::channels, NULL, and ast_dial::state.

Referenced by app_control_dial(), ari_originate_dial(), do_notify(), pbx_outgoing_exec(), and recall_callback().

00976 {
00977    struct ast_channel *chan = NULL;
00978 
00979    if (!dial)
00980       return NULL;
00981 
00982    if (dial->state == AST_DIAL_RESULT_ANSWERED) {
00983       chan = AST_LIST_FIRST(&dial->channels)->owner;
00984       AST_LIST_FIRST(&dial->channels)->owner = NULL;
00985    }
00986 
00987    return chan;
00988 }

int ast_dial_append ( struct ast_dial dial,
const char *  tech,
const char *  device,
const struct ast_assigned_ids assignedids 
)

Append a channel.

Note:
Appends a channel to a dialing structure
Returns:
Returns channel reference number on success, -1 on failure

Definition at line 254 of file dial.c.

References ast_dial_channel::assignedid1, ast_dial_channel::assignedid2, ast_atomic_fetchadd_int(), ast_calloc, AST_LIST_INSERT_TAIL, ast_strdup, ast_strlen_zero, ast_dial::channels, ast_dial_channel::device, ast_dial_channel::list, NULL, ast_dial::num, ast_dial_channel::num, ast_dial_channel::tech, ast_dial_channel::timeout, ast_assigned_ids::uniqueid, and ast_assigned_ids::uniqueid2.

Referenced by app_control_dial(), ari_channels_handle_originate_with_id(), dial_trunk(), do_notify(), page_exec(), pbx_outgoing_attempt(), recalling_enter(), and sla_ring_station().

00255 {
00256    struct ast_dial_channel *channel = NULL;
00257 
00258    /* Make sure we have required arguments */
00259    if (!dial || !tech || !device)
00260       return -1;
00261 
00262    /* Allocate new memory for dialed channel structure */
00263    if (!(channel = ast_calloc(1, sizeof(*channel))))
00264       return -1;
00265 
00266    /* Record technology and device for when we actually dial */
00267    channel->tech = ast_strdup(tech);
00268    channel->device = ast_strdup(device);
00269 
00270    /* Store the assigned id */
00271    if (assignedids && !ast_strlen_zero(assignedids->uniqueid)) {
00272       channel->assignedid1 = ast_strdup(assignedids->uniqueid);
00273 
00274       if (!ast_strlen_zero(assignedids->uniqueid2)) {
00275          channel->assignedid2 = ast_strdup(assignedids->uniqueid2);
00276       }
00277    }
00278 
00279    /* Grab reference number from dial structure */
00280    channel->num = ast_atomic_fetchadd_int(&dial->num, +1);
00281 
00282    /* No timeout exists... yet */
00283    channel->timeout = -1;
00284 
00285    /* Insert into channels list */
00286    AST_LIST_INSERT_TAIL(&dial->channels, channel, list);
00287 
00288    return channel->num;
00289 }

struct ast_dial* ast_dial_create ( void   )  [read]

New dialing structure.

Note:
Create a dialing structure
Returns:
Returns a calloc'd ast_dial structure, NULL on failure

Definition at line 226 of file dial.c.

References ast_dial::actual_timeout, ast_calloc, AST_LIST_HEAD_INIT, ast_mutex_init, AST_PTHREADT_NULL, ast_dial::channels, ast_dial::lock, NULL, ast_dial::thread, and ast_dial::timeout.

Referenced by app_control_dial(), ari_channels_handle_originate_with_id(), dial_trunk(), do_notify(), page_exec(), pbx_outgoing_attempt(), recalling_enter(), and sla_ring_station().

00227 {
00228    struct ast_dial *dial = NULL;
00229 
00230    /* Allocate new memory for structure */
00231    if (!(dial = ast_calloc(1, sizeof(*dial))))
00232       return NULL;
00233 
00234    /* Initialize list of channels */
00235    AST_LIST_HEAD_INIT(&dial->channels);
00236 
00237    /* Initialize thread to NULL */
00238    dial->thread = AST_PTHREADT_NULL;
00239 
00240    /* No timeout exists... yet */
00241    dial->timeout = -1;
00242    dial->actual_timeout = -1;
00243 
00244    /* Can't forget about the lock */
00245    ast_mutex_init(&dial->lock);
00246 
00247    return dial;
00248 }

int ast_dial_destroy ( struct ast_dial dial  ) 

Destroys a dialing structure.

Note:
Destroys (free's) the given ast_dial structure
Parameters:
dial Dialing structure to free
Returns:
Returns 0 on success, -1 on failure

Definition at line 1073 of file dial.c.

References ast_dial_channel::assignedid1, ast_dial_channel::assignedid2, AST_DIAL_OPTION_MAX, ast_free, ast_hangup(), AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_mutex_destroy, ast_dial::channels, ast_dial_channel::device, ast_option_types::disable, ast_dial_channel::list, ast_dial::lock, NULL, ast_dial::options, ast_dial_channel::options, ast_dial_channel::owner, and ast_dial_channel::tech.

Referenced by app_control_dial(), ari_channels_handle_originate_with_id(), ari_originate_dial(), dial_trunk(), do_notify(), monitor_dial(), page_exec(), pbx_outgoing_destroy(), recalling_exit(), run_station(), sla_handle_dial_state_event(), sla_hangup_stations(), sla_ring_station(), and sla_stop_ringing_station().

01074 {
01075    int i = 0;
01076    struct ast_dial_channel *channel = NULL;
01077 
01078    if (!dial)
01079       return -1;
01080 
01081    /* Hangup and deallocate all the dialed channels */
01082    AST_LIST_LOCK(&dial->channels);
01083    AST_LIST_TRAVERSE_SAFE_BEGIN(&dial->channels, channel, list) {
01084       /* Disable any enabled options */
01085       for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
01086          if (!channel->options[i])
01087             continue;
01088          if (option_types[i].disable)
01089             option_types[i].disable(channel->options[i]);
01090          channel->options[i] = NULL;
01091       }
01092 
01093       /* Hang up channel if need be */
01094       ast_hangup(channel->owner);
01095       channel->owner = NULL;
01096 
01097       /* Free structure */
01098       ast_free(channel->tech);
01099       ast_free(channel->device);
01100       ast_free(channel->assignedid1);
01101       ast_free(channel->assignedid2);
01102 
01103       AST_LIST_REMOVE_CURRENT(list);
01104       ast_free(channel);
01105    }
01106    AST_LIST_TRAVERSE_SAFE_END;
01107    AST_LIST_UNLOCK(&dial->channels);
01108 
01109    /* Disable any enabled options globally */
01110    for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
01111       if (!dial->options[i])
01112          continue;
01113       if (option_types[i].disable)
01114          option_types[i].disable(dial->options[i]);
01115       dial->options[i] = NULL;
01116    }
01117 
01118    /* Lock be gone! */
01119    ast_mutex_destroy(&dial->lock);
01120 
01121    /* Free structure */
01122    ast_free(dial);
01123 
01124    return 0;
01125 }

struct ast_channel* ast_dial_get_channel ( struct ast_dial dial,
int  num 
) [read]

Get the dialing channel, if prerun has been executed.

Parameters:
dial Dial structure
num Channel number to get channel of
Returns:
Pointer to channel, without reference

Definition at line 1264 of file dial.c.

References AST_LIST_EMPTY, ast_dial::channels, find_dial_channel(), NULL, and ast_dial_channel::owner.

Referenced by ari_channels_handle_originate_with_id(), pbx_outgoing_attempt(), pbx_outgoing_state_callback(), and recalling_enter().

01265 {
01266    struct ast_dial_channel *channel;
01267 
01268    if (!dial || AST_LIST_EMPTY(&dial->channels) || !(channel = find_dial_channel(dial, num))) {
01269       return NULL;
01270    }
01271 
01272    return channel->owner;
01273 }

void* ast_dial_get_user_data ( struct ast_dial dial  ) 

Return the user data on a dial structure.

Parameters:
dial The dial structure
Returns:
A pointer to the user data

Definition at line 1285 of file dial.c.

References ast_dial::user_data.

Referenced by ari_originate_dial(), page_state_callback(), and recall_callback().

01286 {
01287    return dial->user_data;
01288 }

void ast_dial_hangup ( struct ast_dial dial  ) 

Hangup channels.

Note:
Hangup all active channels
Parameters:
dial Dialing structure

Definition at line 1051 of file dial.c.

References ast_hangup(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_dial::channels, ast_dial_channel::list, NULL, and ast_dial_channel::owner.

Referenced by ast_dial_run(), and page_exec().

01052 {
01053    struct ast_dial_channel *channel = NULL;
01054 
01055    if (!dial)
01056       return;
01057 
01058    AST_LIST_LOCK(&dial->channels);
01059    AST_LIST_TRAVERSE(&dial->channels, channel, list) {
01060       ast_hangup(channel->owner);
01061       channel->owner = NULL;
01062    }
01063    AST_LIST_UNLOCK(&dial->channels);
01064 
01065    return;
01066 }

enum ast_dial_result ast_dial_join ( struct ast_dial dial  ) 

Cancel async thread.

Note:
Cancel a running async thread
Parameters:
dial Dialing structure

Definition at line 1003 of file dial.c.

References ast_channel_lock, ast_channel_unlock, AST_DIAL_RESULT_FAILED, AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_mutex_lock, ast_mutex_unlock, AST_PTHREADT_NULL, AST_PTHREADT_STOP, ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, ast_dial::channels, ast_dial::lock, NULL, ast_dial::state, and ast_dial::thread.

Referenced by dial_trunk(), page_exec(), recalling_exit(), run_station(), sla_handle_dial_state_event(), sla_hangup_stations(), sla_ring_station(), and sla_stop_ringing_station().

01004 {
01005    pthread_t thread;
01006 
01007    /* If the dial structure is not running in async, return failed */
01008    if (dial->thread == AST_PTHREADT_NULL)
01009       return AST_DIAL_RESULT_FAILED;
01010 
01011    /* Record thread */
01012    thread = dial->thread;
01013 
01014    /* Boom, commence locking */
01015    ast_mutex_lock(&dial->lock);
01016 
01017    /* Stop the thread */
01018    dial->thread = AST_PTHREADT_STOP;
01019 
01020    /* If the answered channel is running an application we have to soft hangup it, can't just poke the thread */
01021    AST_LIST_LOCK(&dial->channels);
01022    if (AST_LIST_FIRST(&dial->channels)->is_running_app) {
01023       struct ast_channel *chan = AST_LIST_FIRST(&dial->channels)->owner;
01024       if (chan) {
01025          ast_channel_lock(chan);
01026          ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT);
01027          ast_channel_unlock(chan);
01028       }
01029    } else {
01030       /* Now we signal it with SIGURG so it will break out of it's waitfor */
01031       pthread_kill(thread, SIGURG);
01032    }
01033    AST_LIST_UNLOCK(&dial->channels);
01034 
01035    /* Yay done with it */
01036    ast_mutex_unlock(&dial->lock);
01037 
01038    /* Finally wait for the thread to exit */
01039    pthread_join(thread, NULL);
01040 
01041    /* Yay thread is all gone */
01042    dial->thread = AST_PTHREADT_NULL;
01043 
01044    return dial->state;
01045 }

int ast_dial_option_disable ( struct ast_dial dial,
int  num,
enum ast_dial_option  option 
)

Disables an option per channel.

Parameters:
dial Dial structure
num Channel number to disable option on
option Option to disable
Returns:
Returns 0 on success, -1 on failure

Definition at line 1228 of file dial.c.

References AST_LIST_EMPTY, ast_dial::channels, ast_option_types::disable, find_dial_channel(), NULL, and ast_dial_channel::options.

01229 {
01230    struct ast_dial_channel *channel = NULL;
01231 
01232    /* Ensure we have required arguments */
01233    if (!dial || AST_LIST_EMPTY(&dial->channels))
01234       return -1;
01235 
01236    if (!(channel = find_dial_channel(dial, num)))
01237       return -1;
01238 
01239    /* If the option is not enabled, return failure */
01240    if (!channel->options[option])
01241       return -1;
01242 
01243    /* Execute callback of option to disable it if it exists */
01244    if (option_types[option].disable)
01245       option_types[option].disable(channel->options[option]);
01246 
01247    /* Finally disable the option on the structure */
01248    channel->options[option] = NULL;
01249 
01250    return 0;
01251 }

int ast_dial_option_enable ( struct ast_dial dial,
int  num,
enum ast_dial_option  option,
void *  data 
)

Enables an option per channel.

Parameters:
dial Dial structure
num Channel number to enable option on
option Option to enable
data Data to pass to this option (not always needed)
Returns:
Returns 0 on success, -1 on failure

Definition at line 1176 of file dial.c.

References AST_LIST_EMPTY, ast_dial::channels, ast_option_types::enable, find_dial_channel(), NULL, and ast_dial_channel::options.

01177 {
01178    struct ast_dial_channel *channel = NULL;
01179 
01180    /* Ensure we have required arguments */
01181    if (!dial || AST_LIST_EMPTY(&dial->channels))
01182       return -1;
01183 
01184    if (!(channel = find_dial_channel(dial, num)))
01185       return -1;
01186 
01187    /* If the option is already enabled, return failure */
01188    if (channel->options[option])
01189       return -1;
01190 
01191    /* Execute enable callback if it exists, if not simply make sure the value is set */
01192    if (option_types[option].enable)
01193       channel->options[option] = option_types[option].enable(data);
01194    else
01195       channel->options[option] = (void*)1;
01196 
01197    return 0;
01198 }

int ast_dial_option_global_disable ( struct ast_dial dial,
enum ast_dial_option  option 
)

Disables an option globally.

Parameters:
dial Dial structure to disable option on
option Option to disable
Returns:
Returns 0 on success, -1 on failure

Definition at line 1205 of file dial.c.

References ast_option_types::disable, NULL, and ast_dial::options.

01206 {
01207    /* If the option is not enabled, return failure */
01208    if (!dial->options[option]) {
01209       return -1;
01210    }
01211 
01212    /* Execute callback of option to disable if it exists */
01213    if (option_types[option].disable)
01214       option_types[option].disable(dial->options[option]);
01215 
01216    /* Finally disable option on the structure */
01217    dial->options[option] = NULL;
01218 
01219    return 0;
01220 }

int ast_dial_option_global_enable ( struct ast_dial dial,
enum ast_dial_option  option,
void *  data 
)

Enables an option globally.

Parameters:
dial Dial structure to enable option on
option Option to enable
data Data to pass to this option (not always needed)
Returns:
Returns 0 on success, -1 on failure

Definition at line 1133 of file dial.c.

References ast_option_types::enable, and ast_dial::options.

Referenced by do_notify(), and page_exec().

01134 {
01135    /* If the option is already enabled, return failure */
01136    if (dial->options[option])
01137       return -1;
01138 
01139    /* Execute enable callback if it exists, if not simply make sure the value is set */
01140    if (option_types[option].enable)
01141       dial->options[option] = option_types[option].enable(data);
01142    else
01143       dial->options[option] = (void*)1;
01144 
01145    return 0;
01146 }

int ast_dial_prerun ( struct ast_dial dial,
struct ast_channel chan,
struct ast_format_cap cap 
)

Request all appended channels, but do not dial.

Parameters:
dial Dialing structure
chan Optional dialing channel
cap Optional requested capabilities
Return values:
-1 failure 0 success

Definition at line 379 of file dial.c.

References AST_DIAL_OPTION_PREDIAL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_replace_subargument_delimiter(), ast_strlen_zero, begin_dial_prerun(), ast_dial::channels, ast_dial_channel::list, and ast_dial::options.

Referenced by ari_channels_handle_originate_with_id(), pbx_outgoing_attempt(), and recalling_enter().

00380 {
00381    struct ast_dial_channel *channel;
00382    int res = -1;
00383    char *predial_string = dial->options[AST_DIAL_OPTION_PREDIAL];
00384 
00385    if (!ast_strlen_zero(predial_string)) {
00386       ast_replace_subargument_delimiter(predial_string);
00387    }
00388 
00389    AST_LIST_LOCK(&dial->channels);
00390    AST_LIST_TRAVERSE(&dial->channels, channel, list) {
00391       if ((res = begin_dial_prerun(channel, chan, cap, predial_string))) {
00392          break;
00393       }
00394    }
00395    AST_LIST_UNLOCK(&dial->channels);
00396 
00397    return res;
00398 }

int ast_dial_reason ( struct ast_dial dial,
int  num 
)

Get the reason an outgoing channel has failed.

Parameters:
dial Dial structure
num Channel number to get the reason from
Returns:
Numerical cause code

Definition at line 1253 of file dial.c.

References AST_LIST_EMPTY, ast_dial_channel::cause, ast_dial::channels, and find_dial_channel().

Referenced by pbx_outgoing_attempt().

01254 {
01255    struct ast_dial_channel *channel;
01256 
01257    if (!dial || AST_LIST_EMPTY(&dial->channels) || !(channel = find_dial_channel(dial, num))) {
01258       return -1;
01259    }
01260 
01261    return channel->cause;
01262 }

enum ast_dial_result ast_dial_run ( struct ast_dial dial,
struct ast_channel chan,
int  async 
)

Execute dialing synchronously or asynchronously.

Note:
Dials channels in a dial structure.
Returns:
Returns dial result code. (TRYING/INVALID/FAILED/ANSWERED/TIMEOUT/UNANSWERED).

Definition at line 921 of file dial.c.

References ast_debug, ast_dial_hangup(), AST_DIAL_RESULT_FAILED, AST_DIAL_RESULT_INVALID, AST_DIAL_RESULT_TRYING, AST_LIST_EMPTY, ast_pthread_create, ast_read_threadstorage_callid(), async_dial(), begin_dial(), ast_dial::callid, ast_dial::channels, monitor_dial(), NULL, ast_dial::state, and ast_dial::thread.

Referenced by app_control_dial(), ari_originate_dial(), dial_trunk(), do_notify(), page_exec(), pbx_outgoing_exec(), recalling_enter(), and sla_ring_station().

00922 {
00923    enum ast_dial_result res = AST_DIAL_RESULT_TRYING;
00924 
00925    /* Ensure required arguments are passed */
00926    if (!dial) {
00927       ast_debug(1, "invalid #1\n");
00928       return AST_DIAL_RESULT_INVALID;
00929    }
00930 
00931    /* If there are no channels to dial we can't very well try to dial them */
00932    if (AST_LIST_EMPTY(&dial->channels)) {
00933       ast_debug(1, "invalid #2\n");
00934       return AST_DIAL_RESULT_INVALID;
00935    }
00936 
00937    /* Dial each requested channel */
00938    if (!begin_dial(dial, chan, async))
00939       return AST_DIAL_RESULT_FAILED;
00940 
00941    /* If we are running async spawn a thread and send it away... otherwise block here */
00942    if (async) {
00943       /* reference be released at dial destruction if it isn't NULL */
00944       dial->callid = ast_read_threadstorage_callid();
00945       dial->state = AST_DIAL_RESULT_TRYING;
00946       /* Try to create a thread */
00947       if (ast_pthread_create(&dial->thread, NULL, async_dial, dial)) {
00948          /* Failed to create the thread - hangup all dialed channels and return failed */
00949          ast_dial_hangup(dial);
00950          res = AST_DIAL_RESULT_FAILED;
00951       }
00952    } else {
00953       res = monitor_dial(dial, chan);
00954    }
00955 
00956    return res;
00957 }

void ast_dial_set_global_timeout ( struct ast_dial dial,
int  timeout 
)

Set the maximum time (globally) allowed for trying to ring phones.

Parameters:
dial The dial structure to apply the time limit to
timeout Maximum time allowed
Returns:
nothing

Definition at line 1295 of file dial.c.

References ast_dial::actual_timeout, and ast_dial::timeout.

Referenced by app_control_dial(), ari_channels_handle_originate_with_id(), do_notify(), page_exec(), and pbx_outgoing_attempt().

01296 {
01297    dial->timeout = timeout;
01298 
01299    if (dial->timeout > 0 && (dial->actual_timeout > dial->timeout || dial->actual_timeout == -1))
01300       dial->actual_timeout = dial->timeout;
01301 
01302    return;
01303 }

void ast_dial_set_state_callback ( struct ast_dial dial,
ast_dial_state_callback  callback 
)

Set a callback for state changes.

Parameters:
dial The dial structure to watch for state changes
callback the callback
Returns:
nothing

Definition at line 1275 of file dial.c.

References ast_dial::state_callback.

Referenced by page_exec(), pbx_outgoing_attempt(), recalling_enter(), and sla_ring_station().

01276 {
01277    dial->state_callback = callback;
01278 }

void ast_dial_set_timeout ( struct ast_dial dial,
int  num,
int  timeout 
)

Set the maximum time (per channel) allowed for trying to ring the phone.

Parameters:
dial The dial structure the channel belongs to
num Channel number to set timeout on
timeout Maximum time allowed
Returns:
nothing

Definition at line 1311 of file dial.c.

References ast_dial::actual_timeout, find_dial_channel(), NULL, and ast_dial_channel::timeout.

01312 {
01313    struct ast_dial_channel *channel = NULL;
01314 
01315    if (!(channel = find_dial_channel(dial, num)))
01316       return;
01317 
01318    channel->timeout = timeout;
01319 
01320    if (channel->timeout > 0 && (dial->actual_timeout > channel->timeout || dial->actual_timeout == -1))
01321       dial->actual_timeout = channel->timeout;
01322 
01323    return;
01324 }

void ast_dial_set_user_data ( struct ast_dial dial,
void *  user_data 
)

Set user data on a dial structure.

Parameters:
dial The dial structure to set a user data pointer on
user_data The user data pointer
Returns:
nothing

Definition at line 1280 of file dial.c.

References ast_dial::user_data.

Referenced by ari_channels_handle_originate_with_id(), page_exec(), and recalling_enter().

01281 {
01282    dial->user_data = user_data;
01283 }

enum ast_dial_result ast_dial_state ( struct ast_dial dial  ) 

Return state of dial.

Note:
Returns the state of the dial attempt
Parameters:
dial Dialing structure

Definition at line 994 of file dial.c.

References ast_dial::state.

Referenced by dial_trunk(), page_state_callback(), pbx_outgoing_state_callback(), recall_callback(), and sla_handle_dial_state_event().

00995 {
00996    return dial->state;
00997 }

const char* ast_hangup_cause_to_dial_status ( int  hangup_cause  ) 

Convert a hangup cause to a publishable dial status.

Since:
12

Definition at line 726 of file dial.c.

References AST_CAUSE_BUSY, AST_CAUSE_CONGESTION, AST_CAUSE_NO_ANSWER, AST_CAUSE_NO_ROUTE_DESTINATION, and AST_CAUSE_UNREGISTERED.

Referenced by monitor_dial(), try_calling(), and wait_for_answer().

00727 {
00728    switch(hangup_cause) {
00729    case AST_CAUSE_BUSY:
00730       return "BUSY";
00731    case AST_CAUSE_CONGESTION:
00732       return "CONGESTION";
00733    case AST_CAUSE_NO_ROUTE_DESTINATION:
00734    case AST_CAUSE_UNREGISTERED:
00735       return "CHANUNAVAIL";
00736    case AST_CAUSE_NO_ANSWER:
00737    default:
00738       return "NOANSWER";
00739    }
00740 }

static void* async_dial ( void *  data  )  [static]

Dial async thread function.

Definition at line 904 of file dial.c.

References ast_callid_threadassoc_add(), ast_dial::callid, monitor_dial(), and NULL.

Referenced by ast_dial_run().

00905 {
00906    struct ast_dial *dial = data;
00907    if (dial->callid) {
00908       ast_callid_threadassoc_add(dial->callid);
00909    }
00910 
00911    /* This is really really simple... we basically pass monitor_dial a NULL owner and it changes it's behavior */
00912    monitor_dial(dial, NULL);
00913 
00914    return NULL;
00915 }

static int begin_dial ( struct ast_dial dial,
struct ast_channel chan,
int  async 
) [static]

Helper function that does the beginning dialing per dial structure.

Definition at line 432 of file dial.c.

References AST_DIAL_OPTION_PREDIAL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_replace_subargument_delimiter(), ast_strlen_zero, begin_dial_channel(), ast_dial::channels, ast_dial_channel::list, NULL, and ast_dial::options.

Referenced by ast_dial_run().

00433 {
00434    struct ast_dial_channel *channel = NULL;
00435    int success = 0;
00436    char *predial_string = dial->options[AST_DIAL_OPTION_PREDIAL];
00437 
00438    if (!ast_strlen_zero(predial_string)) {
00439       ast_replace_subargument_delimiter(predial_string);
00440    }
00441 
00442    /* Iterate through channel list, requesting and calling each one */
00443    AST_LIST_LOCK(&dial->channels);
00444    AST_LIST_TRAVERSE(&dial->channels, channel, list) {
00445       success += begin_dial_channel(channel, chan, async, predial_string);
00446    }
00447    AST_LIST_UNLOCK(&dial->channels);
00448 
00449    /* If number of failures matches the number of channels, then this truly failed */
00450    return success;
00451 }

static int begin_dial_channel ( struct ast_dial_channel channel,
struct ast_channel chan,
int  async,
const char *  predial_string 
) [static]

Helper function that does the beginning dialing per-appended channel.

Definition at line 401 of file dial.c.

References ast_call(), ast_channel_publish_dial(), ast_copy_string(), ast_hangup(), AST_MAX_EXTENSION, ast_poll_channel_add(), ast_verb, begin_dial_prerun(), ast_dial_channel::device, NULL, and ast_dial_channel::owner.

Referenced by begin_dial(), and handle_call_forward().

00402 {
00403    char numsubst[AST_MAX_EXTENSION];
00404    int res = 1;
00405 
00406    /* If no owner channel exists yet execute pre-run */
00407    if (!channel->owner && begin_dial_prerun(channel, chan, NULL, predial_string)) {
00408       return 0;
00409    }
00410 
00411    /* Copy device string over */
00412    ast_copy_string(numsubst, channel->device, sizeof(numsubst));
00413 
00414    /* Attempt to actually call this device */
00415    if ((res = ast_call(channel->owner, numsubst, 0))) {
00416       res = 0;
00417       ast_hangup(channel->owner);
00418       channel->owner = NULL;
00419    } else {
00420       if (chan) {
00421          ast_poll_channel_add(chan, channel->owner);
00422       }
00423       ast_channel_publish_dial(async ? NULL : chan, channel->owner, channel->device, NULL);
00424       res = 1;
00425       ast_verb(3, "Called %s\n", numsubst);
00426    }
00427 
00428    return res;
00429 }

static int begin_dial_prerun ( struct ast_dial_channel channel,
struct ast_channel chan,
struct ast_format_cap cap,
const char *  predial_string 
) [static]

Helper function that requests all channels.

Definition at line 292 of file dial.c.

References ao2_cleanup, ast_dial_channel::assignedid1, ast_dial_channel::assignedid2, ast_app_expand_sub_args(), ast_autoservice_start(), ast_autoservice_stop(), ast_channel_adsicpe_set(), ast_channel_appl_set(), ast_channel_caller(), ast_channel_connected(), ast_channel_data_set(), ast_channel_datastore_inherit(), ast_channel_dialed(), ast_channel_inherit_variables(), ast_channel_language(), ast_channel_lock, ast_channel_lock_both, ast_channel_musicclass(), ast_channel_nativeformats(), ast_channel_redirecting(), ast_channel_req_accountcodes(), AST_CHANNEL_REQUESTOR_BRIDGE_PEER, AST_CHANNEL_REQUESTOR_REPLACEMENT, ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_channel_transfercapability(), ast_channel_transfercapability_set(), ast_channel_unlock, ast_channel_whentohangup(), ast_connected_line_copy_from_caller(), ast_copy_string(), AST_DIAL_OPTION_DIAL_REPLACES_SELF, ast_format_cap_alloc, ast_format_cap_append_by_type(), ast_format_cap_count(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_free, ast_log, AST_MAX_EXTENSION, AST_MEDIA_TYPE_AUDIO, ast_party_redirecting_copy(), ast_pre_call(), ast_request(), ast_strlen_zero, ast_dial_channel::cause, ast_dial_channel::device, LOG_ERROR, NULL, ast_dial_channel::options, ast_dial_channel::owner, ast_dial_channel::tech, ast_party_dialed::transit_network_select, and ast_assigned_ids::uniqueid.

Referenced by ast_dial_prerun(), and begin_dial_channel().

00293 {
00294    char numsubst[AST_MAX_EXTENSION];
00295    struct ast_format_cap *cap_all_audio = NULL;
00296    struct ast_format_cap *cap_request;
00297    struct ast_assigned_ids assignedids = {
00298       .uniqueid = channel->assignedid1,
00299       .uniqueid2 = channel->assignedid2,
00300    };
00301 
00302    /* Copy device string over */
00303    ast_copy_string(numsubst, channel->device, sizeof(numsubst));
00304 
00305    if (cap && ast_format_cap_count(cap)) {
00306       cap_request = cap;
00307    } else if (chan) {
00308       cap_request = ast_channel_nativeformats(chan);
00309    } else {
00310       cap_all_audio = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
00311       ast_format_cap_append_by_type(cap_all_audio, AST_MEDIA_TYPE_AUDIO);
00312       cap_request = cap_all_audio;
00313    }
00314 
00315    /* If we fail to create our owner channel bail out */
00316    if (!(channel->owner = ast_request(channel->tech, cap_request, &assignedids, chan, numsubst, &channel->cause))) {
00317       ao2_cleanup(cap_all_audio);
00318       return -1;
00319    }
00320    cap_request = NULL;
00321    ao2_cleanup(cap_all_audio);
00322 
00323    if (chan) {
00324       ast_channel_lock_both(chan, channel->owner);
00325    } else {
00326       ast_channel_lock(channel->owner);
00327    }
00328 
00329    ast_channel_stage_snapshot(channel->owner);
00330 
00331    ast_channel_appl_set(channel->owner, "AppDial2");
00332    ast_channel_data_set(channel->owner, "(Outgoing Line)");
00333 
00334    memset(ast_channel_whentohangup(channel->owner), 0, sizeof(*ast_channel_whentohangup(channel->owner)));
00335 
00336    /* Inherit everything from he who spawned this dial */
00337    if (chan) {
00338       ast_channel_inherit_variables(chan, channel->owner);
00339       ast_channel_datastore_inherit(chan, channel->owner);
00340 
00341       /* Copy over callerid information */
00342       ast_party_redirecting_copy(ast_channel_redirecting(channel->owner), ast_channel_redirecting(chan));
00343 
00344       ast_channel_dialed(channel->owner)->transit_network_select = ast_channel_dialed(chan)->transit_network_select;
00345 
00346       ast_connected_line_copy_from_caller(ast_channel_connected(channel->owner), ast_channel_caller(chan));
00347 
00348       ast_channel_language_set(channel->owner, ast_channel_language(chan));
00349       if (channel->options[AST_DIAL_OPTION_DIAL_REPLACES_SELF]) {
00350          ast_channel_req_accountcodes(channel->owner, chan, AST_CHANNEL_REQUESTOR_REPLACEMENT);
00351       } else {
00352          ast_channel_req_accountcodes(channel->owner, chan, AST_CHANNEL_REQUESTOR_BRIDGE_PEER);
00353       }
00354       if (ast_strlen_zero(ast_channel_musicclass(channel->owner)))
00355          ast_channel_musicclass_set(channel->owner, ast_channel_musicclass(chan));
00356 
00357       ast_channel_adsicpe_set(channel->owner, ast_channel_adsicpe(chan));
00358       ast_channel_transfercapability_set(channel->owner, ast_channel_transfercapability(chan));
00359       ast_channel_unlock(chan);
00360    }
00361 
00362    ast_channel_stage_snapshot_done(channel->owner);
00363    ast_channel_unlock(channel->owner);
00364 
00365    if (!ast_strlen_zero(predial_string)) {
00366       const char *predial_callee = ast_app_expand_sub_args(chan, predial_string);
00367       if (!predial_callee) {
00368          ast_log(LOG_ERROR, "Could not expand subroutine arguments in predial request '%s'\n", predial_string);
00369       }
00370       ast_autoservice_start(chan);
00371       ast_pre_call(channel->owner, predial_callee);
00372       ast_autoservice_stop(chan);
00373       ast_free((char *) predial_callee);
00374    }
00375 
00376    return 0;
00377 }

static struct ast_dial_channel* find_dial_channel ( struct ast_dial dial,
int  num 
) [static, read]

Helper function for finding a channel in a dial structure based on number.

Definition at line 1150 of file dial.c.

References AST_LIST_LAST, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_dial::channels, ast_dial_channel::list, and ast_dial_channel::num.

Referenced by ast_dial_get_channel(), ast_dial_option_disable(), ast_dial_option_enable(), ast_dial_reason(), and ast_dial_set_timeout().

01151 {
01152    struct ast_dial_channel *channel = AST_LIST_LAST(&dial->channels);
01153 
01154    /* We can try to predict programmer behavior, the last channel they added is probably the one they wanted to modify */
01155    if (channel->num == num)
01156       return channel;
01157 
01158    /* Hrm not at the end... looking through the list it is! */
01159    AST_LIST_LOCK(&dial->channels);
01160    AST_LIST_TRAVERSE(&dial->channels, channel, list) {
01161       if (channel->num == num)
01162          break;
01163    }
01164    AST_LIST_UNLOCK(&dial->channels);
01165 
01166    return channel;
01167 }

static struct ast_dial_channel* find_relative_dial_channel ( struct ast_dial dial,
struct ast_channel owner 
) [static, read]

Helper function that finds the dialed channel based on owner.

Definition at line 516 of file dial.c.

References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_dial::channels, ast_dial_channel::list, NULL, and ast_dial_channel::owner.

Referenced by monitor_dial().

00517 {
00518    struct ast_dial_channel *channel = NULL;
00519 
00520    AST_LIST_LOCK(&dial->channels);
00521    AST_LIST_TRAVERSE(&dial->channels, channel, list) {
00522       if (channel->owner == owner)
00523          break;
00524    }
00525    AST_LIST_UNLOCK(&dial->channels);
00526 
00527    return channel;
00528 }

static int handle_call_forward ( struct ast_dial dial,
struct ast_dial_channel channel,
struct ast_channel chan 
) [static]

Helper function to handle channels that have been call forwarded.

Definition at line 454 of file dial.c.

References ast_dial_channel::assignedid1, ast_dial_channel::assignedid2, ast_channel_call_forward(), ast_channel_context(), ast_channel_lock, ast_channel_publish_dial_forward(), ast_channel_unlock, AST_DIAL_OPTION_DISABLE_CALL_FORWARDING, AST_DIAL_OPTION_PREDIAL, ast_free, ast_hangup(), AST_LIST_UNLOCK, AST_MAX_CONTEXT, AST_MAX_EXTENSION, ast_replace_subargument_delimiter(), ast_strdup, ast_strdupa, ast_strlen_zero, begin_dial_channel(), ast_dial::channels, ast_dial_channel::device, FIND_RELATIVE_OPTION, NULL, ast_dial::options, ast_dial_channel::owner, pbx_builtin_getvar_helper(), S_OR, ast_dial_channel::tech, and tmp().

Referenced by monitor_dial().

00455 {
00456    struct ast_channel *original = channel->owner;
00457    char *tmp = ast_strdupa(ast_channel_call_forward(channel->owner));
00458    char *tech = "Local", *device = tmp, *stuff;
00459    char *predial_string = dial->options[AST_DIAL_OPTION_PREDIAL];
00460 
00461    if (!ast_strlen_zero(predial_string)) {
00462       ast_replace_subargument_delimiter(predial_string);
00463    }
00464 
00465    /* If call forwarding is disabled just drop the original channel and don't attempt to dial the new one */
00466    if (FIND_RELATIVE_OPTION(dial, channel, AST_DIAL_OPTION_DISABLE_CALL_FORWARDING)) {
00467       ast_hangup(original);
00468       channel->owner = NULL;
00469       return 0;
00470    }
00471 
00472    /* Figure out the new destination */
00473    if ((stuff = strchr(tmp, '/'))) {
00474       *stuff++ = '\0';
00475       tech = tmp;
00476       device = stuff;
00477    } else {
00478       const char *forward_context;
00479       char destination[AST_MAX_CONTEXT + AST_MAX_EXTENSION + 1];
00480 
00481       ast_channel_lock(original);
00482       forward_context = pbx_builtin_getvar_helper(original, "FORWARD_CONTEXT");
00483       snprintf(destination, sizeof(destination), "%s@%s", tmp, S_OR(forward_context, ast_channel_context(original)));
00484       ast_channel_unlock(original);
00485       device = ast_strdupa(destination);
00486    }
00487 
00488    /* Drop old destination information */
00489    ast_free(channel->tech);
00490    ast_free(channel->device);
00491    ast_free(channel->assignedid1);
00492    channel->assignedid1 = NULL;
00493    ast_free(channel->assignedid2);
00494    channel->assignedid2 = NULL;
00495 
00496    /* Update the dial channel with the new destination information */
00497    channel->tech = ast_strdup(tech);
00498    channel->device = ast_strdup(device);
00499    AST_LIST_UNLOCK(&dial->channels);
00500 
00501    /* Drop the original channel */
00502    channel->owner = NULL;
00503 
00504    /* Finally give it a go... send it out into the world */
00505    begin_dial_channel(channel, chan, chan ? 0 : 1, predial_string);
00506 
00507    ast_channel_publish_dial_forward(chan, original, channel->owner, NULL, "CANCEL",
00508       ast_channel_call_forward(original));
00509 
00510    ast_hangup(original);
00511 
00512    return 0;
00513 }

static void handle_frame ( struct ast_dial dial,
struct ast_dial_channel channel,
struct ast_frame fr,
struct ast_channel chan 
) [static]

Helper function that handles control frames WITH owner.

Definition at line 539 of file dial.c.

References AST_CAUSE_NORMAL_CIRCUIT_CONGESTION, AST_CAUSE_USER_BUSY, ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_channel_exten(), ast_channel_name(), ast_channel_publish_dial(), ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_FLASH, AST_CONTROL_HOLD, AST_CONTROL_INCOMPLETE, AST_CONTROL_OFFHOOK, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_SRCUPDATE, AST_CONTROL_UNHOLD, AST_CONTROL_VIDUPDATE, AST_DIAL_OPTION_MUSIC, AST_DIAL_RESULT_ANSWERED, AST_DIAL_RESULT_PROCEEDING, AST_DIAL_RESULT_PROGRESS, AST_DIAL_RESULT_RINGING, AST_FRAME_CONTROL, ast_hangup(), ast_indicate(), ast_indicate_data(), AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_REMOVE, AST_LIST_UNLOCK, ast_verb, ast_dial_channel::cause, ast_dial::channels, ast_frame::data, ast_frame::datalen, ast_dial_channel::device, ast_frame::frametype, ast_frame_subclass::integer, ast_dial_channel::list, NULL, ast_dial::options, ast_dial_channel::owner, ast_frame::ptr, set_state(), and ast_frame::subclass.

Referenced by monitor_dial(), and socket_read().

00540 {
00541    if (fr->frametype == AST_FRAME_CONTROL) {
00542       switch (fr->subclass.integer) {
00543       case AST_CONTROL_ANSWER:
00544          ast_verb(3, "%s answered %s\n", ast_channel_name(channel->owner), ast_channel_name(chan));
00545          AST_LIST_LOCK(&dial->channels);
00546          AST_LIST_REMOVE(&dial->channels, channel, list);
00547          AST_LIST_INSERT_HEAD(&dial->channels, channel, list);
00548          AST_LIST_UNLOCK(&dial->channels);
00549          ast_channel_publish_dial(chan, channel->owner, channel->device, "ANSWER");
00550          set_state(dial, AST_DIAL_RESULT_ANSWERED);
00551          break;
00552       case AST_CONTROL_BUSY:
00553          ast_verb(3, "%s is busy\n", ast_channel_name(channel->owner));
00554          ast_channel_publish_dial(chan, channel->owner, channel->device, "BUSY");
00555          ast_hangup(channel->owner);
00556          channel->cause = AST_CAUSE_USER_BUSY;
00557          channel->owner = NULL;
00558          break;
00559       case AST_CONTROL_CONGESTION:
00560          ast_verb(3, "%s is circuit-busy\n", ast_channel_name(channel->owner));
00561          ast_channel_publish_dial(chan, channel->owner, channel->device, "CONGESTION");
00562          ast_hangup(channel->owner);
00563          channel->cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION;
00564          channel->owner = NULL;
00565          break;
00566       case AST_CONTROL_INCOMPLETE:
00567          ast_verb(3, "%s dialed Incomplete extension %s\n", ast_channel_name(channel->owner), ast_channel_exten(channel->owner));
00568          ast_indicate(chan, AST_CONTROL_INCOMPLETE);
00569          break;
00570       case AST_CONTROL_RINGING:
00571          ast_verb(3, "%s is ringing\n", ast_channel_name(channel->owner));
00572          if (!dial->options[AST_DIAL_OPTION_MUSIC])
00573             ast_indicate(chan, AST_CONTROL_RINGING);
00574          set_state(dial, AST_DIAL_RESULT_RINGING);
00575          break;
00576       case AST_CONTROL_PROGRESS:
00577          ast_verb(3, "%s is making progress, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan));
00578          ast_indicate(chan, AST_CONTROL_PROGRESS);
00579          set_state(dial, AST_DIAL_RESULT_PROGRESS);
00580          break;
00581       case AST_CONTROL_VIDUPDATE:
00582          ast_verb(3, "%s requested a video update, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan));
00583          ast_indicate(chan, AST_CONTROL_VIDUPDATE);
00584          break;
00585       case AST_CONTROL_SRCUPDATE:
00586          ast_verb(3, "%s requested a source update, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan));
00587          ast_indicate(chan, AST_CONTROL_SRCUPDATE);
00588          break;
00589       case AST_CONTROL_CONNECTED_LINE:
00590          ast_verb(3, "%s connected line has changed, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan));
00591          if (ast_channel_connected_line_sub(channel->owner, chan, fr, 1) &&
00592             ast_channel_connected_line_macro(channel->owner, chan, fr, 1, 1)) {
00593             ast_indicate_data(chan, AST_CONTROL_CONNECTED_LINE, fr->data.ptr, fr->datalen);
00594          }
00595          break;
00596       case AST_CONTROL_REDIRECTING:
00597          ast_verb(3, "%s redirecting info has changed, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan));
00598          if (ast_channel_redirecting_sub(channel->owner, chan, fr, 1) &&
00599             ast_channel_redirecting_macro(channel->owner, chan, fr, 1, 1)) {
00600             ast_indicate_data(chan, AST_CONTROL_REDIRECTING, fr->data.ptr, fr->datalen);
00601          }
00602          break;
00603       case AST_CONTROL_PROCEEDING:
00604          ast_verb(3, "%s is proceeding, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan));
00605          ast_indicate(chan, AST_CONTROL_PROCEEDING);
00606          set_state(dial, AST_DIAL_RESULT_PROCEEDING);
00607          break;
00608       case AST_CONTROL_HOLD:
00609          ast_verb(3, "Call on %s placed on hold\n", ast_channel_name(chan));
00610          ast_indicate_data(chan, AST_CONTROL_HOLD, fr->data.ptr, fr->datalen);
00611          break;
00612       case AST_CONTROL_UNHOLD:
00613          ast_verb(3, "Call on %s left from hold\n", ast_channel_name(chan));
00614          ast_indicate(chan, AST_CONTROL_UNHOLD);
00615          break;
00616       case AST_CONTROL_OFFHOOK:
00617       case AST_CONTROL_FLASH:
00618          break;
00619       case AST_CONTROL_PVT_CAUSE_CODE:
00620          ast_indicate_data(chan, AST_CONTROL_PVT_CAUSE_CODE, fr->data.ptr, fr->datalen);
00621          break;
00622       case -1:
00623          /* Prod the channel */
00624          ast_indicate(chan, -1);
00625          break;
00626       default:
00627          break;
00628       }
00629    }
00630 }

static void handle_frame_ownerless ( struct ast_dial dial,
struct ast_dial_channel channel,
struct ast_frame fr 
) [static]

Helper function that handles control frames WITHOUT owner.

Definition at line 633 of file dial.c.

References AST_CAUSE_NORMAL_CIRCUIT_CONGESTION, AST_CAUSE_UNALLOCATED, AST_CAUSE_USER_BUSY, ast_channel_exten(), ast_channel_name(), ast_channel_publish_dial(), AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_INCOMPLETE, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_RINGING, AST_DIAL_RESULT_ANSWERED, AST_DIAL_RESULT_PROCEEDING, AST_DIAL_RESULT_PROGRESS, AST_DIAL_RESULT_RINGING, AST_FRAME_CONTROL, ast_hangup(), AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_REMOVE, AST_LIST_UNLOCK, ast_verb, ast_dial_channel::cause, ast_dial::channels, ast_dial_channel::device, ast_frame::frametype, ast_frame_subclass::integer, ast_dial_channel::list, NULL, ast_dial_channel::owner, set_state(), and ast_frame::subclass.

Referenced by monitor_dial().

00634 {
00635    /* If we have no owner we can only update the state of the dial structure, so only look at control frames */
00636    if (fr->frametype != AST_FRAME_CONTROL)
00637       return;
00638 
00639    switch (fr->subclass.integer) {
00640    case AST_CONTROL_ANSWER:
00641       ast_verb(3, "%s answered\n", ast_channel_name(channel->owner));
00642       AST_LIST_LOCK(&dial->channels);
00643       AST_LIST_REMOVE(&dial->channels, channel, list);
00644       AST_LIST_INSERT_HEAD(&dial->channels, channel, list);
00645       AST_LIST_UNLOCK(&dial->channels);
00646       ast_channel_publish_dial(NULL, channel->owner, channel->device, "ANSWER");
00647       set_state(dial, AST_DIAL_RESULT_ANSWERED);
00648       break;
00649    case AST_CONTROL_BUSY:
00650       ast_verb(3, "%s is busy\n", ast_channel_name(channel->owner));
00651       ast_channel_publish_dial(NULL, channel->owner, channel->device, "BUSY");
00652       ast_hangup(channel->owner);
00653       channel->cause = AST_CAUSE_USER_BUSY;
00654       channel->owner = NULL;
00655       break;
00656    case AST_CONTROL_CONGESTION:
00657       ast_verb(3, "%s is circuit-busy\n", ast_channel_name(channel->owner));
00658       ast_channel_publish_dial(NULL, channel->owner, channel->device, "CONGESTION");
00659       ast_hangup(channel->owner);
00660       channel->cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION;
00661       channel->owner = NULL;
00662       break;
00663    case AST_CONTROL_INCOMPLETE:
00664       /*
00665        * Nothing to do but abort the call since we have no
00666        * controlling channel to ask for more digits.
00667        */
00668       ast_verb(3, "%s dialed Incomplete extension %s\n",
00669          ast_channel_name(channel->owner), ast_channel_exten(channel->owner));
00670       ast_hangup(channel->owner);
00671       channel->cause = AST_CAUSE_UNALLOCATED;
00672       channel->owner = NULL;
00673       break;
00674    case AST_CONTROL_RINGING:
00675       ast_verb(3, "%s is ringing\n", ast_channel_name(channel->owner));
00676       set_state(dial, AST_DIAL_RESULT_RINGING);
00677       break;
00678    case AST_CONTROL_PROGRESS:
00679       ast_verb(3, "%s is making progress\n", ast_channel_name(channel->owner));
00680       set_state(dial, AST_DIAL_RESULT_PROGRESS);
00681       break;
00682    case AST_CONTROL_PROCEEDING:
00683       ast_verb(3, "%s is proceeding\n", ast_channel_name(channel->owner));
00684       set_state(dial, AST_DIAL_RESULT_PROCEEDING);
00685       break;
00686    default:
00687       break;
00688    }
00689 }

static int handle_timeout_trip ( struct ast_dial dial,
struct timeval  start 
) [static]

Helper function to handle when a timeout occurs on dialing attempt.

Definition at line 692 of file dial.c.

References AST_CAUSE_NO_ANSWER, AST_DIAL_RESULT_TIMEOUT, ast_hangup(), AST_LIST_TRAVERSE, ast_tvdiff_ms(), ast_tvnow(), ast_dial_channel::cause, ast_dial::channels, ast_dial_channel::list, NULL, ast_dial_channel::owner, set_state(), ast_dial::state, ast_dial_channel::timeout, and ast_dial::timeout.

Referenced by monitor_dial().

00693 {
00694    struct ast_dial_channel *channel = NULL;
00695    int diff = ast_tvdiff_ms(ast_tvnow(), start), lowest_timeout = -1, new_timeout = -1;
00696 
00697    /* If there is no difference yet return the dial timeout so we can go again, we were likely interrupted */
00698    if (!diff) {
00699       return dial->timeout;
00700    }
00701 
00702    /* If the global dial timeout tripped switch the state to timeout so our channel loop will drop every channel */
00703    if (diff >= dial->timeout) {
00704       set_state(dial, AST_DIAL_RESULT_TIMEOUT);
00705       new_timeout = 0;
00706    }
00707 
00708    /* Go through dropping out channels that have met their timeout */
00709    AST_LIST_TRAVERSE(&dial->channels, channel, list) {
00710       if (dial->state == AST_DIAL_RESULT_TIMEOUT || diff >= channel->timeout) {
00711          ast_hangup(channel->owner);
00712          channel->cause = AST_CAUSE_NO_ANSWER;
00713          channel->owner = NULL;
00714       } else if ((lowest_timeout == -1) || (lowest_timeout > channel->timeout)) {
00715          lowest_timeout = channel->timeout;
00716       }
00717    }
00718 
00719    /* Calculate the new timeout using the lowest timeout found */
00720    if (lowest_timeout >= 0)
00721       new_timeout = lowest_timeout - diff;
00722 
00723    return new_timeout;
00724 }

static enum ast_dial_result monitor_dial ( struct ast_dial dial,
struct ast_channel chan 
) [static]

Helper function that basically keeps tabs on dialing attempts.

Definition at line 743 of file dial.c.

References ast_dial::actual_timeout, answer_exec_run(), answer_exec_struct::app, answer_exec_struct::args, AST_CAUSE_ANSWERED_ELSEWHERE, AST_CAUSE_NORMAL_CLEARING, ast_channel_call_forward(), ast_channel_hangupcause(), ast_channel_musicclass(), ast_channel_publish_dial(), AST_CONTROL_RINGING, ast_dial_destroy(), AST_DIAL_OPTION_ANSWER_EXEC, AST_DIAL_OPTION_MUSIC, AST_DIAL_OPTION_RINGING, AST_DIAL_OPTION_SELF_DESTROY, AST_DIAL_RESULT_ANSWERED, AST_DIAL_RESULT_HANGUP, AST_DIAL_RESULT_RINGING, AST_DIAL_RESULT_TIMEOUT, AST_DIAL_RESULT_TRYING, AST_DIAL_RESULT_UNANSWERED, ast_frfree, ast_hangup(), ast_hangup_cause_to_dial_status(), ast_indicate(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, AST_MAX_WATCHERS, ast_moh_start(), ast_moh_stop(), ast_poll_channel_del(), AST_PTHREADT_STOP, ast_read(), ast_strdupa, ast_strlen_zero, ast_tvnow(), ast_waitfor_n(), ast_dial_channel::cause, ast_dial::channels, ast_dial_channel::device, find_relative_dial_channel(), FIND_RELATIVE_OPTION, handle_call_forward(), handle_frame(), handle_frame_ownerless(), handle_timeout_trip(), IS_CALLER, ast_dial_channel::is_running_app, NULL, ast_dial::options, ast_dial_channel::owner, set_state(), ast_dial::state, and ast_dial::thread.

Referenced by ast_dial_run(), and async_dial().

00744 {
00745    int timeout = -1;
00746    struct ast_channel *cs[AST_MAX_WATCHERS], *who = NULL;
00747    struct ast_dial_channel *channel = NULL;
00748    struct answer_exec_struct *answer_exec = NULL;
00749    struct timeval start;
00750 
00751    set_state(dial, AST_DIAL_RESULT_TRYING);
00752 
00753    /* If the "always indicate ringing" option is set, change state to ringing and indicate to the owner if present */
00754    if (dial->options[AST_DIAL_OPTION_RINGING]) {
00755       set_state(dial, AST_DIAL_RESULT_RINGING);
00756       if (chan)
00757          ast_indicate(chan, AST_CONTROL_RINGING);
00758    } else if (chan && dial->options[AST_DIAL_OPTION_MUSIC] &&
00759       !ast_strlen_zero(dial->options[AST_DIAL_OPTION_MUSIC])) {
00760       char *original_moh = ast_strdupa(ast_channel_musicclass(chan));
00761       ast_indicate(chan, -1);
00762       ast_channel_musicclass_set(chan, dial->options[AST_DIAL_OPTION_MUSIC]);
00763       ast_moh_start(chan, dial->options[AST_DIAL_OPTION_MUSIC], NULL);
00764       ast_channel_musicclass_set(chan, original_moh);
00765    }
00766 
00767    /* Record start time for timeout purposes */
00768    start = ast_tvnow();
00769 
00770    /* We actually figured out the maximum timeout we can do as they were added, so we can directly access the info */
00771    timeout = dial->actual_timeout;
00772 
00773    /* Go into an infinite loop while we are trying */
00774    while ((dial->state != AST_DIAL_RESULT_UNANSWERED) && (dial->state != AST_DIAL_RESULT_ANSWERED) && (dial->state != AST_DIAL_RESULT_HANGUP) && (dial->state != AST_DIAL_RESULT_TIMEOUT)) {
00775       int pos = 0, count = 0;
00776       struct ast_frame *fr = NULL;
00777 
00778       /* Set up channel structure array */
00779       pos = count = 0;
00780       if (chan)
00781          cs[pos++] = chan;
00782 
00783       /* Add channels we are attempting to dial */
00784       AST_LIST_LOCK(&dial->channels);
00785       AST_LIST_TRAVERSE(&dial->channels, channel, list) {
00786          if (channel->owner) {
00787             cs[pos++] = channel->owner;
00788             count++;
00789          }
00790       }
00791       AST_LIST_UNLOCK(&dial->channels);
00792 
00793       /* If we have no outbound channels in progress, switch state to unanswered and stop */
00794       if (!count) {
00795          set_state(dial, AST_DIAL_RESULT_UNANSWERED);
00796          break;
00797       }
00798 
00799       /* Just to be safe... */
00800       if (dial->thread == AST_PTHREADT_STOP)
00801          break;
00802 
00803       /* Wait for frames from channels */
00804       who = ast_waitfor_n(cs, pos, &timeout);
00805 
00806       /* Check to see if our thread is being canceled */
00807       if (dial->thread == AST_PTHREADT_STOP)
00808          break;
00809 
00810       /* If the timeout no longer exists OR if we got no channel it basically means the timeout was tripped, so handle it */
00811       if (!timeout || !who) {
00812          timeout = handle_timeout_trip(dial, start);
00813          continue;
00814       }
00815 
00816       /* Find relative dial channel */
00817       if (!chan || !IS_CALLER(chan, who))
00818          channel = find_relative_dial_channel(dial, who);
00819 
00820       /* See if this channel has been forwarded elsewhere */
00821       if (!ast_strlen_zero(ast_channel_call_forward(who))) {
00822          handle_call_forward(dial, channel, chan);
00823          continue;
00824       }
00825 
00826       /* Attempt to read in a frame */
00827       if (!(fr = ast_read(who))) {
00828          /* If this is the caller then we switch state to hangup and stop */
00829          if (chan && IS_CALLER(chan, who)) {
00830             set_state(dial, AST_DIAL_RESULT_HANGUP);
00831             break;
00832          }
00833          if (chan)
00834             ast_poll_channel_del(chan, channel->owner);
00835          ast_channel_publish_dial(chan, who, channel->device, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(who)));
00836          ast_hangup(who);
00837          channel->owner = NULL;
00838          continue;
00839       }
00840 
00841       /* Process the frame */
00842       if (chan)
00843          handle_frame(dial, channel, fr, chan);
00844       else
00845          handle_frame_ownerless(dial, channel, fr);
00846 
00847       /* Free the received frame and start all over */
00848       ast_frfree(fr);
00849    }
00850 
00851    /* Do post-processing from loop */
00852    if (dial->state == AST_DIAL_RESULT_ANSWERED) {
00853       /* Hangup everything except that which answered */
00854       AST_LIST_LOCK(&dial->channels);
00855       AST_LIST_TRAVERSE(&dial->channels, channel, list) {
00856          if (!channel->owner || channel->owner == who)
00857             continue;
00858          if (chan)
00859             ast_poll_channel_del(chan, channel->owner);
00860          ast_channel_publish_dial(chan, channel->owner, channel->device, "CANCEL");
00861          ast_hangup(channel->owner);
00862          channel->cause = AST_CAUSE_ANSWERED_ELSEWHERE;
00863          channel->owner = NULL;
00864       }
00865       AST_LIST_UNLOCK(&dial->channels);
00866       /* If ANSWER_EXEC is enabled as an option, execute application on answered channel */
00867       if ((channel = find_relative_dial_channel(dial, who)) && (answer_exec = FIND_RELATIVE_OPTION(dial, channel, AST_DIAL_OPTION_ANSWER_EXEC))) {
00868          channel->is_running_app = 1;
00869          answer_exec_run(dial, channel, answer_exec->app, answer_exec->args);
00870          channel->is_running_app = 0;
00871       }
00872 
00873       if (chan && dial->options[AST_DIAL_OPTION_MUSIC] &&
00874          !ast_strlen_zero(dial->options[AST_DIAL_OPTION_MUSIC])) {
00875          ast_moh_stop(chan);
00876       }
00877    } else if (dial->state == AST_DIAL_RESULT_HANGUP) {
00878       /* Hangup everything */
00879       AST_LIST_LOCK(&dial->channels);
00880       AST_LIST_TRAVERSE(&dial->channels, channel, list) {
00881          if (!channel->owner)
00882             continue;
00883          if (chan)
00884             ast_poll_channel_del(chan, channel->owner);
00885          ast_channel_publish_dial(chan, channel->owner, channel->device, "CANCEL");
00886          ast_hangup(channel->owner);
00887          channel->cause = AST_CAUSE_NORMAL_CLEARING;
00888          channel->owner = NULL;
00889       }
00890       AST_LIST_UNLOCK(&dial->channels);
00891    }
00892 
00893    if (dial->options[AST_DIAL_OPTION_SELF_DESTROY]) {
00894       enum ast_dial_result state = dial->state;
00895 
00896       ast_dial_destroy(dial);
00897       return state;
00898    }
00899 
00900    return dial->state;
00901 }

static int music_disable ( void *  data  )  [static]

Definition at line 140 of file dial.c.

References ast_free.

00141 {
00142    if (!data)
00143       return -1;
00144 
00145    ast_free(data);
00146 
00147    return 0;
00148 }

static void* music_enable ( void *  data  )  [static]

Definition at line 135 of file dial.c.

References ast_strdup.

00136 {
00137    return ast_strdup(data);
00138 }

static int predial_disable ( void *  data  )  [static]

Definition at line 155 of file dial.c.

References ast_free.

00156 {
00157    if (!data) {
00158       return -1;
00159    }
00160 
00161    ast_free(data);
00162 
00163    return 0;
00164 }

static void* predial_enable ( void *  data  )  [static]

Definition at line 150 of file dial.c.

References ast_strdup.

00151 {
00152    return ast_strdup(data);
00153 }

static void set_state ( struct ast_dial dial,
enum ast_dial_result  state 
) [static]

Definition at line 530 of file dial.c.

References ast_dial::state, and ast_dial::state_callback.

00531 {
00532    dial->state = state;
00533 
00534    if (dial->state_callback)
00535       dial->state_callback(dial);
00536 }


Variable Documentation

struct ast_option_types option_types[] [static]

Map options to respective handlers (enable/disable).

Note:
This list MUST be perfectly kept in order with enum ast_dial_option, or else madness will happen.

Definition at line 202 of file dial.c.


Generated on Thu Apr 16 06:30:39 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6