#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 229 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_OMIT | |
| AST_CEL_AMA_FLAG_BILLING | |
| AST_CEL_AMA_FLAG_DOCUMENTATION | |
| AST_CEL_AMA_FLAG_TOTAL | Must be final entry. |
Definition at line 32 of file cel.h.
00032 { 00033 AST_CEL_AMA_FLAG_OMIT, 00034 AST_CEL_AMA_FLAG_BILLING, 00035 AST_CEL_AMA_FLAG_DOCUMENTATION, 00036 /*! \brief Must be final entry */ 00037 AST_CEL_AMA_FLAG_TOTAL, 00038 };
| enum ast_cel_event_type |
CEL event types.
Definition at line 43 of file cel.h.
00043 { 00044 /*! \brief channel birth */ 00045 AST_CEL_CHANNEL_START = 1, 00046 /*! \brief channel end */ 00047 AST_CEL_CHANNEL_END = 2, 00048 /*! \brief hangup terminates connection */ 00049 AST_CEL_HANGUP = 3, 00050 /*! \brief A ringing phone is answered */ 00051 AST_CEL_ANSWER = 4, 00052 /*! \brief an app starts */ 00053 AST_CEL_APP_START = 5, 00054 /*! \brief an app ends */ 00055 AST_CEL_APP_END = 6, 00056 /*! \brief a bridge is established */ 00057 AST_CEL_BRIDGE_START = 7, 00058 /*! \brief a bridge is torn down */ 00059 AST_CEL_BRIDGE_END = 8, 00060 /*! \brief a conference is started */ 00061 AST_CEL_CONF_START = 9, 00062 /*! \brief a conference is ended */ 00063 AST_CEL_CONF_END = 10, 00064 /*! \brief a channel is parked */ 00065 AST_CEL_PARK_START = 11, 00066 /*! \brief channel out of the park */ 00067 AST_CEL_PARK_END = 12, 00068 /*! \brief a transfer occurs */ 00069 AST_CEL_BLINDTRANSFER = 13, 00070 /*! \brief a transfer occurs */ 00071 AST_CEL_ATTENDEDTRANSFER = 14, 00072 /*! \brief a transfer occurs */ 00073 AST_CEL_TRANSFER = 15, 00074 /*! \brief a 3-way conference, usually part of a transfer */ 00075 AST_CEL_HOOKFLASH = 16, 00076 /*! \brief a 3-way conference, usually part of a transfer */ 00077 AST_CEL_3WAY_START = 17, 00078 /*! \brief a 3-way conference, usually part of a transfer */ 00079 AST_CEL_3WAY_END = 18, 00080 /*! \brief channel enters a conference */ 00081 AST_CEL_CONF_ENTER = 19, 00082 /*! \brief channel exits a conference */ 00083 AST_CEL_CONF_EXIT = 20, 00084 /*! \brief a user-defined event, the event name field should be set */ 00085 AST_CEL_USER_DEFINED = 21, 00086 /*! \brief the last channel with the given linkedid is retired */ 00087 AST_CEL_LINKEDID_END = 22, 00088 /*! \brief a masquerade happened to alter the participants on a bridge */ 00089 AST_CEL_BRIDGE_UPDATE = 23, 00090 /*! \brief a directed pickup was performed on this channel */ 00091 AST_CEL_PICKUP = 24, 00092 /*! \brief this call was forwarded somewhere else */ 00093 AST_CEL_FORWARD = 25, 00094 };
| 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 130 of file cel.c.
00131 { 00132 return cel_enabled; 00133 }
| 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 376 of file cel.c.
References AST_CEL_LINKEDID_END, ast_cel_report_event(), ast_cel_track_event(), ast_channel_callback(), ast_channel_unref, ast_strlen_zero(), channel_find_data::chan, ast_channel::linkedid, channel_find_data::linkedid, and linkedid_match().
Referenced by ast_channel_change_linkedid(), and ast_channel_destructor().
00377 { 00378 const char *linkedid = chan->linkedid; 00379 struct channel_find_data find_dat; 00380 00381 /* make sure we need to do all this work */ 00382 00383 if (!ast_strlen_zero(linkedid) && ast_cel_track_event(AST_CEL_LINKEDID_END)) { 00384 struct ast_channel *tmp = NULL; 00385 find_dat.chan = chan; 00386 find_dat.linkedid = linkedid; 00387 if ((tmp = ast_channel_callback(linkedid_match, NULL, &find_dat, 0))) { 00388 tmp = ast_channel_unref(tmp); 00389 } else { 00390 ast_cel_report_event(chan, AST_CEL_LINKEDID_END, NULL, NULL, NULL); 00391 } 00392 } 00393 }
| 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.
This function creates a fake channel containing the serialized channel data in the given cel event. It must be released with ast_channel_release.
| event | the CEL event |
Definition at line 395 of file cel.c.
References ast_cel_event_record::account_code, accountcode, ast_cel_event_record::amaflag, ast_channel::amaflags, 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_channel_release(), ast_copy_string(), ast_dummy_channel_alloc(), AST_LIST_INSERT_HEAD, ast_localtime(), ast_strdup, ast_strftime(), ast_string_field_set, ast_strlen_zero(), ast_var_assign(), 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_channel::cid, ast_callerid::cid_ani, ast_callerid::cid_dnid, ast_callerid::cid_name, ast_callerid::cid_num, ast_callerid::cid_rdnis, ast_cel_event_record::context, ast_channel::context, ast_channel::data, ast_cel_event_record::event_name, ast_cel_event_record::event_time, ast_channel::exten, ast_cel_event_record::extension, ast_cel_event_record::extra, ast_cel_event_record::linked_id, name, pbx_builtin_setvar_helper(), ast_cel_event_record::peer, ast_cel_event_record::peer_account, ast_cel_event_record::unique_id, ast_cel_event_record::user_field, ast_channel::varshead, and ast_cel_event_record::version.
00396 { 00397 struct varshead *headp; 00398 struct ast_var_t *newvariable; 00399 char timebuf[30]; 00400 struct ast_channel *tchan; 00401 struct ast_cel_event_record record = { 00402 .version = AST_CEL_EVENT_RECORD_VERSION, 00403 }; 00404 00405 /* do not call ast_channel_alloc because this is not really a real channel */ 00406 if (!(tchan = ast_dummy_channel_alloc())) { 00407 return NULL; 00408 } 00409 00410 headp = &tchan->varshead; 00411 00412 /* first, get the variables from the event */ 00413 if (ast_cel_fill_record(event, &record)) { 00414 ast_channel_release(tchan); 00415 return NULL; 00416 } 00417 00418 /* next, fill the channel with their data */ 00419 if ((newvariable = ast_var_assign("eventtype", record.event_name))) { 00420 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00421 } 00422 00423 if (ast_strlen_zero(cel_dateformat)) { 00424 snprintf(timebuf, sizeof(timebuf), "%ld.%06ld", record.event_time.tv_sec, 00425 (long) record.event_time.tv_usec); 00426 } else { 00427 struct ast_tm tm; 00428 ast_localtime(&record.event_time, &tm, NULL); 00429 ast_strftime(timebuf, sizeof(timebuf), cel_dateformat, &tm); 00430 } 00431 00432 if ((newvariable = ast_var_assign("eventtime", timebuf))) { 00433 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00434 } 00435 00436 if ((newvariable = ast_var_assign("eventextra", record.extra))) { 00437 AST_LIST_INSERT_HEAD(headp, newvariable, entries); 00438 } 00439 00440 tchan->cid.cid_name = ast_strdup(record.caller_id_name); 00441 tchan->cid.cid_num = ast_strdup(record.caller_id_num); 00442 tchan->cid.cid_ani = ast_strdup(record.caller_id_ani); 00443 tchan->cid.cid_rdnis = ast_strdup(record.caller_id_rdnis); 00444 tchan->cid.cid_dnid = ast_strdup(record.caller_id_dnid); 00445 00446 ast_copy_string(tchan->exten, record.extension, sizeof(tchan->exten)); 00447 ast_copy_string(tchan->context, record.context, sizeof(tchan->context)); 00448 ast_string_field_set(tchan, name, record.channel_name); 00449 ast_string_field_set(tchan, uniqueid, record.unique_id); 00450 ast_string_field_set(tchan, linkedid, record.linked_id); 00451 ast_string_field_set(tchan, accountcode, record.account_code); 00452 ast_string_field_set(tchan, peeraccount, record.peer_account); 00453 ast_string_field_set(tchan, userfield, record.user_field); 00454 00455 pbx_builtin_setvar_helper(tchan, "BRIDGEPEER", record.peer); 00456 00457 tchan->appl = ast_strdup(record.application_name); 00458 tchan->data = ast_strdup(record.application_data); 00459 tchan->amaflags = record.amaflag; 00460 00461 return tchan; 00462 }
| 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 567 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().
00568 { 00569 if (r->version != AST_CEL_EVENT_RECORD_VERSION) { 00570 ast_log(LOG_ERROR, "Module ABI mismatch for ast_cel_event_record. " 00571 "Please ensure all modules were compiled for " 00572 "this version of Asterisk.\n"); 00573 return -1; 00574 } 00575 00576 r->event_type = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_EVENT_TYPE); 00577 00578 r->event_time.tv_sec = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_EVENT_TIME); 00579 r->event_time.tv_usec = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_EVENT_TIME_USEC); 00580 00581 r->user_defined_name = ""; 00582 00583 if (r->event_type == AST_CEL_USER_DEFINED) { 00584 r->user_defined_name = ast_event_get_ie_str(e, AST_EVENT_IE_CEL_USEREVENT_NAME); 00585 r->event_name = r->user_defined_name; 00586 } else { 00587 r->event_name = ast_cel_get_type_name(r->event_type); 00588 } 00589 00590 r->caller_id_name = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDNAME), ""); 00591 r->caller_id_num = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDNUM), ""); 00592 r->caller_id_ani = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDANI), ""); 00593 r->caller_id_rdnis = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDRDNIS), ""); 00594 r->caller_id_dnid = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDDNID), ""); 00595 r->extension = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_EXTEN), ""); 00596 r->context = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CONTEXT), ""); 00597 r->channel_name = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CHANNAME), ""); 00598 r->application_name = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_APPNAME), ""); 00599 r->application_data = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_APPDATA), ""); 00600 r->account_code = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_ACCTCODE), ""); 00601 r->peer_account = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_ACCTCODE), ""); 00602 r->unique_id = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_UNIQUEID), ""); 00603 r->linked_id = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_LINKEDID), ""); 00604 r->amaflag = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_AMAFLAGS); 00605 r->user_field = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_USERFIELD), ""); 00606 r->peer = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_PEER), ""); 00607 r->extra = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_EXTRA), ""); 00608 00609 return 0; 00610 }
| 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 350 of file cel.c.
References S_OR.
00351 { 00352 return S_OR(cel_ama_flags[flag], "Unknown"); 00353 }
| 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 345 of file cel.c.
References S_OR.
Referenced by ast_cel_fill_record(), and handle_cli_status().
00346 { 00347 return S_OR(cel_event_types[type], "Unknown"); 00348 }
| 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 464 of file cel.c.
References ast_channel::accountcode, ast_channel::amaflags, 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_lock, ast_channel_ref, ast_channel_unlock, ast_channel_unref, 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::cid, ast_callerid::cid_ani, ast_callerid::cid_dnid, ast_callerid::cid_name, ast_callerid::cid_num, ast_callerid::cid_rdnis, ast_channel::context, ast_channel::data, ast_channel::exten, ast_channel::linkedid, ast_channel::name, OBJ_POINTER, ast_channel::peeraccount, reload_lock, S_OR, ast_channel::uniqueid, and ast_channel::userfield.
Referenced by __analog_handle_event(), __ast_channel_alloc_ap(), __ast_read(), analog_attempt_transfer(), ast_bridge_call(), ast_cel_check_retire_linkedid(), ast_channel_destructor(), ast_do_masquerade(), ast_hangup(), ast_raw_answer(), builtin_atxfer(), builtin_blindtransfer(), celgenuserevent_exec(), do_forward(), handle_request_refer(), local_attended_transfer(), manage_parkinglot(), park_call_full(), park_exec_full(), pbx_exec(), pickup_do(), and wait_for_answer().
00466 { 00467 struct timeval eventtime; 00468 struct ast_event *ev; 00469 const char *peername = ""; 00470 struct ast_channel *peer; 00471 00472 ast_channel_lock(chan); 00473 peer = ast_bridged_channel(chan); 00474 if (peer) { 00475 ast_channel_ref(peer); 00476 } 00477 ast_channel_unlock(chan); 00478 00479 /* Make sure a reload is not occurring while we're checking to see if this 00480 * is an event that we care about. We could lose an important event in this 00481 * process otherwise. */ 00482 ast_mutex_lock(&reload_lock); 00483 00484 if (!cel_enabled || !ast_cel_track_event(event_type)) { 00485 ast_mutex_unlock(&reload_lock); 00486 if (peer) { 00487 ast_channel_unref(peer); 00488 } 00489 return 0; 00490 } 00491 00492 if (event_type == AST_CEL_APP_START || event_type == AST_CEL_APP_END) { 00493 char *app; 00494 if (!(app = ao2_find(appset, (char *) chan->appl, OBJ_POINTER))) { 00495 ast_mutex_unlock(&reload_lock); 00496 if (peer) { 00497 ast_channel_unref(peer); 00498 } 00499 return 0; 00500 } 00501 ao2_ref(app, -1); 00502 } 00503 00504 ast_mutex_unlock(&reload_lock); 00505 00506 if (peer) { 00507 ast_channel_lock(peer); 00508 peername = ast_strdupa(peer->name); 00509 ast_channel_unlock(peer); 00510 } else if (peer2) { 00511 ast_channel_lock(peer2); 00512 peername = ast_strdupa(peer2->name); 00513 ast_channel_unlock(peer2); 00514 } 00515 00516 if (!userdefevname) { 00517 userdefevname = ""; 00518 } 00519 00520 if (!extra) { 00521 extra = ""; 00522 } 00523 00524 eventtime = ast_tvnow(); 00525 00526 ast_channel_lock(chan); 00527 00528 ev = ast_event_new(AST_EVENT_CEL, 00529 AST_EVENT_IE_CEL_EVENT_TYPE, AST_EVENT_IE_PLTYPE_UINT, event_type, 00530 AST_EVENT_IE_CEL_EVENT_TIME, AST_EVENT_IE_PLTYPE_UINT, eventtime.tv_sec, 00531 AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_PLTYPE_UINT, eventtime.tv_usec, 00532 AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_PLTYPE_STR, userdefevname, 00533 AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_name, ""), 00534 AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_num, ""), 00535 AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_ani, ""), 00536 AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_rdnis, ""), 00537 AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->cid.cid_dnid, ""), 00538 AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_PLTYPE_STR, chan->exten, 00539 AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_PLTYPE_STR, chan->context, 00540 AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_PLTYPE_STR, chan->name, 00541 AST_EVENT_IE_CEL_APPNAME, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->appl, ""), 00542 AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->data, ""), 00543 AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, chan->amaflags, 00544 AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_PLTYPE_STR, chan->accountcode, 00545 AST_EVENT_IE_CEL_PEERACCT, AST_EVENT_IE_PLTYPE_STR, chan->peeraccount, 00546 AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, chan->uniqueid, 00547 AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_PLTYPE_STR, chan->linkedid, 00548 AST_EVENT_IE_CEL_USERFIELD, AST_EVENT_IE_PLTYPE_STR, chan->userfield, 00549 AST_EVENT_IE_CEL_EXTRA, AST_EVENT_IE_PLTYPE_STR, extra, 00550 AST_EVENT_IE_CEL_PEER, AST_EVENT_IE_PLTYPE_STR, peername, 00551 AST_EVENT_IE_END); 00552 00553 ast_channel_unlock(chan); 00554 00555 if (peer) { 00556 peer = ast_channel_unref(peer); 00557 } 00558 00559 if (ev && ast_event_queue(ev)) { 00560 ast_event_destroy(ev); 00561 return -1; 00562 } 00563 00564 return 0; 00565 }
| 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 208 of file cel.c.
References ARRAY_LEN.
Referenced by parse_events().
00209 { 00210 unsigned int i; 00211 00212 for (i = 0; i < ARRAY_LEN(cel_event_types); i++) { 00213 if (!cel_event_types[i]) { 00214 continue; 00215 } 00216 00217 if (!strcasecmp(name, cel_event_types[i])) { 00218 return i; 00219 } 00220 } 00221 00222 return -1; 00223 }
1.5.6