39 const char *caller_id_name,
40 const char *caller_id_number,
41 const char *network_addr,
45 const char *source,
const char *context,
const char *destination_number)
52 memset(profile, 0,
sizeof(*profile));
61 if (
zstr(caller_id_name)) {
65 if (
zstr(caller_id_number)) {
71 ani = caller_id_number;
162 for (pn = tocopy->
soft; pn; pn = pn->
next) {
168 if (!profile->
soft) {
195 if (!strcasecmp(name,
"dialplan")) {
198 if (!strcasecmp(name,
"username")) {
201 if (!strcasecmp(name,
"caller_id_name")) {
204 if (!strcasecmp(name,
"caller_id_number")) {
207 if (!strcasecmp(name,
"orig_caller_id_name")) {
210 if (!strcasecmp(name,
"orig_caller_id_number")) {
213 if (!strcasecmp(name,
"callee_id_name")) {
216 if (!strcasecmp(name,
"callee_id_number")) {
219 if (!strcasecmp(name,
"ani")) {
220 return caller_profile->
ani;
222 if (!strcasecmp(name,
"aniii")) {
223 return caller_profile->
aniii;
225 if (!strcasecmp(name,
"network_addr")) {
228 if (!strcasecmp(name,
"rdnis")) {
229 return caller_profile->
rdnis;
231 if (!strcasecmp(name,
"destination_number")) {
234 if (!strcasecmp(name,
"uuid")) {
235 return caller_profile->
uuid;
237 if (!strcasecmp(name,
"source")) {
238 return caller_profile->
source;
240 if (!strcasecmp(name,
"transfer_source")) {
243 if (!strcasecmp(name,
"context")) {
244 return caller_profile->
context;
247 if (!strcasecmp(name,
"chan_name")) {
251 if (!strcasecmp(name,
"profile_index")) {
255 if (!strcasecmp(name,
"caller_ton")) {
258 if (!strcasecmp(name,
"caller_numplan")) {
261 if (!strcasecmp(name,
"destination_number_ton")) {
264 if (!strcasecmp(name,
"destination_number_numplan")) {
267 if (!strcasecmp(name,
"ani_ton")) {
270 if (!strcasecmp(name,
"ani_numplan")) {
273 if (!strcasecmp(name,
"rdnis_ton")) {
276 if (!strcasecmp(name,
"rdnis_numplan")) {
279 if (!strcasecmp(name,
"screen_bit")) {
282 if (!strcasecmp(name,
"privacy_hide_name")) {
285 if (!strcasecmp(name,
"privacy_hide_number")) {
288 if (!strcasecmp(name,
"profile_created_time")) {
291 if (!strcasecmp(name,
"created_time")) {
294 if (!strcasecmp(name,
"answered_time")) {
297 if (!strcasecmp(name,
"progress_time")) {
300 if (!strcasecmp(name,
"progress_media_time")) {
303 if (!strcasecmp(name,
"hungup_time")) {
306 if (!strcasecmp(name,
"transferred_time")) {
312 for (pn = caller_profile->
soft; pn; pn = pn->
next) {
313 if (!strcasecmp(name, pn->
var)) {
324 char header_name[1024];
327 switch_snprintf(header_name,
sizeof(header_name),
"%s-Direction", prefix);
329 "inbound" :
"outbound");
331 switch_snprintf(header_name,
sizeof(header_name),
"%s-Logical-Direction", prefix);
333 "inbound" :
"outbound");
336 switch_snprintf(header_name,
sizeof(header_name),
"%s-Username", prefix);
340 switch_snprintf(header_name,
sizeof(header_name),
"%s-Dialplan", prefix);
344 switch_snprintf(header_name,
sizeof(header_name),
"%s-Caller-ID-Name", prefix);
348 switch_snprintf(header_name,
sizeof(header_name),
"%s-Caller-ID-Number", prefix);
352 switch_snprintf(header_name,
sizeof(header_name),
"%s-Orig-Caller-ID-Name", prefix);
356 switch_snprintf(header_name,
sizeof(header_name),
"%s-Orig-Caller-ID-Number", prefix);
360 switch_snprintf(header_name,
sizeof(header_name),
"%s-Callee-ID-Name", prefix);
364 switch_snprintf(header_name,
sizeof(header_name),
"%s-Callee-ID-Number", prefix);
368 switch_snprintf(header_name,
sizeof(header_name),
"%s-Network-Addr", prefix);
371 if (!
zstr(caller_profile->
ani)) {
376 switch_snprintf(header_name,
sizeof(header_name),
"%s-ANI-II", prefix);
380 switch_snprintf(header_name,
sizeof(header_name),
"%s-Destination-Number", prefix);
384 switch_snprintf(header_name,
sizeof(header_name),
"%s-Unique-ID", prefix);
388 switch_snprintf(header_name,
sizeof(header_name),
"%s-Source", prefix);
392 switch_snprintf(header_name,
sizeof(header_name),
"%s-Transfer-Source", prefix);
396 switch_snprintf(header_name,
sizeof(header_name),
"%s-Context", prefix);
404 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Name", prefix);
408 switch_snprintf(header_name,
sizeof(header_name),
"%s-Profile-Index", prefix);
412 if (caller_profile->
soft) {
415 for (pn = caller_profile->
soft; pn; pn = pn->
next) {
426 if (!(times = caller_profile->
times)) {
432 switch_snprintf(header_name,
sizeof(header_name),
"%s-Profile-Created-Time", prefix);
434 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Created-Time", prefix);
436 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Answered-Time", prefix);
438 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Progress-Time", prefix);
440 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Progress-Media-Time", prefix);
442 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Hangup-Time", prefix);
444 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Transfer-Time", prefix);
446 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Resurrect-Time", prefix);
448 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Bridged-Time", prefix);
450 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Last-Hold", prefix);
452 switch_snprintf(header_name,
sizeof(header_name),
"%s-Channel-Hold-Accum", prefix);
456 switch_snprintf(header_name,
sizeof(header_name),
"%s-Screen-Bit", prefix);
459 switch_snprintf(header_name,
sizeof(header_name),
"%s-Privacy-Hide-Name", prefix);
462 switch_snprintf(header_name,
sizeof(header_name),
"%s-Privacy-Hide-Number", prefix);
507 *new_ext = caller_extension;
517 const char *extension_number)
527 return caller_extension;
533 const char *
fmt, ...)
540 if (strstr(data,
"\\'")) {
555 const char *application_data)
#define SWITCH_DEFAULT_CLID_NUMBER
#define SWITCH_CHANNEL_SESSION_LOG(x)
An Abstract Representation of a dialplan extension.
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
switch_call_direction_t logical_direction
#define SWITCH_NUMPLAN_UNDEF
const char * orig_caller_id_name
int switch_core_test_flag(int flag)
const char * switch_caller_get_field_by_name(switch_caller_profile_t *caller_profile, const char *name)
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
const char * network_addr
switch_memory_pool_t * pool
switch_status_t switch_event_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *fmt,...) PRINTF_FUNCTION(4
Add a header to an event.
Representation of an event.
An Abstract Representation of a dialplan Application.
void switch_caller_profile_event_set_data(switch_caller_profile_t *caller_profile, const char *prefix, switch_event_t *event)
switch_caller_application_t * last_application
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
struct switch_caller_application * next
#define SWITCH_DEFAULT_CLID_NAME
switch_caller_profile_t * switch_caller_profile_dup(switch_memory_pool_t *pool, switch_caller_profile_t *tocopy)
const char * orig_caller_id_number
const char * callee_id_number
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
switch_caller_profile_t * switch_caller_profile_clone(switch_core_session_t *session, switch_caller_profile_t *tocopy)
switch_caller_application_t * applications
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
uint8_t destination_number_ton
const char * caller_id_name
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
#define SWITCH_BLANK_STRING
struct profile_node_s * next
switch_call_direction_t direction
int switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap)
uint8_t destination_number_numplan
const char * profile_index
switch_status_t switch_caller_extension_clone(switch_caller_extension_t **new_ext, switch_caller_extension_t *orig, switch_memory_pool_t *pool)
switch_caller_application_t * current_application
switch_caller_profile_flag_t flags
switch_status_t
Common return values.
#define profile_dup(a, b, p)
struct switch_channel_timetable * old_times
char * switch_uuid_str(char *buf, switch_size_t len)
void switch_caller_extension_add_application(switch_core_session_t *session, switch_caller_extension_t *caller_extension, const char *application_name, const char *application_data)
char * destination_number
struct switch_channel_timetable * times
const char * caller_id_number
#define switch_core_session_alloc(_session, _memory)
Allocate memory from a session's pool.
void switch_caller_extension_add_application_printf(switch_core_session_t *session, switch_caller_extension_t *caller_extension, const char *application_name, const char *fmt,...)
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
struct fspr_pool_t switch_memory_pool_t
switch_caller_extension_t * switch_caller_extension_new(switch_core_session_t *session, const char *extension_name, const char *extension_number)
#define switch_core_session_strdup(_session, _todup)
Copy a string using memory allocation from a session's pool.
char * switch_core_sprintf(_In_ switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt,...)
printf-style style printing routine. The data is output to a string allocated from the pool ...
#define profile_dup_clean(a, b, p)
const char * callee_id_name
switch_caller_profile_t * switch_caller_profile_new(switch_memory_pool_t *pool, const char *username, const char *dialplan, const char *caller_id_name, const char *caller_id_number, const char *network_addr, const char *ani, const char *aniii, const char *rdnis, const char *source, const char *context, const char *destination_number)
switch_memory_pool_t * switch_core_session_get_pool(_In_ switch_core_session_t *session)
Retrieve the memory pool from a session.
#define SWITCH_UUID_FORMATTED_LENGTH
switch_memory_pool_t * pool