2005-11-19 20:07:43 +00:00
|
|
|
/*
|
|
|
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
* Version: MPL 1.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
* Portions created by the Initial Developer are Copyright (C)
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* switch_caller.h -- Caller Identification
|
|
|
|
*
|
|
|
|
*/
|
2006-01-10 20:10:38 +00:00
|
|
|
/**
|
|
|
|
* @file switch_caller.h
|
|
|
|
* @brief Caller Identification
|
|
|
|
* @see caller
|
2006-04-12 15:04:26 +00:00
|
|
|
*/
|
2006-01-10 20:10:38 +00:00
|
|
|
/**
|
|
|
|
* @defgroup caller Caller Identity / Dialplan
|
2006-04-12 16:34:34 +00:00
|
|
|
* @ingroup core1
|
2006-01-10 20:10:38 +00:00
|
|
|
*
|
|
|
|
* This module implements a caller profile which is a group of information about a connected endpoint
|
|
|
|
* such as common caller id and other useful information such as ip address and destination number.
|
|
|
|
* A connected session's channel has up to 3 profiles: It's own, that of the session who spawned it
|
|
|
|
* and that of the session it has spawned.
|
|
|
|
*
|
|
|
|
* In addition, this module implements an abstract interface for extensions and applications.
|
|
|
|
* A connected session's channel has one extension object which may have one or more applications
|
|
|
|
* linked into a stack which will be executed in order by the session's state machine when the
|
|
|
|
* current state is CS_EXECUTE.
|
|
|
|
* @{
|
|
|
|
*/
|
2006-01-01 15:23:12 +00:00
|
|
|
|
2005-11-19 20:07:43 +00:00
|
|
|
#ifndef SWITCH_CALLER_H
|
|
|
|
#define SWITCH_CALLER_H
|
|
|
|
|
|
|
|
#include <switch.h>
|
|
|
|
|
2006-09-07 14:23:31 +00:00
|
|
|
SWITCH_BEGIN_EXTERN_C
|
2006-04-28 20:04:08 +00:00
|
|
|
|
2006-04-12 15:04:26 +00:00
|
|
|
/*! \brief Call Specific Data
|
|
|
|
*/
|
|
|
|
struct switch_caller_profile {
|
2006-05-26 16:00:08 +00:00
|
|
|
/*! The Call's User Name */
|
|
|
|
char *username;
|
2006-04-12 15:04:26 +00:00
|
|
|
/*! The name of the dialplan */
|
|
|
|
char *dialplan;
|
|
|
|
/*! Caller ID Name */
|
|
|
|
char *caller_id_name;
|
|
|
|
/*! Caller ID Number */
|
|
|
|
char *caller_id_number;
|
|
|
|
/*! Caller Network Address (when applicable) */
|
|
|
|
char *network_addr;
|
|
|
|
/*! ANI (when applicable) */
|
|
|
|
char *ani;
|
|
|
|
/*! ANI II (when applicable) */
|
2006-10-17 23:33:32 +00:00
|
|
|
char *aniii;
|
2006-04-21 22:31:08 +00:00
|
|
|
/*! RDNIS */
|
|
|
|
char *rdnis;
|
2006-04-12 15:04:26 +00:00
|
|
|
/*! Destination Number */
|
|
|
|
char *destination_number;
|
2006-04-21 22:31:08 +00:00
|
|
|
/*! channel type */
|
|
|
|
char *source;
|
2006-04-12 15:04:26 +00:00
|
|
|
/*! channel name */
|
|
|
|
char *chan_name;
|
|
|
|
/*! unique id */
|
|
|
|
char *uuid;
|
2006-04-28 19:46:57 +00:00
|
|
|
/*! context */
|
|
|
|
char *context;
|
2006-10-16 04:39:00 +00:00
|
|
|
/*! flags */
|
|
|
|
switch_caller_profile_flag_t flags;
|
2006-12-01 15:26:37 +00:00
|
|
|
struct switch_caller_profile *originator_caller_profile;
|
|
|
|
struct switch_caller_profile *originatee_caller_profile;
|
|
|
|
struct switch_channel_timetable *times;
|
2006-04-28 19:46:57 +00:00
|
|
|
struct switch_caller_profile *next;
|
2006-04-12 15:04:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*! \brief An Abstract Representation of a dialplan Application */
|
|
|
|
struct switch_caller_application {
|
|
|
|
/*! The name of the registered application to call */
|
|
|
|
char *application_name;
|
|
|
|
/*! An optional argument string to pass to the application */
|
|
|
|
char *application_data;
|
|
|
|
/*! A function pointer to the application */
|
2006-04-29 23:43:28 +00:00
|
|
|
switch_application_function_t application_function;
|
2006-04-12 15:04:26 +00:00
|
|
|
struct switch_caller_application *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*! \brief An Abstract Representation of a dialplan extension */
|
|
|
|
struct switch_caller_extension {
|
|
|
|
/*! The name of the extension */
|
|
|
|
char *extension_name;
|
|
|
|
/*! The number of the extension */
|
|
|
|
char *extension_number;
|
|
|
|
/*! Pointer to the current application for this extension */
|
2006-04-29 06:05:03 +00:00
|
|
|
switch_caller_application_t *current_application;
|
2006-04-12 15:04:26 +00:00
|
|
|
/*! Pointer to the last application for this extension */
|
2006-04-29 06:05:03 +00:00
|
|
|
switch_caller_application_t *last_application;
|
2006-04-12 15:04:26 +00:00
|
|
|
/*! Pointer to the entire stack of applications for this extension */
|
2006-04-29 06:05:03 +00:00
|
|
|
switch_caller_application_t *applications;
|
2006-06-03 17:06:06 +00:00
|
|
|
struct switch_caller_extension *next;
|
2006-04-12 15:04:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Create a new extension with desired parameters
|
|
|
|
\param session session associated with the extension (bound by scope)
|
|
|
|
\param extension_name extension name
|
|
|
|
\param extension_number extension number
|
|
|
|
\return a new extension object allocated from the session's memory pool
|
|
|
|
*/
|
2006-04-29 06:05:03 +00:00
|
|
|
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session,
|
2006-04-12 15:04:26 +00:00
|
|
|
char *extension_name,
|
|
|
|
char *extension_number
|
|
|
|
);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Add an application (instruction) to the given extension
|
|
|
|
\param session session associated with the extension (bound by scope)
|
|
|
|
\param caller_extension extension to add the application to
|
|
|
|
\param application_name the name of the application
|
|
|
|
\param extra_data optional argument to the application
|
|
|
|
*/
|
2006-04-29 06:05:03 +00:00
|
|
|
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session_t *session,
|
|
|
|
switch_caller_extension_t *caller_extension,
|
2006-04-12 15:04:26 +00:00
|
|
|
char *application_name,
|
|
|
|
char *extra_data);
|
|
|
|
|
|
|
|
|
2006-05-10 03:23:05 +00:00
|
|
|
/*!
|
|
|
|
\brief Get the value of a field in a caller profile based on it's name
|
|
|
|
\param caller_profile The caller profile
|
|
|
|
\param name the name
|
|
|
|
\note this function is meant for situations where the name paramater is the contents of the variable
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *caller_profile, char *name);
|
|
|
|
|
2006-04-12 15:04:26 +00:00
|
|
|
/*!
|
|
|
|
\brief Create a new caller profile object
|
|
|
|
\param pool memory pool to use
|
2006-06-03 17:06:39 +00:00
|
|
|
\param username tne username of the caller
|
2006-04-12 15:04:26 +00:00
|
|
|
\param dialplan name of the dialplan module in use
|
|
|
|
\param caller_id_name caller ID name
|
|
|
|
\param caller_id_number caller ID number
|
|
|
|
\param network_addr network address
|
|
|
|
\param ani ANI information
|
2006-10-17 23:33:32 +00:00
|
|
|
\param aniii ANI II information
|
2006-04-24 16:19:11 +00:00
|
|
|
\param rdnis RDNIS
|
|
|
|
\param source the source
|
2006-04-29 21:36:10 +00:00
|
|
|
\param context a logical context
|
2006-04-12 15:04:26 +00:00
|
|
|
\param destination_number destination number
|
|
|
|
\return a new profile object allocated from the session's memory pool
|
|
|
|
*/
|
2006-04-29 06:05:03 +00:00
|
|
|
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool,
|
2006-05-26 16:00:08 +00:00
|
|
|
char *username,
|
|
|
|
char *dialplan,
|
|
|
|
char *caller_id_name,
|
|
|
|
char *caller_id_number,
|
|
|
|
char *network_addr,
|
|
|
|
char *ani,
|
2006-10-17 23:33:32 +00:00
|
|
|
char *aniii,
|
2006-05-26 16:00:08 +00:00
|
|
|
char *rdnis,
|
|
|
|
char *source,
|
|
|
|
char *context,
|
|
|
|
char *destination_number);
|
2006-04-12 15:04:26 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Clone an existing caller profile object
|
|
|
|
\param session session associated with the profile (bound by scope)
|
|
|
|
\param tocopy the existing profile
|
|
|
|
*/
|
2006-01-05 21:03:22 +00:00
|
|
|
|
2006-04-29 06:05:03 +00:00
|
|
|
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_core_session_t *session,
|
|
|
|
switch_caller_profile_t *tocopy);
|
2006-04-12 15:04:26 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Add headers to an existing event in regards to a specific profile
|
|
|
|
\param caller_profile the desired profile
|
|
|
|
\param prefix a prefix string to all of the field names (for uniqueness)
|
|
|
|
\param event the event to add the information to
|
|
|
|
*/
|
2006-01-05 21:03:22 +00:00
|
|
|
|
2006-04-29 06:05:03 +00:00
|
|
|
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_t *caller_profile, char *prefix, switch_event_t *event);
|
2005-11-19 20:07:43 +00:00
|
|
|
|
2006-09-07 15:15:39 +00:00
|
|
|
SWITCH_END_EXTERN_C
|
2005-11-19 20:07:43 +00:00
|
|
|
|
2006-01-10 20:10:38 +00:00
|
|
|
/** @} */
|
2005-11-19 20:07:43 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2006-11-27 22:30:48 +00:00
|
|
|
/* For Emacs:
|
|
|
|
* Local Variables:
|
|
|
|
* mode:c
|
|
|
|
* indent-tabs-mode:nil
|
|
|
|
* tab-width:4
|
|
|
|
* c-basic-offset:4
|
|
|
|
* End:
|
|
|
|
* For VIM:
|
|
|
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
|
|
|
*/
|