mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Add pickup event to AMI. Also, fix AMI documentation.
(closes issue #16431) Reported by: syspert Patches: 20100112__issue16431.diff.txt uploaded by tilghman (license 14) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240421 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -40,6 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
#include "asterisk/features.h"
|
#include "asterisk/features.h"
|
||||||
|
#include "asterisk/manager.h"
|
||||||
#include "asterisk/callerid.h"
|
#include "asterisk/callerid.h"
|
||||||
#include "asterisk/cel.h"
|
#include "asterisk/cel.h"
|
||||||
|
|
||||||
@@ -94,6 +95,7 @@ static int pickup_do(struct ast_channel *chan, struct ast_channel *target)
|
|||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
struct ast_party_connected_line connected_caller;
|
struct ast_party_connected_line connected_caller;
|
||||||
|
struct ast_channel *chans[2] = { chan, target };
|
||||||
|
|
||||||
ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name);
|
ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name);
|
||||||
ast_cel_report_event(target, AST_CEL_PICKUP, NULL, NULL, chan);
|
ast_cel_report_event(target, AST_CEL_PICKUP, NULL, NULL, chan);
|
||||||
@@ -128,6 +130,10 @@ static int pickup_do(struct ast_channel *chan, struct ast_channel *target)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If you want UniqueIDs, set channelvars in manager.conf to CHANNEL(uniqueid) */
|
||||||
|
ast_manager_event_multichan(EVENT_FLAG_CALL, "Pickup", 2, chans,
|
||||||
|
"Channel: %s\r\nTargetChannel: %s\r\n", chan->name, target->name);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -207,10 +207,10 @@ int astman_verify_session_writepermissions(uint32_t ident, int perm);
|
|||||||
__ast_manager_event_multichan(category, event, nchans, chans, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__);
|
__ast_manager_event_multichan(category, event, nchans, chans, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__);
|
||||||
|
|
||||||
/*! External routines may send asterisk manager events this way
|
/*! External routines may send asterisk manager events this way
|
||||||
* \param chan1 First channel related to this event (or NULL if none are relevant)
|
|
||||||
* \param chan2 Second channel related to this event (or NULL if none are relevant)
|
|
||||||
* \param category Event category, matches manager authorization
|
* \param category Event category, matches manager authorization
|
||||||
* \param event Event name
|
* \param event Event name
|
||||||
|
* \param chancount Number of channels in chans parameter
|
||||||
|
* \param chans A pointer to an array of channels involved in the event
|
||||||
* \param contents Format string describing event
|
* \param contents Format string describing event
|
||||||
* \since 1.8
|
* \since 1.8
|
||||||
*/
|
*/
|
||||||
|
@@ -4734,7 +4734,7 @@ static int find_channel_by_group(void *obj, void *arg, void *data, int flags)
|
|||||||
*/
|
*/
|
||||||
int ast_pickup_call(struct ast_channel *chan)
|
int ast_pickup_call(struct ast_channel *chan)
|
||||||
{
|
{
|
||||||
struct ast_channel *cur;
|
struct ast_channel *cur, *chans[2] = { chan, };
|
||||||
struct ast_party_connected_line connected_caller;
|
struct ast_party_connected_line connected_caller;
|
||||||
int res;
|
int res;
|
||||||
const char *chan_name;
|
const char *chan_name;
|
||||||
@@ -4748,6 +4748,8 @@ int ast_pickup_call(struct ast_channel *chan)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chans[1] = cur;
|
||||||
|
|
||||||
ast_channel_lock_both(cur, chan);
|
ast_channel_lock_both(cur, chan);
|
||||||
|
|
||||||
cur_name = ast_strdupa(cur->name);
|
cur_name = ast_strdupa(cur->name);
|
||||||
@@ -4784,6 +4786,10 @@ int ast_pickup_call(struct ast_channel *chan)
|
|||||||
ast_stream_and_wait(cur, pickupsound, "");
|
ast_stream_and_wait(cur, pickupsound, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If you want UniqueIDs, set channelvars in manager.conf to CHANNEL(uniqueid) */
|
||||||
|
ast_manager_event_multichan(EVENT_FLAG_CALL, "Pickup", 2, chans,
|
||||||
|
"Channel: %s\r\nTargetChannel: %s\r\n", chan->name, cur->name);
|
||||||
|
|
||||||
cur = ast_channel_unref(cur);
|
cur = ast_channel_unref(cur);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
Reference in New Issue
Block a user