Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Caller Identity / Dialplan
[Core Library]


Detailed Description

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.


Data Structures

struct  switch_caller_profile
 Call Specific Data. More...
struct  switch_caller_application
 An Abstract Representation of a dialplan Application. More...
struct  switch_caller_extension
 An Abstract Representation of a dialplan extension. More...

Functions

switch_caller_extension_tswitch_caller_extension_new (_In_ switch_core_session_t *session, _In_z_ const char *extension_name, _In_z_ const char *extension_number)
 Create a new extension with desired parameters.
switch_status_t switch_caller_extension_clone (switch_caller_extension_t **new_ext, switch_caller_extension_t *orig, switch_memory_pool_t *pool)
void switch_caller_extension_add_application (_In_ switch_core_session_t *session, _In_ switch_caller_extension_t *caller_extension, _In_z_ const char *application_name, _In_z_ const char *extra_data)
 Add an application (instruction) to the given extension.
_Check_return_ _Ret_opt_z_
const char * 
switch_caller_get_field_by_name (_In_ switch_caller_profile_t *caller_profile, _In_z_ const char *name)
 Get the value of a field in a caller profile based on it's name.
switch_caller_profile_tswitch_caller_profile_new (_In_ switch_memory_pool_t *pool, _In_opt_z_ const char *username, _In_opt_z_ const char *dialplan, _In_opt_z_ const char *caller_id_name, _In_opt_z_ const char *caller_id_number, _In_opt_z_ const char *network_addr, _In_opt_z_ const char *ani, _In_opt_z_ const char *aniii, _In_opt_z_ const char *rdnis, _In_opt_z_ const char *source, _In_opt_z_ const char *context, _In_opt_z_ const char *destination_number)
 Create a new caller profile object.
switch_caller_profile_tswitch_caller_profile_clone (_In_ switch_core_session_t *session, _In_ switch_caller_profile_t *tocopy)
 Clone an existing caller profile object.
switch_caller_profile_tswitch_caller_profile_dup (_In_ switch_memory_pool_t *pool, _In_ switch_caller_profile_t *tocopy)
 Duplicate an existing caller profile object.
void switch_caller_profile_event_set_data (_In_ switch_caller_profile_t *caller_profile, _In_opt_z_ const char *prefix, _In_ switch_event_t *event)
 Add headers to an existing event in regards to a specific profile.


Function Documentation

void switch_caller_extension_add_application _In_ switch_core_session_t session,
_In_ switch_caller_extension_t caller_extension,
_In_z_ const char *  application_name,
_In_z_ const char *  extra_data
 

Add an application (instruction) to the given extension.

Parameters:
session session associated with the extension (bound by scope)
caller_extension extension to add the application to
application_name the name of the application
extra_data optional argument to the application

switch_status_t switch_caller_extension_clone switch_caller_extension_t **  new_ext,
switch_caller_extension_t orig,
switch_memory_pool_t pool
 

00325 {
00326         switch_caller_extension_t *caller_extension = NULL;
00327         switch_caller_application_t *caller_application = NULL, *ap = NULL;
00328 
00329         *new_ext = NULL;
00330 
00331         if ((caller_extension = switch_core_alloc(pool, sizeof(switch_caller_extension_t))) != 0) {
00332                 int match = 0;
00333 
00334         caller_extension->extension_name = switch_core_strdup(pool, orig->extension_name);
00335         caller_extension->extension_number = switch_core_strdup(pool, orig->extension_number);
00336 
00337                 for(ap = orig->applications; ap; ap = ap->next) {
00338 
00339                         if (!match) {
00340                                 if (ap == orig->current_application) {
00341                                         match++;
00342                                 } else {
00343                                         continue;
00344                                 }
00345                         }
00346                         caller_application = switch_core_alloc(pool, sizeof(switch_caller_application_t));
00347                         
00348                         caller_application->application_name = switch_core_strdup(pool, ap->application_name);
00349                         caller_application->application_data = switch_core_strdup(pool, ap->application_data);
00350 
00351                         if (!caller_extension->applications) {
00352                                 caller_extension->applications = caller_application;
00353                         } else if (caller_extension->last_application) {
00354                                 caller_extension->last_application->next = caller_application;
00355                         }
00356                         
00357                         caller_extension->last_application = caller_application;
00358 
00359                         if (ap == orig->current_application) {
00360                                 caller_extension->current_application = caller_application;
00361                         }
00362                 }
00363 
00364                 *new_ext = caller_extension;
00365 
00366                 return SWITCH_STATUS_SUCCESS;
00367     }
00368         
00369 
00370         return SWITCH_STATUS_MEMERR;
00371 }

switch_caller_extension_t* switch_caller_extension_new _In_ switch_core_session_t session,
_In_z_ const char *  extension_name,
_In_z_ const char *  extension_number
 

Create a new extension with desired parameters.

Parameters:
session session associated with the extension (bound by scope)
extension_name extension name
extension_number extension number
Returns:
a new extension object allocated from the session's memory pool

_Check_return_ _Ret_opt_z_ const char* switch_caller_get_field_by_name _In_ switch_caller_profile_t caller_profile,
_In_z_ const char *  name
 

Get the value of a field in a caller profile based on it's name.

Parameters:
caller_profile The caller profile
name the name
Note:
this function is meant for situations where the name paramater is the contents of the variable

switch_caller_profile_t* switch_caller_profile_clone _In_ switch_core_session_t session,
_In_ switch_caller_profile_t tocopy
 

Clone an existing caller profile object.

Parameters:
session session associated with the profile (bound by scope)
tocopy the existing profile

switch_caller_profile_t* switch_caller_profile_dup _In_ switch_memory_pool_t pool,
_In_ switch_caller_profile_t tocopy
 

Duplicate an existing caller profile object.

Parameters:
pool pool to duplicate with
tocopy the existing profile

void switch_caller_profile_event_set_data _In_ switch_caller_profile_t caller_profile,
_In_opt_z_ const char *  prefix,
_In_ switch_event_t event
 

Add headers to an existing event in regards to a specific profile.

Parameters:
caller_profile the desired profile
prefix a prefix string to all of the field names (for uniqueness)
event the event to add the information to

switch_caller_profile_t* switch_caller_profile_new _In_ switch_memory_pool_t pool,
_In_opt_z_ const char *  username,
_In_opt_z_ const char *  dialplan,
_In_opt_z_ const char *  caller_id_name,
_In_opt_z_ const char *  caller_id_number,
_In_opt_z_ const char *  network_addr,
_In_opt_z_ const char *  ani,
_In_opt_z_ const char *  aniii,
_In_opt_z_ const char *  rdnis,
_In_opt_z_ const char *  source,
_In_opt_z_ const char *  context,
_In_opt_z_ const char *  destination_number
 

Create a new caller profile object.

Parameters:
pool memory pool to use
username tne username of the caller
dialplan name of the dialplan module in use
caller_id_name caller ID name
caller_id_number caller ID number
network_addr network address
ani ANI information
aniii ANI II information
rdnis RDNIS
source the source
context a logical context
destination_number destination number
Returns:
a new profile object allocated from the session's memory pool


Generated on Fri Oct 10 11:24:23 2008 for FreeSWITCH by  doxygen 1.3.9.1