#include "asterisk/event.h"


Go to the source code of this file.
Definition in file cel.h.
| #define AST_CEL_EVENT_RECORD_VERSION 2 |
struct ABI version
Definition at line 244 of file cel.h.
Referenced by ast_cel_fabricate_channel_from_event(), and ast_cel_fill_record().
| enum ast_cel_ama_flag |
AMA Flags.
| AST_CEL_AMA_FLAG_NONE | |
| AST_CEL_AMA_FLAG_OMIT | |
| AST_CEL_AMA_FLAG_BILLING | |
| AST_CEL_AMA_FLAG_DOCUMENTATION | |
| AST_CEL_AMA_FLAG_TOTAL | Must be final entry. |
Definition at line 43 of file cel.h.
00043 { 00044 AST_CEL_AMA_FLAG_NONE, 00045 AST_CEL_AMA_FLAG_OMIT, 00046 AST_CEL_AMA_FLAG_BILLING, 00047 AST_CEL_AMA_FLAG_DOCUMENTATION, 00048 /*! \brief Must be final entry */ 00049 AST_CEL_AMA_FLAG_TOTAL, 00050 };
| enum ast_cel_event_type |
CEL event types.
Definition at line 55 of file cel.h.
00055 { 00056 /*! \brief channel birth */ 00057 AST_CEL_CHANNEL_START = 1, 00058 /*! \brief channel end */ 00059 AST_CEL_CHANNEL_END = 2, 00060 /*! \brief hangup terminates connection */ 00061 AST_CEL_HANGUP = 3, 00062 /*! \brief A ringing phone is answered */ 00063 AST_CEL_ANSWER = 4, 00064 /*! \brief an app starts */ 00065 AST_CEL_APP_START = 5, 00066 /*! \brief an app ends */ 00067 AST_CEL_APP_END = 6, 00068 /*! \brief a bridge is established */ 00069 AST_CEL_BRIDGE_START = 7, 00070 /*! \brief a bridge is torn down */ 00071 AST_CEL_BRIDGE_END = 8, 00072 /*! \brief a conference is started */ 00073 AST_CEL_CONF_START = 9, 00074 /*! \brief a conference is ended */ 00075 AST_CEL_CONF_END = 10, 00076 /*! \brief a channel is parked */ 00077 AST_CEL_PARK_START = 11, 00078 /*! \brief channel out of the park */ 00079 AST_CEL_PARK_END = 12, 00080 /*! \brief a transfer occurs */ 00081 AST_CEL_BLINDTRANSFER = 13, 00082 /*! \brief a transfer occurs */ 00083 AST_CEL_ATTENDEDTRANSFER = 14, 00084 /*! \brief a transfer occurs */ 00085 AST_CEL_TRANSFER = 15, 00086 /*! \brief a 3-way conference, usually part of a transfer */ 00087 AST_CEL_HOOKFLASH = 16, 00088 /*! \brief a 3-way conference, usually part of a transfer */ 00089 AST_CEL_3WAY_START = 17, 00090 /*! \brief a 3-way conference, usually part of a transfer */ 00091 AST_CEL_3WAY_END = 18, 00092 /*! \brief channel enters a conference */ 00093 AST_CEL_CONF_ENTER = 19, 00094 /*! \brief channel exits a conference */ 00095 AST_CEL_CONF_EXIT = 20, 00096 /*! \brief a user-defined event, the event name field should be set */ 00097 AST_CEL_USER_DEFINED = 21, 00098 /*! \brief the last channel with the given linkedid is retired */ 00099 AST_CEL_LINKEDID_END = 22, 00100 /*! \brief a masquerade happened to alter the participants on a bridge */ 00101 AST_CEL_BRIDGE_UPDATE = 23, 00102 /*! \brief a directed pickup was performed on this channel */ 00103 AST_CEL_PICKUP = 24, 00104 /*! \brief this call was forwarded somewhere else */ 00105 AST_CEL_FORWARD = 25, 00106 };
| struct ast_cel* ast_cel_alloc | ( | void | ) | [read] |
Allocate a CEL record.
| non-NULL | an allocated ast_cel structure | |
| NULL | error |
| unsigned int ast_cel_check_enabled | ( | void | ) |
Check to see if CEL is enabled.
| zero | not enabled | |
| non-zero | enabled |
Definition at line 131 of file cel.c.
00132 { 00133 return cel_enabled; 00134 }
| void ast_cel_check_retire_linkedid | ( | struct ast_channel * | chan | ) |
Check and potentially retire a Linked ID.
| chan | channel that is being destroyed or its linkedid is changing |
Definition at line 382 of file cel.c.
References AST_CEL_LINKEDID_END, ast_cel_report_event(), ast_cel_track_event(), ast_channel_callback(), ast_channel_linkedid(), ast_channel_unref, ast_strlen_zero(), channel_find_data::chan, channel_find_data::linkedid, and linkedid_match().
Referenced by ast_channel_change_linkedid(), and ast_channel_destructor().
00383 { 00384 const char *linkedid = ast_channel_linkedid(chan); 00385 struct channel_find_data find_dat; 00386 00387 /* make sure we need to do all this work */ 00388 00389 if (!ast_strlen_zero(linkedid) && ast_cel_track_event(AST_CEL_LINKEDID_END)) { 00390 struct ast_channel *tmp = NULL; 00391 find_dat.chan = chan; 00392 find_dat.linkedid = linkedid; 00393 if ((tmp = ast_channel_callback(linkedid_match, NULL, &find_dat, 0))) { 00394 tmp = ast_channel_unref(tmp); 00395 } else { 00396 ast_cel_report_event(chan, AST_CEL_LINKEDID_END, NULL, NULL, NULL); 00397 } 00398 } 00399 }
| void ast_cel_destroy | ( | struct ast_cel * | cel | ) |
Destroy a CEL record.
| cel | the record to destroy |
| struct ast_channel* ast_cel_fabricate_channel_from_event | ( | const struct ast_event * | event | ) | [read] |
Create a fake channel from data in a CEL event.
| event | the CEL event |
Definition at line 401 of file cel.c.
References ast_cel_event_record::account_code, ast_cel_event_record::amaflag, ast_channel::amaflags, ast_party_caller::ani, ast_channel::appl, ast_cel_event_record::application_data, ast_cel_event_record::application_name, AST_CEL_EVENT_RECORD_VERSION, ast_cel_fill_record(), AST_CEL_USER_DEFINED, ast_channel_name_set(), ast_channel_unref, ast_copy_string(), ast_dummy_channel_alloc(), AST_LIST_INSERT_HEAD, ast_localtime(), ast_strdup, ast_strftime(), ast_strlen_zero(), ast_var_assign(), ast_channel::caller, ast_cel_event_record::caller_id_ani, ast_cel_event_record::caller_id_dnid, ast_cel_event_record::caller_id_name, ast_cel_event_record::caller_id_num, ast_cel_event_record::caller_id_rdnis, ast_cel_event_record::channel_name, ast_cel_event_record::context, ast_channel::context, ast_channel::data, ast_channel::dialed, ast_cel_event_record::event_name, ast_cel_event_record::event_time, ast_cel_event_record::event_type, ast_channel::exten, ast_cel_event_record::extension, ast_cel_event_record::extra, ast_party_redirecting::from, ast_party_caller::id, ast_cel_event_record::linked_id, ast_party_id::name, ast_party_dialed::number, ast_party_id::number, ast_cel_event_record::peer, ast_cel_event_record::peer_account, ast_channel::redirecting, ast_party_dialed::str, ast_party_number::str, ast_party_name::str, ast_cel_event_record::unique_id, ast_cel_event_record::user_defined_name, ast_cel_event_record::user_field, ast_party_number::valid, ast_party_name::valid, ast_channel::varshead, and ast_cel_event_record::version.
00402 { 00403 struct varshead *headp; 00404 struct ast_var_t *newvariable; 00405 const char *mixed_name; 00406 char timebuf[30]; 00407 struct ast_channel *tchan; 00408 struct ast_cel_event_record record = { 00409 .version = AST_CEL_EVENT_RECORD_VERSION, 00410 }; 00411 00412 /* do not call ast_channel_alloc because this is not really a real channel */ 00413 if (!(tchan = ast_dummy_channel_alloc())) { 00414 return NULL; 00415 } 00416 00417 headp = &tchan->varshead; 00418 00419 /* first, get the variables from the event */ 00420 if (ast_cel_fill_record(event, &record)) { 00421 ast_channel_unref(tchan); 00422 return NULL; 00423 } 00424 00425 /* next, fill the channel with their data */ 00426 mixed_name = (record.event_type == AST_CEL_USER_DEFINED) 00427 ? record.user_defined_name : record.event_name; 00428 if ((newvariable = ast_var_assign("eventtype", mixed_name))) { 00429 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00430 } 00431 00432 if (ast_strlen_zero(cel_dateformat)) { 00433 snprintf(timebuf, sizeof(timebuf), "%ld.%06ld", (long) record.event_time.tv_sec, 00434 (long) record.event_time.tv_usec); 00435 } else { 00436 struct ast_tm tm; 00437 ast_localtime(&record.event_time, &tm, NULL); 00438 ast_strftime(timebuf, sizeof(timebuf), cel_dateformat, &tm); 00439 } 00440 00441 if ((newvariable = ast_var_assign("eventtime", timebuf))) { 00442 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00443 } 00444 00445 if ((newvariable = ast_var_assign("eventenum", record.event_name))) { 00446 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00447 } 00448 if ((newvariable = ast_var_assign("userdeftype", record.user_defined_name))) { 00449 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00450 } 00451 if ((newvariable = ast_var_assign("eventextra", record.extra))) { 00452 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00453 } 00454 00455 tchan->caller.id.name.valid = 1; 00456 tchan->caller.id.name.str = ast_strdup(record.caller_id_name); 00457 tchan->caller.id.number.valid = 1; 00458 tchan->caller.id.number.str = ast_strdup(record.caller_id_num); 00459 tchan->caller.ani.number.valid = 1; 00460 tchan->caller.ani.number.str = ast_strdup(record.caller_id_ani); 00461 tchan->redirecting.from.number.valid = 1; 00462 tchan->redirecting.from.number.str = ast_strdup(record.caller_id_rdnis); 00463 tchan->dialed.number.str = ast_strdup(record.caller_id_dnid); 00464 00465 ast_copy_string(tchan->exten, record.extension, sizeof(tchan->exten)); 00466 ast_copy_string(tchan->context, record.context, sizeof(tchan->context)); 00467 ast_channel_name_set(tchan, record.channel_name); 00468 ast_channel_uniqueid_set(tchan, record.unique_id); 00469 ast_channel_linkedid_set(tchan, record.linked_id); 00470 ast_channel_accountcode_set(tchan, record.account_code); 00471 ast_channel_peeraccount_set(tchan, record.peer_account); 00472 ast_channel_userfield_set(tchan, record.user_field); 00473 00474 if ((newvariable = ast_var_assign("BRIDGEPEER", record.peer))) { 00475 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00476 } 00477 00478 tchan->appl = ast_strdup(record.application_name); 00479 tchan->data = ast_strdup(record.application_data); 00480 tchan->amaflags = record.amaflag; 00481 00482 return tchan; 00483 }
| int ast_cel_fill_record | ( | const struct ast_event * | event, | |
| struct ast_cel_event_record * | r | |||
| ) |
Fill in an ast_cel_event_record from a CEL event.
| [in] | event | the CEL event |
| [out] | r | the ast_cel_event_record to fill in |
| 0 | success | |
| non-zero | failure |
Definition at line 593 of file cel.c.
References ast_cel_event_record::account_code, ast_cel_event_record::amaflag, ast_cel_event_record::application_data, ast_cel_event_record::application_name, AST_CEL_EVENT_RECORD_VERSION, ast_cel_get_type_name(), AST_CEL_USER_DEFINED, ast_event_get_ie_str(), ast_event_get_ie_uint(), AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_CEL_APPNAME, AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_CEL_EVENT_TIME, AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_CEL_EVENT_TYPE, AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_CEL_EXTRA, AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_CEL_PEER, AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_CEL_USERFIELD, ast_log(), ast_cel_event_record::caller_id_ani, ast_cel_event_record::caller_id_dnid, ast_cel_event_record::caller_id_name, ast_cel_event_record::caller_id_num, ast_cel_event_record::caller_id_rdnis, ast_cel_event_record::channel_name, ast_cel_event_record::context, ast_cel_event_record::event_name, ast_cel_event_record::event_time, ast_cel_event_record::event_type, ast_cel_event_record::extension, ast_cel_event_record::extra, ast_cel_event_record::linked_id, LOG_ERROR, ast_cel_event_record::peer, ast_cel_event_record::peer_account, S_OR, ast_cel_event_record::unique_id, ast_cel_event_record::user_defined_name, ast_cel_event_record::user_field, and ast_cel_event_record::version.
Referenced by ast_cel_fabricate_channel_from_event().
00594 { 00595 if (r->version != AST_CEL_EVENT_RECORD_VERSION) { 00596 ast_log(LOG_ERROR, "Module ABI mismatch for ast_cel_event_record. " 00597 "Please ensure all modules were compiled for " 00598 "this version of Asterisk.\n"); 00599 return -1; 00600 } 00601 00602 r->event_type = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_EVENT_TYPE); 00603 00604 r->event_time.tv_sec = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_EVENT_TIME); 00605 r->event_time.tv_usec = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_EVENT_TIME_USEC); 00606 00607 r->event_name = ast_cel_get_type_name(r->event_type); 00608 if (r->event_type == AST_CEL_USER_DEFINED) { 00609 r->user_defined_name = ast_event_get_ie_str(e, AST_EVENT_IE_CEL_USEREVENT_NAME); 00610 } else { 00611 r->user_defined_name = ""; 00612 } 00613 00614 r->caller_id_name = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDNAME), ""); 00615 r->caller_id_num = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDNUM), ""); 00616 r->caller_id_ani = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDANI), ""); 00617 r->caller_id_rdnis = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDRDNIS), ""); 00618 r->caller_id_dnid = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDDNID), ""); 00619 r->extension = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_EXTEN), ""); 00620 r->context = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CONTEXT), ""); 00621 r->channel_name = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CHANNAME), ""); 00622 r->application_name = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_APPNAME), ""); 00623 r->application_data = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_APPDATA), ""); 00624 r->account_code = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_ACCTCODE), ""); 00625 r->peer_account = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_ACCTCODE), ""); 00626 r->unique_id = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_UNIQUEID), ""); 00627 r->linked_id = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_LINKEDID), ""); 00628 r->amaflag = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_AMAFLAGS); 00629 r->user_field = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_USERFIELD), ""); 00630 r->peer = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_PEER), ""); 00631 r->extra = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_EXTRA), ""); 00632 00633 return 0; 00634 }
| const char* ast_cel_get_ama_flag_name | ( | enum ast_cel_ama_flag | flag | ) |
Convert AMA flag to printable string.
| [in] | flag | the flag to convert to a string |
Definition at line 351 of file cel.c.
References ARRAY_LEN, ast_log(), LOG_WARNING, and S_OR.
00352 { 00353 if (flag < 0 || flag >= ARRAY_LEN(cel_ama_flags)) { 00354 ast_log(LOG_WARNING, "Invalid AMA flag: %d\n", flag); 00355 return "Unknown"; 00356 } 00357 00358 return S_OR(cel_ama_flags[flag], "Unknown"); 00359 }
| const char* ast_cel_get_type_name | ( | enum ast_cel_event_type | type | ) |
Get the name of a CEL event type.
| type | the type to get the name of |
Definition at line 346 of file cel.c.
References S_OR.
Referenced by ast_cel_fill_record(), and handle_cli_status().
00347 { 00348 return S_OR(cel_event_types[type], "Unknown"); 00349 }
| int ast_cel_report_event | ( | struct ast_channel * | chan, | |
| enum ast_cel_event_type | event_type, | |||
| const char * | userdefevname, | |||
| const char * | extra, | |||
| struct ast_channel * | peer2 | |||
| ) |
Report a channel event.
| chan | This argument is required. This is the primary channel associated with this channel event. | |
| event_type | This is the type of call event being reported. | |
| userdefevname | This is an optional custom name for the call event. | |
| extra | This is an optional opaque field that will go into the "CEL_EXTRA" information element of the call event. | |
| peer2 | All CEL events contain a "peer name" information element. The first place the code will look to get a peer name is from the bridged channel to chan. If chan has no bridged channel and peer2 is specified, then the name of peer2 will go into the "peer name" field. If neither are available, the peer name field will be blank. |
| 0 | success | |
| non-zero | failure |
Definition at line 485 of file cel.c.
References ast_channel::amaflags, ast_party_caller::ani, ao2_find, ao2_ref, app, ast_channel::appl, ast_bridged_channel(), AST_CEL_APP_END, AST_CEL_APP_START, ast_cel_track_event(), ast_channel_accountcode(), ast_channel_linkedid(), ast_channel_lock, ast_channel_name(), ast_channel_peeraccount(), ast_channel_ref, ast_channel_uniqueid(), ast_channel_unlock, ast_channel_unref, ast_channel_userfield(), AST_EVENT_CEL, ast_event_destroy(), AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_CEL_APPNAME, AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_CEL_EVENT_TIME, AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_CEL_EVENT_TYPE, AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_CEL_EXTRA, AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_CEL_PEER, AST_EVENT_IE_CEL_PEERACCT, AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_CEL_USERFIELD, AST_EVENT_IE_END, AST_EVENT_IE_PLTYPE_STR, AST_EVENT_IE_PLTYPE_UINT, ast_event_new(), ast_event_queue(), ast_mutex_lock, ast_mutex_unlock, ast_strdupa, ast_tvnow(), ast_channel::caller, ast_channel::context, ast_channel::data, ast_channel::dialed, ast_channel::exten, ast_party_redirecting::from, ast_party_caller::id, ast_party_id::name, ast_party_dialed::number, ast_party_id::number, OBJ_POINTER, ast_channel::redirecting, reload_lock, S_COR, S_OR, ast_party_dialed::str, ast_party_number::str, ast_party_name::str, ast_party_number::valid, and ast_party_name::valid.
Referenced by __ast_channel_alloc_ap(), __ast_read(), analog_attempt_transfer(), ast_bridge_call(), ast_cel_check_retire_linkedid(), ast_channel_destructor(), ast_do_masquerade(), ast_do_pickup(), ast_hangup(), ast_raw_answer(), builtin_atxfer(), builtin_blindtransfer(), celgenuserevent_exec(), do_forward(), handle_request_refer(), local_attended_transfer(), manage_parked_call(), park_call_full(), parked_call_exec(), pbx_exec(), and wait_for_answer().
00487 { 00488 struct timeval eventtime; 00489 struct ast_event *ev; 00490 const char *peername = ""; 00491 struct ast_channel *peer; 00492 00493 ast_channel_lock(chan); 00494 peer = ast_bridged_channel(chan); 00495 if (peer) { 00496 ast_channel_ref(peer); 00497 } 00498 ast_channel_unlock(chan); 00499 00500 /* Make sure a reload is not occurring while we're checking to see if this 00501 * is an event that we care about. We could lose an important event in this 00502 * process otherwise. */ 00503 ast_mutex_lock(&reload_lock); 00504 00505 if (!cel_enabled || !ast_cel_track_event(event_type)) { 00506 ast_mutex_unlock(&reload_lock); 00507 if (peer) { 00508 ast_channel_unref(peer); 00509 } 00510 return 0; 00511 } 00512 00513 if (event_type == AST_CEL_APP_START || event_type == AST_CEL_APP_END) { 00514 char *app; 00515 if (!(app = ao2_find(appset, (char *) chan->appl, OBJ_POINTER))) { 00516 ast_mutex_unlock(&reload_lock); 00517 if (peer) { 00518 ast_channel_unref(peer); 00519 } 00520 return 0; 00521 } 00522 ao2_ref(app, -1); 00523 } 00524 00525 ast_mutex_unlock(&reload_lock); 00526 00527 if (peer) { 00528 ast_channel_lock(peer); 00529 peername = ast_strdupa(ast_channel_name(peer)); 00530 ast_channel_unlock(peer); 00531 } else if (peer2) { 00532 ast_channel_lock(peer2); 00533 peername = ast_strdupa(ast_channel_name(peer2)); 00534 ast_channel_unlock(peer2); 00535 } 00536 00537 if (!userdefevname) { 00538 userdefevname = ""; 00539 } 00540 00541 if (!extra) { 00542 extra = ""; 00543 } 00544 00545 eventtime = ast_tvnow(); 00546 00547 ast_channel_lock(chan); 00548 00549 ev = ast_event_new(AST_EVENT_CEL, 00550 AST_EVENT_IE_CEL_EVENT_TYPE, AST_EVENT_IE_PLTYPE_UINT, event_type, 00551 AST_EVENT_IE_CEL_EVENT_TIME, AST_EVENT_IE_PLTYPE_UINT, eventtime.tv_sec, 00552 AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_PLTYPE_UINT, eventtime.tv_usec, 00553 AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_PLTYPE_STR, userdefevname, 00554 AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, 00555 S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""), 00556 AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_PLTYPE_STR, 00557 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), 00558 AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_PLTYPE_STR, 00559 S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, ""), 00560 AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_PLTYPE_STR, 00561 S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, ""), 00562 AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_PLTYPE_STR, 00563 S_OR(chan->dialed.number.str, ""), 00564 AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_PLTYPE_STR, chan->exten, 00565 AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_PLTYPE_STR, chan->context, 00566 AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_PLTYPE_STR, ast_channel_name(chan), 00567 AST_EVENT_IE_CEL_APPNAME, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->appl, ""), 00568 AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->data, ""), 00569 AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, chan->amaflags, 00570 AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_PLTYPE_STR, ast_channel_accountcode(chan), 00571 AST_EVENT_IE_CEL_PEERACCT, AST_EVENT_IE_PLTYPE_STR, ast_channel_peeraccount(chan), 00572 AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, ast_channel_uniqueid(chan), 00573 AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_PLTYPE_STR, ast_channel_linkedid(chan), 00574 AST_EVENT_IE_CEL_USERFIELD, AST_EVENT_IE_PLTYPE_STR, ast_channel_userfield(chan), 00575 AST_EVENT_IE_CEL_EXTRA, AST_EVENT_IE_PLTYPE_STR, extra, 00576 AST_EVENT_IE_CEL_PEER, AST_EVENT_IE_PLTYPE_STR, peername, 00577 AST_EVENT_IE_END); 00578 00579 ast_channel_unlock(chan); 00580 00581 if (peer) { 00582 peer = ast_channel_unref(peer); 00583 } 00584 00585 if (ev && ast_event_queue(ev)) { 00586 ast_event_destroy(ev); 00587 return -1; 00588 } 00589 00590 return 0; 00591 }
| enum ast_cel_event_type ast_cel_str_to_event_type | ( | const char * | name | ) |
Get the event type from a string.
| name | the event type name as a string |
Definition at line 209 of file cel.c.
References ARRAY_LEN.
Referenced by parse_events().
00210 { 00211 unsigned int i; 00212 00213 for (i = 0; i < ARRAY_LEN(cel_event_types); i++) { 00214 if (!cel_event_types[i]) { 00215 continue; 00216 } 00217 00218 if (!strcasecmp(name, cel_event_types[i])) { 00219 return i; 00220 } 00221 } 00222 00223 return -1; 00224 }
1.5.6